glsl/ast: Generalize some sampler variable restrictions to all opaque types.
No opaque types may be statically initialized in the shader, all opaque variables must be declared uniform or be part of an "in" function parameter declaration, no opaque types may be used as the return type of a function. v2: Add explicit check for opaque types in interface blocks. Check for opaque types in ir_dereference::is_lvalue(). Reviewed-by: Paul Berry <stereotype441@gmail.com>
This commit is contained in:
@@ -1311,13 +1311,13 @@ ir_dereference::is_lvalue() const
|
||||
if ((var == NULL) || var->data.read_only)
|
||||
return false;
|
||||
|
||||
/* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
|
||||
/* From section 4.1.7 of the GLSL 4.40 spec:
|
||||
*
|
||||
* "Samplers cannot be treated as l-values; hence cannot be used
|
||||
* as out or inout function parameters, nor can they be
|
||||
* assigned into."
|
||||
* "Opaque variables cannot be treated as l-values; hence cannot
|
||||
* be used as out or inout function parameters, nor can they be
|
||||
* assigned into."
|
||||
*/
|
||||
if (this->type->contains_sampler())
|
||||
if (this->type->contains_opaque())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user