tests/shader-runner: Make geometry shaders optional.

This allows the Vulkan runner to execute in environments which do
not support geometry shaders, most notably MoltenVK. In particular,
that enables SM<4 shaders to run in such environments
This commit is contained in:
Giovanni Mascellani 2024-10-14 21:48:41 +02:00 committed by Henri Verbeet
parent 7f834f57e5
commit bc351f4b70
Notes: Henri Verbeet 2024-10-15 17:05:20 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1182
7 changed files with 33 additions and 13 deletions

View File

@ -1,5 +1,6 @@
[require]
shader model >= 4.0
geometry-shader
[input layout]
0 r32g32b32a32-float SV_POSITION

View File

@ -1,5 +1,7 @@
[require]
shader model >= 5.0
% Used for SV_PrimitiveID/SpvBuiltInPrimitiveId.
geometry-shader
[rtv 0]
format r32-uint
@ -61,6 +63,7 @@ uint4 main(float4 pos : SV_Position, uint id : SV_PrimitiveID) : SV_Target
[require]
shader model >= 5.0
geometry-shader
rov
[test]

View File

@ -386,6 +386,10 @@ static void parse_require_directive(struct shader_runner *runner, const char *li
fatal_error("Unknown format cap '%s'.\n", line);
}
}
else if (match_string(line, "geometry-shader", &line))
{
runner->require_geometry_shader = true;
}
else if (match_string(line, "float64", &line))
{
runner->require_float64 = true;
@ -1563,6 +1567,8 @@ static bool check_capabilities(const struct shader_runner *runner, const struct
{
unsigned int i;
if (runner->require_geometry_shader && !caps->geometry_shader)
return false;
if (runner->require_float64 && !caps->float64)
return false;
if (runner->require_int64 && !caps->int64)
@ -1626,7 +1632,7 @@ static void trace_format_cap(const struct shader_runner_caps *caps, enum format_
p = buffer;
rem = ARRAY_SIZE(buffer);
rc = snprintf(p, rem, "%14s:", cap_name);
rc = snprintf(p, rem, "%15s:", cap_name);
p += rc;
rem -= rc;
@ -1688,6 +1694,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
dxc_compiler ? "dxcompiler" : HLSL_COMPILER, caps->runner);
if (caps->tag_count)
trace_tags(caps);
trace("geometry-shader: %u.\n", caps->geometry_shader);
trace(" float64: %u.\n", caps->float64);
trace(" int64: %u.\n", caps->int64);
trace(" rov: %u.\n", caps->rov);
@ -1956,6 +1963,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
state = STATE_REQUIRE;
runner->minimum_shader_model = caps->minimum_shader_model;
runner->maximum_shader_model = caps->maximum_shader_model;
runner->require_geometry_shader = false;
runner->require_float64 = false;
runner->require_int64 = false;
runner->require_rov = false;

View File

@ -142,6 +142,7 @@ struct shader_runner_caps
size_t tag_count;
enum shader_model minimum_shader_model;
enum shader_model maximum_shader_model;
bool geometry_shader;
bool float64;
bool int64;
bool rov;
@ -181,6 +182,7 @@ struct shader_runner
char *gs_source;
enum shader_model minimum_shader_model;
enum shader_model maximum_shader_model;
bool require_geometry_shader;
bool require_float64;
bool require_int64;
bool require_rov;

View File

@ -1022,6 +1022,7 @@ static void d3d12_runner_init_caps(struct d3d12_shader_runner *runner,
#endif
runner->caps.minimum_shader_model = minimum_shader_model;
runner->caps.maximum_shader_model = maximum_shader_model;
runner->caps.geometry_shader = true;
runner->caps.float64 = options.DoublePrecisionFloatShaderOps;
runner->caps.int64 = options1.Int64ShaderOps;
runner->caps.rov = options.ROVsSupported;

View File

@ -346,6 +346,7 @@ static bool gl_runner_init(struct gl_runner *runner, enum shading_language langu
runner->caps.tag_count = runner->language == GLSL;
runner->caps.minimum_shader_model = SHADER_MODEL_4_0;
runner->caps.maximum_shader_model = SHADER_MODEL_5_1;
runner->caps.geometry_shader = true;
glGetIntegerv(GL_NUM_EXTENSIONS, &extension_count);
if (check_gl_extension("GL_ARB_internalformat_query2", extension_count))

View File

@ -1571,12 +1571,16 @@ static bool init_vulkan_runner(struct vulkan_shader_runner *runner)
features.x = VK_TRUE
ENABLE_FEATURE(fragmentStoresAndAtomics);
/* For SV_PrimitiveID/SpvBuiltInPrimitiveId in fragment shaders. */
ENABLE_FEATURE(geometryShader);
ENABLE_FEATURE(shaderClipDistance);
ENABLE_FEATURE(shaderImageGatherExtended);
ENABLE_FEATURE(shaderStorageImageWriteWithoutFormat);
if (ret_features->geometryShader)
{
features.geometryShader = VK_TRUE;
runner->caps.geometry_shader = true;
}
if (ret_features->shaderFloat64)
{
features.shaderFloat64 = VK_TRUE;