1
0
Fork 0
forked from suyu/suyu

vk_texture_cache: Disable cube compatibility flag on non-mesa AMD GCN4 and earlier

Fixes rainbow textures on BOTW.
This commit is contained in:
ameerj 2021-09-23 18:11:18 -04:00
parent 7b22d61fb1
commit 1e1ecca691
3 changed files with 22 additions and 11 deletions

View file

@ -127,7 +127,7 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) {
const auto format_info = MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, format); const auto format_info = MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, format);
VkImageCreateFlags flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; VkImageCreateFlags flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
if (info.type == ImageType::e2D && info.resources.layers >= 6 && if (info.type == ImageType::e2D && info.resources.layers >= 6 &&
info.size.width == info.size.height) { info.size.width == info.size.height && !device.HasBrokenCubeImageCompability()) {
flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
} }
if (info.type == ImageType::e3D) { if (info.type == ImageType::e3D) {

View file

@ -588,22 +588,27 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
ext_extended_dynamic_state = false; ext_extended_dynamic_state = false;
} }
} }
sets_per_pool = 64; sets_per_pool = 64;
if (driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE) {
const bool is_amd =
driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE;
if (is_amd) {
// AMD drivers need a higher amount of Sets per Pool in certain circunstances like in XC2. // AMD drivers need a higher amount of Sets per Pool in certain circunstances like in XC2.
sets_per_pool = 96; sets_per_pool = 96;
} // Disable VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT on AMD GCN4 and lower as it is broken.
const bool is_amd = driver_id == VK_DRIVER_ID_AMD_PROPRIETARY ||
driver_id == VK_DRIVER_ID_MESA_RADV ||
driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE;
if (ext_sampler_filter_minmax && is_amd) {
// Disable ext_sampler_filter_minmax on AMD GCN4 and lower as it is broken.
if (!is_float16_supported) { if (!is_float16_supported) {
LOG_WARNING( LOG_WARNING(
Render_Vulkan, Render_Vulkan,
"Blacklisting AMD GCN4 and lower for VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME"); "AMD GCN4 and earlier do not properly support VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT");
has_broken_cube_compatibility = true;
}
}
const bool is_amd_or_radv = is_amd || driver_id == VK_DRIVER_ID_MESA_RADV;
if (ext_sampler_filter_minmax && is_amd_or_radv) {
// Disable ext_sampler_filter_minmax on AMD GCN4 and lower as it is broken.
if (!is_float16_supported) {
LOG_WARNING(Render_Vulkan,
"Blacklisting AMD GCN4 and earlier for VK_EXT_sampler_filter_minmax");
ext_sampler_filter_minmax = false; ext_sampler_filter_minmax = false;
} }
} }

View file

@ -309,6 +309,11 @@ public:
return has_renderdoc || has_nsight_graphics; return has_renderdoc || has_nsight_graphics;
} }
/// Returns true when the device does not properly support cube compatibility.
bool HasBrokenCubeImageCompability() const {
return has_broken_cube_compatibility;
}
/// Returns the vendor name reported from Vulkan. /// Returns the vendor name reported from Vulkan.
std::string_view GetVendorName() const { std::string_view GetVendorName() const {
return vendor_name; return vendor_name;
@ -417,6 +422,7 @@ private:
bool ext_conservative_rasterization{}; ///< Support for VK_EXT_conservative_rasterization. bool ext_conservative_rasterization{}; ///< Support for VK_EXT_conservative_rasterization.
bool ext_provoking_vertex{}; ///< Support for VK_EXT_provoking_vertex. bool ext_provoking_vertex{}; ///< Support for VK_EXT_provoking_vertex.
bool nv_device_diagnostics_config{}; ///< Support for VK_NV_device_diagnostics_config. bool nv_device_diagnostics_config{}; ///< Support for VK_NV_device_diagnostics_config.
bool has_broken_cube_compatibility{}; ///< Has broken cube compatiblity bit
bool has_renderdoc{}; ///< Has RenderDoc attached bool has_renderdoc{}; ///< Has RenderDoc attached
bool has_nsight_graphics{}; ///< Has Nsight Graphics attached bool has_nsight_graphics{}; ///< Has Nsight Graphics attached