diff options
Diffstat (limited to '')
| -rw-r--r-- | src/common/scratch_buffer.h | 1 | ||||
| -rw-r--r-- | src/common/settings.cpp | 2 | ||||
| -rw-r--r-- | src/common/settings.h | 1 | ||||
| -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/image_base.h | 3 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 70 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache_base.h | 16 | ||||
| -rw-r--r-- | src/video_core/textures/astc.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics_advanced.cpp | 7 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics_advanced.h | 1 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics_advanced.ui | 10 | ||||
| -rw-r--r-- | src/yuzu_cmd/config.cpp | 1 | ||||
| -rw-r--r-- | src/yuzu_cmd/default_ini.h | 4 |
15 files changed, 138 insertions, 8 deletions
diff --git a/src/common/scratch_buffer.h b/src/common/scratch_buffer.h index 1245a5086..26d4e76dc 100644 --- a/src/common/scratch_buffer.h +++ b/src/common/scratch_buffer.h | |||
| @@ -23,6 +23,7 @@ public: | |||
| 23 | buffer{Common::make_unique_for_overwrite<T[]>(initial_capacity)} {} | 23 | buffer{Common::make_unique_for_overwrite<T[]>(initial_capacity)} {} |
| 24 | 24 | ||
| 25 | ~ScratchBuffer() = default; | 25 | ~ScratchBuffer() = default; |
| 26 | ScratchBuffer(ScratchBuffer&&) = default; | ||
| 26 | 27 | ||
| 27 | /// This will only grow the buffer's capacity if size is greater than the current capacity. | 28 | /// This will only grow the buffer's capacity if size is greater than the current capacity. |
| 28 | /// The previously held data will remain intact. | 29 | /// The previously held data will remain intact. |
diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 749ac213f..84955030b 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp | |||
| @@ -59,6 +59,7 @@ void LogSettings() { | |||
| 59 | values.use_asynchronous_gpu_emulation.GetValue()); | 59 | values.use_asynchronous_gpu_emulation.GetValue()); |
| 60 | log_setting("Renderer_NvdecEmulation", values.nvdec_emulation.GetValue()); | 60 | log_setting("Renderer_NvdecEmulation", values.nvdec_emulation.GetValue()); |
| 61 | log_setting("Renderer_AccelerateASTC", values.accelerate_astc.GetValue()); | 61 | log_setting("Renderer_AccelerateASTC", values.accelerate_astc.GetValue()); |
| 62 | log_setting("Renderer_AsyncASTC", values.async_astc.GetValue()); | ||
| 62 | log_setting("Renderer_UseVsync", values.use_vsync.GetValue()); | 63 | log_setting("Renderer_UseVsync", values.use_vsync.GetValue()); |
| 63 | log_setting("Renderer_ShaderBackend", values.shader_backend.GetValue()); | 64 | log_setting("Renderer_ShaderBackend", values.shader_backend.GetValue()); |
| 64 | log_setting("Renderer_UseAsynchronousShaders", values.use_asynchronous_shaders.GetValue()); | 65 | log_setting("Renderer_UseAsynchronousShaders", values.use_asynchronous_shaders.GetValue()); |
| @@ -219,6 +220,7 @@ void RestoreGlobalState(bool is_powered_on) { | |||
| 219 | values.use_asynchronous_gpu_emulation.SetGlobal(true); | 220 | values.use_asynchronous_gpu_emulation.SetGlobal(true); |
| 220 | values.nvdec_emulation.SetGlobal(true); | 221 | values.nvdec_emulation.SetGlobal(true); |
| 221 | values.accelerate_astc.SetGlobal(true); | 222 | values.accelerate_astc.SetGlobal(true); |
| 223 | values.async_astc.SetGlobal(true); | ||
| 222 | values.use_vsync.SetGlobal(true); | 224 | values.use_vsync.SetGlobal(true); |
| 223 | values.shader_backend.SetGlobal(true); | 225 | values.shader_backend.SetGlobal(true); |
| 224 | values.use_asynchronous_shaders.SetGlobal(true); | 226 | values.use_asynchronous_shaders.SetGlobal(true); |
diff --git a/src/common/settings.h b/src/common/settings.h index 9fe764e86..4d0694b7d 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -453,6 +453,7 @@ struct Values { | |||
| 453 | SwitchableSetting<bool> use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"}; | 453 | SwitchableSetting<bool> use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"}; |
| 454 | SwitchableSetting<NvdecEmulation> nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"}; | 454 | SwitchableSetting<NvdecEmulation> nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"}; |
| 455 | SwitchableSetting<bool> accelerate_astc{true, "accelerate_astc"}; | 455 | SwitchableSetting<bool> accelerate_astc{true, "accelerate_astc"}; |
| 456 | SwitchableSetting<bool> async_astc{false, "async_astc"}; | ||
| 456 | SwitchableSetting<bool> use_vsync{true, "use_vsync"}; | 457 | SwitchableSetting<bool> use_vsync{true, "use_vsync"}; |
| 457 | SwitchableSetting<ShaderBackend, true> shader_backend{ShaderBackend::GLSL, ShaderBackend::GLSL, | 458 | SwitchableSetting<ShaderBackend, true> shader_backend{ShaderBackend::GLSL, ShaderBackend::GLSL, |
| 458 | ShaderBackend::SPIRV, "shader_backend"}; | 459 | ShaderBackend::SPIRV, "shader_backend"}; |
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/image_base.h b/src/video_core/texture_cache/image_base.h index 620565684..e8fa592d2 100644 --- a/src/video_core/texture_cache/image_base.h +++ b/src/video_core/texture_cache/image_base.h | |||
| @@ -38,6 +38,9 @@ enum class ImageFlagBits : u32 { | |||
| 38 | Rescaled = 1 << 13, | 38 | Rescaled = 1 << 13, |
| 39 | CheckingRescalable = 1 << 14, | 39 | CheckingRescalable = 1 << 14, |
| 40 | IsRescalable = 1 << 15, | 40 | IsRescalable = 1 << 15, |
| 41 | |||
| 42 | AsynchronousDecode = 1 << 16, | ||
| 43 | IsDecoding = 1 << 17, ///< Is currently being decoded asynchornously. | ||
| 41 | }; | 44 | }; |
| 42 | DECLARE_ENUM_FLAG_OPERATORS(ImageFlagBits) | 45 | DECLARE_ENUM_FLAG_OPERATORS(ImageFlagBits) |
| 43 | 46 | ||
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 3e2cbb0b0..9dd152fbe 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -85,6 +85,11 @@ void TextureCache<P>::RunGarbageCollector() { | |||
| 85 | } | 85 | } |
| 86 | --num_iterations; | 86 | --num_iterations; |
| 87 | auto& image = slot_images[image_id]; | 87 | auto& image = slot_images[image_id]; |
| 88 | if (True(image.flags & ImageFlagBits::IsDecoding)) { | ||
| 89 | // This image is still being decoded, deleting it will invalidate the slot | ||
| 90 | // used by the async decoder thread. | ||
| 91 | return false; | ||
| 92 | } | ||
| 88 | const bool must_download = | 93 | const bool must_download = |
| 89 | image.IsSafeDownload() && False(image.flags & ImageFlagBits::BadOverlap); | 94 | image.IsSafeDownload() && False(image.flags & ImageFlagBits::BadOverlap); |
| 90 | if (!high_priority_mode && | 95 | if (!high_priority_mode && |
| @@ -133,6 +138,8 @@ void TextureCache<P>::TickFrame() { | |||
| 133 | sentenced_images.Tick(); | 138 | sentenced_images.Tick(); |
| 134 | sentenced_framebuffers.Tick(); | 139 | sentenced_framebuffers.Tick(); |
| 135 | sentenced_image_view.Tick(); | 140 | sentenced_image_view.Tick(); |
| 141 | TickAsyncDecode(); | ||
| 142 | |||
| 136 | runtime.TickFrame(); | 143 | runtime.TickFrame(); |
| 137 | critical_gc = 0; | 144 | critical_gc = 0; |
| 138 | ++frame_tick; | 145 | ++frame_tick; |
| @@ -777,6 +784,10 @@ void TextureCache<P>::RefreshContents(Image& image, ImageId image_id) { | |||
| 777 | LOG_WARNING(HW_GPU, "MSAA image uploads are not implemented"); | 784 | LOG_WARNING(HW_GPU, "MSAA image uploads are not implemented"); |
| 778 | return; | 785 | return; |
| 779 | } | 786 | } |
| 787 | if (True(image.flags & ImageFlagBits::AsynchronousDecode)) { | ||
| 788 | QueueAsyncDecode(image, image_id); | ||
| 789 | return; | ||
| 790 | } | ||
| 780 | auto staging = runtime.UploadStagingBuffer(MapSizeBytes(image)); | 791 | auto staging = runtime.UploadStagingBuffer(MapSizeBytes(image)); |
| 781 | UploadImageContents(image, staging); | 792 | UploadImageContents(image, staging); |
| 782 | runtime.InsertUploadMemoryBarrier(); | 793 | runtime.InsertUploadMemoryBarrier(); |
| @@ -990,6 +1001,65 @@ u64 TextureCache<P>::GetScaledImageSizeBytes(const ImageBase& image) { | |||
| 990 | } | 1001 | } |
| 991 | 1002 | ||
| 992 | template <class P> | 1003 | template <class P> |
| 1004 | void TextureCache<P>::QueueAsyncDecode(Image& image, ImageId image_id) { | ||
| 1005 | UNIMPLEMENTED_IF(False(image.flags & ImageFlagBits::Converted)); | ||
| 1006 | LOG_INFO(HW_GPU, "Queuing async texture decode"); | ||
| 1007 | |||
| 1008 | image.flags |= ImageFlagBits::IsDecoding; | ||
| 1009 | auto decode = std::make_unique<AsyncDecodeContext>(); | ||
| 1010 | auto* decode_ptr = decode.get(); | ||
| 1011 | decode->image_id = image_id; | ||
| 1012 | async_decodes.push_back(std::move(decode)); | ||
| 1013 | |||
| 1014 | Common::ScratchBuffer<u8> local_unswizzle_data_buffer(image.unswizzled_size_bytes); | ||
| 1015 | const size_t guest_size_bytes = image.guest_size_bytes; | ||
| 1016 | swizzle_data_buffer.resize_destructive(guest_size_bytes); | ||
| 1017 | gpu_memory->ReadBlockUnsafe(image.gpu_addr, swizzle_data_buffer.data(), guest_size_bytes); | ||
| 1018 | auto copies = UnswizzleImage(*gpu_memory, image.gpu_addr, image.info, swizzle_data_buffer, | ||
| 1019 | local_unswizzle_data_buffer); | ||
| 1020 | const size_t out_size = MapSizeBytes(image); | ||
| 1021 | |||
| 1022 | auto func = [out_size, copies, info = image.info, | ||
| 1023 | input = std::move(local_unswizzle_data_buffer), | ||
| 1024 | async_decode = decode_ptr]() mutable { | ||
| 1025 | async_decode->decoded_data.resize_destructive(out_size); | ||
| 1026 | std::span copies_span{copies.data(), copies.size()}; | ||
| 1027 | ConvertImage(input, info, async_decode->decoded_data, copies_span); | ||
| 1028 | |||
| 1029 | // TODO: Do we need this lock? | ||
| 1030 | std::unique_lock lock{async_decode->mutex}; | ||
| 1031 | async_decode->copies = std::move(copies); | ||
| 1032 | async_decode->complete = true; | ||
| 1033 | }; | ||
| 1034 | texture_decode_worker.QueueWork(std::move(func)); | ||
| 1035 | } | ||
| 1036 | |||
| 1037 | template <class P> | ||
| 1038 | void TextureCache<P>::TickAsyncDecode() { | ||
| 1039 | bool has_uploads{}; | ||
| 1040 | auto i = async_decodes.begin(); | ||
| 1041 | while (i != async_decodes.end()) { | ||
| 1042 | auto* async_decode = i->get(); | ||
| 1043 | std::unique_lock lock{async_decode->mutex}; | ||
| 1044 | if (!async_decode->complete) { | ||
| 1045 | ++i; | ||
| 1046 | continue; | ||
| 1047 | } | ||
| 1048 | Image& image = slot_images[async_decode->image_id]; | ||
| 1049 | auto staging = runtime.UploadStagingBuffer(MapSizeBytes(image)); | ||
| 1050 | std::memcpy(staging.mapped_span.data(), async_decode->decoded_data.data(), | ||
| 1051 | async_decode->decoded_data.size()); | ||
| 1052 | image.UploadMemory(staging, async_decode->copies); | ||
| 1053 | image.flags &= ~ImageFlagBits::IsDecoding; | ||
| 1054 | has_uploads = true; | ||
| 1055 | i = async_decodes.erase(i); | ||
| 1056 | } | ||
| 1057 | if (has_uploads) { | ||
| 1058 | runtime.InsertUploadMemoryBarrier(); | ||
| 1059 | } | ||
| 1060 | } | ||
| 1061 | |||
| 1062 | template <class P> | ||
| 993 | bool TextureCache<P>::ScaleUp(Image& image) { | 1063 | bool TextureCache<P>::ScaleUp(Image& image) { |
| 994 | const bool has_copy = image.HasScaled(); | 1064 | const bool has_copy = image.HasScaled(); |
| 995 | const bool rescaled = image.ScaleUp(); | 1065 | const bool rescaled = image.ScaleUp(); |
diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h index 485eaabaa..013836933 100644 --- a/src/video_core/texture_cache/texture_cache_base.h +++ b/src/video_core/texture_cache/texture_cache_base.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <atomic> | ||
| 6 | #include <deque> | 7 | #include <deque> |
| 7 | #include <limits> | 8 | #include <limits> |
| 8 | #include <mutex> | 9 | #include <mutex> |
| @@ -18,6 +19,7 @@ | |||
| 18 | #include "common/lru_cache.h" | 19 | #include "common/lru_cache.h" |
| 19 | #include "common/polyfill_ranges.h" | 20 | #include "common/polyfill_ranges.h" |
| 20 | #include "common/scratch_buffer.h" | 21 | #include "common/scratch_buffer.h" |
| 22 | #include "common/thread_worker.h" | ||
| 21 | #include "video_core/compatible_formats.h" | 23 | #include "video_core/compatible_formats.h" |
| 22 | #include "video_core/control/channel_state_cache.h" | 24 | #include "video_core/control/channel_state_cache.h" |
| 23 | #include "video_core/delayed_destruction_ring.h" | 25 | #include "video_core/delayed_destruction_ring.h" |
| @@ -54,6 +56,14 @@ struct ImageViewInOut { | |||
| 54 | ImageViewId id{}; | 56 | ImageViewId id{}; |
| 55 | }; | 57 | }; |
| 56 | 58 | ||
| 59 | struct AsyncDecodeContext { | ||
| 60 | ImageId image_id; | ||
| 61 | Common::ScratchBuffer<u8> decoded_data; | ||
| 62 | std::vector<BufferImageCopy> copies; | ||
| 63 | std::mutex mutex; | ||
| 64 | std::atomic_bool complete; | ||
| 65 | }; | ||
| 66 | |||
| 57 | using TextureCacheGPUMap = std::unordered_map<u64, std::vector<ImageId>, Common::IdentityHash<u64>>; | 67 | using TextureCacheGPUMap = std::unordered_map<u64, std::vector<ImageId>, Common::IdentityHash<u64>>; |
| 58 | 68 | ||
| 59 | class TextureCacheChannelInfo : public ChannelInfo { | 69 | class TextureCacheChannelInfo : public ChannelInfo { |
| @@ -377,6 +387,9 @@ private: | |||
| 377 | bool ScaleDown(Image& image); | 387 | bool ScaleDown(Image& image); |
| 378 | u64 GetScaledImageSizeBytes(const ImageBase& image); | 388 | u64 GetScaledImageSizeBytes(const ImageBase& image); |
| 379 | 389 | ||
| 390 | void QueueAsyncDecode(Image& image, ImageId image_id); | ||
| 391 | void TickAsyncDecode(); | ||
| 392 | |||
| 380 | Runtime& runtime; | 393 | Runtime& runtime; |
| 381 | 394 | ||
| 382 | VideoCore::RasterizerInterface& rasterizer; | 395 | VideoCore::RasterizerInterface& rasterizer; |
| @@ -430,6 +443,9 @@ private: | |||
| 430 | 443 | ||
| 431 | u64 modification_tick = 0; | 444 | u64 modification_tick = 0; |
| 432 | u64 frame_tick = 0; | 445 | u64 frame_tick = 0; |
| 446 | |||
| 447 | Common::ThreadWorker texture_decode_worker{1, "TextureDecoder"}; | ||
| 448 | std::vector<std::unique_ptr<AsyncDecodeContext>> async_decodes; | ||
| 433 | }; | 449 | }; |
| 434 | 450 | ||
| 435 | } // namespace VideoCommon | 451 | } // namespace VideoCommon |
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; |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index f8fae7416..4dad83b75 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -702,6 +702,7 @@ void Config::ReadRendererValues() { | |||
| 702 | ReadGlobalSetting(Settings::values.use_asynchronous_gpu_emulation); | 702 | ReadGlobalSetting(Settings::values.use_asynchronous_gpu_emulation); |
| 703 | ReadGlobalSetting(Settings::values.nvdec_emulation); | 703 | ReadGlobalSetting(Settings::values.nvdec_emulation); |
| 704 | ReadGlobalSetting(Settings::values.accelerate_astc); | 704 | ReadGlobalSetting(Settings::values.accelerate_astc); |
| 705 | ReadGlobalSetting(Settings::values.async_astc); | ||
| 705 | ReadGlobalSetting(Settings::values.use_vsync); | 706 | ReadGlobalSetting(Settings::values.use_vsync); |
| 706 | ReadGlobalSetting(Settings::values.shader_backend); | 707 | ReadGlobalSetting(Settings::values.shader_backend); |
| 707 | ReadGlobalSetting(Settings::values.use_asynchronous_shaders); | 708 | ReadGlobalSetting(Settings::values.use_asynchronous_shaders); |
| @@ -1343,6 +1344,7 @@ void Config::SaveRendererValues() { | |||
| 1343 | static_cast<u32>(Settings::values.nvdec_emulation.GetDefault()), | 1344 | static_cast<u32>(Settings::values.nvdec_emulation.GetDefault()), |
| 1344 | Settings::values.nvdec_emulation.UsingGlobal()); | 1345 | Settings::values.nvdec_emulation.UsingGlobal()); |
| 1345 | WriteGlobalSetting(Settings::values.accelerate_astc); | 1346 | WriteGlobalSetting(Settings::values.accelerate_astc); |
| 1347 | WriteGlobalSetting(Settings::values.async_astc); | ||
| 1346 | WriteGlobalSetting(Settings::values.use_vsync); | 1348 | WriteGlobalSetting(Settings::values.use_vsync); |
| 1347 | WriteSetting(QString::fromStdString(Settings::values.shader_backend.GetLabel()), | 1349 | WriteSetting(QString::fromStdString(Settings::values.shader_backend.GetLabel()), |
| 1348 | static_cast<u32>(Settings::values.shader_backend.GetValue(global)), | 1350 | static_cast<u32>(Settings::values.shader_backend.GetValue(global)), |
diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index 7ab5d5bf5..59fb1b334 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp | |||
| @@ -23,11 +23,13 @@ void ConfigureGraphicsAdvanced::SetConfiguration() { | |||
| 23 | const bool runtime_lock = !system.IsPoweredOn(); | 23 | const bool runtime_lock = !system.IsPoweredOn(); |
| 24 | ui->use_vsync->setEnabled(runtime_lock); | 24 | ui->use_vsync->setEnabled(runtime_lock); |
| 25 | ui->renderer_force_max_clock->setEnabled(runtime_lock); | 25 | ui->renderer_force_max_clock->setEnabled(runtime_lock); |
| 26 | ui->async_astc->setEnabled(runtime_lock); | ||
| 26 | ui->use_asynchronous_shaders->setEnabled(runtime_lock); | 27 | ui->use_asynchronous_shaders->setEnabled(runtime_lock); |
| 27 | ui->anisotropic_filtering_combobox->setEnabled(runtime_lock); | 28 | ui->anisotropic_filtering_combobox->setEnabled(runtime_lock); |
| 28 | 29 | ||
| 29 | ui->renderer_force_max_clock->setChecked(Settings::values.renderer_force_max_clock.GetValue()); | 30 | ui->renderer_force_max_clock->setChecked(Settings::values.renderer_force_max_clock.GetValue()); |
| 30 | ui->use_vsync->setChecked(Settings::values.use_vsync.GetValue()); | 31 | ui->use_vsync->setChecked(Settings::values.use_vsync.GetValue()); |
| 32 | ui->async_astc->setChecked(Settings::values.async_astc.GetValue()); | ||
| 31 | ui->use_asynchronous_shaders->setChecked(Settings::values.use_asynchronous_shaders.GetValue()); | 33 | ui->use_asynchronous_shaders->setChecked(Settings::values.use_asynchronous_shaders.GetValue()); |
| 32 | ui->use_fast_gpu_time->setChecked(Settings::values.use_fast_gpu_time.GetValue()); | 34 | ui->use_fast_gpu_time->setChecked(Settings::values.use_fast_gpu_time.GetValue()); |
| 33 | ui->use_pessimistic_flushes->setChecked(Settings::values.use_pessimistic_flushes.GetValue()); | 35 | ui->use_pessimistic_flushes->setChecked(Settings::values.use_pessimistic_flushes.GetValue()); |
| @@ -58,6 +60,8 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() { | |||
| 58 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, | 60 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, |
| 59 | ui->anisotropic_filtering_combobox); | 61 | ui->anisotropic_filtering_combobox); |
| 60 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, use_vsync); | 62 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, use_vsync); |
| 63 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.async_astc, ui->async_astc, | ||
| 64 | async_astc); | ||
| 61 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, | 65 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, |
| 62 | ui->use_asynchronous_shaders, | 66 | ui->use_asynchronous_shaders, |
| 63 | use_asynchronous_shaders); | 67 | use_asynchronous_shaders); |
| @@ -89,6 +93,7 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() { | |||
| 89 | ui->renderer_force_max_clock->setEnabled( | 93 | ui->renderer_force_max_clock->setEnabled( |
| 90 | Settings::values.renderer_force_max_clock.UsingGlobal()); | 94 | Settings::values.renderer_force_max_clock.UsingGlobal()); |
| 91 | ui->use_vsync->setEnabled(Settings::values.use_vsync.UsingGlobal()); | 95 | ui->use_vsync->setEnabled(Settings::values.use_vsync.UsingGlobal()); |
| 96 | ui->async_astc->setEnabled(Settings::values.async_astc.UsingGlobal()); | ||
| 92 | ui->use_asynchronous_shaders->setEnabled( | 97 | ui->use_asynchronous_shaders->setEnabled( |
| 93 | Settings::values.use_asynchronous_shaders.UsingGlobal()); | 98 | Settings::values.use_asynchronous_shaders.UsingGlobal()); |
| 94 | ui->use_fast_gpu_time->setEnabled(Settings::values.use_fast_gpu_time.UsingGlobal()); | 99 | ui->use_fast_gpu_time->setEnabled(Settings::values.use_fast_gpu_time.UsingGlobal()); |
| @@ -106,6 +111,8 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() { | |||
| 106 | Settings::values.renderer_force_max_clock, | 111 | Settings::values.renderer_force_max_clock, |
| 107 | renderer_force_max_clock); | 112 | renderer_force_max_clock); |
| 108 | ConfigurationShared::SetColoredTristate(ui->use_vsync, Settings::values.use_vsync, use_vsync); | 113 | ConfigurationShared::SetColoredTristate(ui->use_vsync, Settings::values.use_vsync, use_vsync); |
| 114 | ConfigurationShared::SetColoredTristate(ui->async_astc, Settings::values.async_astc, | ||
| 115 | async_astc); | ||
| 109 | ConfigurationShared::SetColoredTristate(ui->use_asynchronous_shaders, | 116 | ConfigurationShared::SetColoredTristate(ui->use_asynchronous_shaders, |
| 110 | Settings::values.use_asynchronous_shaders, | 117 | Settings::values.use_asynchronous_shaders, |
| 111 | use_asynchronous_shaders); | 118 | use_asynchronous_shaders); |
diff --git a/src/yuzu/configuration/configure_graphics_advanced.h b/src/yuzu/configuration/configure_graphics_advanced.h index df557d585..bf1b04749 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.h +++ b/src/yuzu/configuration/configure_graphics_advanced.h | |||
| @@ -38,6 +38,7 @@ private: | |||
| 38 | 38 | ||
| 39 | ConfigurationShared::CheckState renderer_force_max_clock; | 39 | ConfigurationShared::CheckState renderer_force_max_clock; |
| 40 | ConfigurationShared::CheckState use_vsync; | 40 | ConfigurationShared::CheckState use_vsync; |
| 41 | ConfigurationShared::CheckState async_astc; | ||
| 41 | ConfigurationShared::CheckState use_asynchronous_shaders; | 42 | ConfigurationShared::CheckState use_asynchronous_shaders; |
| 42 | ConfigurationShared::CheckState use_fast_gpu_time; | 43 | ConfigurationShared::CheckState use_fast_gpu_time; |
| 43 | ConfigurationShared::CheckState use_pessimistic_flushes; | 44 | ConfigurationShared::CheckState use_pessimistic_flushes; |
diff --git a/src/yuzu/configuration/configure_graphics_advanced.ui b/src/yuzu/configuration/configure_graphics_advanced.ui index 061885e30..a7dbdc18c 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.ui +++ b/src/yuzu/configuration/configure_graphics_advanced.ui | |||
| @@ -90,6 +90,16 @@ | |||
| 90 | </widget> | 90 | </widget> |
| 91 | </item> | 91 | </item> |
| 92 | <item> | 92 | <item> |
| 93 | <widget class="QCheckBox" name="async_astc"> | ||
| 94 | <property name="toolTip"> | ||
| 95 | <string>Enables asynchronous ASTC texture decoding, which may reduce load time stutter. This feature is experimental.</string> | ||
| 96 | </property> | ||
| 97 | <property name="text"> | ||
| 98 | <string>Decode ASTC textures asynchronously (Hack)</string> | ||
| 99 | </property> | ||
| 100 | </widget> | ||
| 101 | </item> | ||
| 102 | <item> | ||
| 93 | <widget class="QCheckBox" name="use_asynchronous_shaders"> | 103 | <widget class="QCheckBox" name="use_asynchronous_shaders"> |
| 94 | <property name="toolTip"> | 104 | <property name="toolTip"> |
| 95 | <string>Enables asynchronous shader compilation, which may reduce shader stutter. This feature is experimental.</string> | 105 | <string>Enables asynchronous shader compilation, which may reduce shader stutter. This feature is experimental.</string> |
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 3b6dce296..464da3231 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp | |||
| @@ -324,6 +324,7 @@ void Config::ReadValues() { | |||
| 324 | ReadSetting("Renderer", Settings::values.use_asynchronous_shaders); | 324 | ReadSetting("Renderer", Settings::values.use_asynchronous_shaders); |
| 325 | ReadSetting("Renderer", Settings::values.nvdec_emulation); | 325 | ReadSetting("Renderer", Settings::values.nvdec_emulation); |
| 326 | ReadSetting("Renderer", Settings::values.accelerate_astc); | 326 | ReadSetting("Renderer", Settings::values.accelerate_astc); |
| 327 | ReadSetting("Renderer", Settings::values.async_astc); | ||
| 327 | ReadSetting("Renderer", Settings::values.use_fast_gpu_time); | 328 | ReadSetting("Renderer", Settings::values.use_fast_gpu_time); |
| 328 | ReadSetting("Renderer", Settings::values.use_pessimistic_flushes); | 329 | ReadSetting("Renderer", Settings::values.use_pessimistic_flushes); |
| 329 | ReadSetting("Renderer", Settings::values.use_vulkan_driver_pipeline_cache); | 330 | ReadSetting("Renderer", Settings::values.use_vulkan_driver_pipeline_cache); |
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index cf3cc4c4e..20e403400 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h | |||
| @@ -342,6 +342,10 @@ nvdec_emulation = | |||
| 342 | # 0: Off, 1 (default): On | 342 | # 0: Off, 1 (default): On |
| 343 | accelerate_astc = | 343 | accelerate_astc = |
| 344 | 344 | ||
| 345 | # Decode ASTC textures asynchronously. | ||
| 346 | # 0 (default): Off, 1: On | ||
| 347 | async_astc = | ||
| 348 | |||
| 345 | # Turns on the speed limiter, which will limit the emulation speed to the desired speed limit value | 349 | # Turns on the speed limiter, which will limit the emulation speed to the desired speed limit value |
| 346 | # 0: Off, 1: On (default) | 350 | # 0: Off, 1: On (default) |
| 347 | use_speed_limit = | 351 | use_speed_limit = |