mesa/glsl: move uses_gl_fragcoord to gl_shader
authorTimothy Arceri <timothy.arceri@collabora.com>
Tue, 22 Nov 2016 07:37:06 +0000 (18:37 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Thu, 19 Jan 2017 06:05:26 +0000 (17:05 +1100)
This is only used by gl_linked_shader as a temp during linking
so use a temp there instead.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/compiler/glsl/glsl_parser_extras.cpp
src/compiler/glsl/linker.cpp
src/mesa/main/mtypes.h

index 99bdfcc340846c58edfcf9309d198275007553ca..afb7260dddacef4ded8def02d8d21d90fc4d0934 100644 (file)
@@ -1809,7 +1809,7 @@ set_shader_inout_layout(struct gl_shader *shader,
 
    case MESA_SHADER_FRAGMENT:
       shader->redeclares_gl_fragcoord = state->fs_redeclares_gl_fragcoord;
-      shader->info.uses_gl_fragcoord = state->fs_uses_gl_fragcoord;
+      shader->uses_gl_fragcoord = state->fs_uses_gl_fragcoord;
       shader->info.pixel_center_integer = state->fs_pixel_center_integer;
       shader->info.origin_upper_left = state->fs_origin_upper_left;
       shader->ARB_fragment_coord_conventions_enable =
index 687615182901cbe05a2fa8e479cea8d561f5cc0d..332455430a25965737dacfaac428d37054dae6d3 100644 (file)
@@ -1827,7 +1827,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog,
                                 unsigned num_shaders)
 {
    bool redeclares_gl_fragcoord = false;
-   linked_shader->info.uses_gl_fragcoord = false;
+   bool uses_gl_fragcoord = false;
    linked_shader->info.origin_upper_left = false;
    linked_shader->info.pixel_center_integer = false;
 
@@ -1845,9 +1845,9 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog,
        *    that have a static use gl_FragCoord."
        */
       if ((redeclares_gl_fragcoord && !shader->redeclares_gl_fragcoord &&
-           shader->info.uses_gl_fragcoord)
+           shader->uses_gl_fragcoord)
           || (shader->redeclares_gl_fragcoord && !redeclares_gl_fragcoord &&
-              linked_shader->info.uses_gl_fragcoord)) {
+              uses_gl_fragcoord)) {
              linker_error(prog, "fragment shader defined with conflicting "
                          "layout qualifiers for gl_FragCoord\n");
       }
@@ -1871,11 +1871,9 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog,
        * are multiple redeclarations, all the fields except uses_gl_fragcoord
        * are already known to be the same.
        */
-      if (shader->redeclares_gl_fragcoord || shader->info.uses_gl_fragcoord) {
+      if (shader->redeclares_gl_fragcoord || shader->uses_gl_fragcoord) {
          redeclares_gl_fragcoord = shader->redeclares_gl_fragcoord;
-         linked_shader->info.uses_gl_fragcoord =
-            linked_shader->info.uses_gl_fragcoord ||
-            shader->info.uses_gl_fragcoord;
+         uses_gl_fragcoord |= shader->uses_gl_fragcoord;
          linked_shader->info.origin_upper_left =
             shader->info.origin_upper_left;
          linked_shader->info.pixel_center_integer =
index cbf2e958113d5403959a9f69d4bc63ed310295f5..5548827a992d1b767a14266338c699c39c7300af 100644 (file)
@@ -2242,7 +2242,6 @@ struct gl_subroutine_function
  */
 struct gl_shader_info
 {
-   bool uses_gl_fragcoord;
    bool PostDepthCoverage;
    bool InnerCoverage;
 
@@ -2435,6 +2434,7 @@ struct gl_shader
    bool ARB_fragment_coord_conventions_enable;
 
    bool redeclares_gl_fragcoord;
+   bool uses_gl_fragcoord;
 
    struct gl_shader_info info;
 };