radv: do not load unused gl_LocalInvocationID/gl_WorkGroupID components
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 14 Dec 2017 15:48:03 +0000 (16:48 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 14 Dec 2017 21:22:06 +0000 (22:22 +0100)
We should also not load the input SGPRs and VGPRS, but
let's start with this for now.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_shader.c

index 4a3fdfa80ec918d54328fd067cf19a4f4b6861b0..907c1986f8a8dc9766f46b2d2c7bcd4583ef49d1 100644 (file)
@@ -392,13 +392,18 @@ radv_fill_shader_variant(struct radv_device *device,
                break;
        case MESA_SHADER_FRAGMENT:
                break;
-       case MESA_SHADER_COMPUTE:
+       case MESA_SHADER_COMPUTE: {
+               struct ac_shader_info *info = &variant->info.info;
                variant->rsrc2 |=
-                       S_00B84C_TGID_X_EN(1) | S_00B84C_TGID_Y_EN(1) |
-                       S_00B84C_TGID_Z_EN(1) | S_00B84C_TIDIG_COMP_CNT(2) |
+                       S_00B84C_TGID_X_EN(info->cs.uses_block_id[0]) |
+                       S_00B84C_TGID_Y_EN(info->cs.uses_block_id[1]) |
+                       S_00B84C_TGID_Z_EN(info->cs.uses_block_id[2]) |
+                       S_00B84C_TIDIG_COMP_CNT(info->cs.uses_thread_id[2] ? 2 :
+                                               info->cs.uses_thread_id[1] ? 1 : 0) |
                        S_00B84C_TG_SIZE_EN(1) |
                        S_00B84C_LDS_SIZE(variant->config.lds_size);
                break;
+       }
        default:
                unreachable("unsupported shader type");
                break;