From 1a973aa5e167c4ac4a7e83d67a4fa3a9a42efd8e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 7 Aug 2018 19:56:44 -0400 Subject: [PATCH] glsl: apply some 1.30 and other rules to EXT_gpu_shader4 as well Reviewed-by: Eric Anholt --- src/compiler/glsl/ast_to_hir.cpp | 15 +++++++++------ src/compiler/glsl/glsl_parser.yy | 2 +- src/compiler/glsl/glsl_parser_extras.h | 3 ++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 069231d44a8..79e14cc6c9b 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -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)) diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy index 9e9b49c8462..80634144084 100644 --- a/src/compiler/glsl/glsl_parser.yy +++ b/src/compiler/glsl/glsl_parser.yy @@ -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 " diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h index 3294838db4f..dad73e924d8 100644 --- a/src/compiler/glsl/glsl_parser_extras.h +++ b/src/compiler/glsl/glsl_parser_extras.h @@ -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) -- 2.30.2