iris: Add support for load_work_dim as a system value
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7047>
This commit is contained in:
@@ -396,6 +396,7 @@ iris_setup_uniforms(const struct brw_compiler *compiler,
|
||||
unsigned ucp_idx[IRIS_MAX_CLIP_PLANES];
|
||||
unsigned img_idx[PIPE_MAX_SHADER_IMAGES];
|
||||
unsigned variable_group_size_idx = -1;
|
||||
unsigned work_dim_idx = -1;
|
||||
memset(ucp_idx, -1, sizeof(ucp_idx));
|
||||
memset(img_idx, -1, sizeof(img_idx));
|
||||
|
||||
@@ -539,6 +540,16 @@ iris_setup_uniforms(const struct brw_compiler *compiler,
|
||||
variable_group_size_idx * sizeof(uint32_t));
|
||||
break;
|
||||
}
|
||||
case nir_intrinsic_load_work_dim: {
|
||||
if (work_dim_idx == -1) {
|
||||
work_dim_idx = num_system_values++;
|
||||
system_values[work_dim_idx] = BRW_PARAM_BUILTIN_WORK_DIM;
|
||||
}
|
||||
b.cursor = nir_before_instr(instr);
|
||||
offset = nir_imm_int(&b, system_values_start +
|
||||
work_dim_idx * sizeof(uint32_t));
|
||||
break;
|
||||
}
|
||||
case nir_intrinsic_load_kernel_input: {
|
||||
assert(nir_intrinsic_base(intrin) +
|
||||
nir_intrinsic_range(intrin) <= kernel_input_size);
|
||||
|
@@ -3314,6 +3314,8 @@ upload_sysvals(struct iris_context *ice,
|
||||
sysval <= BRW_PARAM_BUILTIN_WORK_GROUP_SIZE_Z) {
|
||||
unsigned i = sysval - BRW_PARAM_BUILTIN_WORK_GROUP_SIZE_X;
|
||||
value = ice->state.last_block[i];
|
||||
} else if (sysval == BRW_PARAM_BUILTIN_WORK_DIM) {
|
||||
value = grid->work_dim;
|
||||
} else {
|
||||
assert(!"unhandled system value");
|
||||
}
|
||||
|
@@ -629,6 +629,7 @@ enum brw_param_builtin {
|
||||
BRW_PARAM_BUILTIN_WORK_GROUP_SIZE_X,
|
||||
BRW_PARAM_BUILTIN_WORK_GROUP_SIZE_Y,
|
||||
BRW_PARAM_BUILTIN_WORK_GROUP_SIZE_Z,
|
||||
BRW_PARAM_BUILTIN_WORK_DIM,
|
||||
};
|
||||
|
||||
#define BRW_PARAM_BUILTIN_CLIP_PLANE(idx, comp) \
|
||||
|
Reference in New Issue
Block a user