glsl: finish up ARB_conservative_depth (v2)
authorMarek Olšák <maraeo@gmail.com>
Sat, 19 Nov 2011 15:41:08 +0000 (16:41 +0100)
committerMarek Olšák <maraeo@gmail.com>
Tue, 22 Nov 2011 19:56:50 +0000 (20:56 +0100)
v2: updated an error message

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/ast_to_hir.cpp
src/glsl/glsl_lexer.ll
src/glsl/glsl_parser.yy

index ac090c315e79be269460a9f59a3e70be1d4bd688..d5b04e9d7bb8d579fb721ce4bafb89c1a1e2ef2b 100644 (file)
@@ -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,9 +2123,11 @@ 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 "
+                        "extension GL_AMD_conservative_depth or "
+                        "GL_ARB_conservative_depth must be enabled "
                        "to use depth layout qualifiers");
    } else if (depth_layout_count > 0
               && strcmp(var->name, "gl_FragDepth") != 0) {
@@ -2237,7 +2240,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) {
index 49f3bc82eb89332aee6028be57d800ddc59e49a5..c7cfedd423202fa680d50874a64e5dffb01157ab 100644 (file)
@@ -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;
index 836390453b1128ffd33ed4121a6d06edbcce801f..71ab039d620dc9b98e2c35625fc284195f0a6eb1 100644 (file)
@@ -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;
@@ -1140,6 +1142,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);