[Mesa-dev] [PATCH 7/7] glsl: Keep track of the early_fragment_tests flag in gl_shader.

Francisco Jerez currojerez at riseup.net
Sat Jan 31 12:54:29 PST 2015


And rename _mesa_glsl_parse_state::early_fragment_tests to
fs_early_fragment_tests for consistency with other FS-specific flags in the
same struct.
---
 src/glsl/ast_type.cpp           | 2 +-
 src/glsl/glsl_parser_extras.cpp | 4 +++-
 src/glsl/glsl_parser_extras.h   | 2 +-
 src/glsl/linker.cpp             | 2 ++
 src/mesa/main/mtypes.h          | 6 ++++++
 5 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
index 34c2b73..1bcf6a2 100644
--- a/src/glsl/ast_type.cpp
+++ b/src/glsl/ast_type.cpp
@@ -342,7 +342,7 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
    }
 
    if (q.flags.q.early_fragment_tests) {
-      state->early_fragment_tests = true;
+      state->fs_early_fragment_tests = true;
    }
 
    if (create_gs_ast) {
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index ccdf031..7526c20 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -212,7 +212,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
    this->gs_input_size = 0;
    this->in_qualifier = new(this) ast_type_qualifier();
    this->out_qualifier = new(this) ast_type_qualifier();
-   this->early_fragment_tests = false;
+   this->fs_early_fragment_tests = false;
    memset(this->atomic_counter_offsets, 0,
           sizeof(this->atomic_counter_offsets));
    this->allow_extension_directive_midshader =
@@ -1393,6 +1393,7 @@ set_shader_inout_layout(struct gl_shader *shader,
       assert(!state->fs_redeclares_gl_fragcoord);
       assert(!state->fs_pixel_center_integer);
       assert(!state->fs_origin_upper_left);
+      assert(!state->fs_early_fragment_tests);
    }
 
    switch (shader->Stage) {
@@ -1435,6 +1436,7 @@ set_shader_inout_layout(struct gl_shader *shader,
       shader->origin_upper_left = state->fs_origin_upper_left;
       shader->ARB_fragment_coord_conventions_enable =
          state->ARB_fragment_coord_conventions_enable;
+      shader->EarlyFragmentTests = state->fs_early_fragment_tests;
       break;
 
    default:
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 843fdae..7d6638e 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -500,7 +500,7 @@ struct _mesa_glsl_parse_state {
     */
    unsigned gs_input_size;
 
-   bool early_fragment_tests;
+   bool fs_early_fragment_tests;
 
    /** Atomic counter offsets by binding */
    unsigned atomic_counter_offsets[MAX_COMBINED_ATOMIC_BUFFERS];
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 3f5eac1..079f6ce 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1411,6 +1411,8 @@ link_fs_input_layout_qualifiers(struct gl_shader_program *prog,
          linked_shader->origin_upper_left = shader->origin_upper_left;
          linked_shader->pixel_center_integer = shader->pixel_center_integer;
       }
+
+      linked_shader->EarlyFragmentTests |= shader->EarlyFragmentTests;
    }
 }
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 81a7c0e..9e19390 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2653,6 +2653,12 @@ struct gl_shader
    GLuint NumImages;
 
    /**
+    * Whether early fragment tests are enabled as defined by
+    * ARB_shader_image_load_store.
+    */
+   bool EarlyFragmentTests;
+
+   /**
     * Compute shader state from ARB_compute_shader layout qualifiers.
     */
    struct {
-- 
2.1.3



More information about the mesa-dev mailing list