diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 9c3940e3ffb..6d1cb023cca 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -648,7 +648,7 @@ radv_shader_compile_to_nir(struct radv_device *device, struct vk_shader_module * } NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_shared, nir_address_format_32bit_offset); - if (nir->info.cs.zero_initialize_shared_memory && nir->info.shared_size > 0) { + if (nir->info.zero_initialize_shared_memory && nir->info.shared_size > 0) { const unsigned chunk_size = 16; /* max single store size */ const unsigned shared_size = ALIGN(nir->info.shared_size, chunk_size); NIR_PASS_V(nir, nir_zero_initialize_shared_memory, shared_size, chunk_size); diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index b1800226c23..7c18e565433 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -254,6 +254,11 @@ typedef struct shader_info { */ bool shared_memory_explicit_layout:1; + /** + * Used for VK_KHR_zero_initialize_workgroup_memory. + */ + bool zero_initialize_shared_memory:1; + union { struct { /* Which inputs are doubles */ @@ -396,8 +401,6 @@ typedef struct shader_info { */ enum gl_derivative_group derivative_group:2; - bool zero_initialize_shared_memory; - /** * pointer size is: * AddressingModelLogical: 0 (default) diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index a93d3d52067..cc49564a20c 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -1960,7 +1960,7 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val, "as initializer, but have %u instead", vtn_id_for_value(b, val), vtn_id_for_value(b, initializer)); - b->shader->info.cs.zero_initialize_shared_memory = true; + b->shader->info.zero_initialize_shared_memory = true; break; case SpvStorageClassUniformConstant: diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index e0c147cf153..3eb75f725e2 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -1808,7 +1808,7 @@ anv_pipeline_compile_cs(struct anv_compute_pipeline *pipeline, NIR_PASS_V(stage.nir, nir_lower_explicit_io, nir_var_mem_shared, nir_address_format_32bit_offset); - if (stage.nir->info.cs.zero_initialize_shared_memory && + if (stage.nir->info.zero_initialize_shared_memory && stage.nir->info.shared_size > 0) { /* The effective Shared Local Memory size is at least 1024 bytes and * is always rounded to a power of two, so it is OK to align the size