[Mesa-dev] [PATCH 10/21] anv/pipeline: Call anv_pipeline_compile_* in a loop
Jason Ekstrand
jason at jlekstrand.net
Sat Oct 28 18:36:18 UTC 2017
---
src/intel/vulkan/anv_pipeline.c | 51 ++++++++++++++++++++++-------------------
1 file changed, 27 insertions(+), 24 deletions(-)
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index e6c4955..ba0ffd7 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -1332,33 +1332,36 @@ anv_pipeline_init(struct anv_pipeline *pipeline,
}
}
- if (stages[MESA_SHADER_VERTEX].entrypoint &&
- !pipeline->shaders[MESA_SHADER_VERTEX]) {
- result = anv_pipeline_compile_vs(pipeline, cache,
- &stages[MESA_SHADER_VERTEX]);
- if (result != VK_SUCCESS)
- goto compile_fail;
- }
+ for (unsigned s = 0; s < MESA_SHADER_STAGES; s++) {
+ if (!stages[s].entrypoint)
+ continue;
- if (stages[MESA_SHADER_TESS_EVAL].entrypoint &&
- !pipeline->shaders[MESA_SHADER_TESS_EVAL]) {
- anv_pipeline_compile_tcs_tes(pipeline, cache,
- &stages[MESA_SHADER_TESS_CTRL],
- &stages[MESA_SHADER_TESS_EVAL]);
- }
+ assert(stages[s].stage == s);
- if (stages[MESA_SHADER_GEOMETRY].entrypoint &&
- !pipeline->shaders[MESA_SHADER_GEOMETRY]) {
- result = anv_pipeline_compile_gs(pipeline, cache,
- &stages[MESA_SHADER_GEOMETRY]);
- if (result != VK_SUCCESS)
- goto compile_fail;
- }
+ if (pipeline->shaders[s])
+ continue;
- if (stages[MESA_SHADER_FRAGMENT].entrypoint &&
- !pipeline->shaders[MESA_SHADER_FRAGMENT]) {
- result = anv_pipeline_compile_fs(pipeline, cache,
- &stages[MESA_SHADER_FRAGMENT]);
+ switch (s) {
+ case MESA_SHADER_VERTEX:
+ result = anv_pipeline_compile_vs(pipeline, cache, &stages[s]);
+ break;
+ case MESA_SHADER_TESS_CTRL:
+ /* Handled with TESS_EVAL */
+ break;
+ case MESA_SHADER_TESS_EVAL:
+ result = anv_pipeline_compile_tcs_tes(pipeline, cache,
+ &stages[MESA_SHADER_TESS_CTRL],
+ &stages[MESA_SHADER_TESS_EVAL]);
+ break;
+ case MESA_SHADER_GEOMETRY:
+ result = anv_pipeline_compile_gs(pipeline, cache, &stages[s]);
+ break;
+ case MESA_SHADER_FRAGMENT:
+ result = anv_pipeline_compile_fs(pipeline, cache, &stages[s]);
+ break;
+ default:
+ unreachable("Invalid graphics shader stage");
+ }
if (result != VK_SUCCESS)
goto compile_fail;
}
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list