radeonsi/gfx10: unpack GS invocation ID
authorMarek Olšák <marek.olsak@amd.com>
Sat, 22 Jun 2019 01:06:16 +0000 (21:06 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 3 Jul 2019 19:51:13 +0000 (15:51 -0400)
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/gallium/drivers/radeonsi/si_shader.c

index 27a5aa3b5eefcdd324c1e9c57110597f9d6c727c..1dec250e6d3dc020cf831572bcd4c9ca7e663e67 100644 (file)
@@ -2044,12 +2044,19 @@ void si_load_system_value(struct si_shader_context *ctx,
                break;
 
        case TGSI_SEMANTIC_INVOCATIONID:
-               if (ctx->type == PIPE_SHADER_TESS_CTRL)
+               if (ctx->type == PIPE_SHADER_TESS_CTRL) {
                        value = unpack_llvm_param(ctx, ctx->abi.tcs_rel_ids, 8, 5);
-               else if (ctx->type == PIPE_SHADER_GEOMETRY)
-                       value = ctx->abi.gs_invocation_id;
-               else
+               } else if (ctx->type == PIPE_SHADER_GEOMETRY) {
+                       if (ctx->screen->info.chip_class >= GFX10) {
+                               value = LLVMBuildAnd(ctx->ac.builder,
+                                                    ctx->abi.gs_invocation_id,
+                                                    LLVMConstInt(ctx->i32, 127, 0), "");
+                       } else {
+                               value = ctx->abi.gs_invocation_id;
+                       }
+               } else {
                        assert(!"INVOCATIONID not implemented");
+               }
                break;
 
        case TGSI_SEMANTIC_POSITION: