aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/compiler/brw_nir_lower_cs_intrinsics.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-09-29 12:22:48 -0700
committerJason Ekstrand <[email protected]>2017-10-12 22:39:31 -0700
commit79d403417cacd2728916e32ae55f4fc2a018515c (patch)
treefab0fd92ab5a0192d2f883d12af00c6258fddf6e /src/intel/compiler/brw_nir_lower_cs_intrinsics.c
parent8d90e2883954eb7022cf8fc98be3773cc5513e7b (diff)
intel/cs: Make thread_local_id a regular builtin param
This is a lot more natural than special casing it all over the place. We still have to do a bit of special-casing in assign_constant_locations but it's not special-cased quite as bad as it was before. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/intel/compiler/brw_nir_lower_cs_intrinsics.c')
-rw-r--r--src/intel/compiler/brw_nir_lower_cs_intrinsics.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/intel/compiler/brw_nir_lower_cs_intrinsics.c b/src/intel/compiler/brw_nir_lower_cs_intrinsics.c
index 01718eb5dd1..9b4a0fdf2eb 100644
--- a/src/intel/compiler/brw_nir_lower_cs_intrinsics.c
+++ b/src/intel/compiler/brw_nir_lower_cs_intrinsics.c
@@ -30,6 +30,7 @@ struct lower_intrinsics_state {
nir_function_impl *impl;
bool progress;
nir_builder builder;
+ int thread_local_id_index;
};
static nir_ssa_def *
@@ -47,12 +48,13 @@ read_thread_local_id(struct lower_intrinsics_state *state)
if (group_size <= 8)
return nir_imm_int(b, 0);
- if (prog_data->thread_local_id_index == -1) {
- prog_data->thread_local_id_index = prog_data->base.nr_params;
- brw_stage_prog_data_add_params(&prog_data->base, 1);
+ if (state->thread_local_id_index == -1) {
+ state->thread_local_id_index = prog_data->base.nr_params;
+ uint32_t *param = brw_stage_prog_data_add_params(&prog_data->base, 1);
+ *param = BRW_PARAM_BUILTIN_THREAD_LOCAL_ID;
nir->num_uniforms += 4;
}
- unsigned id_index = prog_data->thread_local_id_index;
+ unsigned id_index = state->thread_local_id_index;
nir_intrinsic_instr *load =
nir_intrinsic_instr_create(nir, nir_intrinsic_load_uniform);
@@ -165,7 +167,7 @@ brw_nir_lower_cs_intrinsics(nir_shader *nir,
state.nir = nir;
state.prog_data = prog_data;
- state.prog_data->thread_local_id_index = -1;
+ state.thread_local_id_index = -1;
do {
state.progress = false;