13c827367444ee418f129b2c238299f49d3264554Jarkko Poyryimport sys
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyryimport itertools
33c827367444ee418f129b2c238299f49d3264554Jarkko Poyryimport operator
43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
53c827367444ee418f129b2c238299f49d3264554Jarkko Poyryimport genutil
63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
73c827367444ee418f129b2c238299f49d3264554Jarkko Poyryfrom genutil import Scalar, Vec2, Vec3, Vec4, Uint, UVec2, UVec3, UVec4, CaseGroup
83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# Templates
113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
123c827367444ee418f129b2c238299f49d3264554Jarkko PoyryARTIHMETIC_CASE_TEMPLATE = """
133c827367444ee418f129b2c238299f49d3264554Jarkko Poyrycase ${{NAME}}
143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	version 310 es
153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	require extension { "GL_EXT_shader_implicit_conversions" } in { vertex, fragment }
163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	values
173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		${{VALUES}}
193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	both ""
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		#version 310 es
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		precision highp float;
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		${DECLARATIONS}
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		void main()
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${SETUP}
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			out0 = ${{EXPR}};
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${OUTPUT}
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	""
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyryend
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry""".strip()
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
363c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFUNCTIONS_CASE_TEMPLATE = """
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyrycase ${{NAME}}
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	version 310 es
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	require extension { "GL_EXT_shader_implicit_conversions" } in { vertex, fragment }
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	values
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		${{VALUES}}
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	both ""
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		#version 310 es
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		precision highp float;
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		${DECLARATIONS}
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		${{OUTTYPE}} func (${{OUTTYPE}} a)
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return a * ${{OUTTYPE}}(2);
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		void main()
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${SETUP}
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			out0 = func(in0);
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${OUTPUT}
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	""
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyryend
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry""".strip()
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
653c827367444ee418f129b2c238299f49d3264554Jarkko PoyryARRAY_CASE_TEMPLATE = """
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyrycase ${{NAME}}
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	version 310 es
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	require extension { "GL_EXT_shader_implicit_conversions" } in { vertex, fragment }
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	values
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		${{VALUES}}
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	both ""
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		#version 310 es
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		precision highp float;
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		${DECLARATIONS}
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		void main()
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${SETUP}
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${{ARRAYTYPE}}[] x = ${{ARRAYTYPE}}[] (${{ARRAYVALUES}});
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			out0 = ${{EXPR}};
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${OUTPUT}
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	""
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyryend
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry""".strip()
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
903c827367444ee418f129b2c238299f49d3264554Jarkko PoyrySTRUCT_CASE_TEMPLATE = """
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyrycase ${{NAME}}
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	version 310 es
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	require extension { "GL_EXT_shader_implicit_conversions" } in { vertex, fragment }
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	values
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		${{VALUES}}
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	both ""
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		#version 310 es
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		precision highp float;
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		${DECLARATIONS}
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		void main()
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${SETUP}
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			struct {
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				${{OUTTYPE}} val;
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			} x;
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			x.val = ${{STRUCTVALUE}};
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			out0 = ${{EXPR}};
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${OUTPUT}
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	""
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyryend
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry""".strip()
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1203c827367444ee418f129b2c238299f49d3264554Jarkko PoyryINVALID_CASE_TEMPLATE = """
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyrycase ${{NAME}}
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	expect compile_fail
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	version 310 es
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	require extension { "GL_EXT_shader_implicit_conversions" } in { vertex, fragment }
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	values
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		${{VALUES}}
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	both ""
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		#version 310 es
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		precision highp float;
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		${DECLARATIONS}
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		void main()
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${SETUP}
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			out0 = in0 + ${{OPERAND}};
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${OUTPUT}
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	""
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyryend
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry""".strip()
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1453c827367444ee418f129b2c238299f49d3264554Jarkko PoyryINVALID_ARRAY_CASE_TEMPLATE = """
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrycase ${{NAME}}
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	expect compile_fail
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	version 310 es
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	require extension { "GL_EXT_shader_implicit_conversions" } in { vertex, fragment }
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	values {}
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	both ""
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		#version 310 es
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		precision highp float;
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		${DECLARATIONS}
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		void main()
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${SETUP}
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${{EXPR}}
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${OUTPUT}
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	""
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyryend
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry""".strip()
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1673c827367444ee418f129b2c238299f49d3264554Jarkko PoyryINVALID_STRUCT_CASE_TEMPLATE = """
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyrycase ${{NAME}}
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	expect compile_fail
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	version 310 es
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	require extension { "GL_EXT_shader_implicit_conversions" } in { vertex, fragment }
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	values {}
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	both ""
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		#version 310 es
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		precision highp float;
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		${DECLARATIONS}
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		void main()
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${SETUP}
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			struct { ${{INTYPE}} value; } a;
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			struct { ${{OUTTYPE}} value; } b;
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			a = ${{INVALUE}};
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			b = a;
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			${OUTPUT}
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	""
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyryend
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry""".strip()
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# Input values
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1953c827367444ee418f129b2c238299f49d3264554Jarkko PoyryIN_ISCALAR = [  2,  1,  1,  3,  5 ]
1963c827367444ee418f129b2c238299f49d3264554Jarkko PoyryIN_USCALAR = [  1,  3,  4,  7, 11 ]
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1983c827367444ee418f129b2c238299f49d3264554Jarkko PoyryIN_IVECTOR = [
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	( 1,  2,  3,  4),
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	( 2,  1,  2,  6),
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	( 3,  7,  2,  5),
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry]
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2043c827367444ee418f129b2c238299f49d3264554Jarkko PoyryIN_UVECTOR = [
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	( 2,  3,  5,  8),
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	( 4,  6,  2,  9),
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	( 1, 13,  7,  4),
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry]
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2103c827367444ee418f129b2c238299f49d3264554Jarkko PoyryIN_VALUES = {
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"int":		[Scalar(x)								for x in IN_ISCALAR],
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"uint":		[Scalar(x)								for x in IN_USCALAR],
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"ivec2":	[Vec2(x[0], x[1])						for x in IN_IVECTOR],
2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"uvec2":	[Vec2(x[0], x[1])						for x in IN_UVECTOR],
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"ivec3":	[Vec3(x[0], x[1], x[2])					for x in IN_IVECTOR],
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"uvec3":	[Vec3(x[0], x[1], x[2])					for x in IN_UVECTOR],
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"ivec4":	[Vec4(x[0], x[1], x[2], x[3])			for x in IN_IVECTOR],
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"uvec4":	[Vec4(x[0], x[1], x[2], x[3])			for x in IN_UVECTOR],
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"float":	[Scalar(x).toFloat()					for x in IN_ISCALAR],
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"vec2":		[Vec2(x[0], x[1]).toFloat()				for x in IN_IVECTOR],
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"vec3":		[Vec3(x[0], x[1], x[2]).toFloat()		for x in IN_IVECTOR],
2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"vec4":		[Vec4(x[0], x[1], x[2], x[3]).toFloat()	for x in IN_IVECTOR],
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2253c827367444ee418f129b2c238299f49d3264554Jarkko PoyryVALID_CONVERSIONS = {
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"int":		["float", "uint"],
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"uint":		["float"],
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"ivec2":	["uvec2", "vec2"],
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"uvec2":	["vec2"],
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"ivec3":	["uvec3", "vec3"],
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"uvec3":	["vec3"],
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"ivec4":	["uvec4", "vec4"],
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"uvec4":	["vec4"]
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2363c827367444ee418f129b2c238299f49d3264554Jarkko PoyrySCALAR_TO_VECTOR_CONVERSIONS = {
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"int":		["vec2", "vec3", "vec4", "uvec2", "uvec3", "uvec4"],
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"uint":		["vec2", "vec3", "vec4"]
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2413c827367444ee418f129b2c238299f49d3264554Jarkko PoyryVALID_ASSIGNMENTS = {
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"int":		["ivec2", "ivec3", "ivec4"],
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"uint":		["uvec2", "uvec3", "uvec4"],
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"ivec2":	["int", "float"],
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"ivec3":	["int", "float"],
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"ivec4":	["int", "float"],
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"uvec2":	["uint", "float"],
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"uvec3":	["uint", "float"],
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"uvec4":	["uint", "float"],
2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"float":	["vec2", "vec3", "vec4"],
2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"vec2":		["float"],
2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"vec3":		["float"],
2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"vec4":		["float"]
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2563c827367444ee418f129b2c238299f49d3264554Jarkko PoyryIN_TYPE_ORDER = [
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"int", 	 "uint",
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"ivec2", "uvec2", "ivec3",
2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"uvec3", "ivec4", "uvec4",
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"float",
2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"vec2",  "vec3",  "vec4"
2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry]
2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef isScalarTypeName (name):
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return name in ["float", "int", "uint"]
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef isVec2TypeName (name):
2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return name in ["vec2", "ivec2", "uvec2"]
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef isVec3TypeName (name):
2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return name in ["vec3", "ivec3", "uvec3"]
2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef isVec4TypeName (name):
2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return name in ["vec4", "ivec4", "uvec4"]
2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# Utilities
2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef scalarToVector(a, b):
2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if isinstance(a, Scalar) and isinstance(b, Vec2):
2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		a = a.toVec2()
2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	elif isinstance(a, Scalar) and isinstance(b, Vec3):
2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		a = a.toVec3()
2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	elif isinstance(a, Scalar) and isinstance(b, Vec4):
2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		a = a.toVec4()
2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return a
2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef isUintTypeName (type_name):
2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return type_name in ["uint", "uvec2", "uvec3", "uvec4"]
2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef convLiteral (type, value):
2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if isUintTypeName(type):
2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return int(value)
2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	else:
2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return value
2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef valueToStr(value_type, value):
2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if isinstance(value, Scalar):
2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return str(value)
3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	else:
3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		assert isinstance(value, genutil.Vec)
3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out = value_type + "("
3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out += ", ".join([str(convLiteral(value_type, x)) for x in value.getScalars()])
3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out += ")"
3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return out
3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef valuesToStr(prefix, value_type, values):
3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def gen_value_strs(value_list, value_type):
3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for value in value_list:
3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			yield valueToStr(value_type, value)
3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return "%s = [ %s ];" % (prefix, " | ".join(gen_value_strs(values, value_type)))
3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# Test cases
3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ArithmeticCase(genutil.ShaderCase):
3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __init__(self, name, op, in_type, out_type, reverse=False):
3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.op_func = {
3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"+":	operator.add,
3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"-":	operator.sub,
3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"*":	operator.mul,
3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"/":	operator.div,
3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.name		= name
3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.op			= op
3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.in_type	= in_type
3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.out_type	= out_type
3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.reverse	= reverse
3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __str__(self):
3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		params = {
3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"NAME":		self.name,
3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"EXPR":		self.get_expr(),
3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"VALUES":	self.gen_values(),
3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return genutil.fillTemplate(ARTIHMETIC_CASE_TEMPLATE, params)
3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def apply(self, a, b):
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		assert(self.op in self.op_func)
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		a = scalarToVector(a, b)
3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if self.reverse:
3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			b, a = a, b
3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return self.op_func[self.op](a, b)
3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def get_expr(self):
3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expr = ["in0", self.op, str(self.get_operand())]
3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if self.reverse:
3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expr.reverse()
3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return " ".join(expr)
3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def get_operand(self):
3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		operands = {
3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"float":	Scalar(2.0),
3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"vec2":		Vec2(1.0, 2.0),
3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"vec3":		Vec3(1.0, 2.0, 3.0),
3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"vec4":		Vec4(1.0, 2.0, 3.0, 4.0),
3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"uint":		Uint(2),
3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"uvec2":	UVec2(1, 2),
3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"uvec3":	UVec3(1, 2, 3),
3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"uvec4":	UVec4(1, 2, 3, 4),
3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		assert self.out_type in operands
3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return operands[self.out_type]
3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def gen_values(self):
3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		in_values	= IN_VALUES[self.in_type]
3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		y			= self.get_operand()
3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out_values	= [self.apply(x, y) for x in in_values]
3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out = []
3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("input %s in0" % (self.in_type), self.in_type, in_values))
3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("output %s out0" % (self.out_type), self.out_type, out_values))
3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return "\n".join(out)
3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ComparisonsCase(ArithmeticCase):
3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __init__(self, name, op, in_type, out_type, reverse=False):
3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		super(ComparisonsCase, self).__init__(name, op, in_type, out_type, reverse)
3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.op_func = {
3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"==":	operator.eq,
3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"!=":	operator.ne,
3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"<":	operator.lt,
3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			">":	operator.gt,
3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"<=":	operator.le,
3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			">=":	operator.ge,
3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def apply(self, a, b):
3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		assert(self.op in self.op_func)
3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if isinstance(a, Scalar) and isinstance(b, Scalar):
4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			a, b = float(a), float(b)
4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if self.reverse:
4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			b, a = a, b
4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return Scalar(self.op_func[self.op](a, b))
4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def gen_values(self):
4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		in_values	= IN_VALUES[self.in_type]
4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		y			= self.get_operand()
4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out_values	= [self.apply(x, y) for x in in_values]
4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out = []
4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("input %s in0" % (self.in_type), self.in_type, in_values))
4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("output bool out0", "bool", out_values))
4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return "\n".join(out)
4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ParenthesizedCase(genutil.ShaderCase):
4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __init__(self, name, in_type, out_type, reverse=False, input_in_parens=False):
4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.name				= name
4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.in_type			= in_type
4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.out_type			= out_type
4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.reverse			= reverse
4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.input_in_parens	= input_in_parens
4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __str__(self):
4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		params = {
4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"NAME":		self.name,
4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"EXPR":		self.get_expr(),
4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"VALUES":	self.gen_values(),
4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return genutil.fillTemplate(ARTIHMETIC_CASE_TEMPLATE, params)
4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def apply(self, a):
4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		b, c	= self.get_operand(0), self.get_operand(1)
4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		a		= scalarToVector(a, b)
4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if self.input_in_parens:
4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return b*(a+c)
4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else:
4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return a*(b+c)
4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def get_expr(self):
4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		def make_paren_expr():
4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			out = [
4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"in0" if self.input_in_parens else self.get_operand(0),
4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"+",
4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				self.get_operand(1)
4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			]
4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return "(%s)" % (" ".join([str(x) for x in out]))
4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expr = [
4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"in0" if not self.input_in_parens else self.get_operand(0),
4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"*",
4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			make_paren_expr()
4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		]
4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if self.reverse:
4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expr.reverse()
4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return " ".join([str(x) for x in expr])
4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def get_operand(self, ndx=0):
4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return IN_VALUES[self.out_type][ndx]
4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def gen_values(self):
4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		in_values	= IN_VALUES[self.in_type]
4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out_values	= [self.apply(x) for x in in_values]
4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out = []
4743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("input %s in0" % (self.in_type), self.in_type, in_values))
4753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("output %s out0" % (self.out_type), self.out_type, out_values))
4763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return "\n".join(out)
4783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FunctionsCase(genutil.ShaderCase):
4813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __init__(self, name, in_type, out_type):
4823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.name		= name
4833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.in_type	= in_type
4843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.out_type	= out_type
4853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __str__(self):
4873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		params = {
4883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"NAME":		self.name,
4893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"OUTTYPE":	self.out_type,
4903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"VALUES":	self.gen_values(),
4913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return genutil.fillTemplate(FUNCTIONS_CASE_TEMPLATE, params)
4933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def apply(self, a):
4953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if isUintTypeName(self.out_type):
4963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return a.toUint() * Uint(2)
4973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else:
4983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return a.toFloat() * Scalar(2.0)
4993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def gen_values(self):
5013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		in_values	= IN_VALUES[self.in_type]
5023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out_values	= [self.apply(x) for x in in_values]
5033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out = []
5053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("input %s in0" % (self.in_type), self.in_type, in_values))
5063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("output %s out0" % (self.out_type), self.out_type, out_values))
5073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return "\n".join(out)
5093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5113c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ArrayCase(genutil.ShaderCase):
5123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __init__(self, name, in_type, out_type, reverse=False):
5133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.name		= name
5143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.in_type	= in_type
5153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.out_type	= out_type
5163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.reverse	= reverse
5173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __str__(self):
5193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		params = {
5203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"NAME":			self.name,
5213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"VALUES":		self.gen_values(),
5223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"ARRAYTYPE":	self.out_type,
5233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"ARRAYVALUES":	self.gen_array_values(),
5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"EXPR":			self.get_expr(),
5253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
5263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return genutil.fillTemplate(ARRAY_CASE_TEMPLATE, params)
5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def apply(self, a):
5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		b = IN_VALUES[self.out_type][1]
5303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		a = scalarToVector(a, b)
5313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return a + b
5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def get_expr(self):
5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if not self.reverse:
5363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return "in0 + x[1]"
5373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else:
5383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return "x[1] + in0"
5393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def gen_values(self):
5413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		in_values	= IN_VALUES[self.in_type]
5423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out_values	= [self.apply(x) for x in in_values]
5433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out = []
5453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("input %s in0" % (self.in_type), self.in_type, in_values))
5463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("output %s out0" % (self.out_type), self.out_type, out_values))
5473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return "\n".join(out)
5493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def gen_array_values(self):
5513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out = [valueToStr(self.out_type, x) for x in IN_VALUES[self.out_type]]
5523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return ", ".join(out)
5533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5553c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ArrayUnpackCase(genutil.ShaderCase):
5563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __init__(self, name, in_type, out_type):
5573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.name		= name
5583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.in_type	= in_type
5593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.out_type	= out_type
5603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __str__(self):
5623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		params = {
5633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"NAME":			self.name,
5643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"VALUES":		self.gen_values(),
5653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"ARRAYTYPE":	"float",
5663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"ARRAYVALUES":	self.gen_array_values(),
5673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"EXPR":			self.get_expr(),
5683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
5693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return genutil.fillTemplate(ARRAY_CASE_TEMPLATE, params)
5703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def apply(self, a):
5723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if isinstance(a, Scalar) and isVec2TypeName(self.out_type):
5733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			a = a.toVec2()
5743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		elif isinstance(a, Scalar) and isVec3TypeName(self.out_type):
5753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			a = a.toVec3()
5763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		elif isinstance(a, Scalar) and isVec4TypeName(self.out_type):
5773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			a = a.toVec4()
5783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		b = IN_VALUES["float"]
5803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out = [Scalar(x)+y for x, y in zip(a.getScalars(), b)]
5823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if self.out_type == "float":
5843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return out[0].toFloat()
5853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		elif self.out_type == "uint":
5863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return out[0].toUint()
5873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		elif self.out_type == "vec2":
5883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return Vec2(out[0], out[1]).toFloat()
5893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		elif self.out_type == "uvec2":
5903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return Vec2(out[0], out[1]).toUint()
5913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		elif self.out_type == "vec3":
5923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return Vec3(out[0], out[1], out[2]).toFloat()
5933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		elif self.out_type == "uvec3":
5943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return Vec3(out[0], out[1], out[2]).toUint()
5953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		elif self.out_type == "vec4":
5963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return Vec4(out[0], out[1], out[2], out[3]).toFloat()
5973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		elif self.out_type == "uvec4":
5983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return Vec4(out[0], out[1], out[2], out[3]).toUint()
5993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def get_expr(self):
6013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		def num_scalars(typename):
6023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return IN_VALUES[typename][0].getNumScalars()
6033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		def gen_sums():
6053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			in_scalars	= num_scalars(self.in_type)
6063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			out_scalars	= num_scalars(self.out_type)
6073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			for ndx in range(out_scalars):
6093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				if in_scalars > 1:
6103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					yield "in0[%i] + x[%i]" % (ndx, ndx)
6113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				else:
6123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					yield "in0 + x[%i]" % (ndx)
6133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return "%s(%s)" % (self.out_type, ", ".join(gen_sums()))
6153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def gen_values(self):
6173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		in_values	= IN_VALUES[self.in_type]
6183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out_values	= [self.apply(x) for x in in_values]
6193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out = []
6213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("input %s in0" % (self.in_type), self.in_type, in_values))
6223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("output %s out0" % (self.out_type), self.out_type, out_values))
6233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return "\n".join(out)
6253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def gen_array_values(self):
6273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out = [valueToStr(self.out_type, x) for x in IN_VALUES["float"]]
6283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return ", ".join(out)
6293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6313c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StructCase(genutil.ShaderCase):
6323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __init__(self, name, in_type, out_type, reverse=False):
6333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.name		= name
6343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.in_type	= in_type
6353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.out_type	= out_type
6363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.reverse	= reverse
6373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __str__(self):
6393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		params = {
6403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"NAME":			self.name,
6413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"VALUES":		self.gen_values(),
6423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"OUTTYPE":		self.out_type,
6433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"STRUCTVALUE":	self.get_struct_value(),
6443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"EXPR":			self.get_expr(),
6453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
6463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return genutil.fillTemplate(STRUCT_CASE_TEMPLATE, params)
6473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def apply(self, a):
6493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if isinstance(a, Scalar) and isVec2TypeName(self.out_type):
6503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			a = a.toVec2()
6513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		elif isinstance(a, Scalar) and isVec3TypeName(self.out_type):
6523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			a = a.toVec3()
6533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		elif isinstance(a, Scalar) and isVec4TypeName(self.out_type):
6543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			a = a.toVec4()
6553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		b = IN_VALUES[self.out_type][0]
6573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return a + b
6593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def get_expr(self):
6613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if not self.reverse:
6623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return "in0 + x.val"
6633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else:
6643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return "x.val + in0"
6653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def gen_values(self):
6673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		in_values	= IN_VALUES[self.in_type]
6683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out_values	= [self.apply(x) for x in in_values]
6693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out = []
6713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("input %s in0" % (self.in_type), self.in_type, in_values))
6723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("output %s out0" % (self.out_type), self.out_type, out_values))
6733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return "\n".join(out)
6753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def get_struct_value(self):
6773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return valueToStr(self.out_type, IN_VALUES[self.out_type][0])
6783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6803c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass InvalidCase(genutil.ShaderCase):
6813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __init__(self, name, in_type, out_type):
6823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.name		= name
6833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.in_type	= in_type
6843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.out_type	= out_type
6853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __str__(self):
6873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		params = {
6883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"NAME":		self.name,
6893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"OPERAND":	str(self.get_operand()),
6903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"VALUES":	self.gen_values(),
6913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
6923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return genutil.fillTemplate(INVALID_CASE_TEMPLATE, params)
6933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def apply(self, a, b):
6953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return b
6963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def get_operand(self):
6983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return IN_VALUES[self.out_type][0]
6993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def gen_values(self):
7013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		in_values	= IN_VALUES[self.in_type]
7023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		y			= self.get_operand()
7043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out_values	= [self.apply(x, y) for x in in_values]
7053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out = []
7073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("input %s in0" % (self.in_type), self.in_type, in_values))
7083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out.append(valuesToStr("output %s out0" % (self.out_type), self.out_type, out_values))
7093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return "\n".join(out)
7113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7133c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass InvalidArrayCase(genutil.ShaderCase):
7143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __init__(self, name, in_type, out_type):
7153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.name		= name
7163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.in_type	= in_type
7173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.out_type	= out_type
7183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __str__(self):
7203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		params = {
7213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"NAME":	self.name,
7223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"EXPR":	self.gen_expr(),
7233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
7243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return genutil.fillTemplate(INVALID_ARRAY_CASE_TEMPLATE, params)
7253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def gen_expr(self):
7273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		in_values = [valueToStr(self.out_type, x) for x in IN_VALUES[self.in_type]]
7283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		out = "%s a[] = %s[] (%s);" % (self.out_type, self.in_type, ", ".join(in_values))
7303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return out
7323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7343c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass InvalidStructCase(genutil.ShaderCase):
7353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __init__(self, name, in_type, out_type):
7363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.name		= name
7373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.in_type	= in_type
7383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		self.out_type	= out_type
7393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def __str__(self):
7413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		params = {
7423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"NAME":		self.name,
7433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"INTYPE":	self.in_type,
7443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"OUTTYPE":	self.out_type,
7453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"INVALUE":	self.get_value(),
7463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
7473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return genutil.fillTemplate(INVALID_STRUCT_CASE_TEMPLATE, params)
7483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def get_value(self):
7503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return valueToStr(self.in_type, IN_VALUES[self.in_type][0])
7513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# Case file generation
7543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7553c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef genConversionPairs(order=IN_TYPE_ORDER, scalar_to_vector=True, additional={}):
7563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	def gen_order(conversions):
7573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		key_set = set(conversions.iterkeys())
7583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for typename in order:
7593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if typename in key_set:
7603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				yield typename
7613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	conversions = {}
7623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for in_type in VALID_CONVERSIONS:
7643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		conversions[in_type] = [] + VALID_CONVERSIONS[in_type]
7653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if in_type in SCALAR_TO_VECTOR_CONVERSIONS and scalar_to_vector:
7663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			conversions[in_type] += SCALAR_TO_VECTOR_CONVERSIONS[in_type]
7673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for key in additional.iterkeys():
7693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			value = conversions.get(key, [])
7703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			conversions[key] = value + additional[key]
7713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for in_type in gen_order(conversions):
7733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for out_type in conversions[in_type]:
7743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			yield (in_type, out_type)
7753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7773c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef genInvalidConversions():
7783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	types = IN_TYPE_ORDER
7793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	valid_pairs = set(genConversionPairs(additional=VALID_ASSIGNMENTS))
7803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for pair in itertools.permutations(types, 2):
7823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if pair not in valid_pairs:
7833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			yield pair
7843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7863c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef genArithmeticCases(reverse=False):
7873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	op_names = [
7883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		("add", "Addition",			"+"),
7893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		("sub", "Subtraction",		"-"),
7903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		("mul", "Multiplication",	"*"),
7913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		("div", "Division",			"/")
7923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	]
7933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for name, desc, op in op_names:
7953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		casegroup = CaseGroup(name, desc, [])
7963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for in_type, out_type in genConversionPairs():
7973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if op == "-" and isUintTypeName(out_type):
7983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				continue # Can't handle at the moment
7993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			name = in_type + "_to_" + out_type
8003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			casegroup.children.append(ArithmeticCase(name, op, in_type, out_type, reverse))
8013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		yield casegroup
8023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8043c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef genComparisonCases(reverse=False):
8053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	op_names = [
8063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		("equal",				"Equal",					"=="),
8073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		("not_equal",			"Not equal",				"!="),
8083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		("less",				"Less than",				"<"),
8093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		("greater",				"Greater than",				">"),
8103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		("less_or_equal",		"Less than or equal",		"<="),
8113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		("greater_or_equal",	"Greater than or equal",	">="),
8123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	]
8133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for name, desc, op in op_names:
8153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		casegroup	= CaseGroup(name, desc, [])
8163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		type_order	= IN_TYPE_ORDER if name in ["equal", "not_equal"] else ["int", "uint"]
8173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for in_type, out_type in genConversionPairs(order=type_order, scalar_to_vector=False):
8193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			name = in_type + "_to_" + out_type
8203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			casegroup.children.append(ComparisonsCase(name, op, in_type, out_type, reverse))
8213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		yield casegroup
8223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8243c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef genParenthesizedCases():
8253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for reverse in [True, False]:
8263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if reverse:
8273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			name = "paren_expr_before_literal"
8283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			desc = "Parenthesized expression before literal"
8293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else:
8303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			name = "literal_before_paren_expr"
8313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			desc = "Literal before parenthesized expression"
8323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		reversegroup = CaseGroup(name, desc, [])
8333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for input_in_parens in [True, False]:
8353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if input_in_parens:
8363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				name = "input_in_parens"
8373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				desc = "Input variable in parenthesized expression"
8383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			else:
8393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				name = "input_outside_parens"
8403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				desc = "Input variable outside parenthesized expression"
8413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			casegroup = CaseGroup(name, desc, [])
8423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			for in_type, out_type in genConversionPairs():
8443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				name = in_type + "_to_" + out_type
8453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				casegroup.children.append(
8463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					ParenthesizedCase(name, in_type, out_type, reverse, input_in_parens)
8473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				)
8483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			reversegroup.children.append(casegroup)
8493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		yield reversegroup
8503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8523c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef genArrayCases(reverse=False):
8533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for in_type, out_type in genConversionPairs():
8543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		name = in_type + "_to_" + out_type
8553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		yield ArrayCase(name, in_type, out_type, reverse)
8563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8583c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef genArrayUnpackCases(reverse=False):
8593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for in_type, out_type in genConversionPairs():
8603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		name = in_type + "_to_" + out_type
8613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		yield ArrayUnpackCase(name, in_type, out_type)
8623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8643c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef genFunctionsCases():
8653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for in_type, out_type in genConversionPairs(scalar_to_vector=False):
8663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		name = in_type + "_to_" + out_type
8673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		yield FunctionsCase(name, in_type, out_type)
8683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8703c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef genStructCases(reverse=False):
8713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for in_type, out_type in genConversionPairs():
8723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		name = in_type + "_to_" + out_type
8733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		yield StructCase(name, in_type, out_type, reverse)
8743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8763c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef genInvalidCases(reverse=False):
8773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for in_type, out_type in genInvalidConversions():
8783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		name = in_type + "_to_" + out_type
8793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		yield InvalidCase(name, in_type, out_type)
8803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8823c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef genInvalidArrayCases():
8833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for in_type, out_type in genConversionPairs(scalar_to_vector=False):
8843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		name = in_type + "_to_" + out_type
8853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		yield InvalidArrayCase(name, in_type, out_type)
8863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8883c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef genInvalidStructCases():
8893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for in_type, out_type in genConversionPairs(scalar_to_vector=False):
8903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		name = in_type + "_to_" + out_type
8913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		yield InvalidStructCase(name, in_type, out_type)
8923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8943c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydef genAllCases():
8953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	yield CaseGroup(
8963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		"arithmetic", "Arithmetic operations",
8973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		[
8983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			CaseGroup("input_before_literal", "Input before literal",
8993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					  genArithmeticCases(reverse=False)),
9003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			CaseGroup("literal_before_input", "Literal before input",
9013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					  genArithmeticCases(reverse=True)),
9023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		]
9033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
9043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	yield CaseGroup(
9063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		"comparisons", "Comparisons",
9073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		[
9083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			CaseGroup("input_before_literal", "Input before literal",
9093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					  genComparisonCases(reverse=False)),
9103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			CaseGroup("literal_before_input", "Literal before input",
9113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					  genComparisonCases(reverse=True)),
9123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		]
9133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
9143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	yield CaseGroup(
9163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		"array_subscripts", "Array subscripts",
9173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		[
9183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			CaseGroup("input_before_subscript", "Input before subscript",
9193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					  genArrayCases(reverse=False)),
9203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			CaseGroup("subscript_before_input", "Subscript before input",
9213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					  genArrayCases(reverse=True)),
9223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		#	CaseGroup("unpack", "Unpack array and repack as value",
9233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		#			  genArrayUnpackCases()),
9243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		]
9253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
9263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	yield CaseGroup("functions", "Function calls",
9283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					genFunctionsCases())
9293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	yield CaseGroup("struct_fields", "Struct field selectors",
9313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		[
9323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			CaseGroup("input_before_field", "Input before field",
9333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					  genStructCases(reverse=False)),
9343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			CaseGroup("field_before_input", "Field before input",
9353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					  genStructCases(reverse=True)),
9363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		]
9373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
9383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	yield CaseGroup("parenthesized_expressions", "Parenthesized expressions",
9403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					genParenthesizedCases())
9413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	yield CaseGroup(
9433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		"invalid", "Invalid conversions",
9443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		[
9453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			CaseGroup("variables", "Single variables",
9463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					  genInvalidCases()),
9473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			CaseGroup("arrays", "Arrays",
9483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					  genInvalidArrayCases()),
9493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			CaseGroup("structs", "Structs",
9503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					  genInvalidStructCases()),
9513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		]
9523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
9533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9553c827367444ee418f129b2c238299f49d3264554Jarkko Poyryif __name__ == "__main__":
9563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	print "Generating shader case files."
9573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	genutil.writeAllCases("implicit_conversions.test", genAllCases())
958