mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 04:40:09 +01:00
compiler/glsl: check that bias is not used outside fragment stage
This fixes some upcoming CTS tests that attempt bias usage when it is not valid per spec. Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34285>
This commit is contained in:
parent
ce716d009f
commit
b93ea155f9
1 changed files with 21 additions and 0 deletions
|
|
@ -291,6 +291,27 @@ verify_parameter_modes(_mesa_glsl_parse_state *state,
|
|||
var->data.must_be_shader_input = 1;
|
||||
}
|
||||
|
||||
/* GLSL spec prohibits using bias with anything else than fragment stage,
|
||||
* this starts already at GLSL 1.30 but here is a quote from latest 4.60
|
||||
* spec, Section 8.9 "Texture Functions":
|
||||
*
|
||||
* "... the bias parameter is optional for fragment shaders. The bias
|
||||
* parameter is not accepted in any other shader stage."
|
||||
*
|
||||
* Mesa has drirc "allow_vertex_texture_bias" to allow bias in vertex
|
||||
* stage, additionally GL_NV_compute_shader_derivatives makes it possible
|
||||
* to use bias in compute shaders.
|
||||
*/
|
||||
if (sig->is_builtin() &&
|
||||
strcmp(formal->name, "bias") == 0 &&
|
||||
state->stage != MESA_SHADER_FRAGMENT &&
|
||||
!state->NV_compute_shader_derivatives_enable &&
|
||||
(!(state->allow_vertex_texture_bias &&
|
||||
state->stage == MESA_SHADER_VERTEX))) {
|
||||
_mesa_glsl_error(&loc, state,
|
||||
"bias parameter may only be used in fragment stage");
|
||||
}
|
||||
|
||||
/* Verify that 'out' and 'inout' actual parameters are lvalues. */
|
||||
if (formal->data.mode == ir_var_function_out
|
||||
|| formal->data.mode == ir_var_function_inout) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue