Add an option to allow CPU writes when fast readback is used

This commit is contained in:
Billy Laws 2023-02-13 17:50:49 +00:00
parent 2d56ed053d
commit a47f010653
7 changed files with 15 additions and 1 deletions

View File

@ -46,6 +46,7 @@ namespace skyline {
forceMaxGpuClocks = ktSettings.GetBool("forceMaxGpuClocks"); forceMaxGpuClocks = ktSettings.GetBool("forceMaxGpuClocks");
disableShaderCache = ktSettings.GetBool("disableShaderCache"); disableShaderCache = ktSettings.GetBool("disableShaderCache");
enableFastGpuReadbackHack = ktSettings.GetBool("enableFastGpuReadbackHack"); enableFastGpuReadbackHack = ktSettings.GetBool("enableFastGpuReadbackHack");
enableFastReadbackWrites = ktSettings.GetBool("enableFastReadbackWrites");
disableSubgroupShuffle = ktSettings.GetBool("disableSubgroupShuffle"); disableSubgroupShuffle = ktSettings.GetBool("disableSubgroupShuffle");
isAudioOutputDisabled = ktSettings.GetBool("isAudioOutputDisabled"); isAudioOutputDisabled = ktSettings.GetBool("isAudioOutputDisabled");
validationLayer = ktSettings.GetBool("validationLayer"); validationLayer = ktSettings.GetBool("validationLayer");

View File

@ -80,6 +80,7 @@ namespace skyline {
// Hacks // Hacks
Setting<bool> enableFastGpuReadbackHack; //!< If the CPU texture readback skipping hack should be used Setting<bool> enableFastGpuReadbackHack; //!< If the CPU texture readback skipping hack should be used
Setting<bool> enableFastReadbackWrites; //!< If buffers should be treated as CPU dirty when written with the readback hack
Setting<bool> disableSubgroupShuffle; //!< If shader subgroup suffle operations should be ignored Setting<bool> disableSubgroupShuffle; //!< If shader subgroup suffle operations should be ignored
// Audio // Audio

View File

@ -98,7 +98,7 @@ namespace skyline::gpu {
// As opposed to skipping readback as we do for textures, with buffers we can still perform the readback but just without syncinc the GPU // As opposed to skipping readback as we do for textures, with buffers we can still perform the readback but just without syncinc the GPU
// While the read data may be invalid it's still better than nothing and works in most cases // While the read data may be invalid it's still better than nothing and works in most cases
memcpy(buffer->mirror.data(), buffer->backing->data(), buffer->mirror.size()); memcpy(buffer->mirror.data(), buffer->backing->data(), buffer->mirror.size());
buffer->dirtyState = DirtyState::Clean; buffer->dirtyState = *buffer->gpu.state.settings->enableFastReadbackWrites ? DirtyState::CpuDirty : DirtyState::Clean;
return true; return true;
} }

View File

@ -34,6 +34,7 @@ class NativeSettings(context : Context, pref : PreferenceSettings) {
// Hacks // Hacks
var enableFastGpuReadbackHack : Boolean = pref.enableFastGpuReadbackHack var enableFastGpuReadbackHack : Boolean = pref.enableFastGpuReadbackHack
var enableFastReadbackWrites : Boolean = pref.enableFastReadbackWrites
var disableSubgroupShuffle : Boolean = pref.disableSubgroupShuffle var disableSubgroupShuffle : Boolean = pref.disableSubgroupShuffle
// Audio // Audio

View File

@ -49,6 +49,7 @@ class PreferenceSettings @Inject constructor(@ApplicationContext private val con
// Hacks // Hacks
var enableFastGpuReadbackHack by sharedPreferences(context, false) var enableFastGpuReadbackHack by sharedPreferences(context, false)
var enableFastReadbackWrites by sharedPreferences(context, false)
var disableSubgroupShuffle by sharedPreferences(context, false) var disableSubgroupShuffle by sharedPreferences(context, false)
// Audio // Audio

View File

@ -96,6 +96,9 @@
<string name="enable_fast_gpu_readback">Enable fast GPU readback</string> <string name="enable_fast_gpu_readback">Enable fast GPU readback</string>
<string name="enable_fast_gpu_readback_enabled">Fast GPU readback is enabled (Will break some games but others will have higher performance)</string> <string name="enable_fast_gpu_readback_enabled">Fast GPU readback is enabled (Will break some games but others will have higher performance)</string>
<string name="enable_fast_gpu_readback_disabled">Fast GPU readback is disabled (Ensures highest accuracy)</string> <string name="enable_fast_gpu_readback_disabled">Fast GPU readback is disabled (Ensures highest accuracy)</string>
<string name="enable_fast_readback_writes">Enable fast readback writes</string>
<string name="enable_fast_readback_writes_enabled">Fast readback writes are enabled</string>
<string name="enable_fast_readback_writes_disabled">Fast readback writes are disabled</string>
<string name="disable_subgroup_shuffle">Disable GPU subgroup shuffle</string> <string name="disable_subgroup_shuffle">Disable GPU subgroup shuffle</string>
<string name="disable_subgroup_shuffle_enabled">Shader subgroup shuffle operations are disabled, may cause severe graphical issues</string> <string name="disable_subgroup_shuffle_enabled">Shader subgroup shuffle operations are disabled, may cause severe graphical issues</string>
<string name="disable_subgroup_shuffle_disabled">Shader subgroup shuffle operations are enabled, ensures maximum accuracy</string> <string name="disable_subgroup_shuffle_disabled">Shader subgroup shuffle operations are enabled, ensures maximum accuracy</string>

View File

@ -186,6 +186,13 @@
android:summaryOn="@string/enable_fast_gpu_readback_enabled" android:summaryOn="@string/enable_fast_gpu_readback_enabled"
app:key="enable_fast_gpu_readback_hack" app:key="enable_fast_gpu_readback_hack"
app:title="@string/enable_fast_gpu_readback" /> app:title="@string/enable_fast_gpu_readback" />
<CheckBoxPreference
android:defaultValue="false"
android:dependency="enable_fast_gpu_readback_hack"
android:summaryOff="@string/enable_fast_readback_writes_disabled"
android:summaryOn="@string/enable_fast_readback_writes_enabled"
app:key="enable_fast_readback_writes"
app:title="@string/enable_fast_readback_writes" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
android:summaryOff="@string/disable_subgroup_shuffle_disabled" android:summaryOff="@string/disable_subgroup_shuffle_disabled"