From 7d3aec9905e7c2702cefb9d18fa948ee85be11fa Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Tue, 14 Apr 2020 01:56:20 -0700 Subject: [PATCH] compiler/spirv: Handle the LocalSizeHint execution modes It's basically the same as the LocalSize version except it fills the local_size_hint array. Signed-off-by: Boris Brezillon Reviewed-by: Erik Faye-Lund Reviewed-by: Jason Ekstrand Part-of: --- src/compiler/shader_info.h | 1 + src/compiler/spirv/spirv_to_nir.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index e1be926..1acb182 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -347,6 +347,7 @@ typedef struct shader_info { struct { uint16_t local_size[3]; + uint16_t local_size_hint[3]; bool local_size_variable:1; uint8_t user_data_components_amd:3; diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index a5288a6..b8b6397 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -4639,6 +4639,13 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point, b->shader->info.fs.depth_layout = FRAG_DEPTH_LAYOUT_UNCHANGED; break; + case SpvExecutionModeLocalSizeHint: + vtn_assert(b->shader->info.stage == MESA_SHADER_KERNEL); + b->shader->info.cs.local_size_hint[0] = mode->operands[0]; + b->shader->info.cs.local_size_hint[1] = mode->operands[1]; + b->shader->info.cs.local_size_hint[2] = mode->operands[2]; + break; + case SpvExecutionModeLocalSize: vtn_assert(gl_shader_stage_is_compute(b->shader->info.stage)); b->shader->info.cs.local_size[0] = mode->operands[0]; @@ -4646,9 +4653,6 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point, b->shader->info.cs.local_size[2] = mode->operands[2]; break; - case SpvExecutionModeLocalSizeHint: - break; /* Nothing to do with this */ - case SpvExecutionModeOutputVertices: if (b->shader->info.stage == MESA_SHADER_TESS_CTRL || b->shader->info.stage == MESA_SHADER_TESS_EVAL) { @@ -4854,7 +4858,10 @@ vtn_handle_execution_mode_id(struct vtn_builder *b, struct vtn_value *entry_poin break; case SpvExecutionModeLocalSizeHintId: - /* Nothing to do with this hint. */ + vtn_assert(b->shader->info.stage == MESA_SHADER_KERNEL); + b->shader->info.cs.local_size_hint[0] = vtn_constant_uint(b, mode->operands[0]); + b->shader->info.cs.local_size_hint[1] = vtn_constant_uint(b, mode->operands[1]); + b->shader->info.cs.local_size_hint[2] = vtn_constant_uint(b, mode->operands[2]); break; default: -- 2.7.4