diff options
Diffstat (limited to '')
5 files changed, 15 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 3bfd82cf0..e560111c3 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp | |||
| @@ -522,6 +522,12 @@ void TextureCacheRuntime::CopyImage(Image& dst_image, Image& src_image, | |||
| 522 | } | 522 | } |
| 523 | } | 523 | } |
| 524 | 524 | ||
| 525 | void TextureCacheRuntime::ConvertImage(Image& dst, Image& src, | ||
| 526 | std::span<const VideoCommon::ImageCopy> copies) { | ||
| 527 | LOG_DEBUG(Render_OpenGL, "Converting {} to {}", src.info.format, dst.info.format); | ||
| 528 | format_conversion_pass.ConvertImage(dst, src, copies); | ||
| 529 | } | ||
| 530 | |||
| 525 | bool TextureCacheRuntime::CanImageBeCopied(const Image& dst, const Image& src) { | 531 | bool TextureCacheRuntime::CanImageBeCopied(const Image& dst, const Image& src) { |
| 526 | if (dst.info.type == ImageType::e3D && dst.info.format == PixelFormat::BC4_UNORM) { | 532 | if (dst.info.type == ImageType::e3D && dst.info.format == PixelFormat::BC4_UNORM) { |
| 527 | return false; | 533 | return false; |
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h index b89c183a9..578f8d523 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.h +++ b/src/video_core/renderer_opengl/gl_texture_cache.h | |||
| @@ -86,6 +86,8 @@ public: | |||
| 86 | 86 | ||
| 87 | void CopyImage(Image& dst, Image& src, std::span<const VideoCommon::ImageCopy> copies); | 87 | void CopyImage(Image& dst, Image& src, std::span<const VideoCommon::ImageCopy> copies); |
| 88 | 88 | ||
| 89 | void ConvertImage(Image& dst, Image& src, std::span<const VideoCommon::ImageCopy> copies); | ||
| 90 | |||
| 89 | void ConvertImage(Framebuffer* dst, ImageView& dst_view, ImageView& src_view, bool rescaled) { | 91 | void ConvertImage(Framebuffer* dst, ImageView& dst_view, ImageView& src_view, bool rescaled) { |
| 90 | UNIMPLEMENTED(); | 92 | UNIMPLEMENTED(); |
| 91 | } | 93 | } |
| @@ -336,6 +338,7 @@ struct TextureCacheParams { | |||
| 336 | static constexpr bool FRAMEBUFFER_BLITS = true; | 338 | static constexpr bool FRAMEBUFFER_BLITS = true; |
| 337 | static constexpr bool HAS_EMULATED_COPIES = true; | 339 | static constexpr bool HAS_EMULATED_COPIES = true; |
| 338 | static constexpr bool HAS_DEVICE_MEMORY_INFO = true; | 340 | static constexpr bool HAS_DEVICE_MEMORY_INFO = true; |
| 341 | static constexpr bool HAS_PIXEL_FORMAT_CONVERSIONS = true; | ||
| 339 | 342 | ||
| 340 | using Runtime = OpenGL::TextureCacheRuntime; | 343 | using Runtime = OpenGL::TextureCacheRuntime; |
| 341 | using Image = OpenGL::Image; | 344 | using Image = OpenGL::Image; |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index ff28b4e96..f5f8f9a74 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h | |||
| @@ -316,6 +316,7 @@ struct TextureCacheParams { | |||
| 316 | static constexpr bool FRAMEBUFFER_BLITS = false; | 316 | static constexpr bool FRAMEBUFFER_BLITS = false; |
| 317 | static constexpr bool HAS_EMULATED_COPIES = false; | 317 | static constexpr bool HAS_EMULATED_COPIES = false; |
| 318 | static constexpr bool HAS_DEVICE_MEMORY_INFO = true; | 318 | static constexpr bool HAS_DEVICE_MEMORY_INFO = true; |
| 319 | static constexpr bool HAS_PIXEL_FORMAT_CONVERSIONS = false; | ||
| 319 | 320 | ||
| 320 | using Runtime = Vulkan::TextureCacheRuntime; | 321 | using Runtime = Vulkan::TextureCacheRuntime; |
| 321 | using Image = Vulkan::Image; | 322 | using Image = Vulkan::Image; |
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 4d2874bf2..241f71a91 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -1759,6 +1759,9 @@ void TextureCache<P>::CopyImage(ImageId dst_id, ImageId src_id, std::vector<Imag | |||
| 1759 | } | 1759 | } |
| 1760 | UNIMPLEMENTED_IF(dst.info.type != ImageType::e2D); | 1760 | UNIMPLEMENTED_IF(dst.info.type != ImageType::e2D); |
| 1761 | UNIMPLEMENTED_IF(src.info.type != ImageType::e2D); | 1761 | UNIMPLEMENTED_IF(src.info.type != ImageType::e2D); |
| 1762 | if constexpr (HAS_PIXEL_FORMAT_CONVERSIONS) { | ||
| 1763 | return runtime.ConvertImage(dst, src, copies); | ||
| 1764 | } | ||
| 1762 | for (const ImageCopy& copy : copies) { | 1765 | for (const ImageCopy& copy : copies) { |
| 1763 | UNIMPLEMENTED_IF(copy.dst_subresource.num_layers != 1); | 1766 | UNIMPLEMENTED_IF(copy.dst_subresource.num_layers != 1); |
| 1764 | UNIMPLEMENTED_IF(copy.src_subresource.num_layers != 1); | 1767 | UNIMPLEMENTED_IF(copy.src_subresource.num_layers != 1); |
diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h index 643ad811c..a9504c0e8 100644 --- a/src/video_core/texture_cache/texture_cache_base.h +++ b/src/video_core/texture_cache/texture_cache_base.h | |||
| @@ -59,6 +59,8 @@ class TextureCache { | |||
| 59 | static constexpr bool HAS_EMULATED_COPIES = P::HAS_EMULATED_COPIES; | 59 | static constexpr bool HAS_EMULATED_COPIES = P::HAS_EMULATED_COPIES; |
| 60 | /// True when the API can provide info about the memory of the device. | 60 | /// True when the API can provide info about the memory of the device. |
| 61 | static constexpr bool HAS_DEVICE_MEMORY_INFO = P::HAS_DEVICE_MEMORY_INFO; | 61 | static constexpr bool HAS_DEVICE_MEMORY_INFO = P::HAS_DEVICE_MEMORY_INFO; |
| 62 | /// True when the API provides utilities for pixel format conversions. | ||
| 63 | static constexpr bool HAS_PIXEL_FORMAT_CONVERSIONS = P::HAS_PIXEL_FORMAT_CONVERSIONS; | ||
| 62 | 64 | ||
| 63 | static constexpr u64 DEFAULT_EXPECTED_MEMORY = 1_GiB; | 65 | static constexpr u64 DEFAULT_EXPECTED_MEMORY = 1_GiB; |
| 64 | static constexpr u64 DEFAULT_CRITICAL_MEMORY = 2_GiB; | 66 | static constexpr u64 DEFAULT_CRITICAL_MEMORY = 2_GiB; |