summaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_pipeline.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-12-18 11:28:21 -0800
committerJason Ekstrand <[email protected]>2015-12-23 13:49:56 -0800
commitac975b73cf7d51ae8dd6a4fed8f82902a0c28919 (patch)
tree4c4fcf2fd473fb8c28ea25c1f0093278ff452f41 /src/vulkan/anv_pipeline.c
parent8fba4bf79f9caf73a6ee9e724d51fae996ff9161 (diff)
anv/pipeline: Run lower_returns and inline_functions after spirv_to_nir
Diffstat (limited to 'src/vulkan/anv_pipeline.c')
-rw-r--r--src/vulkan/anv_pipeline.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/vulkan/anv_pipeline.c b/src/vulkan/anv_pipeline.c
index 1906205c4d0..02be5a81984 100644
--- a/src/vulkan/anv_pipeline.c
+++ b/src/vulkan/anv_pipeline.c
@@ -102,26 +102,38 @@ anv_shader_compile_to_nir(struct anv_device *device,
* and just use the NIR shader */
nir = module->nir;
nir->options = nir_options;
+ nir_validate_shader(nir);
} else {
uint32_t *spirv = (uint32_t *) module->data;
assert(spirv[0] == SPIR_V_MAGIC_NUMBER);
assert(module->size % 4 == 0);
nir = spirv_to_nir(spirv, module->size / 4, stage, nir_options);
+ nir_validate_shader(nir);
+
+ nir_lower_returns(nir);
+ nir_validate_shader(nir);
+
+ nir_inline_functions(nir);
+ nir_validate_shader(nir);
}
- nir_validate_shader(nir);
/* Vulkan uses the separate-shader linking model */
nir->info.separate_shader = true;
- /* Make sure the provided shader has exactly one entrypoint and that the
- * name matches the name that came in from the VkShader.
- */
+ /* Pick off the single entrypoint that we want */
nir_function_impl *entrypoint = NULL;
- nir_foreach_overload(nir, overload) {
- if (strcmp(entrypoint_name, overload->function->name) == 0 &&
- overload->impl) {
- assert(entrypoint == NULL);
+ foreach_list_typed_safe(nir_function, func, node, &nir->functions) {
+ if (strcmp(entrypoint_name, func->name) != 0) {
+ /* Not our function, get rid of it */
+ exec_node_remove(&func->node);
+ continue;
+ }
+
+ assert(exec_list_length(&func->overload_list) == 1);
+ foreach_list_typed(nir_function_overload, overload, node,
+ &func->overload_list) {
+ assert(overload->impl);
entrypoint = overload->impl;
}
}