diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 12 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.h | 5 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 0ba56ff1e..0f62779de 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -554,10 +554,12 @@ void CopyBufferToImage(vk::CommandBuffer cmdbuf, VkBuffer src_buffer, VkImage im | |||
| 554 | }; | 554 | }; |
| 555 | } | 555 | } |
| 556 | 556 | ||
| 557 | [[nodiscard]] bool IsFormatFlipped(PixelFormat format) { | 557 | [[nodiscard]] bool IsFormatFlipped(PixelFormat format, bool emulate_bgr565) { |
| 558 | switch (format) { | 558 | switch (format) { |
| 559 | case PixelFormat::A1B5G5R5_UNORM: | 559 | case PixelFormat::A1B5G5R5_UNORM: |
| 560 | return true; | 560 | return true; |
| 561 | case PixelFormat::B5G6R5_UNORM: | ||
| 562 | return emulate_bgr565; | ||
| 561 | default: | 563 | default: |
| 562 | return false; | 564 | return false; |
| 563 | } | 565 | } |
| @@ -1488,7 +1490,7 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI | |||
| 1488 | }; | 1490 | }; |
| 1489 | if (!info.IsRenderTarget()) { | 1491 | if (!info.IsRenderTarget()) { |
| 1490 | swizzle = info.Swizzle(); | 1492 | swizzle = info.Swizzle(); |
| 1491 | if (IsFormatFlipped(format)) { | 1493 | if (IsFormatFlipped(format, device->MustEmulateBGR565())) { |
| 1492 | std::ranges::transform(swizzle, swizzle.begin(), SwapBlueRed); | 1494 | std::ranges::transform(swizzle, swizzle.begin(), SwapBlueRed); |
| 1493 | } | 1495 | } |
| 1494 | if ((aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) != 0) { | 1496 | if ((aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) != 0) { |
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 153702c0b..d0c84215f 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -39,6 +39,11 @@ constexpr std::array DEPTH16_UNORM_STENCIL8_UINT{ | |||
| 39 | VK_FORMAT_D32_SFLOAT_S8_UINT, | 39 | VK_FORMAT_D32_SFLOAT_S8_UINT, |
| 40 | VK_FORMAT_UNDEFINED, | 40 | VK_FORMAT_UNDEFINED, |
| 41 | }; | 41 | }; |
| 42 | |||
| 43 | constexpr std::array B5G6R5_UNORM_PACK16{ | ||
| 44 | VK_FORMAT_R5G6B5_UNORM_PACK16, | ||
| 45 | VK_FORMAT_UNDEFINED, | ||
| 46 | }; | ||
| 42 | } // namespace Alternatives | 47 | } // namespace Alternatives |
| 43 | 48 | ||
| 44 | enum class NvidiaArchitecture { | 49 | enum class NvidiaArchitecture { |
| @@ -87,6 +92,8 @@ constexpr const VkFormat* GetFormatAlternatives(VkFormat format) { | |||
| 87 | return Alternatives::DEPTH24_UNORM_STENCIL8_UINT.data(); | 92 | return Alternatives::DEPTH24_UNORM_STENCIL8_UINT.data(); |
| 88 | case VK_FORMAT_D16_UNORM_S8_UINT: | 93 | case VK_FORMAT_D16_UNORM_S8_UINT: |
| 89 | return Alternatives::DEPTH16_UNORM_STENCIL8_UINT.data(); | 94 | return Alternatives::DEPTH16_UNORM_STENCIL8_UINT.data(); |
| 95 | case VK_FORMAT_B5G6R5_UNORM_PACK16: | ||
| 96 | return Alternatives::B5G6R5_UNORM_PACK16.data(); | ||
| 90 | default: | 97 | default: |
| 91 | return nullptr; | 98 | return nullptr; |
| 92 | } | 99 | } |
| @@ -639,6 +646,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 639 | } | 646 | } |
| 640 | 647 | ||
| 641 | const bool is_intel_windows = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS; | 648 | const bool is_intel_windows = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS; |
| 649 | const bool is_intel_anv = driver_id == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA; | ||
| 642 | if (ext_vertex_input_dynamic_state && is_intel_windows) { | 650 | if (ext_vertex_input_dynamic_state && is_intel_windows) { |
| 643 | LOG_WARNING(Render_Vulkan, "Blacklisting Intel for VK_EXT_vertex_input_dynamic_state"); | 651 | LOG_WARNING(Render_Vulkan, "Blacklisting Intel for VK_EXT_vertex_input_dynamic_state"); |
| 644 | ext_vertex_input_dynamic_state = false; | 652 | ext_vertex_input_dynamic_state = false; |
| @@ -652,6 +660,10 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 652 | LOG_WARNING(Render_Vulkan, "Intel proprietary drivers do not support MSAA image blits"); | 660 | LOG_WARNING(Render_Vulkan, "Intel proprietary drivers do not support MSAA image blits"); |
| 653 | cant_blit_msaa = true; | 661 | cant_blit_msaa = true; |
| 654 | } | 662 | } |
| 663 | if (is_intel_anv) { | ||
| 664 | LOG_WARNING(Render_Vulkan, "ANV driver does not support native BGR format"); | ||
| 665 | must_emulate_bgr565 = true; | ||
| 666 | } | ||
| 655 | 667 | ||
| 656 | supports_d24_depth = | 668 | supports_d24_depth = |
| 657 | IsFormatSupported(VK_FORMAT_D24_UNORM_S8_UINT, | 669 | IsFormatSupported(VK_FORMAT_D24_UNORM_S8_UINT, |
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index 37d140ebd..34b1add16 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h | |||
| @@ -354,6 +354,10 @@ public: | |||
| 354 | return cant_blit_msaa; | 354 | return cant_blit_msaa; |
| 355 | } | 355 | } |
| 356 | 356 | ||
| 357 | bool MustEmulateBGR565() const { | ||
| 358 | return must_emulate_bgr565; | ||
| 359 | } | ||
| 360 | |||
| 357 | private: | 361 | private: |
| 358 | /// Checks if the physical device is suitable. | 362 | /// Checks if the physical device is suitable. |
| 359 | void CheckSuitability(bool requires_swapchain) const; | 363 | void CheckSuitability(bool requires_swapchain) const; |
| @@ -448,6 +452,7 @@ private: | |||
| 448 | bool has_nsight_graphics{}; ///< Has Nsight Graphics attached | 452 | bool has_nsight_graphics{}; ///< Has Nsight Graphics attached |
| 449 | bool supports_d24_depth{}; ///< Supports D24 depth buffers. | 453 | bool supports_d24_depth{}; ///< Supports D24 depth buffers. |
| 450 | bool cant_blit_msaa{}; ///< Does not support MSAA<->MSAA blitting. | 454 | bool cant_blit_msaa{}; ///< Does not support MSAA<->MSAA blitting. |
| 455 | bool must_emulate_bgr565{}; ///< Emulates BGR565 by swizzling RGB565 format. | ||
| 451 | 456 | ||
| 452 | // Telemetry parameters | 457 | // Telemetry parameters |
| 453 | std::string vendor_name; ///< Device's driver name. | 458 | std::string vendor_name; ///< Device's driver name. |