1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-26 04:32:35 +01:00

vk: Improve driver compatibility

- Add workarounds to disable compression on mesa drivers
- Separate intel proprietary vs mesa into two enumerants
This commit is contained in:
kd-11 2021-08-17 15:47:29 +03:00 committed by kd-11
parent 47e784d5d0
commit 8848dc6673
7 changed files with 46 additions and 9 deletions

View File

@ -75,6 +75,7 @@ namespace vk
{
case vk::driver_vendor::unknown:
case vk::driver_vendor::INTEL:
case vk::driver_vendor::ANV:
// Intel hw has 8 threads, but LDS allocation behavior makes optimal group size between 64 and 256
// Based on intel's own OpenCL recommended settings
unroll_loops = true;

View File

@ -583,7 +583,7 @@ VKGSRender::VKGSRender() : GSRender()
case vk::driver_vendor::AMD:
#if !defined(__linux__)
// Intel chipsets would fail on BSD in most cases and DRM_IOCTL_i915_GEM_USERPTR unimplemented
case vk::driver_vendor::INTEL:
case vk::driver_vendor::ANV:
#endif
if (backend_config.supports_passthrough_dma)
{

View File

@ -121,6 +121,9 @@ namespace vk
g_drv_sanitize_fp_values = true;
break;
case driver_vendor::INTEL:
case driver_vendor::ANV:
// INTEL vulkan drivers are mostly OK, workarounds are applied when creating the device
break;
default:
rsx_log.warning("Unsupported device: %s", gpu_name);
}

View File

@ -89,6 +89,35 @@ namespace vk
using download_buffer_object = void*;
using barrier_descriptor_t = rsx::deferred_clipped_region<vk::render_target*>;
static VkFlags get_attachment_compression_usage_flags()
{
if (g_cfg.video.strict_rendering_mode)
{
return 0;
}
switch (vk::get_driver_vendor())
{
case driver_vendor::NVIDIA:
case driver_vendor::INTEL:
case driver_vendor::AMD: // TODO
return 0;
// Workaround to force transition to GENERAL to decompress.
// Fixes corruption in FBO loops for ANV and RADV.
case driver_vendor::ANV:
return VK_IMAGE_USAGE_STORAGE_BIT;
case driver_vendor::RADV:
// Only needed for GFX10+
return (vk::get_chip_family() >= chip_class::AMD_navi1x) ?
VK_IMAGE_USAGE_STORAGE_BIT : 0;
default:
rsx_log.error("Unknown driver vendor!");
return 0;
}
}
static std::unique_ptr<vk::render_target> create_new_surface(
u32 address,
rsx::surface_color_format format,
@ -115,7 +144,7 @@ namespace vk
VkImageUsageFlags usage_flags = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
if (samples == 1) [[likely]]
{
usage_flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;
usage_flags |= get_attachment_compression_usage_flags() | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;
}
else
{
@ -180,7 +209,7 @@ namespace vk
if (samples == 1) [[likely]]
{
usage_flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
usage_flags |= get_attachment_compression_usage_flags() | VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
}
std::unique_ptr<vk::render_target> ds;

View File

@ -29,7 +29,8 @@ namespace vk
AMD,
NVIDIA,
RADV,
INTEL
INTEL,
ANV
};
driver_vendor get_driver_vendor();

View File

@ -128,7 +128,11 @@ namespace vk
if (gpu_name.find("Intel") != umax)
{
#ifdef _WIN32
return driver_vendor::INTEL;
#else
return driver_vendor::ANV;
#endif
}
return driver_vendor::unknown;
@ -145,10 +149,11 @@ namespace vk
case VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR:
return driver_vendor::NVIDIA;
case VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS_KHR:
case VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA_KHR:
return driver_vendor::INTEL;
case VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA_KHR:
return driver_vendor::ANV;
default:
// Mobile
// Mobile?
return driver_vendor::unknown;
}
}

View File

@ -520,11 +520,9 @@ namespace vk
switch (gpu.get_driver_vendor())
{
case driver_vendor::AMD:
break;
case driver_vendor::INTEL:
#ifdef _WIN32
break;
#endif
case driver_vendor::ANV:
case driver_vendor::NVIDIA:
case driver_vendor::RADV:
m_wm_reports_flag = true;