shader: double size of offbuf and bias

This gets rid of some warnings about buffers being too small.

Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Erik Faye-Lund 6 years ago committed by Dave Airlie
parent c5e7173212
commit aa036b8bcb
  1. 24
      src/vrend_shader.c

@ -1916,7 +1916,7 @@ static bool fill_offset_buffer(struct dump_ctx *ctx,
case TGSI_TEXTURE_1D_ARRAY:
case TGSI_TEXTURE_SHADOW1D:
case TGSI_TEXTURE_SHADOW1D_ARRAY:
snprintf(offbuf, 25, ", int(%d)", imd->val[inst->TexOffsets[0].SwizzleX].i);
snprintf(offbuf, 256, ", int(%d)", imd->val[inst->TexOffsets[0].SwizzleX].i);
break;
case TGSI_TEXTURE_RECT:
case TGSI_TEXTURE_SHADOWRECT:
@ -1924,10 +1924,10 @@ static bool fill_offset_buffer(struct dump_ctx *ctx,
case TGSI_TEXTURE_2D_ARRAY:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOW2D_ARRAY:
snprintf(offbuf, 25, ", ivec2(%d, %d)", imd->val[inst->TexOffsets[0].SwizzleX].i, imd->val[inst->TexOffsets[0].SwizzleY].i);
snprintf(offbuf, 256, ", ivec2(%d, %d)", imd->val[inst->TexOffsets[0].SwizzleX].i, imd->val[inst->TexOffsets[0].SwizzleY].i);
break;
case TGSI_TEXTURE_3D:
snprintf(offbuf, 25, ", ivec3(%d, %d, %d)", imd->val[inst->TexOffsets[0].SwizzleX].i, imd->val[inst->TexOffsets[0].SwizzleY].i,
snprintf(offbuf, 256, ", ivec3(%d, %d, %d)", imd->val[inst->TexOffsets[0].SwizzleX].i, imd->val[inst->TexOffsets[0].SwizzleY].i,
imd->val[inst->TexOffsets[0].SwizzleZ].i);
break;
default:
@ -1942,7 +1942,7 @@ static bool fill_offset_buffer(struct dump_ctx *ctx,
case TGSI_TEXTURE_1D_ARRAY:
case TGSI_TEXTURE_SHADOW1D:
case TGSI_TEXTURE_SHADOW1D_ARRAY:
snprintf(offbuf, 120, ", int(floatBitsToInt(temp%d[%d].%c))",
snprintf(offbuf, 256, ", int(floatBitsToInt(temp%d[%d].%c))",
range->first, idx,
get_swiz_char(inst->TexOffsets[0].SwizzleX));
break;
@ -1952,14 +1952,14 @@ static bool fill_offset_buffer(struct dump_ctx *ctx,
case TGSI_TEXTURE_2D_ARRAY:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOW2D_ARRAY:
snprintf(offbuf, 120, ", ivec2(floatBitsToInt(temp%d[%d].%c), floatBitsToInt(temp%d[%d].%c))",
snprintf(offbuf, 256, ", ivec2(floatBitsToInt(temp%d[%d].%c), floatBitsToInt(temp%d[%d].%c))",
range->first, idx,
get_swiz_char(inst->TexOffsets[0].SwizzleX),
range->first, idx,
get_swiz_char(inst->TexOffsets[0].SwizzleY));
break;
case TGSI_TEXTURE_3D:
snprintf(offbuf, 120, ", ivec3(floatBitsToInt(temp%d[%d].%c), floatBitsToInt(temp%d[%d].%c), floatBitsToInt(temp%d[%d].%c)",
snprintf(offbuf, 256, ", ivec3(floatBitsToInt(temp%d[%d].%c), floatBitsToInt(temp%d[%d].%c), floatBitsToInt(temp%d[%d].%c)",
range->first, idx,
get_swiz_char(inst->TexOffsets[0].SwizzleX),
range->first, idx,
@ -1981,7 +1981,7 @@ static bool fill_offset_buffer(struct dump_ctx *ctx,
case TGSI_TEXTURE_1D_ARRAY:
case TGSI_TEXTURE_SHADOW1D:
case TGSI_TEXTURE_SHADOW1D_ARRAY:
snprintf(offbuf, 120, ", int(floatBitsToInt(%s.%c))",
snprintf(offbuf, 256, ", int(floatBitsToInt(%s.%c))",
ctx->inputs[j].glsl_name,
get_swiz_char(inst->TexOffsets[0].SwizzleX));
break;
@ -1991,14 +1991,14 @@ static bool fill_offset_buffer(struct dump_ctx *ctx,
case TGSI_TEXTURE_2D_ARRAY:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOW2D_ARRAY:
snprintf(offbuf, 120, ", ivec2(floatBitsToInt(%s.%c), floatBitsToInt(%s.%c))",
snprintf(offbuf, 256, ", ivec2(floatBitsToInt(%s.%c), floatBitsToInt(%s.%c))",
ctx->inputs[j].glsl_name,
get_swiz_char(inst->TexOffsets[0].SwizzleX),
ctx->inputs[j].glsl_name,
get_swiz_char(inst->TexOffsets[0].SwizzleY));
break;
case TGSI_TEXTURE_3D:
snprintf(offbuf, 120, ", ivec3(floatBitsToInt(%s.%c), floatBitsToInt(%s.%c), floatBitsToInt(%s.%c)",
snprintf(offbuf, 256, ", ivec3(floatBitsToInt(%s.%c), floatBitsToInt(%s.%c), floatBitsToInt(%s.%c)",
ctx->inputs[j].glsl_name,
get_swiz_char(inst->TexOffsets[0].SwizzleX),
ctx->inputs[j].glsl_name,
@ -2028,8 +2028,8 @@ static void translate_tex(struct dump_ctx *ctx,
unsigned twm = TGSI_WRITEMASK_NONE, gwm = TGSI_WRITEMASK_NONE;
enum vrend_type_qualifier dtypeprefix = TYPE_CONVERSION_NONE;
bool is_shad = false;
char offbuf[128] = {0};
char bias[128] = {0};
char offbuf[256] = {0};
char bias[256] = {0};
int sampler_index;
const char *tex_ext;
@ -2219,7 +2219,7 @@ static void translate_tex(struct dump_ctx *ctx,
}
if (inst->Instruction.Opcode == TGSI_OPCODE_TXL || inst->Instruction.Opcode == TGSI_OPCODE_TXL2 || inst->Instruction.Opcode == TGSI_OPCODE_TXD || (inst->Instruction.Opcode == TGSI_OPCODE_TG4 && is_shad)) {
char tmp[128];
char tmp[256];
strcpy(tmp, offbuf);
strcpy(offbuf, bias);
strcpy(bias, tmp);

Loading…
Cancel
Save