Set Depth Attachment Texture

This commit is contained in:
Isaac Marovitz 2024-05-16 20:29:37 -04:00
parent 6d3df3a4ab
commit a568e19434
No known key found for this signature in database
GPG Key ID: 97250B2B09A132E1
1 changed files with 10 additions and 0 deletions

View File

@ -30,6 +30,7 @@ namespace Ryujinx.Graphics.Metal
private MTLCommandEncoder? _currentEncoder;
private EncoderType _currentEncoderType = EncoderType.None;
private MTLTexture[] _renderTargets = [];
private MTLTexture _depthTarget;
private RenderEncoderState _renderEncoderState;
private readonly MTLVertexDescriptor _vertexDescriptor = new();
@ -136,6 +137,10 @@ namespace Ryujinx.Graphics.Metal
}
}
var depthAttachment = descriptor.DepthAttachment;
depthAttachment.Texture = _depthTarget;
depthAttachment.LoadAction = MTLLoadAction.Load;
var renderCommandEncoder = _commandBuffer.RenderCommandEncoder(descriptor);
_renderEncoderState.SetEncoderState(renderCommandEncoder, descriptor, _vertexDescriptor);
@ -523,6 +528,11 @@ namespace Ryujinx.Graphics.Metal
}
}
if (depthStencil is Texture depthTexture)
{
_depthTarget = depthTexture.MTLTexture;
}
// Recreate Render Command Encoder
BeginRenderPass();
}