[Mesa-dev] [PATCH v3 21/32] glsl: skip IR validation for out/inout sampler/image parameters

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue May 2 20:53:42 UTC 2017


Plain GLSL doesn't allow sampler/image types to be l-values
while ARB_bindless_texture allows the opposite. Unfortunately,
at this point we can't have access to _mesa_glsl_parse_state.

This is not ideal, but in order to avoid a crash in debug build,
just skip the IR validation when out/inout function parameters
contain samplers or images.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/compiler/glsl/ir_validate.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/ir_validate.cpp b/src/compiler/glsl/ir_validate.cpp
index 8f54637246..d2cb0b4d62 100644
--- a/src/compiler/glsl/ir_validate.cpp
+++ b/src/compiler/glsl/ir_validate.cpp
@@ -982,7 +982,9 @@ ir_validate::visit_enter(ir_call *ir)
       }
       if (formal_param->data.mode == ir_var_function_out
           || formal_param->data.mode == ir_var_function_inout) {
-         if (!actual_param->is_lvalue()) {
+         if (!actual_param->type->contains_sampler() &&
+             !actual_param->type->contains_image() &&
+             !actual_param->is_lvalue()) {
             printf("ir_call out/inout parameters must be lvalues:\n");
             goto dump_ir;
          }
-- 
2.12.2



More information about the mesa-dev mailing list