tests/shader_runner: Add a "mesa<23.3" tag.

This commit is contained in:
Anna (navi) Figueiredo Gomes 2024-12-12 21:02:33 +01:00 committed by Henri Verbeet
parent 31ea11fb0e
commit d5ed4df254
Notes: Henri Verbeet 2024-12-19 21:25:35 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1179
6 changed files with 85 additions and 30 deletions

View File

@ -480,6 +480,11 @@ static inline bool is_mesa_device(ID3D12Device *device)
return false; return false;
} }
static inline bool is_mesa_device_lt(ID3D12Device *device, uint32_t major, uint32_t minor, uint32_t patch)
{
return false;
}
static inline bool is_mesa_intel_device(ID3D12Device *device) static inline bool is_mesa_intel_device(ID3D12Device *device)
{ {
return false; return false;
@ -531,10 +536,12 @@ static inline bool is_depth_clip_enable_supported(ID3D12Device *device)
#define VKD3D_AGILITY_SDK_EXPORTS #define VKD3D_AGILITY_SDK_EXPORTS
#include "vulkan_utils.h"
#define DECLARE_VK_PFN(name) static PFN_##name name; #define DECLARE_VK_PFN(name) static PFN_##name name;
DECLARE_VK_PFN(vkGetInstanceProcAddr) DECLARE_VK_PFN(vkGetInstanceProcAddr)
#define VK_INSTANCE_PFN DECLARE_VK_PFN #define VK_INSTANCE_PFN DECLARE_VK_PFN
#include "vulkan_procs.h" #include "vulkan_procs.h"
#undef DECLARE_VK_PFN
static bool check_device_extension(VkPhysicalDevice vk_physical_device, const char *name) static bool check_device_extension(VkPhysicalDevice vk_physical_device, const char *name)
{ {
@ -750,9 +757,17 @@ static inline bool is_mesa_device(ID3D12Device *device)
VkPhysicalDeviceDriverPropertiesKHR properties; VkPhysicalDeviceDriverPropertiesKHR properties;
get_driver_properties(device, NULL, &properties); get_driver_properties(device, NULL, &properties);
return properties.driverID == VK_DRIVER_ID_MESA_RADV_KHR return is_mesa_vulkan_driver(&properties);
|| properties.driverID == VK_DRIVER_ID_MESA_LLVMPIPE }
|| properties.driverID == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA_KHR;
static inline bool is_mesa_device_lt(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 is_mesa_vulkan_driver(&driver_properties)
&& !is_vulkan_driver_version_ge(&device_properties, &driver_properties, major, minor, patch);
} }
static inline bool is_mesa_intel_device(ID3D12Device *device) static inline bool is_mesa_intel_device(ID3D12Device *device)
@ -778,24 +793,8 @@ static inline bool is_llvmpipe_device_gte(ID3D12Device *device,
VkPhysicalDeviceProperties device_properties; VkPhysicalDeviceProperties device_properties;
get_driver_properties(device, &device_properties, &driver_properties); get_driver_properties(device, &device_properties, &driver_properties);
if (driver_properties.driverID != VK_DRIVER_ID_MESA_LLVMPIPE) return driver_properties.driverID == VK_DRIVER_ID_MESA_LLVMPIPE
return false; && is_vulkan_driver_version_ge(&device_properties, &driver_properties, major, minor, patch);
if (device_properties.driverVersion == 1)
{
uint32_t driver_major, driver_minor, driver_patch;
/* llvmpipe doesn't provide a valid driverVersion value, so we resort to parsing the
* driverInfo string. */
if (sscanf(driver_properties.driverInfo, "Mesa %u.%u.%u",
&driver_major, &driver_minor, &driver_patch) == 3)
{
device_properties.driverVersion = VK_MAKE_API_VERSION(0,
driver_major, driver_minor, driver_patch);
}
}
return device_properties.driverVersion >= VK_MAKE_API_VERSION(0, major, minor, patch);
} }
static inline bool is_nvidia_device(ID3D12Device *device) static inline bool is_nvidia_device(ID3D12Device *device)

View File

@ -143,7 +143,7 @@ static bool match_tag(struct shader_runner *runner, const char *tag)
static bool check_qualifier_args_conjunction(struct shader_runner *runner, static bool check_qualifier_args_conjunction(struct shader_runner *runner,
const char *line, const char **const rest, uint32_t *model_mask) const char *line, const char **const rest, uint32_t *model_mask)
{ {
static const char *const valid_tags[] = {"d3d12", "glsl", "llvmpipe", "msl", "mvk", "vulkan"}; static const char *const valid_tags[] = {"d3d12", "glsl", "llvmpipe", "msl", "mvk", "vulkan", "mesa<23.3"};
bool holds = true; bool holds = true;
*model_mask = ~0u; *model_mask = ~0u;

View File

@ -155,7 +155,7 @@ enum shader_cap
struct shader_runner_caps struct shader_runner_caps
{ {
const char *runner; const char *runner;
const char *tags[2]; const char *tags[3];
size_t tag_count; size_t tag_count;
enum shader_model minimum_shader_model; enum shader_model minimum_shader_model;
enum shader_model maximum_shader_model; enum shader_model maximum_shader_model;

View File

@ -1037,11 +1037,17 @@ static void d3d12_runner_init_caps(struct d3d12_shader_runner *runner,
runner->caps.tag_count = 0; runner->caps.tag_count = 0;
runner->caps.tags[runner->caps.tag_count++] = "d3d12"; runner->caps.tags[runner->caps.tag_count++] = "d3d12";
if (is_mvk_device(device)) if (is_mvk_device(device))
{
runner->caps.tags[runner->caps.tag_count++] = "mvk"; runner->caps.tags[runner->caps.tag_count++] = "mvk";
else if (is_llvmpipe_device(device)) }
runner->caps.tags[runner->caps.tag_count++] = "llvmpipe"; else
{
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";
}
for (unsigned int i = 0; i < ARRAY_SIZE(formats); ++i) for (unsigned int i = 0; i < ARRAY_SIZE(formats); ++i)
{ {

View File

@ -1720,11 +1720,19 @@ static bool init_vulkan_runner(struct vulkan_shader_runner *runner)
runner->caps.tag_count = 0; runner->caps.tag_count = 0;
runner->caps.tags[runner->caps.tag_count++] = "vulkan"; runner->caps.tags[runner->caps.tag_count++] = "vulkan";
if (device_info.driver_properties.driverID == VK_DRIVER_ID_MOLTENVK) if (device_info.driver_properties.driverID == VK_DRIVER_ID_MOLTENVK)
{
runner->caps.tags[runner->caps.tag_count++] = "mvk"; runner->caps.tags[runner->caps.tag_count++] = "mvk";
else if (device_info.driver_properties.driverID == VK_DRIVER_ID_MESA_LLVMPIPE) }
runner->caps.tags[runner->caps.tag_count++] = "llvmpipe"; else
{
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)
&& !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";
}
runner->caps.shader_caps[SHADER_CAP_CLIP_PLANES] = true; runner->caps.shader_caps[SHADER_CAP_CLIP_PLANES] = true;
runner->caps.shader_caps[SHADER_CAP_FOG] = true; runner->caps.shader_caps[SHADER_CAP_FOG] = true;

View File

@ -49,6 +49,8 @@ struct vulkan_test_context
#include "vulkan_procs.h" #include "vulkan_procs.h"
}; };
#undef DECLARE_VK_PFN
#define VK_CALL(f) (context->f) #define VK_CALL(f) (context->f)
static inline void begin_command_buffer(const struct vulkan_test_context *context) static inline void begin_command_buffer(const struct vulkan_test_context *context)
@ -265,7 +267,7 @@ static inline bool vulkan_test_context_init_instance(struct vulkan_test_context
{ {
VkInstanceCreateInfo instance_desc = {.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO}; VkInstanceCreateInfo instance_desc = {.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO};
struct vulkan_extension_list enabled_extensions; struct vulkan_extension_list enabled_extensions;
DECLARE_VK_PFN(vkGetInstanceProcAddr) PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
void *libvulkan; void *libvulkan;
uint32_t count; uint32_t count;
VkResult vr; VkResult vr;
@ -417,4 +419,44 @@ static inline void vulkan_test_context_destroy(const struct vulkan_test_context
VK_CALL(vkDestroyInstance(context->instance, NULL)); VK_CALL(vkDestroyInstance(context->instance, NULL));
} }
/* This doesn't work for NVIDIA, because they use a different bit pattern. */
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 version = device_properties->driverVersion;
if (version == 1)
{
uint32_t driver_major, driver_minor, driver_patch;
/* llvmpipe doesn't provide a valid driverVersion value, so we resort to
* parsing the driverInfo string. */
if (sscanf(driver_properties->driverInfo, "Mesa %u.%u.%u",
&driver_major, &driver_minor, &driver_patch) == 3)
version = VK_MAKE_API_VERSION(0, driver_major, driver_minor, driver_patch);
}
return version >= VK_MAKE_API_VERSION(0, major, minor, patch);
}
static inline bool is_mesa_vulkan_driver(const VkPhysicalDeviceDriverPropertiesKHR *properties)
{
switch (properties->driverID)
{
case VK_DRIVER_ID_MESA_RADV_KHR:
case VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA:
case VK_DRIVER_ID_MESA_LLVMPIPE:
case VK_DRIVER_ID_MESA_TURNIP:
case VK_DRIVER_ID_MESA_V3DV:
case VK_DRIVER_ID_MESA_PANVK:
case VK_DRIVER_ID_MESA_VENUS:
case VK_DRIVER_ID_MESA_DOZEN:
return true;
default:
return false;
}
}
#endif /* __VKD3D_VULKAN_UTILS_H */ #endif /* __VKD3D_VULKAN_UTILS_H */