diff options
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.cpp | 17 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 7 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 1 | ||||
| -rw-r--r-- | src/video_core/textures/astc.cpp | 4 |
4 files changed, 21 insertions, 8 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index eb6e43a08..b047e7b3d 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp | |||
| @@ -228,8 +228,9 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4 | |||
| 228 | 228 | ||
| 229 | [[nodiscard]] bool CanBeAccelerated(const TextureCacheRuntime& runtime, | 229 | [[nodiscard]] bool CanBeAccelerated(const TextureCacheRuntime& runtime, |
| 230 | const VideoCommon::ImageInfo& info) { | 230 | const VideoCommon::ImageInfo& info) { |
| 231 | if (IsPixelFormatASTC(info.format)) { | 231 | if (IsPixelFormatASTC(info.format) && !runtime.HasNativeASTC()) { |
| 232 | return !runtime.HasNativeASTC() && Settings::values.accelerate_astc.GetValue(); | 232 | return Settings::values.accelerate_astc.GetValue() && |
| 233 | !Settings::values.async_astc.GetValue(); | ||
| 233 | } | 234 | } |
| 234 | // Disable other accelerated uploads for now as they don't implement swizzled uploads | 235 | // Disable other accelerated uploads for now as they don't implement swizzled uploads |
| 235 | return false; | 236 | return false; |
| @@ -258,6 +259,14 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4 | |||
| 258 | return format_info.compatibility_class == store_class; | 259 | return format_info.compatibility_class == store_class; |
| 259 | } | 260 | } |
| 260 | 261 | ||
| 262 | [[nodiscard]] bool CanBeDecodedAsync(const TextureCacheRuntime& runtime, | ||
| 263 | const VideoCommon::ImageInfo& info) { | ||
| 264 | if (IsPixelFormatASTC(info.format) && !runtime.HasNativeASTC()) { | ||
| 265 | return Settings::values.async_astc.GetValue(); | ||
| 266 | } | ||
| 267 | return false; | ||
| 268 | } | ||
| 269 | |||
| 261 | [[nodiscard]] CopyOrigin MakeCopyOrigin(VideoCommon::Offset3D offset, | 270 | [[nodiscard]] CopyOrigin MakeCopyOrigin(VideoCommon::Offset3D offset, |
| 262 | VideoCommon::SubresourceLayers subresource, GLenum target) { | 271 | VideoCommon::SubresourceLayers subresource, GLenum target) { |
| 263 | switch (target) { | 272 | switch (target) { |
| @@ -721,7 +730,9 @@ std::optional<size_t> TextureCacheRuntime::StagingBuffers::FindBuffer(size_t req | |||
| 721 | Image::Image(TextureCacheRuntime& runtime_, const VideoCommon::ImageInfo& info_, GPUVAddr gpu_addr_, | 730 | Image::Image(TextureCacheRuntime& runtime_, const VideoCommon::ImageInfo& info_, GPUVAddr gpu_addr_, |
| 722 | VAddr cpu_addr_) | 731 | VAddr cpu_addr_) |
| 723 | : VideoCommon::ImageBase(info_, gpu_addr_, cpu_addr_), runtime{&runtime_} { | 732 | : VideoCommon::ImageBase(info_, gpu_addr_, cpu_addr_), runtime{&runtime_} { |
| 724 | if (CanBeAccelerated(*runtime, info)) { | 733 | if (CanBeDecodedAsync(*runtime, info)) { |
| 734 | flags |= ImageFlagBits::AsynchronousDecode; | ||
| 735 | } else if (CanBeAccelerated(*runtime, info)) { | ||
| 725 | flags |= ImageFlagBits::AcceleratedUpload; | 736 | flags |= ImageFlagBits::AcceleratedUpload; |
| 726 | } | 737 | } |
| 727 | if (IsConverted(runtime->device, info.format, info.type)) { | 738 | if (IsConverted(runtime->device, info.format, info.type)) { |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 9b85dfb5e..80adb70eb 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -1256,11 +1256,12 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu | |||
| 1256 | commit(runtime_.memory_allocator.Commit(original_image, MemoryUsage::DeviceLocal)), | 1256 | commit(runtime_.memory_allocator.Commit(original_image, MemoryUsage::DeviceLocal)), |
| 1257 | aspect_mask(ImageAspectMask(info.format)) { | 1257 | aspect_mask(ImageAspectMask(info.format)) { |
| 1258 | if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) { | 1258 | if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) { |
| 1259 | if (Settings::values.accelerate_astc.GetValue()) { | 1259 | if (Settings::values.async_astc.GetValue()) { |
| 1260 | flags |= VideoCommon::ImageFlagBits::AsynchronousDecode; | ||
| 1261 | } else if (Settings::values.accelerate_astc.GetValue()) { | ||
| 1260 | flags |= VideoCommon::ImageFlagBits::AcceleratedUpload; | 1262 | flags |= VideoCommon::ImageFlagBits::AcceleratedUpload; |
| 1261 | } else { | ||
| 1262 | flags |= VideoCommon::ImageFlagBits::Converted; | ||
| 1263 | } | 1263 | } |
| 1264 | flags |= VideoCommon::ImageFlagBits::Converted; | ||
| 1264 | flags |= VideoCommon::ImageFlagBits::CostlyLoad; | 1265 | flags |= VideoCommon::ImageFlagBits::CostlyLoad; |
| 1265 | } | 1266 | } |
| 1266 | if (runtime->device.HasDebuggingToolAttached()) { | 1267 | if (runtime->device.HasDebuggingToolAttached()) { |
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 4159bc796..9dd152fbe 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -1003,6 +1003,7 @@ u64 TextureCache<P>::GetScaledImageSizeBytes(const ImageBase& image) { | |||
| 1003 | template <class P> | 1003 | template <class P> |
| 1004 | void TextureCache<P>::QueueAsyncDecode(Image& image, ImageId image_id) { | 1004 | void TextureCache<P>::QueueAsyncDecode(Image& image, ImageId image_id) { |
| 1005 | UNIMPLEMENTED_IF(False(image.flags & ImageFlagBits::Converted)); | 1005 | UNIMPLEMENTED_IF(False(image.flags & ImageFlagBits::Converted)); |
| 1006 | LOG_INFO(HW_GPU, "Queuing async texture decode"); | ||
| 1006 | 1007 | ||
| 1007 | image.flags |= ImageFlagBits::IsDecoding; | 1008 | image.flags |= ImageFlagBits::IsDecoding; |
| 1008 | auto decode = std::make_unique<AsyncDecodeContext>(); | 1009 | auto decode = std::make_unique<AsyncDecodeContext>(); |
diff --git a/src/video_core/textures/astc.cpp b/src/video_core/textures/astc.cpp index e8d7c7863..4381eed1d 100644 --- a/src/video_core/textures/astc.cpp +++ b/src/video_core/textures/astc.cpp | |||
| @@ -1656,8 +1656,8 @@ void Decompress(std::span<const uint8_t> data, uint32_t width, uint32_t height, | |||
| 1656 | const u32 rows = Common::DivideUp(height, block_height); | 1656 | const u32 rows = Common::DivideUp(height, block_height); |
| 1657 | const u32 cols = Common::DivideUp(width, block_width); | 1657 | const u32 cols = Common::DivideUp(width, block_width); |
| 1658 | 1658 | ||
| 1659 | Common::ThreadWorker workers{std::max(std::thread::hardware_concurrency(), 2U) / 2, | 1659 | static Common::ThreadWorker workers{std::max(std::thread::hardware_concurrency(), 2U) / 2, |
| 1660 | "ASTCDecompress"}; | 1660 | "ASTCDecompress"}; |
| 1661 | 1661 | ||
| 1662 | for (u32 z = 0; z < depth; ++z) { | 1662 | for (u32 z = 0; z < depth; ++z) { |
| 1663 | const u32 depth_offset = z * height * width * 4; | 1663 | const u32 depth_offset = z * height * width * 4; |