From 3cc863649fe6040c1284d8ac753cd418aaad3c75 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Fri, 16 Dec 2022 10:32:15 +0100 Subject: [PATCH] v3dv: pipeline creation feedback may not request all stages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nothing in the spec seems to require that the number of stages for which creation feedback is requested must match the number of stages available in the pipeline. In fact, the spec explicitly mentions that this number could be 0: "If pipelineStageCreationFeedbackCount is not 0, pPipelineStageCreationFeedbacks must be a valid pointer to an array of pipelineStageCreationFeedbackCount VkPipelineCreationFeedback structures" Fixes an assert crash in: dEQP-VK.pipeline.monolithic.creation_feedback.graphics_tests.vertex_stage_fragment_stage_no_cache_zero_out_feedback_cout cc: mesa-stable Reviewed-by: Alejandro PiƱeiro Part-of: --- src/broadcom/vulkan/v3dv_pipeline.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index 3ac7cb1eca4..46cdb676301 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -2057,9 +2057,11 @@ write_creation_feedback(struct v3dv_pipeline *pipeline, pipeline_feedback, 1); - assert(stage_count == create_feedback->pipelineStageCreationFeedbackCount); + const uint32_t feedback_stage_count = + create_feedback->pipelineStageCreationFeedbackCount; + assert(feedback_stage_count <= stage_count); - for (uint32_t i = 0; i < stage_count; i++) { + for (uint32_t i = 0; i < feedback_stage_count; i++) { gl_shader_stage s = vk_to_mesa_shader_stage(stages[i].stage); enum broadcom_shader_stage bs = gl_shader_stage_to_broadcom(s);