anv: Set graphics pipeline active_stages earlier
authorMarcin Ślusarz <marcin.slusarz@intel.com>
Tue, 31 Aug 2021 12:43:08 +0000 (14:43 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 4 Oct 2021 18:55:56 +0000 (18:55 +0000)
So that we can use the active_stages in copy_non_dynamic_state() later.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13047>

src/intel/vulkan/anv_pipeline.c

index dd16339..eded787 100644 (file)
@@ -1400,8 +1400,6 @@ anv_pipeline_compile_graphics(struct anv_graphics_pipeline *pipeline,
    const struct brw_compiler *compiler = pipeline->base.device->physical->compiler;
    struct anv_pipeline_stage stages[MESA_SHADER_STAGES] = {};
 
-   pipeline->active_stages = 0;
-
    /* Information on which states are considered dynamic. */
    const VkPipelineDynamicStateCreateInfo *dyn_info =
       info->pDynamicState;
@@ -1417,8 +1415,6 @@ anv_pipeline_compile_graphics(struct anv_graphics_pipeline *pipeline,
       const VkPipelineShaderStageCreateInfo *sinfo = &info->pStages[i];
       gl_shader_stage stage = vk_to_mesa_shader_stage(sinfo->stage);
 
-      pipeline->active_stages |= sinfo->stage;
-
       int64_t stage_start = os_time_get_nano();
 
       stages[stage].stage = stage;
@@ -1478,9 +1474,6 @@ anv_pipeline_compile_graphics(struct anv_graphics_pipeline *pipeline,
       stages[stage].feedback.flags |= VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT_EXT;
    }
 
-   if (pipeline->active_stages & VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT)
-      pipeline->active_stages |= VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
-
    assert(pipeline->active_stages & VK_SHADER_STAGE_VERTEX_BIT);
 
    ANV_FROM_HANDLE(anv_pipeline_layout, layout, info->layout);
@@ -2375,6 +2368,14 @@ anv_graphics_pipeline_init(struct anv_graphics_pipeline *pipeline,
             pCreateInfo->pDynamicState->pDynamicStates[s]);
       }
    }
+
+   pipeline->active_stages = 0;
+   for (uint32_t i = 0; i < pCreateInfo->stageCount; i++)
+      pipeline->active_stages |= pCreateInfo->pStages[i].stage;
+
+   if (pipeline->active_stages & VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT)
+      pipeline->active_stages |= VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
+
    copy_non_dynamic_state(pipeline, pCreateInfo);
 
    pipeline->depth_clamp_enable = pCreateInfo->pRasterizationState->depthClampEnable;