summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp
index de9b0d25d..1eec4afb0 100644
--- a/src/video_core/vulkan_common/vulkan_device.cpp
+++ b/src/video_core/vulkan_common/vulkan_device.cpp
@@ -266,6 +266,30 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(vk::Physica
266 return format_properties; 266 return format_properties;
267} 267}
268 268
269void OverrideBcnFormats(std::unordered_map<VkFormat, VkFormatProperties>& format_properties) {
270 // These properties are extracted from Adreno driver 512.687.0
271 constexpr VkFormatFeatureFlags tiling_features{
272 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
273 VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT | VK_FORMAT_FEATURE_TRANSFER_SRC_BIT |
274 VK_FORMAT_FEATURE_TRANSFER_DST_BIT};
275
276 constexpr VkFormatFeatureFlags buffer_features{VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT};
277
278 static constexpr std::array bcn_formats{
279 VK_FORMAT_BC1_RGBA_SRGB_BLOCK, VK_FORMAT_BC1_RGBA_UNORM_BLOCK, VK_FORMAT_BC2_SRGB_BLOCK,
280 VK_FORMAT_BC2_UNORM_BLOCK, VK_FORMAT_BC3_SRGB_BLOCK, VK_FORMAT_BC3_UNORM_BLOCK,
281 VK_FORMAT_BC4_SNORM_BLOCK, VK_FORMAT_BC4_UNORM_BLOCK, VK_FORMAT_BC5_SNORM_BLOCK,
282 VK_FORMAT_BC5_UNORM_BLOCK, VK_FORMAT_BC6H_SFLOAT_BLOCK, VK_FORMAT_BC6H_UFLOAT_BLOCK,
283 VK_FORMAT_BC7_SRGB_BLOCK, VK_FORMAT_BC7_UNORM_BLOCK,
284 };
285
286 for (const auto format : bcn_formats) {
287 format_properties[format].linearTilingFeatures = tiling_features;
288 format_properties[format].optimalTilingFeatures = tiling_features;
289 format_properties[format].bufferFeatures = buffer_features;
290 }
291}
292
269NvidiaArchitecture GetNvidiaArchitecture(vk::PhysicalDevice physical, 293NvidiaArchitecture GetNvidiaArchitecture(vk::PhysicalDevice physical,
270 const std::set<std::string, std::less<>>& exts) { 294 const std::set<std::string, std::less<>>& exts) {
271 if (exts.contains(VK_KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME)) { 295 if (exts.contains(VK_KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME)) {
@@ -390,8 +414,10 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
390 414
391 if (patch_status == ADRENOTOOLS_BCN_PATCH) { 415 if (patch_status == ADRENOTOOLS_BCN_PATCH) {
392 LOG_INFO(Render_Vulkan, "Patching Adreno driver to support BCn texture formats"); 416 LOG_INFO(Render_Vulkan, "Patching Adreno driver to support BCn texture formats");
393 if (!adrenotools_patch_bcn( 417 if (adrenotools_patch_bcn(
394 reinterpret_cast<void*>(dld.vkGetPhysicalDeviceFormatProperties))) { 418 reinterpret_cast<void*>(dld.vkGetPhysicalDeviceFormatProperties))) {
419 OverrideBcnFormats(format_properties);
420 } else {
395 LOG_ERROR(Render_Vulkan, "Patch failed! Driver code may now crash"); 421 LOG_ERROR(Render_Vulkan, "Patch failed! Driver code may now crash");
396 } 422 }
397 } else if (patch_status == ADRENOTOOLS_BCN_BLOB) { 423 } else if (patch_status == ADRENOTOOLS_BCN_BLOB) {