From section 4.1.7 of the GLSL 4.40 spec: "The opaque types declare variables that are effectively opaque handles to other objects. These objects are accessed through built-in functions, not through direct reading or writing of the declared variable. They can only be declared as function parameters or in uniform- qualified variables."
Image variables and atomic counters are already rejected in this situation. Note that opaque variables can't be treated as l-values, which means only the 'in' function parameter is allowed. Signed-off-by: Samuel Pitoiset <[email protected]> --- src/compiler/glsl/ast_to_hir.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 22803e89c7..3279149d34 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -3601,6 +3601,15 @@ apply_layout_qualifier_to_variable(const struct ast_type_qualifier *qual, } } + if (var->type->contains_sampler()) { + if (var->data.mode != ir_var_uniform && + var->data.mode != ir_var_function_in) { + _mesa_glsl_error(loc, state, "sampler variables may only be declared " + "as function parameters or uniform-qualified " + "global variables"); + } + } + /* Is the 'layout' keyword used with parameters that allow relaxed checking. * Many implementations of GL_ARB_fragment_coord_conventions_enable and some * implementations (only Mesa?) GL_ARB_explicit_attrib_location_enable -- 2.11.1 _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
