On 12/04/17 02:48, Samuel Pitoiset wrote:
Only ast_fully_specified_type is able to know if the underlying
type is bindless or not. Because type_specifier is a subrule of
fully_specified_type this shouldn't break anything.

This will help for handling explicit conversions like
'sampler2D tex = sampler2D(pair);' where sampler2D is a constructor.

Signed-off-by: Samuel Pitoiset <[email protected]>
---
 src/compiler/glsl/ast.h            | 2 +-
 src/compiler/glsl/ast_function.cpp | 6 +++---
 src/compiler/glsl/glsl_parser.yy   | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
index 2a2dd4bcd9..4fb8b87286 100644
--- a/src/compiler/glsl/ast.h
+++ b/src/compiler/glsl/ast.h
@@ -305,7 +305,7 @@ public:
       /* empty */
    }

-   ast_function_expression(class ast_type_specifier *type)
+   ast_function_expression(class ast_fully_specified_type *type)
       : ast_expression(ast_function_call, (ast_expression *) type,
                       NULL, NULL),
        cons(true)
diff --git a/src/compiler/glsl/ast_function.cpp 
b/src/compiler/glsl/ast_function.cpp
index 0665e0c393..95ec2db173 100644
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -1942,8 +1942,8 @@ ast_function_expression::hir(exec_list *instructions,
     *
     */
    if (is_constructor()) {
-      const ast_type_specifier *type =
-         (ast_type_specifier *) subexpressions[0];
+      const ast_fully_specified_type *type =
+         (ast_fully_specified_type *) subexpressions[0];
       YYLTYPE loc = type->get_location();
       const char *name;

@@ -1955,7 +1955,7 @@ ast_function_expression::hir(exec_list *instructions,
       if (constructor_type == NULL) {
          _mesa_glsl_error(& loc, state, "unknown type `%s' (structure name "
                           "may be shadowed by a variable with the same name)",
-                          type->type_name);
+                          type->specifier->type_name);
          return ir_rvalue::error_value(ctx);
       }

diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index 05171e53a3..a35a649879 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -573,7 +573,7 @@ function_call_header:
    ;

 function_identifier:
-   type_specifier
+   fully_specified_type

I'm not so sure about this. Wouldn't this allow you to do things like:

sampler2D tex = precise sampler2D(pair)

Without triggering an error in the parser?


    {
       void *ctx = state->linalloc;
       $$ = new(ctx) ast_function_expression($1);

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to