tests/shader_runner: Introduce a "cull-distance" capability.

This commit is contained in:
Francisco Casas
2025-06-02 12:08:04 -04:00
committed by Henri Verbeet
parent d3f658d410
commit cb7dac4d65
Notes: Henri Verbeet 2025-10-29 13:43:34 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1801
8 changed files with 42 additions and 10 deletions

View File

@@ -552,6 +552,11 @@ static inline bool is_macos_lt(unsigned int major, unsigned int minor, unsigned
return false;
}
static inline bool is_cull_distance_supported(ID3D12Device *device)
{
return true;
}
static inline bool is_depth_clip_enable_supported(ID3D12Device *device)
{
return true;
@@ -932,6 +937,15 @@ static inline bool is_macos_lt(unsigned int major, unsigned int minor, unsigned
#endif
static inline bool is_cull_distance_supported(ID3D12Device *device)
{
VkPhysicalDeviceFeatures features;
vkGetPhysicalDeviceFeatures(vkd3d_get_vk_physical_device(device), &features);
return features.shaderCullDistance;
}
static inline bool is_depth_clip_enable_supported(ID3D12Device *device)
{
VkPhysicalDevice vk_physical_device = vkd3d_get_vk_physical_device(device);

View File

@@ -247,6 +247,10 @@ probe rtv 0 (480, 120) rgba(1.0, 1.0, 0.0, 1.0)
probe rtv 0 (480, 240) rgba(1.0, 1.0, 0.0, 1.0)
probe rtv 0 (480, 360) rgba(1.0, 1.0, 0.0, 1.0)
[require]
shader model >= 4.0
cull-distance
% Now it works. Here all the cull distances are effectively ignored, because
% they do not leave the only triangle entirely on one side. (Also, they
% coincide with other clip distances.)
@@ -284,19 +288,20 @@ void main(uint id : SV_VertexID, out vs_out o)
[test]
clear rtv 0 1.0 1.0 0.0 1.0
todo(sm<6 | msl) draw triangle strip 4
probe rtv 0 (160, 120) rgba(1.0, 1.0, 0.0, 1.0)
probe rtv 0 (160, 240) rgba(1.0, 1.0, 0.0, 1.0)
probe rtv 0 (160, 360) rgba(1.0, 1.0, 0.0, 1.0)
probe rtv 0 (320, 120) rgba(1.0, 1.0, 0.0, 1.0)
bug(d3d12 & mvk) probe rtv 0 (320, 240) rgba(0.0, 1.0, 0.0, 1.0)
probe rtv 0 (320, 360) rgba(1.0, 1.0, 0.0, 1.0)
probe rtv 0 (480, 120) rgba(1.0, 1.0, 0.0, 1.0)
probe rtv 0 (480, 240) rgba(1.0, 1.0, 0.0, 1.0)
probe rtv 0 (480, 360) rgba(1.0, 1.0, 0.0, 1.0)
todo(sm<6) draw triangle strip 4
probe rtv 0 (160, 120) f32(1.0, 1.0, 0.0, 1.0)
probe rtv 0 (160, 240) f32(1.0, 1.0, 0.0, 1.0)
probe rtv 0 (160, 360) f32(1.0, 1.0, 0.0, 1.0)
probe rtv 0 (320, 120) f32(1.0, 1.0, 0.0, 1.0)
probe rtv 0 (320, 240) f32(0.0, 1.0, 0.0, 1.0)
probe rtv 0 (320, 360) f32(1.0, 1.0, 0.0, 1.0)
probe rtv 0 (480, 120) f32(1.0, 1.0, 0.0, 1.0)
probe rtv 0 (480, 240) f32(1.0, 1.0, 0.0, 1.0)
probe rtv 0 (480, 360) f32(1.0, 1.0, 0.0, 1.0)
[require]
shader model >= 4.0
cull-distance
geometry-shader
% Let clip and cull distances go through a geometry shader.

View File

@@ -461,6 +461,7 @@ static DXGI_FORMAT parse_format(const char *line, unsigned int *texel_size, bool
static const char *const shader_cap_strings[] =
{
[SHADER_CAP_CLIP_PLANES] = "clip-planes",
[SHADER_CAP_CULL_DISTANCE] = "cull-distance",
[SHADER_CAP_DEPTH_BOUNDS] = "depth-bounds",
[SHADER_CAP_FLOAT64] = "float64",
[SHADER_CAP_FOG] = "fog",

View File

@@ -150,6 +150,7 @@ enum format_cap
enum shader_cap
{
SHADER_CAP_CLIP_PLANES,
SHADER_CAP_CULL_DISTANCE,
SHADER_CAP_DEPTH_BOUNDS,
SHADER_CAP_FLOAT64,
SHADER_CAP_FOG,

View File

@@ -336,6 +336,7 @@ static BOOL init_test_context(struct d3d11_shader_runner *runner)
runner->caps.minimum_shader_model = SHADER_MODEL_4_0;
runner->caps.maximum_shader_model = SHADER_MODEL_5_0;
runner->caps.shader_caps[SHADER_CAP_CULL_DISTANCE] = true;
hr = ID3D11Device_CheckFeatureSupport(runner->device, D3D11_FEATURE_DOUBLES,
&doubles, sizeof(doubles));
ok(hr == S_OK, "Failed to check double precision feature support, hr %#lx.\n", hr);

View File

@@ -1109,6 +1109,8 @@ static void d3d12_runner_init_caps(struct d3d12_shader_runner *runner,
runner->caps.compiler = using_dxcompiler ? "dxcompiler" : HLSL_COMPILER;
runner->caps.minimum_shader_model = minimum_shader_model;
runner->caps.maximum_shader_model = maximum_shader_model;
if (is_cull_distance_supported(device))
runner->caps.shader_caps[SHADER_CAP_CULL_DISTANCE] = true;
runner->caps.shader_caps[SHADER_CAP_DEPTH_BOUNDS] = options2.DepthBoundsTestSupported;
runner->caps.shader_caps[SHADER_CAP_FLOAT64] = options.DoublePrecisionFloatShaderOps;
if (is_geometry_shader_supported(device))

View File

@@ -153,6 +153,8 @@ static bool check_gl_extensions(struct gl_runner *runner)
if (check_gl_extension("GL_EXT_depth_bounds_test", count))
runner->caps.shader_caps[SHADER_CAP_DEPTH_BOUNDS] = true;
if (check_gl_extension("GL_ARB_cull_distance", count))
runner->caps.shader_caps[SHADER_CAP_CULL_DISTANCE] = true;
if (check_gl_extension("GL_ARB_gpu_shader_fp64", count))
runner->caps.shader_caps[SHADER_CAP_FLOAT64] = true;
if (check_gl_extension("GL_ARB_gpu_shader_int64", count))

View File

@@ -1877,6 +1877,12 @@ static bool init_vulkan_runner(struct vulkan_shader_runner *runner)
runner->caps.shader_caps[SHADER_CAP_GEOMETRY_SHADER] = true;
}
if (ret_features->shaderCullDistance)
{
features.shaderCullDistance = VK_TRUE;
runner->caps.shader_caps[SHADER_CAP_CULL_DISTANCE] = true;
}
if (ret_features->shaderFloat64)
{
features.shaderFloat64 = VK_TRUE;