anv: Compile shader stages in pipeline order.

Instead of the arbitrary order modules might be specified in.

Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
This commit is contained in:
Kenneth Graunke
2016-02-24 15:41:24 -08:00
parent 8dddc3fb1e
commit 623ce595a9

View File

@@ -1108,29 +1108,33 @@ anv_pipeline_init(struct anv_pipeline *pipeline,
pipeline->active_stages = 0; pipeline->active_stages = 0;
pipeline->total_scratch = 0; pipeline->total_scratch = 0;
const VkPipelineShaderStageCreateInfo *pStages[MESA_SHADER_STAGES] = { 0, };
struct anv_shader_module *modules[MESA_SHADER_STAGES] = { 0, };
for (uint32_t i = 0; i < pCreateInfo->stageCount; i++) { for (uint32_t i = 0; i < pCreateInfo->stageCount; i++) {
ANV_FROM_HANDLE(anv_shader_module, module, gl_shader_stage stage = ffs(pCreateInfo->pStages[i].stage) - 1;
pCreateInfo->pStages[i].module); pStages[stage] = &pCreateInfo->pStages[i];
modules[stage] = anv_shader_module_from_handle(pStages[stage]->module);
}
switch (pCreateInfo->pStages[i].stage) { if (modules[MESA_SHADER_VERTEX]) {
case VK_SHADER_STAGE_VERTEX_BIT: anv_pipeline_compile_vs(pipeline, cache, pCreateInfo,
anv_pipeline_compile_vs(pipeline, cache, pCreateInfo, module, modules[MESA_SHADER_VERTEX],
pCreateInfo->pStages[i].pName, pStages[MESA_SHADER_VERTEX]->pName,
pCreateInfo->pStages[i].pSpecializationInfo); pStages[MESA_SHADER_VERTEX]->pSpecializationInfo);
break; }
case VK_SHADER_STAGE_GEOMETRY_BIT:
anv_pipeline_compile_gs(pipeline, cache, pCreateInfo, module, if (modules[MESA_SHADER_GEOMETRY]) {
pCreateInfo->pStages[i].pName, anv_pipeline_compile_gs(pipeline, cache, pCreateInfo,
pCreateInfo->pStages[i].pSpecializationInfo); modules[MESA_SHADER_GEOMETRY],
break; pStages[MESA_SHADER_GEOMETRY]->pName,
case VK_SHADER_STAGE_FRAGMENT_BIT: pStages[MESA_SHADER_GEOMETRY]->pSpecializationInfo);
anv_pipeline_compile_fs(pipeline, cache, pCreateInfo, extra, module, }
pCreateInfo->pStages[i].pName,
pCreateInfo->pStages[i].pSpecializationInfo); if (modules[MESA_SHADER_FRAGMENT]) {
break; anv_pipeline_compile_fs(pipeline, cache, pCreateInfo, extra,
default: modules[MESA_SHADER_FRAGMENT],
anv_finishme("Unsupported shader stage"); pStages[MESA_SHADER_FRAGMENT]->pName,
} pStages[MESA_SHADER_FRAGMENT]->pSpecializationInfo);
} }
if (!(pipeline->active_stages & VK_SHADER_STAGE_VERTEX_BIT)) { if (!(pipeline->active_stages & VK_SHADER_STAGE_VERTEX_BIT)) {