summaryrefslogtreecommitdiff
path: root/src/glsl/linker.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-12-13 15:16:39 -0800
committerIan Romanick <ian.d.romanick@intel.com>2010-12-13 15:16:39 -0800
commitcb2b547a4771ddf56975ede566dbf3a8f5389689 (patch)
tree0313a22aa024607260a7039f4b44c0a7614800da /src/glsl/linker.cpp
parent036c817f77f71e7c4b17571ae100a9bc93d8fe5b (diff)
linker: Allow built-in arrays to have different sizes between shader stages
Fixes pitlit test glsl-link-varying-TexCoord (bugzilla #31650).
Diffstat (limited to 'src/glsl/linker.cpp')
-rw-r--r--src/glsl/linker.cpp37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index e62fe6d7e9..d8c42ac462 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -487,14 +487,35 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
/* Check that the types match between stages.
*/
if (input->type != output->type) {
- linker_error_printf(prog,
- "%s shader output `%s' declared as "
- "type `%s', but %s shader input declared "
- "as type `%s'\n",
- producer_stage, output->name,
- output->type->name,
- consumer_stage, input->type->name);
- return false;
+ /* There is a bit of a special case for gl_TexCoord. This
+ * built-in is unsized by default. Appliations that variable
+ * access it must redeclare it with a size. There is some
+ * language in the GLSL spec that implies the fragment shader
+ * and vertex shader do not have to agree on this size. Other
+ * driver behave this way, and one or two applications seem to
+ * rely on it.
+ *
+ * Neither declaration needs to be modified here because the array
+ * sizes are fixed later when update_array_sizes is called.
+ *
+ * From page 48 (page 54 of the PDF) of the GLSL 1.10 spec:
+ *
+ * "Unlike user-defined varying variables, the built-in
+ * varying variables don't have a strict one-to-one
+ * correspondence between the vertex language and the
+ * fragment language."
+ */
+ if (!output->type->is_array()
+ || (strncmp("gl_", output->name, 3) != 0)) {
+ linker_error_printf(prog,
+ "%s shader output `%s' declared as "
+ "type `%s', but %s shader input declared "
+ "as type `%s'\n",
+ producer_stage, output->name,
+ output->type->name,
+ consumer_stage, input->type->name);
+ return false;
+ }
}
/* Check that all of the qualifiers match between stages.