if(stage->content.variables.count(name))
return 0;
+ if(stage->type==Stage::GEOMETRY && !copy_block && var.interface=="out" && var.array)
+ return 0;
+
VariableDeclaration* iface_var = new VariableDeclaration;
iface_var->sampling = var.sampling;
iface_var->interface = iface;
i = prev_vars.find(in_prefix+var.name);
if(i!=prev_vars.end() && i->second->interface=="out")
{
- generate_interface(*i->second, "in", i->second->name);
- var.name = i->second->name;
+ if(stage->type==Stage::GEOMETRY && i->second->array)
+ stage->diagnostics.push_back(Diagnostic(Diagnostic::WARN, var.source, var.line,
+ format("Can't access '%s' through automatic interface because it's an array", var.name)));
+ else
+ {
+ generate_interface(*i->second, "in", i->second->name);
+ var.name = i->second->name;
+ }
return;
}
--- /dev/null
+uniform mat4 vp_matrix;
+uniform sampler2D tex;
+
+#pragma MSP stage(vertex)
+layout(location=0) in vec4 position;
+layout(location=1) in vec2 texcoord;
+layout(location=2) in vec4 instance_transform[3];
+void main()
+{
+ passthrough;
+ mat4 model_matrix = transpose(mat4(instance_transform[0], instance_transform[1], instance_transform[2], vec4(0.0, 0.0, 0.0, 1.0)));
+ gl_Position = vp_matrix*model_matrix*position;
+}
+
+#pragma MSP stage(geometry)
+layout(triangles) in;
+layout(triangles, max_vertices=3) out;
+void main()
+{
+ for(int i=0; i<3; ++i)
+ {
+ passthrough[i];
+ EmitVertex();
+ }
+}
+
+#pragma MSP stage(fragment)
+layout(location=0) out vec4 frag_color;
+void main()
+{
+ frag_color = texture(tex, texcoord);
+}
+
+/* Expected output: vertex
+uniform mat4 vp_matrix;
+layout(location=0) in vec4 position;
+layout(location=1) in vec2 texcoord;
+layout(location=2) in vec4 instance_transform[3];
+out vec2 _vs_out_texcoord;
+void main()
+{
+ _vs_out_texcoord = texcoord;
+ gl_Position = vp_matrix*transpose(mat4(instance_transform[0], instance_transform[1], instance_transform[2], vec4(0.0, 0.0, 0.0, 1.0)))*position;
+}
+*/
+
+/* Expected output: geometry
+layout(triangles) in;
+layout(triangles, max_vertices=3) out;
+in vec2 _vs_out_texcoord[];
+out vec2 _gs_out_texcoord;
+void main()
+{
+ for(int i = 0; i<3; ++i)
+ {
+ gl_Position = gl_in[i].gl_Position;
+ _gs_out_texcoord = _vs_out_texcoord[i];
+ EmitVertex();
+ }
+}
+*/
+
+/* Expected output: fragment
+uniform sampler2D tex;
+layout(location=0) out vec4 frag_color;
+in vec2 _gs_out_texcoord;
+void main()
+{
+ frag_color = texture(tex, _gs_out_texcoord);
+}
+*/