summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2016-01-11 14:51:38 -0800
committerKenneth Graunke <[email protected]>2016-01-12 12:20:02 -0800
commitc034dbeda8850fe1f3ec0dbdbd73344ace024748 (patch)
tree62475cf1ccc4103da3526e0ac445f5b77378f608
parent9095847c254be2d55ab188232aa6b84555dbac4e (diff)
glsl: Make read_from_write_only_variable_visitor ignore .length().
.length() on an unsized SSBO variable doesn't actually read any data from the SSBO, and is allowed on variables marked 'writeonly'. Fixes compute shader compilation in Shadow of Mordor. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Matt Turner <[email protected]>
-rw-r--r--src/glsl/ast_to_hir.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index f3966d7e3f4..13696a36b0c 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -106,6 +106,15 @@ public:
return found;
}
+ virtual ir_visitor_status visit_enter(ir_expression *ir)
+ {
+ /* .length() doesn't actually read anything */
+ if (ir->operation == ir_unop_ssbo_unsized_array_length)
+ return visit_continue_with_parent;
+
+ return visit_continue;
+ }
+
private:
ir_variable *found;
};