Argument Buffers (#24)
* Stuff * More arg buffer stuff * Fixes * Rebase * Pass storage buffers to inline functions * Fix binding * Fix typo + Fix a couple shaders * Enforce ids * Dispose * Mark used buffers as resident * Update depth clear shader * Fix non-contiguous struct defs * Update ChangeBufferStride * Fix StorageBuffer assignments * Fix odyssey crash * Retain buffer bindings * Pad Std140 * Set texture data with safe buffers * Clone buffers * Always declare vert in * Stop clears from breaking OpenGL games * Fix depth clear * Use invariant position * Horribly inefficient texture & sampler arg buffers * Fix missing struct access * Minimise rebinds as much as possible * Build arg buffers on staging buffer
This commit is contained in:
parent
a71b5f1a3a
commit
c8308d27f1
20 changed files with 721 additions and 402 deletions
|
@ -77,7 +77,8 @@ namespace Ryujinx.Graphics.Metal
|
|||
ITexture dst,
|
||||
Extents2D srcRegion,
|
||||
Extents2D dstRegion,
|
||||
bool linearFilter)
|
||||
bool linearFilter,
|
||||
bool clear = false)
|
||||
{
|
||||
// Save current state
|
||||
_pipeline.SaveAndResetState();
|
||||
|
@ -134,7 +135,7 @@ namespace Ryujinx.Graphics.Metal
|
|||
_pipeline.SetRenderTargets([dst], null);
|
||||
_pipeline.SetScissors(stackalloc Rectangle<int>[] { new Rectangle<int>(0, 0, dstWidth, dstHeight) });
|
||||
|
||||
_pipeline.SetClearLoadAction(true);
|
||||
_pipeline.SetClearLoadAction(clear);
|
||||
|
||||
_pipeline.SetViewports(viewports);
|
||||
_pipeline.SetPrimitiveTopology(PrimitiveTopology.TriangleStrip);
|
||||
|
@ -305,13 +306,15 @@ namespace Ryujinx.Graphics.Metal
|
|||
int dstWidth,
|
||||
int dstHeight)
|
||||
{
|
||||
const int ClearDepthBufferSize = 4;
|
||||
|
||||
IntPtr ptr = new(&depthValue);
|
||||
|
||||
// Save current state
|
||||
_pipeline.SaveState();
|
||||
|
||||
const int ClearDepthBufferSize = 4;
|
||||
|
||||
using var buffer = _renderer.BufferManager.ReserveOrCreate(_pipeline.Cbs, ClearDepthBufferSize);
|
||||
buffer.Holder.SetDataUnchecked(buffer.Offset, new ReadOnlySpan<float>(ref depthValue));
|
||||
_pipeline.SetUniformBuffers([new BufferAssignment(0, buffer.Range)]);
|
||||
|
||||
Span<Viewport> viewports = stackalloc Viewport[1];
|
||||
|
||||
viewports[0] = new Viewport(
|
||||
|
@ -330,7 +333,6 @@ namespace Ryujinx.Graphics.Metal
|
|||
_pipeline.SetViewports(viewports);
|
||||
_pipeline.SetDepthTest(new DepthTestDescriptor(true, depthMask, CompareOp.Always));
|
||||
_pipeline.SetStencilTest(CreateStencilTestDescriptor(stencilMask != 0, stencilValue, 0xFF, stencilMask));
|
||||
_pipeline.GetOrCreateRenderEncoder(true).SetFragmentBytes(ptr, ClearDepthBufferSize, 0);
|
||||
_pipeline.Draw(4, 1, 0, 0);
|
||||
|
||||
// Restore previous state
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue