Browse Source

fix maintanance stuff

pull/2977/head
CamilleLaVey 3 months ago
committed by lizzie
parent
commit
dc927e7395
  1. 29
      src/video_core/vulkan_common/vulkan.h
  2. 51
      src/video_core/vulkan_common/vulkan_device.cpp
  3. 28
      src/video_core/vulkan_common/vulkan_device.h

29
src/video_core/vulkan_common/vulkan.h

@ -22,6 +22,35 @@
#include <vulkan/vulkan.h>
#ifndef VK_KHR_MAINTENANCE_1_EXTENSION_NAME
# define VK_KHR_MAINTENANCE_1_EXTENSION_NAME "VK_KHR_maintenance1"
#endif
#ifndef VK_KHR_MAINTENANCE_2_EXTENSION_NAME
# define VK_KHR_MAINTENANCE_2_EXTENSION_NAME "VK_KHR_maintenance2"
#endif
#ifndef VK_KHR_MAINTENANCE_3_EXTENSION_NAME
# define VK_KHR_MAINTENANCE_3_EXTENSION_NAME "VK_KHR_maintenance3"
#endif
#ifndef VK_KHR_MAINTENANCE_4_EXTENSION_NAME
# define VK_KHR_MAINTENANCE_4_EXTENSION_NAME "VK_KHR_maintenance4"
#endif
#ifndef VK_KHR_MAINTENANCE_5_EXTENSION_NAME
# define VK_KHR_MAINTENANCE_5_EXTENSION_NAME "VK_KHR_maintenance5"
#endif
#ifndef VK_KHR_MAINTENANCE_6_EXTENSION_NAME
# define VK_KHR_MAINTENANCE_6_EXTENSION_NAME "VK_KHR_maintenance6"
#endif
#ifndef VK_KHR_MAINTENANCE_7_EXTENSION_NAME
# define VK_KHR_MAINTENANCE_7_EXTENSION_NAME "VK_KHR_maintenance7"
#endif
#ifndef VK_KHR_MAINTENANCE_8_EXTENSION_NAME
# define VK_KHR_MAINTENANCE_8_EXTENSION_NAME "VK_KHR_maintenance8"
#endif
#ifndef VK_KHR_MAINTENANCE_9_EXTENSION_NAME
# define VK_KHR_MAINTENANCE_9_EXTENSION_NAME "VK_KHR_maintenance9"
#endif
// Sanitize macros
#undef CreateEvent
#undef CreateSemaphore

51
src/video_core/vulkan_common/vulkan_device.cpp

@ -416,7 +416,6 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
const bool is_suitable = GetSuitability(surface != nullptr);
const VkDriverId driver_id = properties.driver.driverID;
const auto device_id = properties.properties.deviceID;
const bool is_radv = driver_id == VK_DRIVER_ID_MESA_RADV;
const bool is_amd_driver =
driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE;
@ -427,7 +426,6 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
const bool is_mvk = driver_id == VK_DRIVER_ID_MOLTENVK;
const bool is_qualcomm = driver_id == VK_DRIVER_ID_QUALCOMM_PROPRIETARY;
const bool is_turnip = driver_id == VK_DRIVER_ID_MESA_TURNIP;
const bool is_s8gen2 = device_id == 0x43050a01;
const bool is_arm = driver_id == VK_DRIVER_ID_ARM_PROPRIETARY;
if ((is_mvk || is_qualcomm || is_turnip || is_arm) && !is_suitable) {
@ -700,29 +698,30 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
LOG_WARNING(Render_Vulkan, "Intel proprietary drivers do not support MSAA image blits");
cant_blit_msaa = true;
}
has_broken_compute =
CheckBrokenCompute(properties.driver.driverID, properties.properties.driverVersion) &&
!Settings::values.enable_compute_pipelines.GetValue();
// Qualcomm driver version where VK_KHR_maintenance5 and A1B5G5R5 become reliable
// Check if VK_KHR_maintenance5 is supported
constexpr uint32_t QUALCOMM_FIXED_DRIVER_VERSION = VK_MAKE_VERSION(512, 800, 1);
bool has_maintenance5 = HasExtension(VK_KHR_MAINTENANCE_5_EXTENSION_NAME);
must_emulate_bgr565 = false; // Default: assume emulation required
if (is_intel_anv) {
LOG_WARNING(Render_Vulkan, "Intel ANV driver does not support native BGR format");
must_emulate_bgr565 = true;
} else if (is_qualcomm) {
if (has_maintenance5 && properties.properties.driverVersion >= QUALCOMM_FIXED_DRIVER_VERSION) {
LOG_INFO(Render_Vulkan, "Qualcomm driver supports VK_KHR_maintenance5, disabling BGR emulation");
must_emulate_bgr565 = false;
} else {
LOG_WARNING(Render_Vulkan, "Qualcomm driver doesn't support native BGR, emulating formats");
has_broken_compute =
CheckBrokenCompute(properties.driver.driverID, properties.properties.driverVersion) &&
!Settings::values.enable_compute_pipelines.GetValue();
// Qualcomm driver version where VK_KHR_maintenance5 and A1B5G5R5 become reliable
// Check if VK_KHR_maintenance5 is supported
constexpr uint32_t QUALCOMM_FIXED_DRIVER_VERSION = VK_MAKE_VERSION(512, 800, 1);
bool has_maintenance5 = HasExtension(VK_KHR_MAINTENANCE_5_EXTENSION_NAME);
must_emulate_bgr565 = false; // Default: assume emulation required
if (is_intel_anv) {
LOG_WARNING(Render_Vulkan, "Intel ANV driver does not support native BGR format");
must_emulate_bgr565 = true;
} else if (is_qualcomm) {
if (has_maintenance5 && properties.properties.driverVersion >= QUALCOMM_FIXED_DRIVER_VERSION) {
LOG_INFO(Render_Vulkan, "Qualcomm driver supports VK_KHR_maintenance5, disabling BGR emulation");
must_emulate_bgr565 = false;
} else {
LOG_WARNING(Render_Vulkan, "Qualcomm driver doesn't support native BGR, emulating formats");
must_emulate_bgr565 = true;
}
}
}
}
if (extensions.push_descriptor && is_intel_anv) {
const u32 version = (properties.properties.driverVersion << 3) >> 3;
if (version >= VK_MAKE_API_VERSION(0, 22, 3, 0) &&
@ -1097,13 +1096,13 @@ bool Device::GetSuitability(bool requires_swapchain) {
// Some extensions are mandatory. Check those.
#define CHECK_EXTENSION(extension_name) \
if (!loaded_extensions.contains(extension_name)) { \
LOG_ERROR(Render_Vulkan, "Missing required extension {}", extension_name); \
suitable = false; \
LOG_ERROR(Render_Vulkan, "Missing required extension " extension_name); \
suitable = false; \
}
#define LOG_EXTENSION(extension_name) \
if (!loaded_extensions.contains(extension_name)) { \
LOG_INFO(Render_Vulkan, "Device doesn't support extension {}", extension_name); \
LOG_INFO(Render_Vulkan, "Device doesn't support extension " extension_name); \
}
FOR_EACH_VK_RECOMMENDED_EXTENSION(LOG_EXTENSION);

28
src/video_core/vulkan_common/vulkan_device.h

@ -90,7 +90,16 @@ VK_DEFINE_HANDLE(VmaAllocator)
EXTENSION(NV, VIEWPORT_SWIZZLE, viewport_swizzle) \
EXTENSION(EXT, DESCRIPTOR_INDEXING, descriptor_indexing) \
EXTENSION(EXT, FILTER_CUBIC, filter_cubic) \
EXTENSION(QCOM, FILTER_CUBIC_WEIGHTS, filter_cubic_weights)
EXTENSION(QCOM, FILTER_CUBIC_WEIGHTS, filter_cubic_weights) \
EXTENSION(KHR, MAINTENANCE_1, maintenance1) \
EXTENSION(KHR, MAINTENANCE_2, maintenance2) \
EXTENSION(KHR, MAINTENANCE_3, maintenance3) \
EXTENSION(KHR, MAINTENANCE_4, maintenance4) \
EXTENSION(KHR, MAINTENANCE_5, maintenance5) \
EXTENSION(KHR, MAINTENANCE_6, maintenance6) \
EXTENSION(KHR, MAINTENANCE_7, maintenance7) \
EXTENSION(KHR, MAINTENANCE_8, maintenance8) \
EXTENSION(KHR, MAINTENANCE_9, maintenance9) \
// Define extensions which must be supported.
#define FOR_EACH_VK_MANDATORY_EXTENSION(EXTENSION_NAME) \
@ -843,23 +852,6 @@ private:
FOR_EACH_VK_FEATURE_EXT(FEATURE);
FOR_EACH_VK_EXTENSION(EXTENSION);
// Maintenance extensions (may not be present in older Vulkan headers).
bool maintenance1{};
bool maintenance2{};
bool maintenance3{};
bool maintenance4{};
bool maintenance5{};
bool maintenance6{};
bool maintenance7{};
bool maintenance8{};
bool maintenance9{};
// Maintenance extensions (may not be present in older Vulkan headers).
bool maintenance1{};
bool maintenance2{};
bool maintenance3{};
bool maintenance4{};
#undef EXTENSION
#undef FEATURE
};

Loading…
Cancel
Save