<div dir="ltr">On 31 July 2013 17:22, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>On 07/28/2013 11:03 PM, Paul Berry wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From section 4.3.4 (Inputs) of the GLSL 1.50 spec:<br>
<br>
Geometry shader input variables get the per-vertex values written<br>
out by vertex shader output variables of the same names. Since a<br>
geometry shader operates on a set of vertices, each input varying<br>
variable (or input block, see interface blocks below) needs to be<br>
declared as an array.<br>
<br>
Therefore, the element type of each geometry shader input array should<br>
match the type of the corresponding vertex shader output.<br>
---<br>
src/glsl/link_varyings.cpp | 11 ++++++++++-<br>
1 file changed, 10 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp<br>
index 2c7e451..07b5699 100644<br>
--- a/src/glsl/link_varyings.cpp<br>
+++ b/src/glsl/link_varyings.cpp<br>
@@ -68,6 +68,10 @@ cross_validate_outputs_to_<u></u>inputs(struct gl_shader_program *prog,<br>
/* Find all shader inputs in the "consumer" stage. Any variables that have<br>
* matching outputs already in the symbol table must have the same type and<br>
* qualifiers.<br>
+ *<br>
+ * Exception: if the consumer is the geometry shader, then the inputs<br>
+ * should be arrays and the type of the array element should match the type<br>
+ * of the corresponding producer output.<br>
*/<br>
foreach_list(node, consumer->ir) {<br>
ir_variable *const input = ((ir_instruction *) node)->as_variable();<br>
@@ -79,7 +83,12 @@ cross_validate_outputs_to_<u></u>inputs(struct gl_shader_program *prog,<br>
if (output != NULL) {<br>
/* Check that the types match between stages.<br>
*/<br>
- if (input->type != output->type) {<br>
+ const glsl_type *type_to_match = input->type;<br>
+ if (consumer->Type == GL_GEOMETRY_SHADER_ARB) {<br>
</blockquote>
<br></div></div>
Use the undecorated name.</blockquote><div><br></div><div>Fixed (as well as similar corrections to patches 11, 18, and 29).<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ assert(type_to_match->is_<u></u>array()); /* Enforced by ast_to_hir */<br>
+ type_to_match = type_to_match->element_type();<br>
+ }<br>
+ if (type_to_match != output->type) {<br>
/* There is a bit of a special case for gl_TexCoord. This<br>
* built-in is unsized by default. Applications that variable<br>
* access it must redeclare it with a size. There is some<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div></div>