For the explicit conversions.

From section 4.1.7 of the ARB_bindless_texture spec:

   "Samplers are represented using 64-bit integer handles, and
    may be converted to and from 64-bit integers using constructors."

From section 4.1.X of the ARB_bindless_texture spec:

   "Images are represented using 64-bit integer handles, and
    may be converted to and from 64-bit integers using constructors."

v3: - add spec comment
    - update the glsl error message

Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]> (v2)
Reviewed-by: Nicolai Hähnle <[email protected]> (v2)
---
 src/compiler/glsl/ast_function.cpp | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/ast_function.cpp 
b/src/compiler/glsl/ast_function.cpp
index 6ec5eda043..026fe075eb 100644
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -1968,9 +1968,21 @@ ast_function_expression::hir(exec_list *instructions,
 
 
       /* Constructors for opaque types are illegal.
+       *
+       * From section 4.1.7 of the ARB_bindless_texture spec:
+       *
+       * "Samplers are represented using 64-bit integer handles, and may be "
+       *  converted to and from 64-bit integers using constructors."
+       *
+       * From section 4.1.X of the ARB_bindless_texture spec:
+       *
+       * "Images are represented using 64-bit integer handles, and may be
+       *  converted to and from 64-bit integers using constructors."
        */
-      if (constructor_type->contains_opaque()) {
-         _mesa_glsl_error(& loc, state, "cannot construct opaque type `%s'",
+      if (constructor_type->contains_atomic() ||
+          (!state->has_bindless() && constructor_type->contains_opaque())) {
+         _mesa_glsl_error(& loc, state, "cannot construct %s type `%s'",
+                          state->has_bindless() ? "atomic" : "opaque",
                           constructor_type->name);
          return ir_rvalue::error_value(ctx);
       }
-- 
2.12.2

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to