summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-10-27 10:13:38 -0700
committerJason Ekstrand <[email protected]>2018-08-02 10:29:20 -0700
commitf3c59ca947ed20cf03ce2f0f4970d383b828bf01 (patch)
treef4529a255b637c4acfb0594062a3ff75c13fbce1 /src/intel
parentbdc3565c8c513dfcfef185da5561dc53dc053787 (diff)
anv/pipeline: Call anv_pipeline_compile_* in a loop
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/vulkan/anv_pipeline.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 3033acbe958..81f04ff7ca2 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -1421,35 +1421,39 @@ anv_pipeline_init(struct anv_pipeline *pipeline,
anv_pipeline_add_compiled_stage(pipeline, s, bin);
}
- if (stages[MESA_SHADER_VERTEX].entrypoint &&
- !pipeline->shaders[MESA_SHADER_VERTEX]) {
- result = anv_pipeline_compile_vs(pipeline, cache, pCreateInfo,
- &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]) {
- result = anv_pipeline_compile_tcs_tes(pipeline, cache, pCreateInfo,
- &stages[MESA_SHADER_TESS_CTRL],
- &stages[MESA_SHADER_TESS_EVAL]);
- if (result != VK_SUCCESS)
- goto compile_fail;
- }
+ assert(stages[s].stage == s);
- if (stages[MESA_SHADER_GEOMETRY].entrypoint &&
- !pipeline->shaders[MESA_SHADER_GEOMETRY]) {
- result = anv_pipeline_compile_gs(pipeline, cache, pCreateInfo,
- &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, pCreateInfo,
- &stages[MESA_SHADER_FRAGMENT]);
+ switch (s) {
+ case MESA_SHADER_VERTEX:
+ result = anv_pipeline_compile_vs(pipeline, cache, pCreateInfo,
+ &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, pCreateInfo,
+ &stages[MESA_SHADER_TESS_CTRL],
+ &stages[MESA_SHADER_TESS_EVAL]);
+ break;
+ case MESA_SHADER_GEOMETRY:
+ result = anv_pipeline_compile_gs(pipeline, cache, pCreateInfo,
+ &stages[s]);
+ break;
+ case MESA_SHADER_FRAGMENT:
+ result = anv_pipeline_compile_fs(pipeline, cache, pCreateInfo,
+ &stages[s]);
+ break;
+ default:
+ unreachable("Invalid graphics shader stage");
+ }
if (result != VK_SUCCESS)
goto compile_fail;
}