[Mesa-dev] [PATCH 5/8] glsl: use better location in struct and block error messages

Timothy Arceri t_arceri at yahoo.com.au
Thu Nov 12 17:13:38 PST 2015


From: Timothy Arceri <timothy.arceri at collabora.com>

Previously we only gave the location for some members and never
gave the variable location. In those cases we were just giving
the location of the struct/block.
---
 src/glsl/ast_to_hir.cpp | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 26c95ff..e37665e 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -5806,7 +5806,6 @@ unsigned
 ast_process_struct_or_iface_block_members(exec_list *instructions,
                                           struct _mesa_glsl_parse_state *state,
                                           exec_list *declarations,
-                                          YYLTYPE &loc,
                                           glsl_struct_field **fields_ret,
                                           bool is_interface,
                                           enum glsl_matrix_layout matrix_layout,
@@ -5836,6 +5835,7 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
    unsigned i = 0;
    foreach_list_typed (ast_declarator_list, decl_list, link, declarations) {
       const char *type_name;
+      YYLTYPE loc = decl_list->get_location();
 
       decl_list->type->specifier->hir(instructions, state);
 
@@ -5865,7 +5865,6 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
       assert(decl_type);
 
       if (is_interface && decl_type->contains_opaque()) {
-         YYLTYPE loc = decl_list->get_location();
          _mesa_glsl_error(&loc, state,
                           "uniform/buffer in non-default interface block contains "
                           "opaque variable");
@@ -5877,7 +5876,6 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
           *    "Members of structures cannot be declared as atomic counter
           *     types."
           */
-         YYLTYPE loc = decl_list->get_location();
          _mesa_glsl_error(&loc, state, "atomic counter in structure, "
                           "shader storage block or uniform block");
       }
@@ -5887,7 +5885,6 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
           * FINISHME: Request clarification from Khronos and add
           * FINISHME: spec quotation here.
           */
-         YYLTYPE loc = decl_list->get_location();
          _mesa_glsl_error(&loc, state,
                           "image in structure, shader storage block or "
                           "uniform block");
@@ -5908,7 +5905,6 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
       }
 
       if (qual->flags.q.constant) {
-         YYLTYPE loc = decl_list->get_location();
          _mesa_glsl_error(&loc, state,
                           "const storage qualifier cannot be applied "
                           "to struct or interface block members");
@@ -5956,6 +5952,8 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
 
       foreach_list_typed (ast_declaration, decl, link,
                           &decl_list->declarations) {
+         YYLTYPE loc = decl->get_location();
+
          if (!allow_reserved_names)
             validate_identifier(decl->identifier, loc, state);
 
@@ -6077,7 +6075,6 @@ ast_struct_specifier::hir(exec_list *instructions,
       ast_process_struct_or_iface_block_members(instructions,
                                                 state,
                                                 &this->declarations,
-                                                loc,
                                                 &fields,
                                                 false,
                                                 GLSL_MATRIX_LAYOUT_INHERITED,
@@ -6241,7 +6238,6 @@ ast_interface_block::hir(exec_list *instructions,
       ast_process_struct_or_iface_block_members(&declared_variables,
                                                 state,
                                                 &this->declarations,
-                                                loc,
                                                 &fields,
                                                 true,
                                                 matrix_layout,
-- 
2.4.3



More information about the mesa-dev mailing list