diff --git a/app/src/main/cpp/skyline/common/android_settings.h b/app/src/main/cpp/skyline/common/android_settings.h index ca7e7553..ec2b7df3 100644 --- a/app/src/main/cpp/skyline/common/android_settings.h +++ b/app/src/main/cpp/skyline/common/android_settings.h @@ -45,6 +45,7 @@ namespace skyline { useDirectMemoryImport = ktSettings.GetBool("useDirectMemoryImport"); forceMaxGpuClocks = ktSettings.GetBool("forceMaxGpuClocks"); enableFastGpuReadbackHack = ktSettings.GetBool("enableFastGpuReadbackHack"); + disableShaderCache = ktSettings.GetBool("disableShaderCache"); isAudioOutputDisabled = ktSettings.GetBool("isAudioOutputDisabled"); validationLayer = ktSettings.GetBool("validationLayer"); }; diff --git a/app/src/main/cpp/skyline/common/settings.h b/app/src/main/cpp/skyline/common/settings.h index 9079c71d..0d07a39c 100644 --- a/app/src/main/cpp/skyline/common/settings.h +++ b/app/src/main/cpp/skyline/common/settings.h @@ -68,6 +68,7 @@ namespace skyline { // Display Setting forceTripleBuffering; //!< If the presentation engine should always triple buffer even if the swapchain supports double buffering Setting disableFrameThrottling; //!< Allow the guest to submit frames without any blocking calls + Setting disableShaderCache; //!< Prevents cached shaders from being loaded and disables caching of new shaders // GPU Setting gpuDriver; //!< The label of the GPU driver to use diff --git a/app/src/main/cpp/skyline/gpu.cpp b/app/src/main/cpp/skyline/gpu.cpp index cc2267d9..d77e7881 100644 --- a/app/src/main/cpp/skyline/gpu.cpp +++ b/app/src/main/cpp/skyline/gpu.cpp @@ -400,6 +400,7 @@ namespace skyline::gpu { buffer(*this), megaBufferAllocator(*this), descriptor(*this), + shader(state, *this), helperShaders(*this, state.os->assetFileSystem), graphicsPipelineCache(*this), renderPassCache(*this), @@ -410,8 +411,9 @@ namespace skyline::gpu { shader.emplace(state, *this, state.os->publicAppFilesPath + "shader_replacements/" + titleId, state.os->publicAppFilesPath + "shader_dumps/" + titleId); - graphicsPipelineCacheManager.emplace(state, - state.os->publicAppFilesPath + "graphics_pipeline_cache/" + titleId); + if (!*state.settings->disableShaderCache) + graphicsPipelineCacheManager.emplace(state, + state.os->publicAppFilesPath + "graphics_pipeline_cache/" + titleId); graphicsPipelineManager.emplace(*this); } } diff --git a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/graphics_pipeline_state_accessor.cpp b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/graphics_pipeline_state_accessor.cpp index 13075435..487dc433 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/graphics_pipeline_state_accessor.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/graphics_pipeline_state_accessor.cpp @@ -32,6 +32,7 @@ namespace skyline::gpu::interconnect::maxwell3d { } void RuntimeGraphicsPipelineStateAccessor::MarkComplete() { - ctx.gpu.graphicsPipelineCacheManager->QueueWrite(std::move(bundle)); + if (ctx.gpu.graphicsPipelineCacheManager) + ctx.gpu.graphicsPipelineCacheManager->QueueWrite(std::move(bundle)); } } diff --git a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp index 660d7227..f5ccbcb3 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp @@ -881,6 +881,9 @@ namespace skyline::gpu::interconnect::maxwell3d { } PipelineManager::PipelineManager(GPU &gpu) { + if (!gpu.graphicsPipelineCacheManager) + return; + std::ifstream stream{gpu.graphicsPipelineCacheManager->OpenReadStream()}; i64 lastKnownGoodOffset{stream.tellg()}; try { diff --git a/app/src/main/java/emu/skyline/utils/NativeSettings.kt b/app/src/main/java/emu/skyline/utils/NativeSettings.kt index 253a2917..da6a39c8 100644 --- a/app/src/main/java/emu/skyline/utils/NativeSettings.kt +++ b/app/src/main/java/emu/skyline/utils/NativeSettings.kt @@ -22,6 +22,7 @@ class NativeSettings(context : Context, pref : PreferenceSettings) { // Display var forceTripleBuffering : Boolean = pref.forceTripleBuffering var disableFrameThrottling : Boolean = pref.disableFrameThrottling + var disableShaderCache : Boolean = pref.disableShaderCache // GPU var gpuDriver : String = if (pref.gpuDriver == PreferenceSettings.SYSTEM_GPU_DRIVER) "" else pref.gpuDriver diff --git a/app/src/main/java/emu/skyline/utils/PreferenceSettings.kt b/app/src/main/java/emu/skyline/utils/PreferenceSettings.kt index d67a0b08..d5acda2d 100644 --- a/app/src/main/java/emu/skyline/utils/PreferenceSettings.kt +++ b/app/src/main/java/emu/skyline/utils/PreferenceSettings.kt @@ -38,6 +38,7 @@ class PreferenceSettings @Inject constructor(@ApplicationContext private val con var aspectRatio by sharedPreferences(context, 0) var orientation by sharedPreferences(context, ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE) var respectDisplayCutout by sharedPreferences(context, false) + var disableShaderCache by sharedPreferences(context, false) // GPU var gpuDriver by sharedPreferences(context, SYSTEM_GPU_DRIVER) diff --git a/app/src/main/res/layout/app_dialog.xml b/app/src/main/res/layout/app_dialog.xml index 07777b91..d6485813 100644 --- a/app/src/main/res/layout/app_dialog.xml +++ b/app/src/main/res/layout/app_dialog.xml @@ -120,6 +120,7 @@ android:textColor="?attr/colorAccent" app:icon="@drawable/ic_add_home" app:iconGravity="textStart" + android:padding="0dp" app:iconPadding="0dp" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8b1521d5..075102e5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -38,8 +38,11 @@ Game information will be shown on clicking a game Game information will only be shown on long-clicking a game Show Performance Statistics + Disable shader cache Performance Statistics will not be shown Performance Statistics will be shown in the top-left corner + Cached shaders won\'t be loaded, will cause stutters + Cached shaders will be loaded, can heavily reduce stuttering Log Level GPU Driver Configuration Active driver: %1$s diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 5c65119b..26326216 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -170,6 +170,12 @@ android:summary="@string/force_max_gpu_clocks_desc" app:key="force_max_gpu_clocks" app:title="@string/force_max_gpu_clocks" /> +