glsl: allow ?: operator with images and samplers when bindless is enabled
authorRhys Perry <pendingchaos02@gmail.com>
Wed, 6 Jun 2018 19:55:06 +0000 (20:55 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 1 Aug 2018 04:10:01 +0000 (00:10 -0400)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/compiler/glsl/ast_to_hir.cpp

index dd60a2a87fd5ad5214e88dd4a06299d57eedb0a4..74160ec142bea39b1b7281a147ac52a0ae0d8cd6 100644 (file)
@@ -1850,9 +1850,11 @@ ast_expression::do_hir(exec_list *instructions,
        *   expressions; such use results in a compile-time error."
        */
       if (type->contains_opaque()) {
-         _mesa_glsl_error(&loc, state, "opaque variables cannot be operands "
-                          "of the ?: operator");
-         error_emitted = true;
+         if (!(state->has_bindless() && (type->is_image() || type->is_sampler()))) {
+            _mesa_glsl_error(&loc, state, "variables of type %s cannot be "
+                             "operands of the ?: operator", type->name);
+            error_emitted = true;
+         }
       }
 
       ir_constant *cond_val = op[0]->constant_expression_value(ctx);