glsl: Introduce a new "const_in" variable mode.
This annotation is for an "in" function parameter for which it is only legal to pass constant expressions. The only known example of this, currently, is the textureOffset functions. This should never be used for globals.
This commit is contained in:
@@ -132,6 +132,9 @@ match_function_by_name(exec_list *instructions, const char *name,
|
||||
/* Verify that 'out' and 'inout' actual parameters are lvalues. This
|
||||
* isn't done in ir_function::matching_signature because that function
|
||||
* cannot generate the necessary diagnostics.
|
||||
*
|
||||
* Also, validate that 'const_in' formal parameters (an extension of our
|
||||
* IR) correspond to ir_constant actual parameters.
|
||||
*/
|
||||
exec_list_iterator actual_iter = actual_parameters->iterator();
|
||||
exec_list_iterator formal_iter = sig->parameters.iterator();
|
||||
@@ -143,6 +146,12 @@ match_function_by_name(exec_list *instructions, const char *name,
|
||||
assert(actual != NULL);
|
||||
assert(formal != NULL);
|
||||
|
||||
if (formal->mode == ir_var_const_in && !actual->as_constant()) {
|
||||
_mesa_glsl_error(loc, state,
|
||||
"parameter `%s' must be a constant expression",
|
||||
formal->name);
|
||||
}
|
||||
|
||||
if ((formal->mode == ir_var_out)
|
||||
|| (formal->mode == ir_var_inout)) {
|
||||
const char *mode = NULL;
|
||||
|
||||
Reference in New Issue
Block a user