Module: Mesa Branch: main Commit: a0109a3754c4211a855579eb4909de0b170d1215 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0109a3754c4211a855579eb4909de0b170d1215
Author: Caio Marcelo de Oliveira Filho <[email protected]> Date: Tue May 18 11:17:30 2021 -0700 anv: Make shaders array in anv_graphics_pipeline fit Task/Mesh We could decouple the locations in the array from the gl_shader_stage enum values, but for now this is convenient. Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13637> --- src/intel/vulkan/anv_pipeline.c | 6 +++--- src/intel/vulkan/anv_private.h | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 1b5a53544e5..085157434ee 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -1409,7 +1409,7 @@ anv_pipeline_compile_graphics(struct anv_graphics_pipeline *pipeline, int64_t pipeline_start = os_time_get_nano(); const struct brw_compiler *compiler = pipeline->base.device->physical->compiler; - struct anv_pipeline_stage stages[MESA_SHADER_STAGES] = {}; + struct anv_pipeline_stage stages[ANV_GRAPHICS_SHADER_STAGE_COUNT] = {}; /* Information on which states are considered dynamic. */ const VkPipelineDynamicStateCreateInfo *dyn_info = @@ -1655,8 +1655,8 @@ anv_pipeline_compile_graphics(struct anv_graphics_pipeline *pipeline, * used in all the active shaders, so this check can't be done per * individual shaders. */ - nir_shader *shaders[MESA_SHADER_STAGES] = {}; - for (unsigned s = 0; s < MESA_SHADER_STAGES; s++) + nir_shader *shaders[ANV_GRAPHICS_SHADER_STAGE_COUNT] = {}; + for (unsigned s = 0; s < ARRAY_SIZE(shaders); s++) shaders[s] = stages[s].nir; pipeline->use_primitive_replication = diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 05ce612553e..d4e05937bc6 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -245,6 +245,8 @@ struct intel_perf_query_result; */ #define ANV_PERF_QUERY_OFFSET_REG 0x2670 /* MI_ALU_REG14 */ +#define ANV_GRAPHICS_SHADER_STAGE_COUNT (MESA_SHADER_MESH + 1) + /* For gfx12 we set the streamout buffers using 4 separate commands * (3DSTATE_SO_BUFFER_INDEX_*) instead of 3DSTATE_SO_BUFFER. However the layout * of the 3DSTATE_SO_BUFFER_INDEX_* commands is identical to that of @@ -3554,7 +3556,7 @@ struct anv_graphics_pipeline { struct anv_subpass * subpass; - struct anv_shader_bin * shaders[MESA_SHADER_STAGES]; + struct anv_shader_bin * shaders[ANV_GRAPHICS_SHADER_STAGE_COUNT]; VkShaderStageFlags active_stages;
