}
TypeDeclaration *type = var.type_declaration;
+ BasicTypeDeclaration::Kind kind = BasicTypeDeclaration::ALIAS;
while(BasicTypeDeclaration *basic = dynamic_cast<BasicTypeDeclaration *>(type))
+ {
+ kind = basic->kind;
type = basic->base_type;
+ }
if(dynamic_cast<ImageTypeDeclaration *>(type))
{
if(scope!=GLOBAL && scope!=FUNCTION_PARAM)
else if(scope==GLOBAL && var.interface!="uniform")
error(var, format("Type '%s' only allowed with uniform interface", type->name));
}
+ else if(kind==BasicTypeDeclaration::VOID)
+ error(var, "Type 'void' not allowed on variable");
+ else if(kind==BasicTypeDeclaration::BOOL && !var.interface.empty() && var.source!=BUILTIN_SOURCE)
+ error(var, "Type 'bool' not allowed on interface variable");
if(var.init_expression)
{
-uniform bool flag;
+uniform int flag;
uniform sampler2D tex;
#pragma MSP stage(vertex)
void main()
{
passthrough[0];
- if(flag)
+ if(flag!=0)
EmitVertex();
passthrough[1];
- if(flag)
+ if(flag!=0)
EmitVertex();
passthrough[2];
- if(flag)
+ if(flag!=0)
EmitVertex();
}
*/
/* Expected output: geometry
-layout(location=0) uniform bool flag;
+layout(location=0) uniform int flag;
layout(triangles) in;
layout(triangle_strip, max_vertices=3) out;
layout(location=0) in vec2 texcoord[];
{
gl_Position = gl_in[0].gl_Position;
_gs_out_texcoord = texcoord[0];
- if(flag)
+ if(flag!=0)
EmitVertex();
gl_Position = gl_in[1].gl_Position;
_gs_out_texcoord = texcoord[1];
- if(flag)
+ if(flag!=0)
EmitVertex();
gl_Position = gl_in[2].gl_Position;
_gs_out_texcoord = texcoord[2];
- if(flag)
+ if(flag!=0)
EmitVertex();
}
*/
--- /dev/null
+uniform bool u_bool;
+
+#pragma MSP stage(vertex)
+void void_var;
+layout(location=0) in vec4 position;
+void main()
+{
+ gl_Position = position;
+}
+
+/* Expected error:
+<test>:1: Type 'bool' not allowed on interface variable
+<test>:4: Type 'void' not allowed on variable
+*/