vkd3d-shader/hlsl: Use a block in hlsl_normalize_binary_exprs().
[vkd3d.git] / tests / hlsl / instance-id.shader_test
blob1fdad00439a89b9e8adab41da523a6d122049ca6
1 [require]
2 shader model >= 4.0
4 [vertex shader]
5 struct vs_in
7     uint instance_id : SV_InstanceId;
8     uint vertex_id : SV_VertexId;
9 };
11 struct vs_out
13     float4 position : SV_Position;
14     float4 color : Color;
17 void main(vs_in i, out vs_out o)
19     float2 vertices[] =
20     {
21         {0.0, 0.0}, { 0.0,  2.0}, {-2.0,  0.0},
22         {0.0, 0.0}, { 2.0,  0.0}, { 0.0,  2.0},
23         {0.0, 0.0}, { 0.0, -2.0}, { 2.0,  0.0},
24         {0.0, 0.0}, {-2.0,  0.0}, { 0.0, -2.0},
25     };
26     uint pos = i.vertex_id % 3;
27     o.position = float4(vertices[pos + i.instance_id * 3], 0.0, 1.0);
28     float color = 0.25 + i.instance_id * 0.25;
29     o.color = float4(0.0, color, 0.0, color);
32 [pixel shader]
33 struct vs_out
35     float4 position : SV_Position;
36     float4 color : Color;
39 float4 main(vs_out i) : SV_Target
41     return i.color;
44 [test]
45 todo(glsl | msl) draw triangle list 3 4
46 probe rtv 0 (160, 120) rgba (0.0, 0.25, 0.0, 0.25)
47 probe rtv 0 (480, 120) rgba (0.0, 0.5, 0.0, 0.5)
48 probe rtv 0 (480, 360) rgba (0.0, 0.75, 0.0, 0.75)
49 probe rtv 0 (160, 360) rgba (0.0, 1.0, 0.0, 1.0)