mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-12-03 06:52:11 +01:00
Fix some crashes
This commit is contained in:
parent
54c8dabadc
commit
c0bb55cf5e
2 changed files with 15 additions and 10 deletions
|
@ -14,7 +14,8 @@ namespace Ryujinx.Graphics.Metal
|
||||||
{
|
{
|
||||||
Blit,
|
Blit,
|
||||||
Compute,
|
Compute,
|
||||||
Render
|
Render,
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
[SupportedOSPlatform("macos")]
|
[SupportedOSPlatform("macos")]
|
||||||
|
@ -26,7 +27,7 @@ namespace Ryujinx.Graphics.Metal
|
||||||
|
|
||||||
private MTLCommandBuffer _commandBuffer;
|
private MTLCommandBuffer _commandBuffer;
|
||||||
private MTLCommandEncoder? _currentEncoder;
|
private MTLCommandEncoder? _currentEncoder;
|
||||||
private EncoderType _currentEncoderType;
|
private EncoderType _currentEncoderType = EncoderType.None;
|
||||||
private MTLTexture[] _renderTargets = [];
|
private MTLTexture[] _renderTargets = [];
|
||||||
|
|
||||||
private RenderEncoderState _renderEncoderState;
|
private RenderEncoderState _renderEncoderState;
|
||||||
|
@ -112,6 +113,8 @@ namespace Ryujinx.Graphics.Metal
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_currentEncoderType = EncoderType.None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@ namespace Ryujinx.Graphics.Metal
|
||||||
private MTLCompareFunction _depthCompareFunction = MTLCompareFunction.Always;
|
private MTLCompareFunction _depthCompareFunction = MTLCompareFunction.Always;
|
||||||
private bool _depthWriteEnabled = false;
|
private bool _depthWriteEnabled = false;
|
||||||
|
|
||||||
private MTLStencilDescriptor? _backFaceStencil = null;
|
private MTLStencilDescriptor _backFaceStencil = new MTLStencilDescriptor();
|
||||||
private MTLStencilDescriptor? _frontFaceStencil = null;
|
private MTLStencilDescriptor _frontFaceStencil = new MTLStencilDescriptor();
|
||||||
|
|
||||||
public PrimitiveTopology Topology = PrimitiveTopology.Triangles;
|
public PrimitiveTopology Topology = PrimitiveTopology.Triangles;
|
||||||
public MTLCullMode CullMode = MTLCullMode.None;
|
public MTLCullMode CullMode = MTLCullMode.None;
|
||||||
|
@ -83,8 +83,8 @@ namespace Ryujinx.Graphics.Metal
|
||||||
{
|
{
|
||||||
DepthCompareFunction = _depthCompareFunction,
|
DepthCompareFunction = _depthCompareFunction,
|
||||||
DepthWriteEnabled = _depthWriteEnabled,
|
DepthWriteEnabled = _depthWriteEnabled,
|
||||||
BackFaceStencil = _backFaceStencil.Value,
|
BackFaceStencil = _backFaceStencil,
|
||||||
FrontFaceStencil = _frontFaceStencil.Value
|
FrontFaceStencil = _frontFaceStencil
|
||||||
});
|
});
|
||||||
|
|
||||||
return _depthStencilState.Value;
|
return _depthStencilState.Value;
|
||||||
|
@ -95,15 +95,17 @@ namespace Ryujinx.Graphics.Metal
|
||||||
_depthCompareFunction = depthCompareFunction;
|
_depthCompareFunction = depthCompareFunction;
|
||||||
_depthWriteEnabled = depthWriteEnabled;
|
_depthWriteEnabled = depthWriteEnabled;
|
||||||
|
|
||||||
_depthStencilState = _device.NewDepthStencilState(new MTLDepthStencilDescriptor
|
var state = _device.NewDepthStencilState(new MTLDepthStencilDescriptor
|
||||||
{
|
{
|
||||||
DepthCompareFunction = _depthCompareFunction,
|
DepthCompareFunction = _depthCompareFunction,
|
||||||
DepthWriteEnabled = _depthWriteEnabled,
|
DepthWriteEnabled = _depthWriteEnabled,
|
||||||
BackFaceStencil = _backFaceStencil.Value,
|
BackFaceStencil = _backFaceStencil,
|
||||||
FrontFaceStencil = _frontFaceStencil.Value
|
FrontFaceStencil = _frontFaceStencil
|
||||||
});
|
});
|
||||||
|
|
||||||
return _depthStencilState.Value;
|
_depthStencilState = state;
|
||||||
|
|
||||||
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue