aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/linker.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-06-28 08:12:11 +0200
committermarha <marha@users.sourceforge.net>2012-06-28 08:12:11 +0200
commit4376eeccc64a10e2a74fd0eb4184d2a144058470 (patch)
tree6a55f2d7660286e3250038228fa33d1fa1d0017e /mesalib/src/glsl/linker.cpp
parent74a24d67cefc273c717f17150b9d41607bcaf8ce (diff)
parent67551627d34fff4a0fbe719bce33a3bacb55ccef (diff)
downloadvcxsrv-4376eeccc64a10e2a74fd0eb4184d2a144058470.tar.gz
vcxsrv-4376eeccc64a10e2a74fd0eb4184d2a144058470.tar.bz2
vcxsrv-4376eeccc64a10e2a74fd0eb4184d2a144058470.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/glsl/linker.cpp')
-rw-r--r--mesalib/src/glsl/linker.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index bdab499f0..310944752 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -1859,6 +1859,32 @@ assign_varying_location(ir_variable *input_var, ir_variable *output_var,
/**
+ * Is the given variable a varying variable to be counted against the
+ * limit in ctx->Const.MaxVarying?
+ * This includes variables such as texcoords, colors and generic
+ * varyings, but excludes variables such as gl_FrontFacing and gl_FragCoord.
+ */
+static bool
+is_varying_var(GLenum shaderType, const ir_variable *var)
+{
+ /* Only fragment shaders will take a varying variable as an input */
+ if (shaderType == GL_FRAGMENT_SHADER &&
+ var->mode == ir_var_in &&
+ var->explicit_location) {
+ switch (var->location) {
+ case FRAG_ATTRIB_WPOS:
+ case FRAG_ATTRIB_FACE:
+ case FRAG_ATTRIB_PNTC:
+ return false;
+ default:
+ return true;
+ }
+ }
+ return false;
+}
+
+
+/**
* Assign locations for all variables that are produced in one pipeline stage
* (the "producer") and consumed in the next stage (the "consumer").
*
@@ -1966,7 +1992,7 @@ assign_varying_locations(struct gl_context *ctx,
* value is written by the previous stage.
*/
var->mode = ir_var_auto;
- } else {
+ } else if (is_varying_var(consumer->Type, var)) {
/* The packing rules are used for vertex shader inputs are also
* used for fragment shader inputs.
*/