1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-18 05:36:40 +00:00

OpenGL: Fix clears of unbound color targets (#3564)

This commit is contained in:
gdkchan 2022-08-08 14:39:22 -03:00 committed by GitHub
parent 2bb9b33da1
commit 66e7fdb871
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -147,7 +147,7 @@ namespace Ryujinx.Graphics.OpenGL
public int GetColorLayerCount(int index) public int GetColorLayerCount(int index)
{ {
return _colors[index].Info.GetDepthOrLayers(); return _colors[index]?.Info.GetDepthOrLayers() ?? 0;
} }
public int GetDepthStencilLayerCount() public int GetDepthStencilLayerCount()

View file

@ -112,6 +112,8 @@ namespace Ryujinx.Graphics.OpenGL
public void ClearRenderTargetColor(int index, int layer, int layerCount, uint componentMask, ColorF color) public void ClearRenderTargetColor(int index, int layer, int layerCount, uint componentMask, ColorF color)
{ {
EnsureFramebuffer();
GL.ColorMask( GL.ColorMask(
index, index,
(componentMask & 1) != 0, (componentMask & 1) != 0,
@ -142,6 +144,8 @@ namespace Ryujinx.Graphics.OpenGL
public void ClearRenderTargetDepthStencil(int layer, int layerCount, float depthValue, bool depthMask, int stencilValue, int stencilMask) public void ClearRenderTargetDepthStencil(int layer, int layerCount, float depthValue, bool depthMask, int stencilValue, int stencilMask)
{ {
EnsureFramebuffer();
bool stencilMaskChanged = bool stencilMaskChanged =
stencilMask != 0 && stencilMask != 0 &&
stencilMask != _stencilFrontMask; stencilMask != _stencilFrontMask;