mirror of https://git.suyu.dev/suyu/suyu
texture_cache: Use pixel format conversion when supported by the runtime
This commit is contained in:
parent
50c3d53076
commit
20ed7ba441
|
@ -522,6 +522,12 @@ void TextureCacheRuntime::CopyImage(Image& dst_image, Image& src_image,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextureCacheRuntime::ConvertImage(Image& dst, Image& src,
|
||||||
|
std::span<const VideoCommon::ImageCopy> copies) {
|
||||||
|
LOG_DEBUG(Render_OpenGL, "Converting {} to {}", src.info.format, dst.info.format);
|
||||||
|
format_conversion_pass.ConvertImage(dst, src, copies);
|
||||||
|
}
|
||||||
|
|
||||||
bool TextureCacheRuntime::CanImageBeCopied(const Image& dst, const Image& src) {
|
bool TextureCacheRuntime::CanImageBeCopied(const Image& dst, const Image& src) {
|
||||||
if (dst.info.type == ImageType::e3D && dst.info.format == PixelFormat::BC4_UNORM) {
|
if (dst.info.type == ImageType::e3D && dst.info.format == PixelFormat::BC4_UNORM) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -86,6 +86,8 @@ public:
|
||||||
|
|
||||||
void CopyImage(Image& dst, Image& src, std::span<const VideoCommon::ImageCopy> copies);
|
void CopyImage(Image& dst, Image& src, std::span<const VideoCommon::ImageCopy> copies);
|
||||||
|
|
||||||
|
void ConvertImage(Image& dst, Image& src, std::span<const VideoCommon::ImageCopy> copies);
|
||||||
|
|
||||||
void ConvertImage(Framebuffer* dst, ImageView& dst_view, ImageView& src_view, bool rescaled) {
|
void ConvertImage(Framebuffer* dst, ImageView& dst_view, ImageView& src_view, bool rescaled) {
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
}
|
}
|
||||||
|
@ -336,6 +338,7 @@ struct TextureCacheParams {
|
||||||
static constexpr bool FRAMEBUFFER_BLITS = true;
|
static constexpr bool FRAMEBUFFER_BLITS = true;
|
||||||
static constexpr bool HAS_EMULATED_COPIES = true;
|
static constexpr bool HAS_EMULATED_COPIES = true;
|
||||||
static constexpr bool HAS_DEVICE_MEMORY_INFO = true;
|
static constexpr bool HAS_DEVICE_MEMORY_INFO = true;
|
||||||
|
static constexpr bool HAS_PIXEL_FORMAT_CONVERSIONS = true;
|
||||||
|
|
||||||
using Runtime = OpenGL::TextureCacheRuntime;
|
using Runtime = OpenGL::TextureCacheRuntime;
|
||||||
using Image = OpenGL::Image;
|
using Image = OpenGL::Image;
|
||||||
|
|
|
@ -316,6 +316,7 @@ struct TextureCacheParams {
|
||||||
static constexpr bool FRAMEBUFFER_BLITS = false;
|
static constexpr bool FRAMEBUFFER_BLITS = false;
|
||||||
static constexpr bool HAS_EMULATED_COPIES = false;
|
static constexpr bool HAS_EMULATED_COPIES = false;
|
||||||
static constexpr bool HAS_DEVICE_MEMORY_INFO = true;
|
static constexpr bool HAS_DEVICE_MEMORY_INFO = true;
|
||||||
|
static constexpr bool HAS_PIXEL_FORMAT_CONVERSIONS = false;
|
||||||
|
|
||||||
using Runtime = Vulkan::TextureCacheRuntime;
|
using Runtime = Vulkan::TextureCacheRuntime;
|
||||||
using Image = Vulkan::Image;
|
using Image = Vulkan::Image;
|
||||||
|
|
|
@ -1759,6 +1759,9 @@ void TextureCache<P>::CopyImage(ImageId dst_id, ImageId src_id, std::vector<Imag
|
||||||
}
|
}
|
||||||
UNIMPLEMENTED_IF(dst.info.type != ImageType::e2D);
|
UNIMPLEMENTED_IF(dst.info.type != ImageType::e2D);
|
||||||
UNIMPLEMENTED_IF(src.info.type != ImageType::e2D);
|
UNIMPLEMENTED_IF(src.info.type != ImageType::e2D);
|
||||||
|
if constexpr (HAS_PIXEL_FORMAT_CONVERSIONS) {
|
||||||
|
return runtime.ConvertImage(dst, src, copies);
|
||||||
|
}
|
||||||
for (const ImageCopy& copy : copies) {
|
for (const ImageCopy& copy : copies) {
|
||||||
UNIMPLEMENTED_IF(copy.dst_subresource.num_layers != 1);
|
UNIMPLEMENTED_IF(copy.dst_subresource.num_layers != 1);
|
||||||
UNIMPLEMENTED_IF(copy.src_subresource.num_layers != 1);
|
UNIMPLEMENTED_IF(copy.src_subresource.num_layers != 1);
|
||||||
|
|
|
@ -59,6 +59,8 @@ class TextureCache {
|
||||||
static constexpr bool HAS_EMULATED_COPIES = P::HAS_EMULATED_COPIES;
|
static constexpr bool HAS_EMULATED_COPIES = P::HAS_EMULATED_COPIES;
|
||||||
/// True when the API can provide info about the memory of the device.
|
/// True when the API can provide info about the memory of the device.
|
||||||
static constexpr bool HAS_DEVICE_MEMORY_INFO = P::HAS_DEVICE_MEMORY_INFO;
|
static constexpr bool HAS_DEVICE_MEMORY_INFO = P::HAS_DEVICE_MEMORY_INFO;
|
||||||
|
/// True when the API provides utilities for pixel format conversions.
|
||||||
|
static constexpr bool HAS_PIXEL_FORMAT_CONVERSIONS = P::HAS_PIXEL_FORMAT_CONVERSIONS;
|
||||||
|
|
||||||
static constexpr u64 DEFAULT_EXPECTED_MEMORY = 1_GiB;
|
static constexpr u64 DEFAULT_EXPECTED_MEMORY = 1_GiB;
|
||||||
static constexpr u64 DEFAULT_CRITICAL_MEMORY = 2_GiB;
|
static constexpr u64 DEFAULT_CRITICAL_MEMORY = 2_GiB;
|
||||||
|
|
Loading…
Reference in New Issue