On 11/18/2011 11:27 AM, Marek Olšák wrote:

This patch also needs to change the _mesa_glsl_supported_extensions table in glsl_parser_extras.cpp. AMD_conservative_depth is used for both versions of the extension in the table.

I'm not super convinced that we even need separate enable flags. Both extensions add the exact same functionality using the exact same layout qualifiers. It's not a big deal to me either way, though.

---
  src/glsl/ast_to_hir.cpp |    7 +++++--
  src/glsl/glsl_lexer.ll  |    1 +
  src/glsl/glsl_parser.yy |    9 ++++++++-
  src/glsl/ir_clone.cpp   |    1 +
  4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index ac090c3..51fec19 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2090,6 +2090,7 @@ apply_type_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
      * The following extension do not allow the deprecated keywords:
      *
      *    GL_AMD_conservative_depth
+    *    GL_ARB_conservative_depth
      *    GL_ARB_gpu_shader5
      *    GL_ARB_separate_shader_objects
      *    GL_ARB_tesselation_shader
@@ -2122,7 +2123,8 @@ apply_type_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
        + qual->flags.q.depth_less
        + qual->flags.q.depth_unchanged;
     if (depth_layout_count>  0
-&&  !state->AMD_conservative_depth_enable) {
+&&  !state->AMD_conservative_depth_enable
+&&  !state->ARB_conservative_depth_enable) {
         _mesa_glsl_error(loc, state,
                          "extension GL_AMD_conservative_depth must be enabled "
                        "to use depth layout qualifiers");

This error should be updated too.

    "extension GL_ARB_conservative_depth or GL_AMD_consevative_depth "
    "must be enabled to use depth layout qualifiers"

@@ -2237,7 +2239,8 @@ get_variable_being_redeclared(ir_variable *var, 
ast_declaration *decl,
        earlier->interpolation = var->interpolation;

        /* Layout qualifiers for gl_FragDepth. */
-   } else if (state->AMD_conservative_depth_enable
+   } else if ((state->AMD_conservative_depth_enable ||
+               state->ARB_conservative_depth_enable)
        &&  strcmp(var->name, "gl_FragDepth") == 0
        &&  earlier->type == var->type
        &&  earlier->mode == var->mode) {
diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index 49f3bc8..c7cfedd 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -310,6 +310,7 @@ void                return VOID_TOK;
  layout                {
                  if ((yyextra->language_version>= 140)
                      || yyextra->AMD_conservative_depth_enable
+                     || yyextra->ARB_conservative_depth_enable
                      || yyextra->ARB_explicit_attrib_location_enable
                      || yyextra->ARB_fragment_coord_conventions_enable) {
                      return LAYOUT_TOK;
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 8363904..71ab039 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -1124,7 +1124,9 @@ layout_qualifier_id:
           }

           /* Layout qualifiers for AMD/ARB_conservative_depth. */
-          if (!got_one&&  state->AMD_conservative_depth_enable) {
+          if (!got_one&&
+              (state->AMD_conservative_depth_enable ||
+               state->ARB_conservative_depth_enable)) {
              if (strcmp($1, "depth_any") == 0) {
                 got_one = true;
                 $$.flags.q.depth_any = 1;
@@ -1141,6 +1143,11 @@ layout_qualifier_id:
        
              if (got_one&&  state->AMD_conservative_depth_warn) {
                 _mesa_glsl_warning(&  @1, state,
+                                   "GL_AMD_conservative_depth "
+                                   "layout qualifier `%s' is used\n", $1);
+             }
+             if (got_one&&  state->ARB_conservative_depth_warn) {
+                _mesa_glsl_warning(&  @1, state,
                                    "GL_ARB_conservative_depth "
                                    "layout qualifier `%s' is used\n", $1);
              }
diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp
index e8ac9fb..c63615c 100644
--- a/src/glsl/ir_clone.cpp
+++ b/src/glsl/ir_clone.cpp
@@ -51,6 +51,7 @@ ir_variable::clone(void *mem_ctx, struct hash_table *ht) const
     var->pixel_center_integer = this->pixel_center_integer;
     var->explicit_location = this->explicit_location;
     var->has_initializer = this->has_initializer;
+   var->depth_layout = this->depth_layout;

     var->num_state_slots = this->num_state_slots;
     if (this->state_slots) {
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to