mirror of
https://github.com/Ryubing/Ryujinx.git
synced 2025-03-10 09:04:23 +00:00
misc: chore: move ThreadedRenderer creation logic into IRenderer base (since ThreadedRenderer is a GAL construct anyways)
This commit is contained in:
parent
b45a65fbdc
commit
f7976753fd
@ -1,4 +1,6 @@
|
|||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
|
using Ryujinx.Graphics.GAL.Multithreading;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
@ -10,6 +12,20 @@ namespace Ryujinx.Graphics.GAL
|
|||||||
|
|
||||||
bool PreferThreading { get; }
|
bool PreferThreading { get; }
|
||||||
|
|
||||||
|
public IRenderer TryMakeThreaded(BackendThreading backendThreading = BackendThreading.Auto)
|
||||||
|
{
|
||||||
|
if (backendThreading is BackendThreading.On ||
|
||||||
|
(backendThreading is BackendThreading.Auto && PreferThreading))
|
||||||
|
{
|
||||||
|
Logger.Info?.PrintMsg(LogClass.Gpu, $"Backend Threading ({backendThreading}): True");
|
||||||
|
return new ThreadedRenderer(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.Info?.PrintMsg(LogClass.Gpu, $"Backend Threading ({backendThreading}): False");
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
IPipeline Pipeline { get; }
|
IPipeline Pipeline { get; }
|
||||||
|
|
||||||
IWindow Window { get; }
|
IWindow Window { get; }
|
||||||
|
@ -902,16 +902,6 @@ namespace Ryujinx.Ava
|
|||||||
_ => new OpenGLRenderer()
|
_ => new OpenGLRenderer()
|
||||||
};
|
};
|
||||||
|
|
||||||
BackendThreading threadingMode = ConfigurationState.Instance.Graphics.BackendThreading;
|
|
||||||
|
|
||||||
bool isGALThreaded = threadingMode == BackendThreading.On || (threadingMode == BackendThreading.Auto && renderer.PreferThreading);
|
|
||||||
if (isGALThreaded)
|
|
||||||
{
|
|
||||||
renderer = new ThreadedRenderer(renderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.Info?.PrintMsg(LogClass.Gpu, $"Backend Threading ({threadingMode}): {isGALThreaded}");
|
|
||||||
|
|
||||||
// Initialize Configuration.
|
// Initialize Configuration.
|
||||||
Device = new Switch(ConfigurationState.Instance.CreateHleConfiguration()
|
Device = new Switch(ConfigurationState.Instance.CreateHleConfiguration()
|
||||||
.Configure(
|
.Configure(
|
||||||
@ -920,7 +910,7 @@ namespace Ryujinx.Ava
|
|||||||
ContentManager,
|
ContentManager,
|
||||||
_accountManager,
|
_accountManager,
|
||||||
_userChannelPersistence,
|
_userChannelPersistence,
|
||||||
renderer,
|
renderer.TryMakeThreaded(ConfigurationState.Instance.Graphics.BackendThreading),
|
||||||
InitializeAudio(),
|
InitializeAudio(),
|
||||||
_viewModel.UiHandler
|
_viewModel.UiHandler
|
||||||
)
|
)
|
||||||
|
@ -312,18 +312,8 @@ namespace Ryujinx.Headless
|
|||||||
return new OpenGLRenderer();
|
return new OpenGLRenderer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Switch InitializeEmulationContext(WindowBase window, IRenderer renderer, Options options)
|
private static Switch InitializeEmulationContext(WindowBase window, IRenderer renderer, Options options) =>
|
||||||
{
|
new(
|
||||||
BackendThreading threadingMode = options.BackendThreading;
|
|
||||||
|
|
||||||
bool threadedGAL = threadingMode == BackendThreading.On || (threadingMode == BackendThreading.Auto && renderer.PreferThreading);
|
|
||||||
|
|
||||||
if (threadedGAL)
|
|
||||||
{
|
|
||||||
renderer = new ThreadedRenderer(renderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Switch(
|
|
||||||
new HleConfiguration(
|
new HleConfiguration(
|
||||||
options.DramSize,
|
options.DramSize,
|
||||||
options.SystemLanguage,
|
options.SystemLanguage,
|
||||||
@ -354,11 +344,10 @@ namespace Ryujinx.Headless
|
|||||||
_contentManager,
|
_contentManager,
|
||||||
_accountManager,
|
_accountManager,
|
||||||
_userChannelPersistence,
|
_userChannelPersistence,
|
||||||
renderer,
|
renderer.TryMakeThreaded(options.BackendThreading),
|
||||||
new SDL2HardwareDeviceDriver(),
|
new SDL2HardwareDeviceDriver(),
|
||||||
window
|
window
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user