diff options
Diffstat (limited to 'mesalib/src')
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format_r11g11b10f.h | 14 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_half.h | 12 | ||||
-rw-r--r-- | mesalib/src/glsl/ast_function.cpp | 2 | ||||
-rw-r--r-- | mesalib/src/glsl/ast_to_hir.cpp | 114 | ||||
-rw-r--r-- | mesalib/src/glsl/ast_type.cpp | 2 | ||||
-rw-r--r-- | mesalib/src/glsl/glsl_lexer.ll | 41 | ||||
-rw-r--r-- | mesalib/src/glsl/glsl_parser.yy | 92 | ||||
-rw-r--r-- | mesalib/src/glsl/glsl_parser_extras.cpp | 16 | ||||
-rw-r--r-- | mesalib/src/glsl/glsl_types.cpp | 8 | ||||
-rw-r--r-- | mesalib/src/glsl/glsl_types.h | 8 | ||||
-rw-r--r-- | mesalib/src/glsl/hir_field_selection.cpp | 20 | ||||
-rw-r--r-- | mesalib/src/glsl/ir_function_detect_recursion.cpp | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/extensions.c | 2 |
13 files changed, 168 insertions, 165 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_format_r11g11b10f.h b/mesalib/src/gallium/auxiliary/util/u_format_r11g11b10f.h index b883b318e..57516c39c 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_r11g11b10f.h +++ b/mesalib/src/gallium/auxiliary/util/u_format_r11g11b10f.h @@ -69,10 +69,10 @@ static INLINE unsigned f32_to_uf11(float val) */ uf11 = UF11_MAX_EXPONENT; if (mantissa) { - uf11 |= 1; /* NaN */ + uf11 |= 1; /* NaN */ } else { - if (sign) - uf11 = 0; /* 0.0 */ + if (sign) + uf11 = 0; /* 0.0 */ } } else if (sign) { return 0; @@ -155,14 +155,14 @@ static INLINE unsigned f32_to_uf10(float val) */ uf10 = UF10_MAX_EXPONENT; if (mantissa) { - uf10 |= 1; /* NaN */ + uf10 |= 1; /* NaN */ } else { - if (sign) - uf10 = 0; /* 0.0 */ + if (sign) + uf10 = 0; /* 0.0 */ } } else if (sign) { return 0; - } else if (val > 64512.0f) { /* Overflow - flush to Infinity */ + } else if (val > 64512.0f) { /* From the GL_EXT_packed_float spec: * * "Likewise, finite positive values greater than 64512 (the maximum diff --git a/mesalib/src/gallium/auxiliary/util/u_half.h b/mesalib/src/gallium/auxiliary/util/u_half.h index f7009f548..d340b9a7a 100644 --- a/mesalib/src/gallium/auxiliary/util/u_half.h +++ b/mesalib/src/gallium/auxiliary/util/u_half.h @@ -75,9 +75,17 @@ util_float_to_half(float f) f32.f *= magic.f; f32.ui -= round_mask; - /* Clamp to infinity if overflowed */ + /* + * Clamp to max finite value if overflowed. + * OpenGL has completely undefined rounding behavior for float to + * half-float conversions, and this matches what is mandated for float + * to fp11/fp10, which recommend round-to-nearest-finite too. + * (d3d10 is deeply unhappy about flushing such values to infinity, and + * while it also mandates round-to-zero it doesn't care nearly as much + * about that.) + */ if (f32.ui > f16inf) - f32.ui = f16inf; + f32.ui = f16inf - 1; f16 = f32.ui >> 13; } diff --git a/mesalib/src/glsl/ast_function.cpp b/mesalib/src/glsl/ast_function.cpp index e34c1ddba..7df2b6925 100644 --- a/mesalib/src/glsl/ast_function.cpp +++ b/mesalib/src/glsl/ast_function.cpp @@ -626,7 +626,7 @@ process_vec_mat_constructor(exec_list *instructions, * int i = { 1 }; // illegal, i is not an aggregate" */ if (constructor_type->vector_elements <= 1) { - _mesa_glsl_error(loc, state, "Aggregates can only initialize vectors, " + _mesa_glsl_error(loc, state, "aggregates can only initialize vectors, " "matrices, arrays, and structs"); return ir_rvalue::error_value(ctx); } diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp index bfd5fda8f..598da92f8 100644 --- a/mesalib/src/glsl/ast_to_hir.cpp +++ b/mesalib/src/glsl/ast_to_hir.cpp @@ -195,7 +195,7 @@ arithmetic_result_type(ir_rvalue * &value_a, ir_rvalue * &value_b, */ if (!type_a->is_numeric() || !type_b->is_numeric()) { _mesa_glsl_error(loc, state, - "Operands to arithmetic operators must be numeric"); + "operands to arithmetic operators must be numeric"); return glsl_type::error_type; } @@ -207,7 +207,7 @@ arithmetic_result_type(ir_rvalue * &value_a, ir_rvalue * &value_b, if (!apply_implicit_conversion(type_a, value_b, state) && !apply_implicit_conversion(type_b, value_a, state)) { _mesa_glsl_error(loc, state, - "Could not implicitly convert operands to " + "could not implicitly convert operands to " "arithmetic operator"); return glsl_type::error_type; } @@ -386,7 +386,7 @@ unary_arithmetic_result_type(const struct glsl_type *type, */ if (!type->is_numeric()) { _mesa_glsl_error(loc, state, - "Operands to arithmetic operators must be numeric"); + "operands to arithmetic operators must be numeric"); return glsl_type::error_type; } @@ -473,11 +473,11 @@ modulus_result_type(const struct glsl_type *type_a, * unsigned." */ if (!type_a->is_integer()) { - _mesa_glsl_error(loc, state, "LHS of operator %% must be an integer."); + _mesa_glsl_error(loc, state, "LHS of operator %% must be an integer"); return glsl_type::error_type; } if (!type_b->is_integer()) { - _mesa_glsl_error(loc, state, "RHS of operator %% must be an integer."); + _mesa_glsl_error(loc, state, "RHS of operator %% must be an integer"); return glsl_type::error_type; } if (type_a->base_type != type_b->base_type) { @@ -523,7 +523,7 @@ relational_result_type(ir_rvalue * &value_a, ir_rvalue * &value_b, || !type_a->is_scalar() || !type_b->is_scalar()) { _mesa_glsl_error(loc, state, - "Operands to relational operators must be scalar and " + "operands to relational operators must be scalar and " "numeric"); return glsl_type::error_type; } @@ -535,7 +535,7 @@ relational_result_type(ir_rvalue * &value_a, ir_rvalue * &value_b, if (!apply_implicit_conversion(type_a, value_b, state) && !apply_implicit_conversion(type_b, value_a, state)) { _mesa_glsl_error(loc, state, - "Could not implicitly convert operands to " + "could not implicitly convert operands to " "relational operator"); return glsl_type::error_type; } @@ -593,7 +593,7 @@ shift_result_type(const struct glsl_type *type_a, * a scalar as well." */ if (type_a->is_scalar() && !type_b->is_scalar()) { - _mesa_glsl_error(loc, state, "If the first operand of %s is scalar, the " + _mesa_glsl_error(loc, state, "if the first operand of %s is scalar, the " "second must be scalar as well", ast_expression::operator_string(op)); return glsl_type::error_type; @@ -605,7 +605,7 @@ shift_result_type(const struct glsl_type *type_a, if (type_a->is_vector() && type_b->is_vector() && type_a->vector_elements != type_b->vector_elements) { - _mesa_glsl_error(loc, state, "Vector operands to operator %s must " + _mesa_glsl_error(loc, state, "vector operands to operator %s must " "have same number of elements", ast_expression::operator_string(op)); return glsl_type::error_type; @@ -958,7 +958,7 @@ check_builtin_array_max_size(const char *name, unsigned size, * gl_MaxTextureCoords." */ _mesa_glsl_error(&loc, state, "`gl_TexCoord' array size cannot " - "be larger than gl_MaxTextureCoords (%u)\n", + "be larger than gl_MaxTextureCoords (%u)", state->Const.MaxTextureCoords); } else if (strcmp("gl_ClipDistance", name) == 0 && size > state->Const.MaxClipPlanes) { @@ -972,7 +972,7 @@ check_builtin_array_max_size(const char *name, unsigned size, * gl_MaxClipDistances." */ _mesa_glsl_error(&loc, state, "`gl_ClipDistance' array size cannot " - "be larger than gl_MaxClipDistances (%u)\n", + "be larger than gl_MaxClipDistances (%u)", state->Const.MaxClipPlanes); } } @@ -1444,8 +1444,8 @@ ast_expression::hir(exec_list *instructions, || (op[1]->type != op[2]->type)) { YYLTYPE loc = this->subexpressions[1]->get_location(); - _mesa_glsl_error(& loc, state, "Second and third operands of ?: " - "operator must have matching types."); + _mesa_glsl_error(& loc, state, "second and third operands of ?: " + "operator must have matching types"); error_emitted = true; type = glsl_type::error_type; } else { @@ -1459,7 +1459,7 @@ ast_expression::hir(exec_list *instructions, */ if (type->is_array() && !state->check_version(120, 300, &loc, - "Second and third operands of ?: operator " + "second and third operands of ?: operator " "cannot be arrays")) { error_emitted = true; } @@ -1776,7 +1776,7 @@ process_array_type(YYLTYPE *loc, const glsl_type *base, ast_node *array_size, * array declarations have been removed from the language. */ _mesa_glsl_error(loc, state, "unsized array declarations are not " - "allowed in GLSL ES 1.00."); + "allowed in GLSL ES 1.00"); } const glsl_type *array_type = glsl_type::get_array_instance(base, length); @@ -1858,12 +1858,12 @@ validate_binding_qualifier(struct _mesa_glsl_parse_state *state, { if (var->mode != ir_var_uniform) { _mesa_glsl_error(loc, state, - "the \"binding\" qualifier only applies to uniforms.\n"); + "the \"binding\" qualifier only applies to uniforms"); return false; } if (qual->binding < 0) { - _mesa_glsl_error(loc, state, "binding values must be >= 0.\n"); + _mesa_glsl_error(loc, state, "binding values must be >= 0"); return false; } @@ -1884,7 +1884,7 @@ validate_binding_qualifier(struct _mesa_glsl_parse_state *state, */ if (max_index >= ctx->Const.MaxUniformBufferBindings) { _mesa_glsl_error(loc, state, "layout(binding = %d) for %d UBOs exceeds " - "the maximum number of UBO binding points (%d).\n", + "the maximum number of UBO binding points (%d)", qual->binding, elements, ctx->Const.MaxUniformBufferBindings); return false; @@ -1914,14 +1914,14 @@ validate_binding_qualifier(struct _mesa_glsl_parse_state *state, if (max_index >= limit) { _mesa_glsl_error(loc, state, "layout(binding = %d) for %d samplers " "exceeds the maximum number of texture image units " - "(%d).\n", qual->binding, elements, limit); + "(%d)", qual->binding, elements, limit); return false; } } else { _mesa_glsl_error(loc, state, "the \"binding\" qualifier only applies to uniform " - "blocks, samplers, or arrays of samplers.\n"); + "blocks, samplers, or arrays of samplers"); return false; } @@ -2060,7 +2060,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, !(state->target == fragment_shader && var->mode == ir_var_shader_in)) { _mesa_glsl_error(loc, state, "interpolation qualifier `%s' can only be applied to " - "vertex shader outputs and fragment shader inputs.", + "vertex shader outputs and fragment shader inputs", var->interpolation_string()); } @@ -2099,7 +2099,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, case geometry_shader: _mesa_glsl_error(loc, state, "geometry shader variables cannot be given " - "explicit locations\n"); + "explicit locations"); break; case fragment_shader: @@ -2113,7 +2113,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, if (fail) { _mesa_glsl_error(loc, state, "only %s shader %s variables can be given an " - "explicit location\n", + "explicit location", _mesa_glsl_shader_target_name(state->target), string); } else { @@ -2146,7 +2146,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, */ if (qual->index < 0 || qual->index > 1) { _mesa_glsl_error(loc, state, - "explicit index may only be 0 or 1\n"); + "explicit index may only be 0 or 1"); } else { var->explicit_index = true; var->index = qual->index; @@ -2155,7 +2155,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, } } else if (qual->flags.q.explicit_index) { _mesa_glsl_error(loc, state, - "explicit index requires explicit location\n"); + "explicit index requires explicit location"); } if (qual->flags.q.explicit_binding && @@ -2545,8 +2545,8 @@ ast_declarator_list::hir(exec_list *instructions, if (state->current_function != NULL) { _mesa_glsl_error(& loc, state, - "All uses of `invariant' keyword must be at global " - "scope\n"); + "all uses of `invariant' keyword must be at global " + "scope"); } foreach_list_typed (ast_declaration, decl, link, &this->declarations) { @@ -2558,18 +2558,18 @@ ast_declarator_list::hir(exec_list *instructions, state->symbols->get_variable(decl->identifier); if (earlier == NULL) { _mesa_glsl_error(& loc, state, - "Undeclared variable `%s' cannot be marked " - "invariant\n", decl->identifier); + "undeclared variable `%s' cannot be marked " + "invariant", decl->identifier); } else if ((state->target == vertex_shader) && (earlier->mode != ir_var_shader_out)) { _mesa_glsl_error(& loc, state, "`%s' cannot be marked invariant, vertex shader " - "outputs only\n", decl->identifier); + "outputs only", decl->identifier); } else if ((state->target == fragment_shader) && (earlier->mode != ir_var_shader_in)) { _mesa_glsl_error(& loc, state, "`%s' cannot be marked invariant, fragment shader " - "inputs only\n", decl->identifier); + "inputs only", decl->identifier); } else if (earlier->used) { _mesa_glsl_error(& loc, state, "variable `%s' may not be redeclared " @@ -2625,8 +2625,8 @@ ast_declarator_list::hir(exec_list *instructions, if (this->type->qualifier.precision != ast_precision_none && this->type->specifier->structure != NULL) { - _mesa_glsl_error(&loc, state, "Precision qualifiers can't be applied " - "to structures.\n"); + _mesa_glsl_error(&loc, state, "precision qualifiers can't be applied " + "to structures"); } } @@ -2679,13 +2679,13 @@ ast_declarator_list::hir(exec_list *instructions, if (this->type->qualifier.flags.q.out) { _mesa_glsl_error(& loc, state, "`out' qualifier in declaration of `%s' " - "only valid for function parameters in %s.", + "only valid for function parameters in %s", decl->identifier, state->get_version_string()); } if (this->type->qualifier.flags.q.in) { _mesa_glsl_error(& loc, state, "`in' qualifier in declaration of `%s' " - "only valid for function parameters in %s.", + "only valid for function parameters in %s", decl->identifier, state->get_version_string()); } /* FINISHME: Test for other invalid qualifiers. */ @@ -2699,7 +2699,7 @@ ast_declarator_list::hir(exec_list *instructions, var->mode != ir_var_shader_out) { _mesa_glsl_error(& loc, state, "`%s' cannot be marked invariant, vertex shader " - "outputs only\n", var->name); + "outputs only", var->name); } else if ((state->target == fragment_shader) && var->mode != ir_var_shader_in) { /* FINISHME: Note that this doesn't work for invariant on @@ -2707,7 +2707,7 @@ ast_declarator_list::hir(exec_list *instructions, */ _mesa_glsl_error(& loc, state, "`%s' cannot be marked invariant, fragment shader " - "inputs only\n", var->name); + "inputs only", var->name); } } @@ -2836,7 +2836,7 @@ ast_declarator_list::hir(exec_list *instructions, && state->es_shader))) { const char *var_type = (state->target == vertex_shader) ? "vertex output" : "fragment input"; - _mesa_glsl_error(&loc, state, "If a %s is (or contains) " + _mesa_glsl_error(&loc, state, "if a %s is (or contains) " "an integer, then it must be qualified with 'flat'", var_type); } @@ -2927,6 +2927,20 @@ ast_declarator_list::hir(exec_list *instructions, "'centroid in' cannot be used in a vertex shader"); } + /* Section 4.3.6 of the GLSL 1.30 specification states: + * "It is an error to use centroid out in a fragment shader." + * + * The GL_ARB_shading_language_420pack extension specification states: + * "It is an error to use auxiliary storage qualifiers or interpolation + * qualifiers on an output in a fragment shader." + */ + if (state->target == fragment_shader && + this->type->qualifier.flags.q.out && + this->type->qualifier.has_auxiliary_storage()) { + _mesa_glsl_error(&loc, state, + "auxiliary storage qualifiers cannot be used on " + "fragment shader outputs"); + } /* Precision qualifiers exists only in GLSL versions 1.00 and >= 1.30. */ @@ -3134,7 +3148,7 @@ ast_parameter_declarator::hir(exec_list *instructions, if (!type->is_error() && type->array_size() == 0) { _mesa_glsl_error(&loc, state, "arrays passed as parameters must have " - "a declared size."); + "a declared size"); type = glsl_type::error_type; } @@ -3177,7 +3191,7 @@ ast_parameter_declarator::hir(exec_list *instructions, if ((var->mode == ir_var_function_inout || var->mode == ir_var_function_out) && type->is_array() && !state->check_version(120, 100, &loc, - "Arrays cannot be out or inout parameters")) { + "arrays cannot be out or inout parameters")) { type = glsl_type::error_type; } @@ -3495,7 +3509,7 @@ ast_jump_statement::hir(exec_list *instructions, if (!apply_implicit_conversion(state->current_function->return_type, ret, state)) { _mesa_glsl_error(& loc, state, - "Could not implicitly convert return value " + "could not implicitly convert return value " "to %s, in function `%s'", state->current_function->return_type->name, state->current_function->function_name()); @@ -4156,8 +4170,8 @@ ast_process_structure_or_interface_block(exec_list *instructions, * embedded structure definitions have been removed from the language. */ if (state->es_shader && decl_list->type->specifier->structure != NULL) { - _mesa_glsl_error(&loc, state, "Embedded structure definitions are " - "not allowed in GLSL ES 1.00."); + _mesa_glsl_error(&loc, state, "embedded structure definitions are " + "not allowed in GLSL ES 1.00"); } const glsl_type *decl_type = @@ -4183,7 +4197,7 @@ ast_process_structure_or_interface_block(exec_list *instructions, if (is_interface && field_type->contains_sampler()) { YYLTYPE loc = decl_list->get_location(); _mesa_glsl_error(&loc, state, - "Uniform in non-default uniform block contains sampler\n"); + "uniform in non-default uniform block contains sampler"); } const struct ast_type_qualifier *const qual = @@ -4208,7 +4222,7 @@ ast_process_structure_or_interface_block(exec_list *instructions, if (!qual->flags.q.uniform) { _mesa_glsl_error(&loc, state, "row_major and column_major can only be " - "applied to uniform interface blocks."); + "applied to uniform interface blocks"); } else if (!field_type->is_matrix() && !field_type->is_record()) { _mesa_glsl_error(&loc, state, "uniform block layout qualifiers row_major and " @@ -4338,8 +4352,8 @@ ast_interface_block::hir(exec_list *instructions, if (!state->symbols->add_interface(block_type->name, block_type, var_mode)) { YYLTYPE loc = this->get_location(); - _mesa_glsl_error(&loc, state, "Interface block `%s' with type `%s' " - "already taken in the current scope.\n", + _mesa_glsl_error(&loc, state, "interface block `%s' with type `%s' " + "already taken in the current scope", this->block_name, iface_type_name); } @@ -4451,14 +4465,14 @@ detect_conflicting_assignments(struct _mesa_glsl_parse_state *state, */ if (gl_FragColor_assigned && gl_FragData_assigned) { _mesa_glsl_error(&loc, state, "fragment shader writes to both " - "`gl_FragColor' and `gl_FragData'\n"); + "`gl_FragColor' and `gl_FragData'"); } else if (gl_FragColor_assigned && user_defined_fs_output_assigned) { _mesa_glsl_error(&loc, state, "fragment shader writes to both " - "`gl_FragColor' and `%s'\n", + "`gl_FragColor' and `%s'", user_defined_fs_output->name); } else if (gl_FragData_assigned && user_defined_fs_output_assigned) { _mesa_glsl_error(&loc, state, "fragment shader writes to both " - "`gl_FragData' and `%s'\n", + "`gl_FragData' and `%s'", user_defined_fs_output->name); } } diff --git a/mesalib/src/glsl/ast_type.cpp b/mesalib/src/glsl/ast_type.cpp index 275b2a1d0..38c3f8eb0 100644 --- a/mesalib/src/glsl/ast_type.cpp +++ b/mesalib/src/glsl/ast_type.cpp @@ -129,7 +129,7 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc, if ((this->flags.i & q.flags.i & ~(ubo_mat_mask.flags.i | ubo_layout_mask.flags.i)) != 0) { _mesa_glsl_error(loc, state, - "duplicate layout qualifiers used\n"); + "duplicate layout qualifiers used"); return false; } diff --git a/mesalib/src/glsl/glsl_lexer.ll b/mesalib/src/glsl/glsl_lexer.ll index dbc8154e4..93752307d 100644 --- a/mesalib/src/glsl/glsl_lexer.ll +++ b/mesalib/src/glsl/glsl_lexer.ll @@ -77,7 +77,7 @@ static int classify_identifier(struct _mesa_glsl_parse_state *, const char *); } else if (yyextra->is_version(reserved_glsl, \ reserved_glsl_es)) { \ _mesa_glsl_error(yylloc, yyextra, \ - "Illegal use of reserved word `%s'", yytext); \ + "illegal use of reserved word `%s'", yytext); \ return ERROR_TOK; \ } else { \ yylval->identifier = strdup(yytext); \ @@ -93,7 +93,7 @@ static int classify_identifier(struct _mesa_glsl_parse_state *, const char *); do { \ if (yyextra->is_version(0, 300)) { \ _mesa_glsl_error(yylloc, yyextra, \ - "Illegal use of reserved word `%s'", yytext); \ + "illegal use of reserved word `%s'", yytext); \ return ERROR_TOK; \ } else { \ return token; \ @@ -124,10 +124,10 @@ literal_integer(char *text, int len, struct _mesa_glsl_parse_state *state, /* Note that signed 0xffffffff is valid, not out of range! */ if (state->is_version(130, 300)) { _mesa_glsl_error(lloc, state, - "Literal value `%s' out of range", text); + "literal value `%s' out of range", text); } else { _mesa_glsl_warning(lloc, state, - "Literal value `%s' out of range", text); + "literal value `%s' out of range", text); } } else if (base == 10 && !is_uint && (unsigned)value > (unsigned)INT_MAX + 1) { /* Tries to catch unintentionally providing a negative value. @@ -135,7 +135,7 @@ literal_integer(char *text, int len, struct _mesa_glsl_parse_state *state, * want to warn for INT_MAX. */ _mesa_glsl_warning(lloc, state, - "Signed literal value `%s' is interpreted as %d", + "signed literal value `%s' is interpreted as %d", text, lval->n); } return is_uint ? UINTCONSTANT : INTCONSTANT; @@ -324,30 +324,11 @@ sampler2DMSArray KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multi isampler2DMSArray KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, ISAMPLER2DMSARRAY); usampler2DMSArray KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, USAMPLER2DMSARRAY); -samplerCubeArray { - if (yyextra->ARB_texture_cube_map_array_enable) - return SAMPLERCUBEARRAY; - else - return IDENTIFIER; - } -isamplerCubeArray { - if (yyextra->ARB_texture_cube_map_array_enable) - return ISAMPLERCUBEARRAY; - else - return IDENTIFIER; - } -usamplerCubeArray { - if (yyextra->ARB_texture_cube_map_array_enable) - return USAMPLERCUBEARRAY; - else - return IDENTIFIER; - } -samplerCubeArrayShadow { - if (yyextra->ARB_texture_cube_map_array_enable) - return SAMPLERCUBEARRAYSHADOW; - else - return IDENTIFIER; - } + /* keywords available with ARB_texture_cube_map_array_enable extension on desktop GLSL */ +samplerCubeArray KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, SAMPLERCUBEARRAY); +isamplerCubeArray KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, ISAMPLERCUBEARRAY); +usamplerCubeArray KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, USAMPLERCUBEARRAY); +samplerCubeArrayShadow KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, SAMPLERCUBEARRAYSHADOW); samplerExternalOES { if (yyextra->OES_EGL_image_external_enable) @@ -371,7 +352,7 @@ layout { return LAYOUT_TOK; } else { yylval->identifier = strdup(yytext); - return IDENTIFIER; + return classify_identifier(yyextra, yytext); } } diff --git a/mesalib/src/glsl/glsl_parser.yy b/mesalib/src/glsl/glsl_parser.yy index cbd94b41f..bf312366b 100644 --- a/mesalib/src/glsl/glsl_parser.yy +++ b/mesalib/src/glsl/glsl_parser.yy @@ -295,7 +295,7 @@ pragma_statement: if (!state->is_version(120, 100)) { _mesa_glsl_warning(& @1, state, "pragma `invariant(all)' not supported in %s " - "(GLSL ES 1.00 or GLSL 1.20 required).", + "(GLSL ES 1.00 or GLSL 1.20 required)", state->get_version_string()); } else { state->all_invariant = true; @@ -887,7 +887,7 @@ parameter_qualifier: | CONST_TOK parameter_qualifier { if ($2.flags.q.constant) - _mesa_glsl_error(&@1, state, "duplicate const qualifier.\n"); + _mesa_glsl_error(&@1, state, "duplicate const qualifier"); $$ = $2; $$.flags.q.constant = 1; @@ -895,11 +895,11 @@ parameter_qualifier: | parameter_direction_qualifier parameter_qualifier { if (($1.flags.q.in || $1.flags.q.out) && ($2.flags.q.in || $2.flags.q.out)) - _mesa_glsl_error(&@1, state, "duplicate in/out/inout qualifier\n"); + _mesa_glsl_error(&@1, state, "duplicate in/out/inout qualifier"); if (!state->ARB_shading_language_420pack_enable && $2.flags.q.constant) _mesa_glsl_error(&@1, state, "const must be specified before " - "in/out/inout.\n"); + "in/out/inout"); $$ = $1; $$.merge_qualifier(&@1, state, $2); @@ -907,10 +907,10 @@ parameter_qualifier: | precision_qualifier parameter_qualifier { if ($2.precision != ast_precision_none) - _mesa_glsl_error(&@1, state, "Duplicate precision qualifier.\n"); + _mesa_glsl_error(&@1, state, "duplicate precision qualifier"); if (!state->ARB_shading_language_420pack_enable && $2.flags.i != 0) - _mesa_glsl_error(&@1, state, "Precision qualifiers must come last.\n"); + _mesa_glsl_error(&@1, state, "precision qualifiers must come last"); $$ = $2; $$.precision = $1; @@ -1163,7 +1163,7 @@ layout_qualifier_id: if ($$.flags.i && state->ARB_fragment_coord_conventions_warn) { _mesa_glsl_warning(& @1, state, "GL_ARB_fragment_coord_conventions layout " - "identifier `%s' used\n", $1); + "identifier `%s' used", $1); } } @@ -1184,12 +1184,12 @@ layout_qualifier_id: if ($$.flags.i && state->AMD_conservative_depth_warn) { _mesa_glsl_warning(& @1, state, "GL_AMD_conservative_depth " - "layout qualifier `%s' is used\n", $1); + "layout qualifier `%s' is used", $1); } if ($$.flags.i && state->ARB_conservative_depth_warn) { _mesa_glsl_warning(& @1, state, "GL_ARB_conservative_depth " - "layout qualifier `%s' is used\n", $1); + "layout qualifier `%s' is used", $1); } } @@ -1214,13 +1214,13 @@ layout_qualifier_id: if ($$.flags.i && state->ARB_uniform_buffer_object_warn) { _mesa_glsl_warning(& @1, state, "#version 140 / GL_ARB_uniform_buffer_object " - "layout qualifier `%s' is used\n", $1); + "layout qualifier `%s' is used", $1); } } if (!$$.flags.i) { _mesa_glsl_error(& @1, state, "unrecognized layout identifier " - "`%s'\n", $1); + "`%s'", $1); YYERROR; } } @@ -1236,7 +1236,7 @@ layout_qualifier_id: $$.location = $3; } else { _mesa_glsl_error(& @3, state, - "invalid location %d specified\n", $3); + "invalid location %d specified", $3); YYERROR; } } @@ -1248,7 +1248,7 @@ layout_qualifier_id: $$.index = $3; } else { _mesa_glsl_error(& @3, state, - "invalid index %d specified\n", $3); + "invalid index %d specified", $3); YYERROR; } } @@ -1265,12 +1265,12 @@ layout_qualifier_id: */ if (!$$.flags.i) { _mesa_glsl_error(& @1, state, "unrecognized layout identifier " - "`%s'\n", $1); + "`%s'", $1); YYERROR; } else if (state->ARB_explicit_attrib_location_warn) { _mesa_glsl_warning(& @1, state, "GL_ARB_explicit_attrib_location layout " - "identifier `%s' used\n", $1); + "identifier `%s' used", $1); } } | interface_block_layout_qualifier @@ -1280,11 +1280,11 @@ layout_qualifier_id: if ($$.flags.q.uniform && !state->ARB_uniform_buffer_object_enable) { _mesa_glsl_error(& @1, state, "#version 140 / GL_ARB_uniform_buffer_object " - "layout qualifier `%s' is used\n", $1); + "layout qualifier `%s' is used", $1); } else if ($$.flags.q.uniform && state->ARB_uniform_buffer_object_warn) { _mesa_glsl_warning(& @1, state, "#version 140 / GL_ARB_uniform_buffer_object " - "layout qualifier `%s' is used\n", $1); + "layout qualifier `%s' is used", $1); } } ; @@ -1357,11 +1357,11 @@ type_qualifier: | INVARIANT type_qualifier { if ($2.flags.q.invariant) - _mesa_glsl_error(&@1, state, "Duplicate \"invariant\" qualifier.\n"); + _mesa_glsl_error(&@1, state, "duplicate \"invariant\" qualifier"); if ($2.has_layout()) { _mesa_glsl_error(&@1, state, - "\"invariant\" cannot be used with layout(...).\n"); + "\"invariant\" cannot be used with layout(...)"); } $$ = $2; @@ -1380,16 +1380,16 @@ type_qualifier: * only one after all, and the 1.40 text is a clarification, not a change. */ if ($2.has_interpolation()) - _mesa_glsl_error(&@1, state, "Duplicate interpolation qualifier.\n"); + _mesa_glsl_error(&@1, state, "duplicate interpolation qualifier"); if ($2.has_layout()) { - _mesa_glsl_error(&@1, state, "Interpolation qualifiers cannot be used " - "with layout(...).\n"); + _mesa_glsl_error(&@1, state, "interpolation qualifiers cannot be used " + "with layout(...)"); } if (!state->ARB_shading_language_420pack_enable && $2.flags.q.invariant) { - _mesa_glsl_error(&@1, state, "Interpolation qualifiers must come " - "after \"invariant\".\n"); + _mesa_glsl_error(&@1, state, "interpolation qualifiers must come " + "after \"invariant\""); } $$ = $1; @@ -1404,15 +1404,15 @@ type_qualifier: * qualifier, but always seems to in examples. */ if (!state->ARB_shading_language_420pack_enable && $2.has_layout()) - _mesa_glsl_error(&@1, state, "Duplicate layout(...) qualifiers.\n"); + _mesa_glsl_error(&@1, state, "duplicate layout(...) qualifiers"); if ($2.flags.q.invariant) _mesa_glsl_error(&@1, state, "layout(...) cannot be used with " - "the \"invariant\" qualifier\n"); + "the \"invariant\" qualifier"); if ($2.has_interpolation()) { _mesa_glsl_error(&@1, state, "layout(...) cannot be used with " - "interpolation qualifiers.\n"); + "interpolation qualifiers"); } $$ = $1; @@ -1422,13 +1422,13 @@ type_qualifier: { if ($2.has_auxiliary_storage()) { _mesa_glsl_error(&@1, state, - "Duplicate auxiliary storage qualifier (centroid).\n"); + "duplicate auxiliary storage qualifier (centroid)"); } if (!state->ARB_shading_language_420pack_enable && ($2.flags.q.invariant || $2.has_interpolation() || $2.has_layout())) { - _mesa_glsl_error(&@1, state, "Auxiliary storage qualifiers must come " - "just before storage qualifiers.\n"); + _mesa_glsl_error(&@1, state, "auxiliary storage qualifiers must come " + "just before storage qualifiers"); } $$ = $1; $$.flags.i |= $2.flags.i; @@ -1440,14 +1440,14 @@ type_qualifier: * 1.30 clarifies this to "may have one storage qualifier". */ if ($2.has_storage()) - _mesa_glsl_error(&@1, state, "Duplicate storage qualifier.\n"); + _mesa_glsl_error(&@1, state, "duplicate storage qualifier"); if (!state->ARB_shading_language_420pack_enable && ($2.flags.q.invariant || $2.has_interpolation() || $2.has_layout() || $2.has_auxiliary_storage())) { - _mesa_glsl_error(&@1, state, "Storage qualifiers must come after " + _mesa_glsl_error(&@1, state, "storage qualifiers must come after " "invariant, interpolation, layout and auxiliary " - "storage qualifiers.\n"); + "storage qualifiers"); } $$ = $1; @@ -1456,10 +1456,10 @@ type_qualifier: | precision_qualifier type_qualifier { if ($2.precision != ast_precision_none) - _mesa_glsl_error(&@1, state, "Duplicate precision qualifier.\n"); + _mesa_glsl_error(&@1, state, "duplicate precision qualifier"); if (!state->ARB_shading_language_420pack_enable && $2.flags.i != 0) - _mesa_glsl_error(&@1, state, "Precision qualifiers must come last.\n"); + _mesa_glsl_error(&@1, state, "precision qualifiers must come last"); $$ = $2; $$.precision = $1; @@ -1795,7 +1795,7 @@ statement_list: statement { if ($1 == NULL) { - _mesa_glsl_error(& @1, state, "<nil> statement\n"); + _mesa_glsl_error(& @1, state, "<nil> statement"); assert($1 != NULL); } @@ -1805,7 +1805,7 @@ statement_list: | statement_list statement { if ($2 == NULL) { - _mesa_glsl_error(& @2, state, "<nil> statement\n"); + _mesa_glsl_error(& @2, state, "<nil> statement"); assert($2 != NULL); } $$ = $1; @@ -2086,17 +2086,17 @@ basic_interface_block: if (!state->ARB_uniform_buffer_object_enable) { _mesa_glsl_error(& @1, state, "#version 140 / GL_ARB_uniform_buffer_object " - "required for defining uniform blocks\n"); + "required for defining uniform blocks"); } else if (state->ARB_uniform_buffer_object_warn) { _mesa_glsl_warning(& @1, state, "#version 140 / GL_ARB_uniform_buffer_object " - "required for defining uniform blocks\n"); + "required for defining uniform blocks"); } } else { if (state->es_shader || state->language_version < 150) { _mesa_glsl_error(& @1, state, "#version 150 required for using " - "interface blocks.\n"); + "interface blocks"); } } @@ -2107,11 +2107,11 @@ basic_interface_block: if ((state->target == vertex_shader) && $1.flags.q.in) { _mesa_glsl_error(& @1, state, "`in' interface block is not allowed for " - "a vertex shader\n"); + "a vertex shader"); } else if ((state->target == fragment_shader) && $1.flags.q.out) { _mesa_glsl_error(& @1, state, "`out' interface block is not allowed for " - "a fragment shader\n"); + "a fragment shader"); } /* Since block arrays require names, and both features are added in @@ -2163,7 +2163,7 @@ basic_interface_block: _mesa_glsl_error(& @1, state, "uniform/in/out qualifier on " "interface block member does not match " - "the interface block\n"); + "the interface block"); } } @@ -2208,7 +2208,7 @@ instance_name_opt: | NEW_IDENTIFIER '[' ']' { _mesa_glsl_error(& @1, state, - "instance block arrays must be explicitly sized\n"); + "instance block arrays must be explicitly sized"); $$ = new(state) ast_interface_block(*state->default_uniform_qualifier, $1, NULL); @@ -2238,11 +2238,11 @@ member_declaration: if (type->qualifier.flags.q.attribute) { _mesa_glsl_error(& @1, state, "keyword 'attribute' cannot be used with " - "interface block member\n"); + "interface block member"); } else if (type->qualifier.flags.q.varying) { _mesa_glsl_error(& @1, state, "keyword 'varying' cannot be used with " - "interface block member\n"); + "interface block member"); } $$ = new(ctx) ast_declarator_list(type); diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index ec4e3196b..e36ba584a 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -204,7 +204,7 @@ _mesa_glsl_parse_state::check_version(unsigned required_glsl_version, requirement_string = ralloc_asprintf(this, " (%s required)", glsl_es_version_string); } - _mesa_glsl_error(locp, this, "%s in %s%s.", + _mesa_glsl_error(locp, this, "%s in %s%s", problem, this->get_version_string(), requirement_string); @@ -234,15 +234,15 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version, */ } else if (strcmp(ident, "compatibility") == 0) { _mesa_glsl_error(locp, this, - "The compatibility profile is not supported.\n"); + "the compatibility profile is not supported"); } else { _mesa_glsl_error(locp, this, "\"%s\" is not a valid shading language profile; " - "if present, it must be \"core\".\n", ident); + "if present, it must be \"core\"", ident); } } else { _mesa_glsl_error(locp, this, - "Illegal text following version number\n"); + "illegal text following version number"); } } @@ -251,7 +251,7 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version, if (es_token_present) { _mesa_glsl_error(locp, this, "GLSL 1.00 ES should be selected using " - "`#version 100'\n"); + "`#version 100'"); } else { this->es_shader = true; } @@ -270,7 +270,7 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version, if (!supported) { _mesa_glsl_error(locp, this, "%s is not supported. " - "Supported versions are: %s\n", + "Supported versions are: %s", this->get_version_string(), this->supported_version_string); @@ -621,14 +621,14 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, behavior = extension_disable; } else { _mesa_glsl_error(behavior_locp, state, - "Unknown extension behavior `%s'", + "unknown extension behavior `%s'", behavior_string); return false; } if (strcmp(name, "all") == 0) { if ((behavior == extension_enable) || (behavior == extension_require)) { - _mesa_glsl_error(name_locp, state, "Cannot %s all extensions", + _mesa_glsl_error(name_locp, state, "cannot %s all extensions", (behavior == extension_enable) ? "enable" : "require"); return false; diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp index 9d3691b54..8324b8ade 100644 --- a/mesalib/src/glsl/glsl_types.cpp +++ b/mesalib/src/glsl/glsl_types.cpp @@ -281,7 +281,7 @@ glsl_type::glsl_type(const glsl_type *array, unsigned length) : } -const glsl_type *const +const glsl_type * glsl_type::vec(unsigned components) { if (components == 0 || components > 4) @@ -294,7 +294,7 @@ glsl_type::vec(unsigned components) } -const glsl_type *const +const glsl_type * glsl_type::ivec(unsigned components) { if (components == 0 || components > 4) @@ -307,7 +307,7 @@ glsl_type::ivec(unsigned components) } -const glsl_type *const +const glsl_type * glsl_type::uvec(unsigned components) { if (components == 0 || components > 4) @@ -320,7 +320,7 @@ glsl_type::uvec(unsigned components) } -const glsl_type *const +const glsl_type * glsl_type::bvec(unsigned components) { if (components == 0 || components > 4) diff --git a/mesalib/src/glsl/glsl_types.h b/mesalib/src/glsl/glsl_types.h index cb5208029..8172309a7 100644 --- a/mesalib/src/glsl/glsl_types.h +++ b/mesalib/src/glsl/glsl_types.h @@ -170,10 +170,10 @@ struct glsl_type { * Convenience accessors for vector types (shorter than get_instance()). * @{ */ - static const glsl_type *const vec(unsigned components); - static const glsl_type *const ivec(unsigned components); - static const glsl_type *const uvec(unsigned components); - static const glsl_type *const bvec(unsigned components); + static const glsl_type *vec(unsigned components); + static const glsl_type *ivec(unsigned components); + static const glsl_type *uvec(unsigned components); + static const glsl_type *bvec(unsigned components); /**@}*/ /** diff --git a/mesalib/src/glsl/hir_field_selection.cpp b/mesalib/src/glsl/hir_field_selection.cpp index ceb0a4cdb..08be74365 100644 --- a/mesalib/src/glsl/hir_field_selection.cpp +++ b/mesalib/src/glsl/hir_field_selection.cpp @@ -53,13 +53,13 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr, expr->primary_expression.identifier); if (result->type->is_error()) { - _mesa_glsl_error(& loc, state, "Cannot access field `%s' of " + _mesa_glsl_error(& loc, state, "cannot access field `%s' of " "structure", expr->primary_expression.identifier); } } else if (expr->subexpressions[1] != NULL) { /* Handle "method calls" in GLSL 1.20 - namely, array.length() */ - state->check_version(120, 300, &loc, "Methods not supported"); + state->check_version(120, 300, &loc, "methods not supported"); ast_expression *call = expr->subexpressions[1]; assert(call->oper == ast_function_call); @@ -69,11 +69,11 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr, if (strcmp(method, "length") == 0) { if (!call->expressions.is_empty()) - _mesa_glsl_error(&loc, state, "length method takes no arguments."); + _mesa_glsl_error(&loc, state, "length method takes no arguments"); if (op->type->is_array()) { if (op->type->array_size() == 0) - _mesa_glsl_error(&loc, state, "length called on unsized array."); + _mesa_glsl_error(&loc, state, "length called on unsized array"); result = new(ctx) ir_constant(op->type->array_size()); } else if (op->type->is_vector()) { @@ -82,7 +82,7 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr, result = new(ctx) ir_constant((int) op->type->vector_elements); } else { _mesa_glsl_error(&loc, state, "length method on matrix only available" - "with ARB_shading_language_420pack."); + "with ARB_shading_language_420pack"); } } else if (op->type->is_matrix()) { if (state->ARB_shading_language_420pack_enable) { @@ -90,11 +90,11 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr, result = new(ctx) ir_constant((int) op->type->matrix_columns); } else { _mesa_glsl_error(&loc, state, "length method on matrix only available" - "with ARB_shading_language_420pack."); + "with ARB_shading_language_420pack"); } } } else { - _mesa_glsl_error(&loc, state, "Unknown method: `%s'.", method); + _mesa_glsl_error(&loc, state, "unknown method: `%s'", method); } } else if (op->type->is_vector() || (state->ARB_shading_language_420pack_enable && @@ -109,12 +109,12 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr, * FINISHME: ir_swizzle::create. This allows the generation of more * FINISHME: specific error messages. */ - _mesa_glsl_error(& loc, state, "Invalid swizzle / mask `%s'", + _mesa_glsl_error(& loc, state, "invalid swizzle / mask `%s'", expr->primary_expression.identifier); } } else { - _mesa_glsl_error(& loc, state, "Cannot access field `%s' of " - "non-structure / non-vector.", + _mesa_glsl_error(& loc, state, "cannot access field `%s' of " + "non-structure / non-vector", expr->primary_expression.identifier); } diff --git a/mesalib/src/glsl/ir_function_detect_recursion.cpp b/mesalib/src/glsl/ir_function_detect_recursion.cpp index 4b39f9724..5df3ac518 100644 --- a/mesalib/src/glsl/ir_function_detect_recursion.cpp +++ b/mesalib/src/glsl/ir_function_detect_recursion.cpp @@ -298,7 +298,7 @@ emit_errors_unlinked(const void *key, void *data, void *closure) memset(&loc, 0, sizeof(loc)); _mesa_glsl_error(&loc, state, - "function `%s' has static recursion.", + "function `%s' has static recursion", proto); ralloc_free(proto); } diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index e0428c683..4e46cf095 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -184,7 +184,7 @@ static const struct extension extension_table[] = { { "GL_EXT_framebuffer_blit", o(EXT_framebuffer_blit), GL, 2005 }, { "GL_EXT_framebuffer_multisample", o(EXT_framebuffer_multisample), GL, 2005 }, { "GL_EXT_framebuffer_multisample_blit_scaled", o(EXT_framebuffer_multisample_blit_scaled), GL, 2011 }, - { "GL_EXT_framebuffer_object", o(dummy_true), GL, 2000 }, + { "GL_EXT_framebuffer_object", o(dummy_true), GLL, 2000 }, { "GL_EXT_framebuffer_sRGB", o(EXT_framebuffer_sRGB), GL, 1998 }, { "GL_EXT_gpu_program_parameters", o(EXT_gpu_program_parameters), GLL, 2006 }, { "GL_EXT_gpu_shader4", o(EXT_gpu_shader4), GL, 2006 }, |