mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-12-15 08:03:30 -08:00
tests/shader_runner: Introduce a new tag system.
Mostly to be able to associate a version number to each tag and get rid of all the foo<1.2.3 tags. The new system also has fixed tag slots, rather than dealing with strings, so we don't have to manually adjust the size of the `tags' array. With the new system each tag can be present or not, and if it is present it can have an associated version number (of the form major.minor.patch). If the version is not available, it is set to 0.0.0. Each tag can be queried for existence and for comparison with the version number.
This commit is contained in:
committed by
Henri Verbeet
parent
41515b7047
commit
cd64aa69c8
Notes:
Henri Verbeet
2025-10-06 19:48:45 +02:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1768
@@ -491,7 +491,12 @@ static inline bool is_mesa_device(ID3D12Device *device)
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool is_mesa_device_lt(ID3D12Device *device, uint32_t major, uint32_t minor, uint32_t patch)
|
||||
static inline bool get_mesa_device_version(ID3D12Device *device, uint32_t *major, uint32_t *minor, uint32_t *patch)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool get_llvm_device_version(ID3D12Device *device, uint32_t *major, uint32_t *minor, uint32_t *patch)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -501,12 +506,6 @@ static inline bool is_llvmpipe_device(ID3D12Device *device)
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool is_llvmpipe_device_gte(ID3D12Device *device,
|
||||
uint32_t major, uint32_t minor, uint32_t patch)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool is_nvidia_device(ID3D12Device *device)
|
||||
{
|
||||
return false;
|
||||
@@ -538,12 +537,12 @@ static inline bool is_mvk_paravirtualized_device(ID3D12Device *device)
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool is_mvk_device_lt(ID3D12Device *device, uint32_t major, uint32_t minor, uint32_t patch)
|
||||
static inline bool get_mvk_device_version(ID3D12Device *device, uint32_t *major, uint32_t *minor, uint32_t *patch)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool is_mesa_device_with_llvm_ge(ID3D12Device *device, uint32_t major, uint32_t minor, uint32_t patch)
|
||||
static inline bool is_mvk_device_lt(ID3D12Device *device, uint32_t major, uint32_t minor, uint32_t patch)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -796,18 +795,24 @@ static inline bool is_mesa_device(ID3D12Device *device)
|
||||
return is_mesa_vulkan_driver(&properties);
|
||||
}
|
||||
|
||||
static inline bool is_mesa_device_lt(ID3D12Device *device, uint32_t major, uint32_t minor, uint32_t patch)
|
||||
static inline bool get_mesa_device_version(ID3D12Device *device, uint32_t *major, uint32_t *minor, uint32_t *patch)
|
||||
{
|
||||
VkPhysicalDeviceDriverPropertiesKHR driver_properties;
|
||||
uint32_t driver_major, driver_minor, driver_patch;
|
||||
VkPhysicalDeviceDriverPropertiesKHR properties;
|
||||
VkPhysicalDeviceProperties device_properties;
|
||||
|
||||
get_driver_properties(device, &device_properties, &driver_properties);
|
||||
get_driver_properties(device, &device_properties, &properties);
|
||||
|
||||
if (!get_mesa_driver_version(&device_properties, &driver_properties, &driver_major, &driver_minor, &driver_patch))
|
||||
return false;
|
||||
return get_mesa_driver_version(&device_properties, &properties, major, minor, patch);
|
||||
}
|
||||
|
||||
return compare_versions(driver_major, driver_minor, driver_patch, major, minor, patch) < 0;
|
||||
static inline bool get_llvm_device_version(ID3D12Device *device, uint32_t *major, uint32_t *minor, uint32_t *patch)
|
||||
{
|
||||
VkPhysicalDeviceDriverPropertiesKHR properties;
|
||||
VkPhysicalDeviceProperties device_properties;
|
||||
|
||||
get_driver_properties(device, &device_properties, &properties);
|
||||
|
||||
return get_llvm_driver_version(&device_properties, major, minor, patch);
|
||||
}
|
||||
|
||||
static inline bool is_llvmpipe_device(ID3D12Device *device)
|
||||
@@ -818,17 +823,6 @@ static inline bool is_llvmpipe_device(ID3D12Device *device)
|
||||
return properties.driverID == VK_DRIVER_ID_MESA_LLVMPIPE;
|
||||
}
|
||||
|
||||
static inline bool is_llvmpipe_device_gte(ID3D12Device *device,
|
||||
uint32_t major, uint32_t minor, uint32_t patch)
|
||||
{
|
||||
VkPhysicalDeviceDriverPropertiesKHR driver_properties;
|
||||
VkPhysicalDeviceProperties device_properties;
|
||||
|
||||
get_driver_properties(device, &device_properties, &driver_properties);
|
||||
return driver_properties.driverID == VK_DRIVER_ID_MESA_LLVMPIPE
|
||||
&& is_vulkan_driver_version_ge(&device_properties, &driver_properties, major, minor, patch);
|
||||
}
|
||||
|
||||
static inline bool is_nvidia_device(ID3D12Device *device)
|
||||
{
|
||||
VkPhysicalDeviceDriverPropertiesKHR properties;
|
||||
@@ -886,33 +880,24 @@ static inline bool is_mvk_paravirtualized_device(ID3D12Device *device)
|
||||
&& strcmp(device_properties.deviceName, "Apple Paravirtual device") == 0;
|
||||
}
|
||||
|
||||
static inline bool is_mvk_device_lt(ID3D12Device *device, uint32_t major, uint32_t minor, uint32_t patch)
|
||||
static inline bool get_mvk_device_version(ID3D12Device *device, uint32_t *major, uint32_t *minor, uint32_t *patch)
|
||||
{
|
||||
VkPhysicalDeviceDriverPropertiesKHR driver_properties;
|
||||
uint32_t driver_major, driver_minor, driver_patch;
|
||||
VkPhysicalDeviceDriverPropertiesKHR properties;
|
||||
VkPhysicalDeviceProperties device_properties;
|
||||
|
||||
get_driver_properties(device, &device_properties, &driver_properties);
|
||||
get_driver_properties(device, &device_properties, &properties);
|
||||
|
||||
if (!get_mvk_driver_version(&device_properties, &driver_properties, &driver_major, &driver_minor, &driver_patch))
|
||||
return false;
|
||||
|
||||
return compare_versions(driver_major, driver_minor, driver_patch, major, minor, patch) < 0;
|
||||
return get_mvk_driver_version(&device_properties, &properties, major, minor, patch);
|
||||
}
|
||||
|
||||
static inline bool is_mesa_device_with_llvm_ge(ID3D12Device *device, uint32_t major, uint32_t minor, uint32_t patch)
|
||||
static inline bool is_mvk_device_lt(ID3D12Device *device, uint32_t major, uint32_t minor, uint32_t patch)
|
||||
{
|
||||
VkPhysicalDeviceDriverPropertiesKHR driver_properties;
|
||||
VkPhysicalDeviceProperties device_properties;
|
||||
uint32_t llvm_major, llvm_minor, llvm_patch;
|
||||
uint32_t device_major, device_minor, device_patch;
|
||||
|
||||
get_driver_properties(device, &device_properties, &driver_properties);
|
||||
|
||||
if (!get_llvm_driver_version(&device_properties, &llvm_major, &llvm_minor, &llvm_patch))
|
||||
if (!get_mvk_device_version(device, &device_major, &device_minor, &device_patch))
|
||||
return false;
|
||||
|
||||
return is_mesa_vulkan_driver(&driver_properties)
|
||||
&& compare_versions(llvm_major, llvm_minor, llvm_patch, major, minor, patch) >= 0;
|
||||
return compare_versions(device_major, device_minor, device_patch, major, minor, patch) < 0;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
@@ -133,40 +133,113 @@ static enum shader_model match_shader_model_string(const char *string, const cha
|
||||
fatal_error("Unrecognized shader model '%s'.\n", string);
|
||||
}
|
||||
|
||||
static bool match_tag(struct shader_runner *runner, const char *tag)
|
||||
static const char * const shader_runner_tag_names[SHADER_RUNNER_TAG_COUNT] =
|
||||
{
|
||||
for (size_t i = 0; i < runner->caps->tag_count; ++i)
|
||||
[SHADER_RUNNER_TAG_D3D11] = "d3d11",
|
||||
[SHADER_RUNNER_TAG_D3D12] = "d3d12",
|
||||
[SHADER_RUNNER_TAG_GLSL] = "glsl",
|
||||
[SHADER_RUNNER_TAG_LLVM] = "llvm",
|
||||
[SHADER_RUNNER_TAG_LLVMPIPE] = "llvmpipe",
|
||||
[SHADER_RUNNER_TAG_MESA] = "mesa",
|
||||
[SHADER_RUNNER_TAG_MSL] = "msl",
|
||||
[SHADER_RUNNER_TAG_MVK] = "mvk",
|
||||
[SHADER_RUNNER_TAG_NVIDIA] = "nvidia",
|
||||
[SHADER_RUNNER_TAG_OPENGL] = "opengl",
|
||||
[SHADER_RUNNER_TAG_VULKAN] = "vulkan",
|
||||
[SHADER_RUNNER_TAG_WARP] = "warp",
|
||||
[SHADER_RUNNER_TAG_WINDOWS] = "windows",
|
||||
};
|
||||
|
||||
static bool match_tag(struct shader_runner *runner, enum shader_runner_tag tag, const char **line)
|
||||
{
|
||||
if (!strcmp(tag, runner->caps->tags[i]))
|
||||
return true;
|
||||
int ret, advance_major, advance_minor, advance_patch, comparison_result;
|
||||
const struct shader_runner_tag_value *value = &runner->caps->tags[tag];
|
||||
uint32_t major, minor, patch;
|
||||
char comparison[2];
|
||||
|
||||
comparison[0] = **line;
|
||||
switch (comparison[0])
|
||||
{
|
||||
case '<':
|
||||
case '>':
|
||||
case '=':
|
||||
case '!':
|
||||
++*line;
|
||||
break;
|
||||
|
||||
default:
|
||||
return value->present;
|
||||
}
|
||||
|
||||
return false;
|
||||
comparison[1] = **line;
|
||||
switch (comparison[1])
|
||||
{
|
||||
case '=':
|
||||
if (comparison[0] == '=')
|
||||
fatal_error("Invalid comparison with '==': '%s'.\n", *line);
|
||||
++*line;
|
||||
break;
|
||||
|
||||
default:
|
||||
comparison[1] = '\0';
|
||||
break;
|
||||
}
|
||||
|
||||
if (comparison[0] == '!' && comparison[1] != '=')
|
||||
fatal_error("Invalid comparison with '%c%c': '%s'.\n", comparison[0], comparison[1], *line);
|
||||
|
||||
ret = sscanf(*line, "%u%n.%u%n.%u%n", &major, &advance_major,
|
||||
&minor, &advance_minor, &patch, &advance_patch);
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case 1:
|
||||
/* Comparison with just major. */
|
||||
*line += advance_major;
|
||||
minor = 0;
|
||||
patch = 0;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/* Comparison with major.minor. */
|
||||
*line += advance_minor;
|
||||
patch = 0;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/* Comparison with major.minor.patch. */
|
||||
*line += advance_patch;
|
||||
break;
|
||||
|
||||
default:
|
||||
fatal_error("Invalid comparison version '%s'.\n", *line);
|
||||
break;
|
||||
}
|
||||
|
||||
comparison_result = compare_versions(value->major, value->minor, value->patch, major, minor, patch);
|
||||
|
||||
switch (comparison[0])
|
||||
{
|
||||
case '<':
|
||||
return comparison[1] == '=' ? comparison_result <= 0 : comparison_result < 0;
|
||||
|
||||
case '>':
|
||||
return comparison[1] == '=' ? comparison_result >= 0 : comparison_result > 0;
|
||||
|
||||
case '=':
|
||||
return comparison_result == 0;
|
||||
|
||||
case '!':
|
||||
return comparison_result != 0;
|
||||
|
||||
default:
|
||||
fatal_error("Invalid tag comparison '%s'.\n", *line);
|
||||
}
|
||||
}
|
||||
|
||||
static bool check_qualifier_args_conjunction(struct shader_runner *runner,
|
||||
const char *line, const char **const rest, uint32_t *model_mask)
|
||||
{
|
||||
/* Tags are tested in this order, so tag X must appear before Y if Y is a
|
||||
* prefix of X. */
|
||||
static const char *const valid_tags[] =
|
||||
{
|
||||
"d3d11",
|
||||
"d3d12",
|
||||
"glsl",
|
||||
"llvm>=16",
|
||||
"llvmpipe",
|
||||
"mesa<23.3",
|
||||
"mesa<25.1",
|
||||
"msl",
|
||||
"mvk<1.2.11",
|
||||
"mvk",
|
||||
"nvidia",
|
||||
"opengl",
|
||||
"vulkan",
|
||||
"warp",
|
||||
"windows",
|
||||
};
|
||||
bool holds = true;
|
||||
|
||||
*model_mask = ~0u;
|
||||
@@ -207,18 +280,20 @@ static bool check_qualifier_args_conjunction(struct shader_runner *runner,
|
||||
++line;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < ARRAY_SIZE(valid_tags); ++i)
|
||||
/* Iterate backwards to avoid matching prefixes of other tags
|
||||
* (e.g., matching the "llvm" prefix of "llvmpipe"). */
|
||||
for (unsigned int i = ARRAY_SIZE(shader_runner_tag_names) - 1; i != UINT_MAX; --i)
|
||||
{
|
||||
const char *option_text = valid_tags[i];
|
||||
size_t option_len = strlen(option_text);
|
||||
const char *tag_name = shader_runner_tag_names[i];
|
||||
size_t tag_len = strlen(tag_name);
|
||||
bool tag_match;
|
||||
|
||||
if (strncmp(line, option_text, option_len))
|
||||
if (strncmp(line, tag_name, tag_len))
|
||||
continue;
|
||||
|
||||
match = true;
|
||||
line += option_len;
|
||||
tag_match = match_tag(runner, option_text);
|
||||
line += tag_len;
|
||||
tag_match = match_tag(runner, i, &line);
|
||||
holds &= negate ? !tag_match : tag_match;
|
||||
break;
|
||||
}
|
||||
@@ -2047,19 +2122,35 @@ static bool check_capabilities(const struct shader_runner *runner, const struct
|
||||
|
||||
static void trace_tags(const struct shader_runner_caps *caps)
|
||||
{
|
||||
size_t i, rem, count = 0;
|
||||
char tags[80], *p;
|
||||
size_t rem;
|
||||
int rc;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(caps->tags); ++i)
|
||||
{
|
||||
count += caps->tags[i].present;
|
||||
}
|
||||
|
||||
if (!count)
|
||||
return;
|
||||
|
||||
p = tags;
|
||||
rem = ARRAY_SIZE(tags);
|
||||
rc = snprintf(p, rem, "%8s:", "tags");
|
||||
p += rc;
|
||||
rem -= rc;
|
||||
|
||||
for (size_t i = 0; i < caps->tag_count; ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(caps->tags); ++i)
|
||||
{
|
||||
rc = snprintf(p, rem, " \"%s\"%s", caps->tags[i], i == caps->tag_count - 1 ? "" : ",");
|
||||
char version[64] = "";
|
||||
|
||||
if (!caps->tags[i].present)
|
||||
continue;
|
||||
|
||||
if (caps->tags[i].major != 0 || caps->tags[i].minor != 0 || caps->tags[i].patch != 0)
|
||||
sprintf(version, " (%u.%u.%u)", caps->tags[i].major, caps->tags[i].minor, caps->tags[i].patch);
|
||||
|
||||
rc = snprintf(p, rem, " \"%s\"%s%s", shader_runner_tag_names[i], version, count == 1 ? "" : ",");
|
||||
if (!(rc >= 0 && (size_t)rc < rem))
|
||||
{
|
||||
*p = 0;
|
||||
@@ -2070,6 +2161,10 @@ static void trace_tags(const struct shader_runner_caps *caps)
|
||||
rc = snprintf(p, rem, "%8s ", "");
|
||||
--i;
|
||||
}
|
||||
else
|
||||
{
|
||||
--count;
|
||||
}
|
||||
p += rc;
|
||||
rem -= rc;
|
||||
}
|
||||
@@ -2222,7 +2317,6 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
|
||||
trace("Compiling SM%s-SM%s shaders with %s and executing with %s.\n",
|
||||
model_strings[minimum_shader_model], model_strings[maximum_shader_model],
|
||||
caps->compiler, caps->runner);
|
||||
if (caps->tag_count)
|
||||
trace_tags(caps);
|
||||
trace_shader_caps(caps->shader_caps);
|
||||
trace_format_cap(caps, FORMAT_CAP_UAV_LOAD, "uav-load");
|
||||
|
||||
@@ -164,12 +164,35 @@ enum shader_cap
|
||||
SHADER_CAP_COUNT,
|
||||
};
|
||||
|
||||
enum shader_runner_tag
|
||||
{
|
||||
SHADER_RUNNER_TAG_D3D11,
|
||||
SHADER_RUNNER_TAG_D3D12,
|
||||
SHADER_RUNNER_TAG_GLSL,
|
||||
SHADER_RUNNER_TAG_LLVM,
|
||||
SHADER_RUNNER_TAG_LLVMPIPE,
|
||||
SHADER_RUNNER_TAG_MESA,
|
||||
SHADER_RUNNER_TAG_MSL,
|
||||
SHADER_RUNNER_TAG_MVK,
|
||||
SHADER_RUNNER_TAG_NVIDIA,
|
||||
SHADER_RUNNER_TAG_OPENGL,
|
||||
SHADER_RUNNER_TAG_VULKAN,
|
||||
SHADER_RUNNER_TAG_WARP,
|
||||
SHADER_RUNNER_TAG_WINDOWS,
|
||||
SHADER_RUNNER_TAG_COUNT,
|
||||
};
|
||||
|
||||
struct shader_runner_tag_value
|
||||
{
|
||||
bool present;
|
||||
uint32_t major, minor, patch;
|
||||
};
|
||||
|
||||
struct shader_runner_caps
|
||||
{
|
||||
const char *runner;
|
||||
const char *compiler;
|
||||
const char *tags[6];
|
||||
size_t tag_count;
|
||||
struct shader_runner_tag_value tags[SHADER_RUNNER_TAG_COUNT];
|
||||
enum shader_model minimum_shader_model;
|
||||
enum shader_model maximum_shader_model;
|
||||
bool shader_caps[SHADER_CAP_COUNT];
|
||||
|
||||
@@ -358,12 +358,14 @@ static BOOL init_test_context(struct d3d11_shader_runner *runner)
|
||||
runner->caps.format_caps[formats[i]] = get_format_support(runner->device, formats[i]);
|
||||
}
|
||||
|
||||
runner->caps.tag_count = 0;
|
||||
runner->caps.tags[runner->caps.tag_count++] = "d3d11";
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_D3D11].present = true;
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_WINDOWS].present = true;
|
||||
|
||||
if (test_options.use_warp_device)
|
||||
runner->caps.tags[runner->caps.tag_count++] = "warp";
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_WARP].present = true;
|
||||
|
||||
if (is_nvidia_windows_device(runner->device))
|
||||
runner->caps.tags[runner->caps.tag_count++] = "nvidia";
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_NVIDIA].present = true;
|
||||
|
||||
rt_width = RENDER_TARGET_WIDTH;
|
||||
rt_height = RENDER_TARGET_HEIGHT;
|
||||
|
||||
@@ -1121,32 +1121,31 @@ static void d3d12_runner_init_caps(struct d3d12_shader_runner *runner,
|
||||
runner->caps.shader_caps[SHADER_CAP_WAVE_OPS] = options1.WaveOps;
|
||||
runner->caps.shader_caps[SHADER_CAP_NATIVE_16_BIT] = options4.Native16BitShaderOpsSupported;
|
||||
|
||||
runner->caps.tag_count = 0;
|
||||
runner->caps.tags[runner->caps.tag_count++] = "d3d12";
|
||||
if (is_mvk_device(device))
|
||||
{
|
||||
runner->caps.tags[runner->caps.tag_count++] = "mvk";
|
||||
if (is_mvk_device_lt(device, 1, 2, 11))
|
||||
runner->caps.tags[runner->caps.tag_count++] = "mvk<1.2.11";
|
||||
}
|
||||
else
|
||||
{
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_D3D12].present = true;
|
||||
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_MVK].present = get_mvk_device_version(device,
|
||||
&runner->caps.tags[SHADER_RUNNER_TAG_MVK].major, &runner->caps.tags[SHADER_RUNNER_TAG_MVK].minor,
|
||||
&runner->caps.tags[SHADER_RUNNER_TAG_MVK].patch);
|
||||
|
||||
if (is_llvmpipe_device(device))
|
||||
runner->caps.tags[runner->caps.tag_count++] = "llvmpipe";
|
||||
if (is_mesa_device_lt(device, 23, 3, 0))
|
||||
runner->caps.tags[runner->caps.tag_count++] = "mesa<23.3";
|
||||
if (is_mesa_device_lt(device, 25, 1, 0))
|
||||
runner->caps.tags[runner->caps.tag_count++] = "mesa<25.1";
|
||||
if (is_mesa_device_with_llvm_ge(device, 16, 0, 0))
|
||||
runner->caps.tags[runner->caps.tag_count++] = "llvm>=16";
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_LLVMPIPE].present = true;
|
||||
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_MESA].present = get_mesa_device_version(device,
|
||||
&runner->caps.tags[SHADER_RUNNER_TAG_MESA].major, &runner->caps.tags[SHADER_RUNNER_TAG_MESA].minor,
|
||||
&runner->caps.tags[SHADER_RUNNER_TAG_MESA].patch);
|
||||
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_LLVM].present = get_llvm_device_version(device,
|
||||
&runner->caps.tags[SHADER_RUNNER_TAG_LLVM].major, &runner->caps.tags[SHADER_RUNNER_TAG_LLVM].minor,
|
||||
&runner->caps.tags[SHADER_RUNNER_TAG_LLVM].patch);
|
||||
|
||||
if (test_options.use_warp_device)
|
||||
runner->caps.tags[runner->caps.tag_count++] = "warp";
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_WARP].present = true;
|
||||
|
||||
if (is_nvidia_windows_device(device) || is_nvidia_device(device))
|
||||
runner->caps.tags[runner->caps.tag_count++] = "nvidia";
|
||||
}
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_NVIDIA].present = true;
|
||||
|
||||
#ifdef _WIN32
|
||||
runner->caps.tags[runner->caps.tag_count++] = "windows";
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_WINDOWS].present = true;
|
||||
#endif
|
||||
|
||||
for (unsigned int i = 0; i < ARRAY_SIZE(formats); ++i)
|
||||
|
||||
@@ -247,14 +247,14 @@ static uint32_t get_format_support(struct gl_runner *runner, enum DXGI_FORMAT fo
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool check_mesa_version_lt(unsigned int major, unsigned int minor, unsigned int patch)
|
||||
static bool get_mesa_version(uint32_t *major, uint32_t *minor, uint32_t *patch)
|
||||
{
|
||||
return compare_version_string_lt((const char *)glGetString(GL_VERSION), "Mesa ", major, minor, patch);
|
||||
return find_version_string((const char *)glGetString(GL_VERSION), "Mesa ", major, minor, patch);
|
||||
}
|
||||
|
||||
static bool check_llvm_version_ge(unsigned int major, unsigned int minor, unsigned int patch)
|
||||
static bool get_llvm_version(uint32_t *major, uint32_t *minor, uint32_t *patch)
|
||||
{
|
||||
return compare_version_string_ge((const char *)glGetString(GL_RENDERER), "LLVM ", major, minor, patch);
|
||||
return find_version_string((const char *)glGetString(GL_RENDERER), "LLVM ", major, minor, patch);
|
||||
}
|
||||
|
||||
static bool gl_runner_init(struct gl_runner *runner, enum shading_language language)
|
||||
@@ -378,16 +378,21 @@ static bool gl_runner_init(struct gl_runner *runner, enum shading_language langu
|
||||
runner->caps.maximum_shader_model = SHADER_MODEL_5_1;
|
||||
runner->caps.shader_caps[SHADER_CAP_GEOMETRY_SHADER] = true;
|
||||
|
||||
runner->caps.tag_count = 0;
|
||||
runner->caps.tags[runner->caps.tag_count++] = "opengl";
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_OPENGL].present = true;
|
||||
|
||||
if (runner->language == GLSL)
|
||||
runner->caps.tags[runner->caps.tag_count++] = "glsl";
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_GLSL].present = true;
|
||||
|
||||
if (strncmp((const char *)glGetString(GL_RENDERER), "llvmpipe ", 9) == 0)
|
||||
runner->caps.tags[runner->caps.tag_count++] = "llvmpipe";
|
||||
if (check_mesa_version_lt(25, 1, 0))
|
||||
runner->caps.tags[runner->caps.tag_count++] = "mesa<25.1";
|
||||
if (check_llvm_version_ge(16, 0, 0))
|
||||
runner->caps.tags[runner->caps.tag_count++] = "llvm>=16";
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_LLVMPIPE].present = true;
|
||||
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_MESA].present = get_mesa_version(
|
||||
&runner->caps.tags[SHADER_RUNNER_TAG_MESA].major, &runner->caps.tags[SHADER_RUNNER_TAG_MESA].minor,
|
||||
&runner->caps.tags[SHADER_RUNNER_TAG_MESA].patch);
|
||||
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_LLVM].present = get_llvm_version(
|
||||
&runner->caps.tags[SHADER_RUNNER_TAG_LLVM].major, &runner->caps.tags[SHADER_RUNNER_TAG_LLVM].minor,
|
||||
&runner->caps.tags[SHADER_RUNNER_TAG_LLVM].patch);
|
||||
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &extension_count);
|
||||
if (check_gl_extension("GL_ARB_internalformat_query2", extension_count))
|
||||
|
||||
@@ -1189,8 +1189,8 @@ static bool metal_runner_init(struct metal_runner *runner)
|
||||
}
|
||||
|
||||
runner->caps.runner = "Metal";
|
||||
runner->caps.tags[0] = "msl";
|
||||
runner->caps.tag_count = 1;
|
||||
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_MSL].present = true;
|
||||
|
||||
if (runner->device.readWriteTextureSupport >= MTLReadWriteTextureTier1)
|
||||
{
|
||||
|
||||
@@ -1779,29 +1779,22 @@ static bool init_vulkan_runner(struct vulkan_shader_runner *runner)
|
||||
get_physical_device_info(runner, &device_info);
|
||||
ret_features = &device_info.features2.features;
|
||||
|
||||
runner->caps.tag_count = 0;
|
||||
runner->caps.tags[runner->caps.tag_count++] = "vulkan";
|
||||
if (device_info.driver_properties.driverID == VK_DRIVER_ID_MOLTENVK)
|
||||
{
|
||||
runner->caps.tags[runner->caps.tag_count++] = "mvk";
|
||||
}
|
||||
else
|
||||
{
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_VULKAN].present = true;
|
||||
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_MVK].present = get_mvk_driver_version(&device_info.properties2.properties,
|
||||
&device_info.driver_properties, &runner->caps.tags[SHADER_RUNNER_TAG_MVK].major,
|
||||
&runner->caps.tags[SHADER_RUNNER_TAG_MVK].minor, &runner->caps.tags[SHADER_RUNNER_TAG_MVK].patch);
|
||||
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_MESA].present = get_mesa_driver_version(&device_info.properties2.properties,
|
||||
&device_info.driver_properties, &runner->caps.tags[SHADER_RUNNER_TAG_MESA].major,
|
||||
&runner->caps.tags[SHADER_RUNNER_TAG_MESA].minor, &runner->caps.tags[SHADER_RUNNER_TAG_MESA].patch);
|
||||
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_LLVM].present = get_llvm_driver_version(
|
||||
&device_info.properties2.properties, &runner->caps.tags[SHADER_RUNNER_TAG_LLVM].major,
|
||||
&runner->caps.tags[SHADER_RUNNER_TAG_LLVM].minor, &runner->caps.tags[SHADER_RUNNER_TAG_LLVM].patch);
|
||||
|
||||
if (device_info.driver_properties.driverID == VK_DRIVER_ID_MESA_LLVMPIPE)
|
||||
runner->caps.tags[runner->caps.tag_count++] = "llvmpipe";
|
||||
if (is_mesa_vulkan_driver(&device_info.driver_properties))
|
||||
{
|
||||
if (!is_vulkan_driver_version_ge(&device_info.properties2.properties,
|
||||
&device_info.driver_properties, 23, 3, 0))
|
||||
runner->caps.tags[runner->caps.tag_count++] = "mesa<23.3";
|
||||
if (!is_vulkan_driver_version_ge(&device_info.properties2.properties,
|
||||
&device_info.driver_properties, 25, 1, 0))
|
||||
runner->caps.tags[runner->caps.tag_count++] = "mesa<25.1";
|
||||
if (compare_version_string_ge(device_info.properties2.properties.deviceName,
|
||||
"LLVM ", 16, 0 ,0))
|
||||
runner->caps.tags[runner->caps.tag_count++] = "llvm>=16";
|
||||
}
|
||||
}
|
||||
runner->caps.tags[SHADER_RUNNER_TAG_LLVMPIPE].present = true;
|
||||
|
||||
runner->caps.shader_caps[SHADER_CAP_CLIP_PLANES] = true;
|
||||
runner->caps.shader_caps[SHADER_CAP_FOG] = true;
|
||||
|
||||
@@ -727,26 +727,4 @@ static inline bool find_version_string(const char *str, const char *tag,
|
||||
return 3 == sscanf(ptr, "%u.%u.%u", major, minor, patch);
|
||||
}
|
||||
|
||||
static inline bool compare_version_string_lt(const char *str, const char *tag,
|
||||
uint32_t major, uint32_t minor, uint32_t patch)
|
||||
{
|
||||
uint32_t major2, minor2, patch2;
|
||||
|
||||
if (!find_version_string(str, tag, &major2, &minor2, &patch2))
|
||||
return false;
|
||||
|
||||
return compare_versions(major, minor, patch, major2, minor2, patch2) > 0;
|
||||
}
|
||||
|
||||
static inline bool compare_version_string_ge(const char *str, const char *tag,
|
||||
uint32_t major, uint32_t minor, uint32_t patch)
|
||||
{
|
||||
uint32_t major2, minor2, patch2;
|
||||
|
||||
if (!find_version_string(str, tag, &major2, &minor2, &patch2))
|
||||
return false;
|
||||
|
||||
return compare_versions(major, minor, patch, major2, minor2, patch2) <= 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -449,17 +449,6 @@ static inline void get_vulkan_driver_version(const VkPhysicalDeviceProperties *d
|
||||
*patch = VK_VERSION_PATCH(version);
|
||||
}
|
||||
|
||||
static inline bool is_vulkan_driver_version_ge(const VkPhysicalDeviceProperties *device_properties,
|
||||
const VkPhysicalDeviceDriverPropertiesKHR *driver_properties,
|
||||
uint32_t major, uint32_t minor, uint32_t patch)
|
||||
{
|
||||
uint32_t driver_major, driver_minor, driver_patch;
|
||||
|
||||
get_vulkan_driver_version(device_properties, driver_properties, &driver_major, &driver_minor, &driver_patch);
|
||||
|
||||
return compare_versions(driver_major, driver_minor, driver_patch, major, minor, patch) >= 0;
|
||||
}
|
||||
|
||||
static inline bool is_mesa_vulkan_driver(const VkPhysicalDeviceDriverPropertiesKHR *properties)
|
||||
{
|
||||
switch (properties->driverID)
|
||||
|
||||
Reference in New Issue
Block a user