change graphics backend selection behavior
parent
a762a80c4f
commit
bde31fbe07
|
@ -3,7 +3,6 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>11</LangVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 859675dbab86e6eeda662ef9bdb0c688cce4cec3
|
Subproject commit 55acf6ee1818b0801cffe7217ee07eb1f56016f6
|
|
@ -53,11 +53,10 @@ namespace MoonWorks
|
||||||
public Game(
|
public Game(
|
||||||
WindowCreateInfo windowCreateInfo,
|
WindowCreateInfo windowCreateInfo,
|
||||||
FrameLimiterSettings frameLimiterSettings,
|
FrameLimiterSettings frameLimiterSettings,
|
||||||
Backend backend = Backend.Vulkan,
|
Span<Backend> preferredBackends,
|
||||||
int targetTimestep = 60,
|
int targetTimestep = 60,
|
||||||
bool debugMode = false
|
bool debugMode = false
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
Logger.LogInfo("Initializing frame limiter...");
|
Logger.LogInfo("Initializing frame limiter...");
|
||||||
Timestep = TimeSpan.FromTicks(TimeSpan.TicksPerSecond / targetTimestep);
|
Timestep = TimeSpan.FromTicks(TimeSpan.TicksPerSecond / targetTimestep);
|
||||||
gameTimer = Stopwatch.StartNew();
|
gameTimer = Stopwatch.StartNew();
|
||||||
|
@ -83,7 +82,7 @@ namespace MoonWorks
|
||||||
|
|
||||||
Logger.LogInfo("Initializing graphics device...");
|
Logger.LogInfo("Initializing graphics device...");
|
||||||
GraphicsDevice = new GraphicsDevice(
|
GraphicsDevice = new GraphicsDevice(
|
||||||
backend,
|
preferredBackends,
|
||||||
debugMode
|
debugMode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,17 @@ namespace MoonWorks.Graphics
|
||||||
private FencePool FencePool;
|
private FencePool FencePool;
|
||||||
private CommandBufferPool CommandBufferPool;
|
private CommandBufferPool CommandBufferPool;
|
||||||
|
|
||||||
internal GraphicsDevice(
|
internal unsafe GraphicsDevice(
|
||||||
Backend preferredBackend,
|
Span<Backend> preferredBackends,
|
||||||
bool debugMode
|
bool debugMode
|
||||||
) {
|
) {
|
||||||
Backend = (Backend) Refresh.Refresh_SelectBackend((Refresh.Backend) preferredBackend, out windowFlags);
|
var backends = stackalloc Refresh.Backend[preferredBackends.Length];
|
||||||
|
for (var i = 0; i < preferredBackends.Length; i += 1)
|
||||||
|
{
|
||||||
|
backends[i] = (Refresh.Backend) preferredBackends[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
Backend = (Backend) Refresh.Refresh_SelectBackend(backends, (uint) preferredBackends.Length, out windowFlags);
|
||||||
|
|
||||||
if (Backend == Backend.Invalid)
|
if (Backend == Backend.Invalid)
|
||||||
{
|
{
|
||||||
|
|
|
@ -311,7 +311,6 @@ namespace MoonWorks.Graphics
|
||||||
|
|
||||||
public enum Backend
|
public enum Backend
|
||||||
{
|
{
|
||||||
DontCare,
|
|
||||||
Vulkan,
|
Vulkan,
|
||||||
D3D11,
|
D3D11,
|
||||||
PS5,
|
PS5,
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue