summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-04-21 19:27:16 +0200
committerSamuel Pitoiset <[email protected]>2017-05-06 16:40:19 +0200
commit35c8e727a55d15485091eb9de279d8beb3abc55e (patch)
tree829e9f570108e196ed5174b99b67be0c1efd9fd9
parentefb668fb293e0cf8401e9a541c67615827974808 (diff)
glsl: allow bindless samplers/images to be initialized
From section 4.1.7 of the ARB_bindless_texture spec: "Samplers may be declared as shader inputs and outputs, as uniform variables, as temporary variables, and as function parameters." From section 4.1.X of the ARB_bindless_texture spec: "Images may be declared as shader inputs and outputs, as uniform variables, as temporary variables, and as function parameters." v3: - add spec comment - update the glsl error message Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r--src/compiler/glsl/ast_to_hir.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index d73d74a5cfe..7ae83dfd83f 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -4333,11 +4333,22 @@ process_initializer(ir_variable *var, ast_declaration *decl,
* "Opaque variables [...] are initialized only through the
* OpenGL API; they cannot be declared with an initializer in a
* shader."
+ *
+ * From section 4.1.7 of the ARB_bindless_texture spec:
+ *
+ * "Samplers may be declared as shader inputs and outputs, as uniform
+ * variables, as temporary variables, and as function parameters."
+ *
+ * From section 4.1.X of the ARB_bindless_texture spec:
+ *
+ * "Images may be declared as shader inputs and outputs, as uniform
+ * variables, as temporary variables, and as function parameters."
*/
- if (var->type->contains_opaque()) {
+ if (var->type->contains_atomic() ||
+ (!state->has_bindless() && var->type->contains_opaque())) {
_mesa_glsl_error(&initializer_loc, state,
- "cannot initialize opaque variable %s",
- var->name);
+ "cannot initialize %s variable %s",
+ var->name, state->has_bindless() ? "atomic" : "opaque");
}
if ((var->data.mode == ir_var_shader_in) && (state->current_function == NULL)) {