[Mesa-dev] [PATCH 2/3] glsl/ast2hir: add a new flag attribute_input for VS input
Gregory Hainaut
gregory.hainaut at gmail.com
Sun Sep 20 13:15:34 PDT 2015
GL_ARB_separate_shader_objects requires that all inputs varying remains active.
This flag allow to distinguish input attribute from the input varying.
Flag will be used on next commit.
Signed-off-by: Gregory Hainaut <gregory.hainaut at gmail.com>
---
src/glsl/ast_to_hir.cpp | 4 ++++
src/glsl/ir.h | 9 +++++++++
2 files changed, 13 insertions(+)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 72c6459..16bf849 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2590,6 +2590,10 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
_mesa_shader_stage_to_string(state->stage));
}
+ if (state->stage == MESA_SHADER_VERTEX &&
+ (qual->flags.q.attribute || qual->flags.q.in))
+ var->data.attribute_input = 1;
+
/* Disallow layout qualifiers which may only appear on layout declarations. */
if (qual->flags.q.prim_type) {
_mesa_glsl_error(loc, state,
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index f9ddf74..a1f5fa0 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -627,6 +627,15 @@ public:
unsigned precise:1;
/**
+ * Is the variable an input from the Vertex Shader?
+ *
+ * GL_ARB_separate_shader_objects doesn't allow the optimization of
+ * unused varying variable. However unused-attribute must still be
+ * optimized.
+ */
+ unsigned attribute_input:1;
+
+ /**
* Has this variable been used for reading or writing?
*
* Several GLSL semantic checks require knowledge of whether or not a
--
2.1.4
More information about the mesa-dev
mailing list