mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-12-15 08:03:30 -08:00
tests/hlsl: Add a test for branching in a hull shader patch constant function.
This commit is contained in:
committed by
Henri Verbeet
parent
0f9a2bdf34
commit
a5a8a4cc99
Notes:
Henri Verbeet
2025-10-03 00:55:37 +02:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1763
@@ -291,3 +291,85 @@ void main(patch_constant_data input,
|
||||
[test]
|
||||
if(!llvmpipe) todo(glsl | mvk & vulkan) draw 3 control point patch list 3
|
||||
if(!llvmpipe) todo(mvk) probe (0, 0, 640, 480) rgba(0.0, 1.0, 0.0, 1.0)
|
||||
|
||||
[require]
|
||||
shader model >= 5.0
|
||||
tessellation-shader
|
||||
|
||||
[hull shader]
|
||||
uniform uint foo;
|
||||
|
||||
struct data
|
||||
{
|
||||
float4 position : SV_Position;
|
||||
float r : RED;
|
||||
float g : GREEN;
|
||||
float b : BLUE;
|
||||
};
|
||||
|
||||
struct patch_constant_data
|
||||
{
|
||||
float edges[3] : SV_TessFactor;
|
||||
float inside : SV_InsideTessFactor;
|
||||
};
|
||||
|
||||
void patch_constant(InputPatch<data, 3> input, out patch_constant_data output)
|
||||
{
|
||||
if (foo)
|
||||
{
|
||||
output.edges[0] = output.edges[1] = output.edges[2] = 1.0f;
|
||||
output.inside = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
output.edges[0] = output.edges[1] = output.edges[2] = 3.0f;
|
||||
output.inside = 2.0f;
|
||||
}
|
||||
}
|
||||
|
||||
[domain("tri")]
|
||||
[outputcontrolpoints(3)]
|
||||
[partitioning("integer")]
|
||||
[outputtopology("triangle_cw")]
|
||||
[patchconstantfunc("patch_constant")]
|
||||
data main(InputPatch<data, 3> input, uint i : SV_OutputControlPointID)
|
||||
{
|
||||
return input[i];
|
||||
}
|
||||
|
||||
[domain shader]
|
||||
struct data
|
||||
{
|
||||
float4 position : SV_Position;
|
||||
float r : RED;
|
||||
float g : GREEN;
|
||||
float b : BLUE;
|
||||
};
|
||||
|
||||
struct patch_constant_data
|
||||
{
|
||||
float edges[3] : SV_TessFactor;
|
||||
float inside : SV_InsideTessFactor;
|
||||
};
|
||||
|
||||
[domain("tri")]
|
||||
void main(patch_constant_data input,
|
||||
float3 tess_coord : SV_DomainLocation,
|
||||
const OutputPatch<data, 3> patch,
|
||||
out data output)
|
||||
{
|
||||
output.position = tess_coord.x * patch[0].position
|
||||
+ tess_coord.y * patch[1].position
|
||||
+ tess_coord.z * patch[2].position;
|
||||
output.r = input.edges[0] / 4.0f;
|
||||
output.g = input.inside / 4.0f;
|
||||
output.b = tess_coord.x * patch[0].b + tess_coord.y * patch[1].b + tess_coord.z * patch[2].b;
|
||||
}
|
||||
|
||||
[test]
|
||||
uniform 0 uint 0
|
||||
if(!llvmpipe) todo(glsl | mvk & vulkan | sm>=6) draw 3 control point patch list 3
|
||||
if(!llvmpipe) todo(mvk) probe (0, 0, 640, 480) f32(0.75, 0.5, 0.0, 1.0)
|
||||
uniform 0 uint 1
|
||||
if(!llvmpipe) todo(glsl | mvk & vulkan | sm>=6) draw 3 control point patch list 3
|
||||
if(!llvmpipe) todo(mvk) probe (0, 0, 640, 480) f32(0.25, 0.25, 0.0, 1.0)
|
||||
|
||||
Reference in New Issue
Block a user