mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
tests/hlsl: Add a test for SV_PrimitiveId inputs and outputs.
This commit is contained in:
committed by
Henri Verbeet
parent
bd3d0f3495
commit
1293db7536
Notes:
Henri Verbeet
2025-08-04 15:08:07 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/843
@@ -215,6 +215,7 @@ vkd3d_shader_tests = \
|
||||
tests/hlsl/pointer-cast.shader_test \
|
||||
tests/hlsl/pow.shader_test \
|
||||
tests/hlsl/precise-modifier.shader_test \
|
||||
tests/hlsl/primitive-id.shader_test \
|
||||
tests/hlsl/rasteriser-ordered-views.shader_test \
|
||||
tests/hlsl/rcp.shader_test \
|
||||
tests/hlsl/reflect.shader_test \
|
||||
|
76
tests/hlsl/primitive-id.shader_test
Normal file
76
tests/hlsl/primitive-id.shader_test
Normal file
@@ -0,0 +1,76 @@
|
||||
[require]
|
||||
shader model >= 4.0
|
||||
geometry-shader
|
||||
|
||||
[vertex shader]
|
||||
struct vs_data
|
||||
{
|
||||
float4 pos : SV_Position;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
void main(out struct vs_data vs_output)
|
||||
{
|
||||
vs_output.pos = float4(0.0, 0.0, 1.0, 1.0);
|
||||
vs_output.color = float4(0.0, 0.0, 1.0, 1.0);
|
||||
}
|
||||
|
||||
[geometry shader]
|
||||
struct gs_data
|
||||
{
|
||||
float4 pos : SV_Position;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct gs_out
|
||||
{
|
||||
float4 pos : SV_Position;
|
||||
float4 color : COLOR;
|
||||
uint prim_id : SV_PrimitiveId;
|
||||
};
|
||||
|
||||
[maxvertexcount(4)]
|
||||
void main(point struct gs_data vin[1], in uint prim_id : SV_PrimitiveId, inout TriangleStream<gs_out> vout)
|
||||
{
|
||||
float offset = 0.2 * vin[0].pos.w;
|
||||
gs_out v;
|
||||
|
||||
v.color = vin[0].color;
|
||||
/* This only confirms that prim_id is zero. */
|
||||
v.color.x = prim_id * 0.25f;
|
||||
|
||||
v.pos = float4(vin[0].pos.x - offset, vin[0].pos.y - offset, vin[0].pos.z, 1.0);
|
||||
v.prim_id = 0;
|
||||
vout.Append(v);
|
||||
v.pos = float4(vin[0].pos.x - offset, vin[0].pos.y + offset, vin[0].pos.z, 1.0);
|
||||
v.prim_id = 1;
|
||||
vout.Append(v);
|
||||
v.pos = float4(vin[0].pos.x + offset, vin[0].pos.y - offset, vin[0].pos.z, 1.0);
|
||||
vout.Append(v);
|
||||
v.pos = float4(vin[0].pos.x + offset, vin[0].pos.y + offset, vin[0].pos.z, 1.0);
|
||||
vout.Append(v);
|
||||
}
|
||||
|
||||
[pixel shader]
|
||||
struct ps_data
|
||||
{
|
||||
float4 pos : SV_Position;
|
||||
float4 color : COLOR;
|
||||
uint prim_id : SV_PrimitiveId;
|
||||
};
|
||||
|
||||
float4 main(struct ps_data ps_input) : SV_Target
|
||||
{
|
||||
float4 color = ps_input.color;
|
||||
color.y = ps_input.prim_id * 0.25f;
|
||||
return color;
|
||||
}
|
||||
|
||||
[test]
|
||||
todo(glsl | sm>=6) bug(mvk) draw point list 1
|
||||
probe rtv 0 (320, 190) f32(0.0, 0.0, 0.0, 0.0)
|
||||
probe rtv 0 (255, 240) f32(0.0, 0.0, 0.0, 0.0)
|
||||
probe rtv 0 (319, 241) f32(0.0, 0.0, 1.0, 1.0)
|
||||
probe rtv 0 (321, 239) f32(0.0, 0.25, 1.0, 1.0)
|
||||
probe rtv 0 (385, 240) f32(0.0, 0.0, 0.0, 0.0)
|
||||
probe rtv 0 (320, 290) f32(0.0, 0.0, 0.0, 0.0)
|
Reference in New Issue
Block a user