[Mesa-dev] [PATCH 06/37] glsl: relax stage restrictions on layout defaults for outputs

Timothy Arceri timothy.arceri at collabora.com
Tue Mar 15 12:56:56 UTC 2016


The new xfb_buffer and xfb_stride global qualifiers are allowed in
geom, tess and vertex stages.
---
 src/compiler/glsl/ast_type.cpp           | 5 +++--
 src/compiler/glsl/glsl_parser_extras.cpp | 9 ++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp
index cede8b3..4f537a9 100644
--- a/src/compiler/glsl/ast_type.cpp
+++ b/src/compiler/glsl/ast_type.cpp
@@ -386,9 +386,10 @@ ast_type_qualifier::merge_out_qualifier(YYLTYPE *loc,
       if (create_node) {
          node = new(mem_ctx) ast_tcs_output_layout(*loc);
       }
-   } else {
+   } else if (!(state->stage == MESA_SHADER_TESS_EVAL ||
+                state->stage == MESA_SHADER_VERTEX)) {
       _mesa_glsl_error(loc, state, "out layout qualifiers only valid in "
-                       "tessellation control or geometry shaders");
+                       "geometry, tessellation and vertex shaders");
    }
 
    /* Allow future assigments of global out's */
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index 30eeb7b..4415b83 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -1592,13 +1592,12 @@ set_shader_inout_layout(struct gl_shader *shader,
 		     struct _mesa_glsl_parse_state *state)
 {
    /* Should have been prevented by the parser. */
-   if (shader->Stage == MESA_SHADER_TESS_CTRL) {
+   if (shader->Stage == MESA_SHADER_TESS_CTRL ||
+       shader->Stage == MESA_SHADER_VERTEX) {
       assert(!state->in_qualifier->flags.i);
-   } else if (shader->Stage == MESA_SHADER_TESS_EVAL) {
-      assert(!state->out_qualifier->flags.i);
-   } else if (shader->Stage != MESA_SHADER_GEOMETRY) {
+   } else if (shader->Stage != MESA_SHADER_GEOMETRY &&
+              shader->Stage != MESA_SHADER_TESS_EVAL) {
       assert(!state->in_qualifier->flags.i);
-      assert(!state->out_qualifier->flags.i);
    }
 
    if (shader->Stage != MESA_SHADER_COMPUTE) {
-- 
2.5.0



More information about the mesa-dev mailing list