mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-15 02:20:29 +01:00
allow builtin functions to require parameters to be shader inputs
The new interpolateAt* builtins have strange restrictions on the <interpolant> parameter. - It must be a shader input, or an element of a shader input array. - It must not include a swizzle. V2: Don't abuse ir_var_mode_shader_in for this; make a new flag. Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
parent
ee2a818d33
commit
8b7a323596
2 changed files with 24 additions and 0 deletions
|
|
@ -178,6 +178,24 @@ verify_parameter_modes(_mesa_glsl_parse_state *state,
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Verify that shader_in parameters are shader inputs */
|
||||
if (formal->data.must_be_shader_input) {
|
||||
ir_variable *var = actual->variable_referenced();
|
||||
if (var && var->data.mode != ir_var_shader_in) {
|
||||
_mesa_glsl_error(&loc, state,
|
||||
"parameter `%s` must be a shader input",
|
||||
formal->name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (actual->ir_type == ir_type_swizzle) {
|
||||
_mesa_glsl_error(&loc, state,
|
||||
"parameter `%s` must not be swizzled",
|
||||
formal->name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Verify that 'out' and 'inout' actual parameters are lvalues. */
|
||||
if (formal->data.mode == ir_var_function_out
|
||||
|| formal->data.mode == ir_var_function_inout) {
|
||||
|
|
|
|||
|
|
@ -677,6 +677,12 @@ public:
|
|||
*/
|
||||
unsigned from_named_ifc_block_array:1;
|
||||
|
||||
/**
|
||||
* Non-zero if the variable must be a shader input. This is useful for
|
||||
* constraints on function parameters.
|
||||
*/
|
||||
unsigned must_be_shader_input:1;
|
||||
|
||||
/**
|
||||
* \brief Layout qualifier for gl_FragDepth.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue