mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-12-15 08:03:30 -08:00
tests/hlsl: Test clip/cull distance semantics as arrays.
Arrays are allowed for clip/cull distance semantics. Their maximum size is 2 since that's the maximum amount of registers allowed for clip/cull distances. Indirect addressing of these arrays is allowed on shader model 6. These tests are introduced after the transformation of clip/cull input/outputs into arrays in vsir since otherwise they segfault.
This commit is contained in:
committed by
Henri Verbeet
parent
60fc072877
commit
41c593ef46
Notes:
Henri Verbeet
2025-11-25 20:40:54 +01:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1816
90
tests/hlsl/clip-cull-distance-2.shader_test
Normal file
90
tests/hlsl/clip-cull-distance-2.shader_test
Normal file
@@ -0,0 +1,90 @@
|
||||
[require]
|
||||
shader model >= 4.0
|
||||
|
||||
[vertex shader todo(sm<6)]
|
||||
struct vertex
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 clip[2] : SV_CLIPDISTANCE;
|
||||
};
|
||||
|
||||
void main(float4 pos : POSITION, out vertex vertex)
|
||||
{
|
||||
vertex.pos = pos;
|
||||
// Only pixels closer to the center should remain.
|
||||
vertex.clip[0] = float2(0.5 + pos.x, 0.5 - pos.x);
|
||||
vertex.clip[1] = float2(0.5 + pos.y, 0.5 - pos.y);
|
||||
}
|
||||
|
||||
[pixel shader todo(sm<6)]
|
||||
struct vertex
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 clip[2] : SV_CLIPDISTANCE;
|
||||
};
|
||||
|
||||
float4 main(in vertex vert) : SV_TARGET
|
||||
{
|
||||
return round(10000 * float4(vert.clip[0], vert.clip[1]));
|
||||
}
|
||||
|
||||
% clip[1] is ignored on WARP on SM6, this is probably a bug.
|
||||
[test]
|
||||
clear rtv 0 0.0 0.0 0.0 1.0
|
||||
todo(sm<6 | msl) draw quad
|
||||
probe ( 80, 60) f32(0.0, 0.0, 0.0, 1.0)
|
||||
probe ( 80, 180) f32(0.0, 0.0, 0.0, 1.0)
|
||||
probe ( 80, 300) f32(0.0, 0.0, 0.0, 1.0)
|
||||
probe ( 80, 420) f32(0.0, 0.0, 0.0, 1.0)
|
||||
if(!warp | sm<6) probe (240, 60) f32(0.0, 0.0, 0.0, 1.0)
|
||||
probe (240, 180) f32(2516, 7484, 7479, 2521)
|
||||
probe (240, 300) f32(2516, 7484, 2479, 7521)
|
||||
if(!warp | sm<6) probe (240, 420) f32(0.0, 0.0, 0.0, 1.0)
|
||||
if(!warp | sm<6) probe (400, 60) f32(0.0, 0.0, 0.0, 1.0)
|
||||
probe (400, 180) f32(7516, 2484, 7479, 2521)
|
||||
probe (400, 300) f32(7516, 2484, 2479, 7521)
|
||||
if(!warp | sm<6) probe (400, 420) f32(0.0, 0.0, 0.0, 1.0)
|
||||
probe (560, 60) f32(0.0, 0.0, 0.0, 1.0)
|
||||
probe (560, 180) f32(0.0, 0.0, 0.0, 1.0)
|
||||
probe (560, 300) f32(0.0, 0.0, 0.0, 1.0)
|
||||
probe (560, 420) f32(0.0, 0.0, 0.0, 1.0)
|
||||
|
||||
[pixel shader]
|
||||
float4 main() : SV_TARGET
|
||||
{
|
||||
return float4(1.0, 1.0, 1.0, 1.0);
|
||||
}
|
||||
|
||||
[vertex shader fail(sm<6)]
|
||||
unsigned int i;
|
||||
|
||||
struct vertex
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float clip[2] : SV_CLIPDISTANCE;
|
||||
};
|
||||
|
||||
void main(float4 pos : POSITION, out vertex vertex)
|
||||
{
|
||||
vertex.pos = pos;
|
||||
vertex.clip[0] = pos.x;
|
||||
vertex.clip[1] = pos.y;
|
||||
vertex.clip[i] = 1.0;
|
||||
}
|
||||
|
||||
% clip[1] is ignored on WARP on SM6, this is probably a bug.
|
||||
[test]
|
||||
uniform 0 int 0
|
||||
clear rtv 0 0.0 0.0 0.0 1.0
|
||||
todo(sm<6 | msl) draw quad
|
||||
probe (160, 120) f32(1.0, 1.0, 1.0, 1.0)
|
||||
if(!warp) probe (160, 360) f32(0.0, 0.0, 0.0, 1.0)
|
||||
probe (480, 120) f32(1.0, 1.0, 1.0, 1.0)
|
||||
if(!warp) probe (480, 360) f32(0.0, 0.0, 0.0, 1.0)
|
||||
uniform 0 int 1
|
||||
clear rtv 0 0.0 0.0 0.0 1.0
|
||||
todo(sm<6 | msl) draw quad
|
||||
probe (160, 120) f32(0.0, 0.0, 0.0, 1.0)
|
||||
probe (160, 360) f32(0.0, 0.0, 0.0, 1.0)
|
||||
probe (480, 120) f32(1.0, 1.0, 1.0, 1.0)
|
||||
probe (480, 360) f32(1.0, 1.0, 1.0, 1.0)
|
||||
Reference in New Issue
Block a user