diff options
author | Dave Airlie <airlied@redhat.com> | 2018-05-15 14:05:26 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2018-05-15 14:05:26 +1000 |
commit | 88c1d40861cd7f501ddf1789baf40b330d640a15 (patch) | |
tree | dcaef13e773b087b6b5fb9f7010bfede1008fb34 | |
parent | ce2090b50ff43f5169752b21d1593e3370c65ed2 (diff) |
arb_gpu_shader5: add support for non-uniform texture offsets
-rw-r--r-- | src/vrend_shader.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/vrend_shader.c b/src/vrend_shader.c index 56b1bbb..6e7ca2f 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -1512,13 +1512,16 @@ static int translate_tex(struct dump_ctx *ctx, return false; } } else if (inst->TexOffsets[0].File == TGSI_FILE_TEMPORARY) { + struct vrend_temp_range *range = find_temp_range(ctx, inst->TexOffsets[0].Index); + int idx = inst->TexOffsets[0].Index - range->first; switch (inst->Texture.Texture) { case TGSI_TEXTURE_1D: case TGSI_TEXTURE_1D_ARRAY: case TGSI_TEXTURE_SHADOW1D: case TGSI_TEXTURE_SHADOW1D_ARRAY: - snprintf(offbuf, 120, ", int(floatBitsToInt(temps[%d].%c))", - inst->TexOffsets[0].Index, get_swiz_char(inst->TexOffsets[0].SwizzleX)); + snprintf(offbuf, 120, ", int(floatBitsToInt(temp%d[%d].%c))", + range->first, idx, + get_swiz_char(inst->TexOffsets[0].SwizzleX)); break; case TGSI_TEXTURE_RECT: case TGSI_TEXTURE_SHADOWRECT: @@ -1526,15 +1529,20 @@ static int translate_tex(struct dump_ctx *ctx, case TGSI_TEXTURE_2D_ARRAY: case TGSI_TEXTURE_SHADOW2D: case TGSI_TEXTURE_SHADOW2D_ARRAY: - snprintf(offbuf, 120, ", ivec2(floatBitsToInt(temps[%d].%c), floatBitsToInt(temps[%d].%c))", - inst->TexOffsets[0].Index, get_swiz_char(inst->TexOffsets[0].SwizzleX), - inst->TexOffsets[0].Index, get_swiz_char(inst->TexOffsets[0].SwizzleY)); + snprintf(offbuf, 120, ", 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, ", ivec2(floatBitsToInt(temps[%d].%c), floatBitsToInt(temps[%d].%c), floatBitsToInt(temps[%d].%c)", - inst->TexOffsets[0].Index, get_swiz_char(inst->TexOffsets[0].SwizzleX), - inst->TexOffsets[0].Index, get_swiz_char(inst->TexOffsets[0].SwizzleY), - inst->TexOffsets[0].Index, get_swiz_char(inst->TexOffsets[0].SwizzleZ)); + snprintf(offbuf, 120, ", ivec2(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, + get_swiz_char(inst->TexOffsets[0].SwizzleY), + range->first, idx, + get_swiz_char(inst->TexOffsets[0].SwizzleZ)); break; default: fprintf(stderr, "unhandled texture: %x\n", inst->Texture.Texture); |