summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2017-04-21 18:45:42 +0200
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>2017-05-06 16:40:19 +0200
commit95c83aba713ad89ff4d189cbdcbf725e2010af7e (patch)
tree649249a96d2f94c4e2badd5fd03fe0b1ebb7d7d4 /src/compiler
parentb98542588cd27ebcd403ea8130ef04b440661cb0 (diff)
glsl: allow bindless samplers/images to be used with constructors
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 <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> (v2) Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/ast_function.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp
index d493d1bd01a..dd08ed84319 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);
}