summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-02-17 13:46:44 -0800
committerJason Ekstrand <[email protected]>2016-02-17 18:04:39 -0800
commitfed8b7f8177ed3e770df1989922ff5cc63eba895 (patch)
tree948859dfe8776dd38059f2b34195e1db1951850d
parent979732fafc8d5c8db4c70461493b7c93ac870cfd (diff)
anv/pipeline: Delete out-of-bounds fragment shader outputs
-rw-r--r--src/vulkan/anv_pipeline.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/vulkan/anv_pipeline.c b/src/vulkan/anv_pipeline.c
index e6cc8faf4fc..4be2bfc625b 100644
--- a/src/vulkan/anv_pipeline.c
+++ b/src/vulkan/anv_pipeline.c
@@ -616,6 +616,19 @@ anv_pipeline_compile_fs(struct anv_pipeline *pipeline,
if (nir == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+ nir_function_impl *impl = nir_shader_get_entrypoint(nir)->impl;
+ nir_foreach_variable_safe(var, &nir->outputs) {
+ if (var->data.location < FRAG_RESULT_DATA0)
+ continue;
+
+ unsigned rt = var->data.location - FRAG_RESULT_DATA0;
+ if (rt >= key.nr_color_regions) {
+ var->data.mode = nir_var_local;
+ exec_node_remove(&var->node);
+ exec_list_push_tail(&impl->locals, &var->node);
+ }
+ }
+
void *mem_ctx = ralloc_context(NULL);
if (module->nir == NULL)