Merge branch 'master_Tweaks' into 'master'

Added: Fix Occlusion Culling

See merge request ryubing/ryujinx!18
This commit is contained in:
Goodfeat 2025-04-18 04:49:51 -05:00
commit e1cd6b777a
15 changed files with 2844 additions and 2576 deletions

File diff suppressed because it is too large Load diff

View file

@ -165,6 +165,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
Timestamp = ticks, Timestamp = ticks,
}; };
if (GraphicsConfig.FixOcclusionCulling && result <= 0)
{
return;
}
if (counter?.Invalid != true) if (counter?.Invalid != true)
{ {
_channel.MemoryManager.Write(gpuVa, counterData); _channel.MemoryManager.Write(gpuVa, counterData);

View file

@ -72,6 +72,11 @@ namespace Ryujinx.Graphics.Gpu
/// Enables or disables color space passthrough, if available. /// Enables or disables color space passthrough, if available.
/// </summary> /// </summary>
public static bool EnableColorSpacePassthrough = false; public static bool EnableColorSpacePassthrough = false;
/// <summary>
/// Enables or disables fix occlusion culling.
/// </summary>
public static bool FixOcclusionCulling = true;
} }
#pragma warning restore CA2211 #pragma warning restore CA2211
} }

View file

@ -15,7 +15,7 @@ namespace Ryujinx.Ava.Systems.Configuration
/// <summary> /// <summary>
/// The current version of the file format /// The current version of the file format
/// </summary> /// </summary>
public const int CurrentVersion = 69; public const int CurrentVersion = 70;
/// <summary> /// <summary>
/// Version of the configuration file format /// Version of the configuration file format
@ -469,6 +469,11 @@ namespace Ryujinx.Ava.Systems.Configuration
/// </summary> /// </summary>
public ulong[] DirtyHacks { get; set; } public ulong[] DirtyHacks { get; set; }
/// <summary>
/// Fixes Occlusion Culling in Games (test feature)
/// </summary>
public bool FixOcclusionCulling { get; set; }
/// <summary> /// <summary>
/// Loads a configuration file from disk /// Loads a configuration file from disk
/// </summary> /// </summary>

View file

@ -156,6 +156,8 @@ namespace Ryujinx.Ava.Systems.Configuration
Multiplayer.LdnPassphrase.Value = cff.MultiplayerLdnPassphrase; Multiplayer.LdnPassphrase.Value = cff.MultiplayerLdnPassphrase;
Multiplayer.LdnServer.Value = cff.LdnServer; Multiplayer.LdnServer.Value = cff.LdnServer;
Tweaks.FixOcclusionCulling.Value = cff.FixOcclusionCulling;
{ {
Hacks.ShowDirtyHacks.Value = cff.ShowDirtyHacks; Hacks.ShowDirtyHacks.Value = cff.ShowDirtyHacks;
@ -461,7 +463,8 @@ namespace Ryujinx.Ava.Systems.Configuration
TurboModeWhileHeld = false TurboModeWhileHeld = false
}; };
}), }),
(69, static cff => cff.SkipUserProfiles = false) (69, static cff => cff.SkipUserProfiles = false),
(70, static cff => cff.FixOcclusionCulling = false)
); );
} }
} }

View file

@ -643,6 +643,21 @@ namespace Ryujinx.Ava.Systems.Configuration
} }
} }
/// <summary>
/// Tweaks Section
/// </summary>
public class TweaksSection
{
/// <summary>
/// Enable or disable Fix Occlusion Culling
/// </summary>
public ReactiveObject<bool> FixOcclusionCulling { get; private set; }
public TweaksSection()
{
FixOcclusionCulling = new ReactiveObject<bool>();
}
}
/// <summary> /// <summary>
/// Multiplayer configuration section /// Multiplayer configuration section
/// </summary> /// </summary>
@ -781,6 +796,11 @@ namespace Ryujinx.Ava.Systems.Configuration
/// </summary> /// </summary>
public GraphicsSection Graphics { get; private set; } public GraphicsSection Graphics { get; private set; }
/// <summary>
/// The Tweaks Section
/// </summary>
public TweaksSection Tweaks { get; private set; }
/// <summary> /// <summary>
/// The Hid section /// The Hid section
/// </summary> /// </summary>
@ -842,6 +862,7 @@ namespace Ryujinx.Ava.Systems.Configuration
Logger = new LoggerSection(); Logger = new LoggerSection();
System = new SystemSection(); System = new SystemSection();
Graphics = new GraphicsSection(); Graphics = new GraphicsSection();
Tweaks = new TweaksSection();
Hid = new HidSection(); Hid = new HidSection();
Multiplayer = new MultiplayerSection(); Multiplayer = new MultiplayerSection();
Hacks = new HacksSection(); Hacks = new HacksSection();

View file

@ -147,6 +147,7 @@ namespace Ryujinx.Ava.Systems.Configuration
LdnServer = Multiplayer.LdnServer, LdnServer = Multiplayer.LdnServer,
ShowDirtyHacks = Hacks.ShowDirtyHacks, ShowDirtyHacks = Hacks.ShowDirtyHacks,
DirtyHacks = Hacks.EnabledHacks.Select(it => it.Pack()).ToArray(), DirtyHacks = Hacks.EnabledHacks.Select(it => it.Pack()).ToArray(),
FixOcclusionCulling = Tweaks.FixOcclusionCulling,
}; };
return configurationFile; return configurationFile;
@ -320,6 +321,7 @@ namespace Ryujinx.Ava.Systems.Configuration
}, },
} }
]; ];
Tweaks.FixOcclusionCulling.Value = true;
} }
private static GraphicsBackend DefaultGraphicsBackend() private static GraphicsBackend DefaultGraphicsBackend()

View file

@ -383,6 +383,8 @@ namespace Ryujinx.Ava.UI.ViewModels
} }
} }
public bool FixOcclusionCulling { get; set; }
public SettingsViewModel( public SettingsViewModel(
VirtualFileSystem virtualFileSystem, VirtualFileSystem virtualFileSystem,
ContentManager contentManager, ContentManager contentManager,
@ -659,6 +661,9 @@ namespace Ryujinx.Ava.UI.ViewModels
DisableP2P = config.Multiplayer.DisableP2p; DisableP2P = config.Multiplayer.DisableP2p;
LdnPassphrase = config.Multiplayer.LdnPassphrase; LdnPassphrase = config.Multiplayer.LdnPassphrase;
LdnServer = config.Multiplayer.LdnServer; LdnServer = config.Multiplayer.LdnServer;
// Tweaks
FixOcclusionCulling = config.Tweaks.FixOcclusionCulling.Value;
} }
public void SaveSettings() public void SaveSettings()
@ -785,6 +790,9 @@ namespace Ryujinx.Ava.UI.ViewModels
config.Hacks.DisableNifmIsAnyInternetRequestAccepted.Value = config.Hacks.DisableNifmIsAnyInternetRequestAccepted.Value =
DirtyHacks.NifmDisableIsAnyInternetRequestAccepted; DirtyHacks.NifmDisableIsAnyInternetRequestAccepted;
// Tweaks
config.Tweaks.FixOcclusionCulling.Value = FixOcclusionCulling;
config.ToFileFormat().SaveConfig(Program.ConfigurationPath); config.ToFileFormat().SaveConfig(Program.ConfigurationPath);
MainWindow.UpdateGraphicsConfig(); MainWindow.UpdateGraphicsConfig();

View file

@ -0,0 +1,65 @@
<UserControl
x:Class="Ryujinx.Ava.UI.Views.Settings.SettingsTweaksView"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ext="clr-namespace:Ryujinx.Ava.Common.Markup"
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
mc:Ignorable="d"
x:DataType="viewModels:SettingsViewModel"
x:CompileBindings="True"
Focusable="True">
<Design.DataContext>
<viewModels:SettingsViewModel />
</Design.DataContext>
<UserControl.Styles>
<Style Selector="TextBlock.DefaultEnable" >
<Setter Property="Foreground" Value="SeaGreen"/>
<Setter Property="Margin" Value="5,0,0,0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style Selector="TextBlock.DefaultDisable" >
<Setter Property="Foreground" Value="IndianRed"/>
<Setter Property="Margin" Value="5,0,0,0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</UserControl.Styles>
<ScrollViewer
Name="HotkeysPage"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<Border Classes="settings">
<StackPanel
Name="SettingButtons"
Margin="10"
Orientation="Vertical"
Spacing="10">
<TextBlock
HorizontalAlignment="Center"
Classes="h1"
Text="{ext:Locale SettingsTabTweaksTitle}" />
<TextBlock
HorizontalAlignment="Center"
Foreground="{DynamicResource SecondaryTextColor}"
TextDecorations="Underline"
Text="{ext:Locale SettingsTabTweaksDescription}" />
<Separator/>
<StackPanel Orientation="Vertical">
<CheckBox IsChecked="{Binding FixOcclusionCulling}"
ToolTip.Tip="{ext:Locale FixOcclusionCullingTooltip}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{ext:Locale FixOcclusionCulling}" />
<TextBlock Classes="DefaultEnable" Text="Default: enable" />
</StackPanel>
</CheckBox>
</StackPanel>
</StackPanel>
</Border>
</ScrollViewer>
</UserControl>

View file

@ -0,0 +1,12 @@
using Avalonia.Controls;
namespace Ryujinx.Ava.UI.Views.Settings
{
public partial class SettingsTweaksView : UserControl
{
public SettingsTweaksView()
{
InitializeComponent();
}
}
}

View file

@ -34,6 +34,7 @@
<settings:SettingsSystemView Name="SystemPage" /> <settings:SettingsSystemView Name="SystemPage" />
<settings:SettingsCPUView Name="CpuPage" /> <settings:SettingsCPUView Name="CpuPage" />
<settings:SettingsGraphicsView Name="GraphicsPage" /> <settings:SettingsGraphicsView Name="GraphicsPage" />
<settings:SettingsTweaksView Name="TweaksPage" />
<settings:SettingsAudioView Name="AudioPage" /> <settings:SettingsAudioView Name="AudioPage" />
<settings:SettingsNetworkView Name="NetworkPage" /> <settings:SettingsNetworkView Name="NetworkPage" />
<settings:SettingsLoggingView Name="LoggingPage" /> <settings:SettingsLoggingView Name="LoggingPage" />
@ -101,6 +102,10 @@
Content="{ext:Locale SettingsTabGraphics}" Content="{ext:Locale SettingsTabGraphics}"
Tag="GraphicsPage" Tag="GraphicsPage"
IconSource="Image" /> IconSource="Image" />
<ui:NavigationViewItem
Content="{ext:Locale SettingsTabTweaks}"
Tag="TweaksPage"
IconSource="Repair" />
<ui:NavigationViewItem <ui:NavigationViewItem
Content="{ext:Locale SettingsTabAudio}" Content="{ext:Locale SettingsTabAudio}"
IconSource="Audio" IconSource="Audio"

View file

@ -70,6 +70,9 @@ namespace Ryujinx.Ava.UI.Windows
case nameof(GraphicsPage): case nameof(GraphicsPage):
NavPanel.Content = GraphicsPage; NavPanel.Content = GraphicsPage;
break; break;
case nameof(TweaksPage):
NavPanel.Content = TweaksPage;
break;
case nameof(AudioPage): case nameof(AudioPage):
NavPanel.Content = AudioPage; NavPanel.Content = AudioPage;
break; break;

View file

@ -569,6 +569,7 @@ namespace Ryujinx.Ava.UI.Windows
GraphicsConfig.EnableShaderCache = ConfigurationState.Instance.Graphics.EnableShaderCache; GraphicsConfig.EnableShaderCache = ConfigurationState.Instance.Graphics.EnableShaderCache;
GraphicsConfig.EnableTextureRecompression = ConfigurationState.Instance.Graphics.EnableTextureRecompression; GraphicsConfig.EnableTextureRecompression = ConfigurationState.Instance.Graphics.EnableTextureRecompression;
GraphicsConfig.EnableMacroHLE = ConfigurationState.Instance.Graphics.EnableMacroHLE; GraphicsConfig.EnableMacroHLE = ConfigurationState.Instance.Graphics.EnableMacroHLE;
GraphicsConfig.FixOcclusionCulling = ConfigurationState.Instance.Tweaks.FixOcclusionCulling;
#pragma warning restore IDE0055 #pragma warning restore IDE0055
} }

View file

@ -43,6 +43,7 @@
<settings:SettingsSystemView Name="SystemPage" /> <settings:SettingsSystemView Name="SystemPage" />
<settings:SettingsCPUView Name="CpuPage" /> <settings:SettingsCPUView Name="CpuPage" />
<settings:SettingsGraphicsView Name="GraphicsPage" /> <settings:SettingsGraphicsView Name="GraphicsPage" />
<settings:SettingsTweaksView Name="TweaksPage" />
<settings:SettingsAudioView Name="AudioPage" /> <settings:SettingsAudioView Name="AudioPage" />
<settings:SettingsNetworkView Name="NetworkPage" /> <settings:SettingsNetworkView Name="NetworkPage" />
<settings:SettingsLoggingView Name="LoggingPage" /> <settings:SettingsLoggingView Name="LoggingPage" />
@ -88,6 +89,10 @@
Content="{ext:Locale SettingsTabGraphics}" Content="{ext:Locale SettingsTabGraphics}"
Tag="GraphicsPage" Tag="GraphicsPage"
IconSource="Image" /> IconSource="Image" />
<ui:NavigationViewItem
Content="{ext:Locale SettingsTabTweaks}"
Tag="TweaksPage"
IconSource="Repair" />
<ui:NavigationViewItem <ui:NavigationViewItem
Content="{ext:Locale SettingsTabAudio}" Content="{ext:Locale SettingsTabAudio}"
IconSource="Audio" IconSource="Audio"

View file

@ -88,6 +88,9 @@ namespace Ryujinx.Ava.UI.Windows
case "GraphicsPage": case "GraphicsPage":
NavPanel.Content = GraphicsPage; NavPanel.Content = GraphicsPage;
break; break;
case "TweaksPage":
NavPanel.Content = TweaksPage;
break;
case "AudioPage": case "AudioPage":
NavPanel.Content = AudioPage; NavPanel.Content = AudioPage;
break; break;