amd/common: scan which components of gl_LocalInvocationID are used
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 14 Dec 2017 15:48:02 +0000 (16:48 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 14 Dec 2017 21:22:04 +0000 (22:22 +0100)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/common/ac_shader_info.c
src/amd/common/ac_shader_info.h

index 01949770d6802f6930f61b89c0d5d6a34ed5931a..87744ed23e141bbafdbbb2dcb51ef588879d4779 100644 (file)
@@ -45,11 +45,16 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, struct ac_shader_info *info)
        case nir_intrinsic_load_num_work_groups:
                info->cs.uses_grid_size = true;
                break;
+       case nir_intrinsic_load_local_invocation_id:
        case nir_intrinsic_load_work_group_id: {
                unsigned mask = nir_ssa_def_components_read(&instr->dest.ssa);
                while (mask) {
                        unsigned i = u_bit_scan(&mask);
-                       info->cs.uses_block_id[i] = true;
+
+                       if (instr->intrinsic == nir_intrinsic_load_work_group_id)
+                               info->cs.uses_block_id[i] = true;
+                       else
+                               info->cs.uses_thread_id[i] = true;
                }
                break;
        }
index 7beefd02ac5a51339aafeea05ffbf2721f2c6997..0136d5af403cd9a233e8dbba2fde91e0275f80f3 100644 (file)
@@ -44,6 +44,7 @@ struct ac_shader_info {
        struct {
                bool uses_grid_size;
                bool uses_block_id[3];
+               bool uses_thread_id[3];
        } cs;
 };