r600: fix resq for buffer images.
authorDave Airlie <airlied@redhat.com>
Fri, 2 Feb 2018 07:28:15 +0000 (17:28 +1000)
committerDave Airlie <airlied@redhat.com>
Sun, 4 Feb 2018 19:15:41 +0000 (05:15 +1000)
If this is an image buffer, we need to calculate the correct resource
id.

Fixes:
KHR-GL45.shader_image_size.*

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/r600/r600_shader.c

index 13aa681049c66011a04bfc0437170c232fa71e39..b0931a3a8518bd9c9a80f96ef6094e163bee3ed4 100644 (file)
@@ -8759,7 +8759,10 @@ static int tgsi_resq(struct r600_shader_ctx *ctx)
            (inst->Src[0].Register.File == TGSI_FILE_IMAGE && inst->Memory.Texture == TGSI_TEXTURE_BUFFER)) {
                if (ctx->bc->chip_class < EVERGREEN)
                        ctx->shader->uses_tex_buffers = true;
-               return r600_do_buffer_txq(ctx, 0, ctx->shader->image_size_const_offset);
+               unsigned offset = 0;
+               if (inst->Src[0].Register.File == TGSI_FILE_IMAGE)
+                       offset += R600_IMAGE_REAL_RESOURCE_OFFSET - R600_MAX_CONST_BUFFERS + ctx->shader->image_size_const_offset;
+               return r600_do_buffer_txq(ctx, 0, offset);
        }
 
        if (inst->Memory.Texture == TGSI_TEXTURE_CUBE_ARRAY &&