diff options
author | Dave Airlie <airlied@gmail.com> | 2014-02-18 17:51:02 +1000 |
---|---|---|
committer | Dave Airlie <airlied@gmail.com> | 2014-02-27 09:19:04 +1000 |
commit | 99981d63f12a4178766c708803dd82f9e1ebcab6 (patch) | |
tree | 75e2d75da3d37e8deaa3fe33acf748fb2fc3b594 | |
parent | 9240f6880adf8746e5d7f0c4b9302d02771ee266 (diff) |
add txf offset support
-rw-r--r-- | src/gallium/renderer/graw_shader.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/gallium/renderer/graw_shader.c b/src/gallium/renderer/graw_shader.c index 596800f5155..41dc13fd90e 100644 --- a/src/gallium/renderer/graw_shader.c +++ b/src/gallium/renderer/graw_shader.c @@ -1018,7 +1018,27 @@ iter_instruction(struct tgsi_iterate_context *iter, tex_ext = ""; if (inst->Instruction.Opcode == TGSI_OPCODE_TXF) { - snprintf(buf, 255, "%s = %s(texelFetch(%s, %s(%s%s)%s)%s);\n", dsts[0], dstconv, srcs[sampler_index], txfi, srcs[0], twm, bias, ctx->outputs[0].override_no_wm ? "" : writemask); + if (inst->Texture.NumOffsets == 1) { + struct immed *imd = &ctx->imm[(inst->TexOffsets[0].Index)]; + char offbuf[25]; + char *offprefix = ""; + switch (inst->Texture.Texture) { + case TGSI_TEXTURE_1D: + case TGSI_TEXTURE_1D_ARRAY: + offprefix = "int"; + break; + case TGSI_TEXTURE_2D: + case TGSI_TEXTURE_2D_ARRAY: + offprefix = "ivec2"; + break; + case TGSI_TEXTURE_3D: + offprefix = "ivec3"; + break; + } + snprintf(offbuf, 25, "%s(%d, %d)", offprefix, imd->val[0].i, imd->val[1].i); + snprintf(buf, 255, "%s = %s(texelFetchOffset(%s, %s(%s%s)%s, %s)%s);\n", dsts[0], dstconv, srcs[sampler_index], txfi, srcs[0], twm, bias, offbuf, ctx->outputs[0].override_no_wm ? "" : writemask); + } else + snprintf(buf, 255, "%s = %s(texelFetch(%s, %s(%s%s)%s)%s);\n", dsts[0], dstconv, srcs[sampler_index], txfi, srcs[0], twm, bias, ctx->outputs[0].override_no_wm ? "" : writemask); } /* rect is special in GLSL 1.30 */ else if (inst->Texture.Texture == TGSI_TEXTURE_RECT) |