glsl: apply some 1.30 and other rules to EXT_gpu_shader4 as well

Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Marek Olšák 2018-08-07 19:56:44 -04:00
parent 85fefd1913
commit 1a973aa5e1
3 changed files with 12 additions and 8 deletions

View file

@ -609,7 +609,8 @@ modulus_result_type(ir_rvalue * &value_a, ir_rvalue * &value_b,
const glsl_type *type_a = value_a->type;
const glsl_type *type_b = value_b->type;
if (!state->check_version(130, 300, loc, "operator '%%' is reserved")) {
if (!state->EXT_gpu_shader4_enable &&
!state->check_version(130, 300, loc, "operator '%%' is reserved")) {
return glsl_type::error_type;
}
@ -3012,7 +3013,7 @@ validate_fragment_flat_interpolation_input(struct _mesa_glsl_parse_state *state,
* reasonable way to interpolate a fragment shader input that contains
* an integer. See Khronos bug #15671.
*/
if (state->is_version(130, 300)
if ((state->is_version(130, 300) || state->EXT_gpu_shader4_enable)
&& var_type->contains_integer()) {
_mesa_glsl_error(loc, state, "if a fragment input is (or contains) "
"an integer, then it must be qualified with 'flat'");
@ -3093,7 +3094,7 @@ validate_interpolation_qualifier(struct _mesa_glsl_parse_state *state,
* not apply to inputs into a vertex shader or outputs from a
* fragment shader."
*/
if (state->is_version(130, 300)
if ((state->is_version(130, 300) || state->EXT_gpu_shader4_enable)
&& interpolation != INTERP_MODE_NONE) {
const char *i = interpolation_string(interpolation);
if (mode != ir_var_shader_in && mode != ir_var_shader_out)
@ -3130,8 +3131,10 @@ validate_interpolation_qualifier(struct _mesa_glsl_parse_state *state,
* to the deprecated storage qualifiers varying or centroid varying."
*
* These deprecated storage qualifiers do not exist in GLSL ES 3.00.
*
* GL_EXT_gpu_shader4 allows this.
*/
if (state->is_version(130, 0)
if (state->is_version(130, 0) && !state->EXT_gpu_shader4_enable
&& interpolation != INTERP_MODE_NONE
&& qual->flags.q.varying) {
@ -4129,7 +4132,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
break;
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT:
if (state->is_version(130, 300))
if (state->is_version(130, 300) || state->EXT_gpu_shader4_enable)
break;
_mesa_glsl_error(loc, state,
"varying variables must be of base type float in %s",
@ -5244,7 +5247,7 @@ ast_declarator_list::hir(exec_list *instructions,
break;
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT:
if (state->is_version(120, 300))
if (state->is_version(120, 300) || state->EXT_gpu_shader4_enable)
break;
case GLSL_TYPE_DOUBLE:
if (check_type->is_double() && (state->is_version(410, 0) || state->ARB_vertex_attrib_64bit_enable))

View file

@ -2072,7 +2072,7 @@ type_qualifier:
"duplicate auxiliary storage qualifier (centroid or sample)");
}
if (!state->has_420pack_or_es31() &&
if ((!state->has_420pack_or_es31() && !state->EXT_gpu_shader4_enable) &&
($2.flags.q.precise || $2.flags.q.invariant ||
$2.has_interpolation() || $2.has_layout())) {
_mesa_glsl_error(&@1, state, "auxiliary storage qualifiers must come "

View file

@ -141,7 +141,8 @@ struct _mesa_glsl_parse_state {
bool check_bitwise_operations_allowed(YYLTYPE *locp)
{
return check_version(130, 300, locp, "bit-wise operations are forbidden");
return EXT_gpu_shader4_enable ||
check_version(130, 300, locp, "bit-wise operations are forbidden");
}
bool check_explicit_attrib_stream_allowed(YYLTYPE *locp)