--- /dev/null
+struct TransformComponents
+{
+ vec3 position;
+ vec3 scale;
+};
+struct Transform
+{
+ TransformComponents components;
+};
+uniform ModelData
+{
+ Transform transform;
+} model;
+
+#pragma MSP stage(vertex)
+layout(location=0) in vec4 position;
+void main()
+{
+ gl_Position = vec4(model.transform.components.position+position.xyz*model.transform.components.scale, 1.0);
+}
+
+/* Expected output: vertex
+struct TransformComponents
+{
+ vec3 position;
+ vec3 scale;
+};
+struct Transform
+{
+ TransformComponents components;
+};
+uniform ModelData
+{
+ Transform transform;
+} model;
+layout(location=0) in vec4 position;
+void main()
+{
+ gl_Position = vec4(model.transform.components.position+position.xyz*model.transform.components.scale, 1.0);
+}
+*/
--- /dev/null
+uniform mat4 mvp;
+uniform sampler2D tex;
+uniform vec3 ambient;
+
+vec3 srgb_to_linear(vec3 color)
+{
+ bvec3 near_zero = lessThan(color, vec3(0.04045));
+ vec3 gamma = pow((color.rgb+0.055)/1.055, vec3(2.4));
+ return mix(color.rgb/12.92, gamma, near_zero);
+}
+vec4 srgb_to_linear(vec4 color)
+{
+ return vec4(srgb_to_linear(color.rgb), color.a);
+}
+
+#pragma MSP stage(vertex)
+layout(location=0) in vec4 position;
+layout(location=1) in vec2 texcoord;
+void main()
+{
+ passthrough;
+ gl_Position = mvp*position;
+}
+
+#pragma MSP stage(fragment)
+layout(location=0) out vec4 frag_color;
+void main()
+{
+ frag_color = srgb_to_linear(texture(tex, texcoord));
+}
+
+/* Expected output: vertex
+uniform mat4 mvp;
+layout(location=0) in vec4 position;
+layout(location=1) in vec2 texcoord;
+out vec2 _vs_out_texcoord;
+void main()
+{
+ _vs_out_texcoord = texcoord;
+ gl_Position = mvp*position;
+}
+*/
+
+/* Expected output: fragment
+uniform sampler2D tex;
+vec3 srgb_to_linear(vec3 color)
+{
+ return mix(color.rgb/12.92, pow((color.rgb+0.055)/1.055, vec3(2.4)), lessThan(color, vec3(0.04045)));
+}
+vec4 srgb_to_linear(vec4 color)
+{
+ return vec4(srgb_to_linear(color.rgb), color.a);
+}
+layout(location=0) out vec4 frag_color;
+in vec2 _vs_out_texcoord;
+void main()
+{
+ frag_color = srgb_to_linear(texture(tex, _vs_out_texcoord));
+}
+*/