Implement clear buffer (fast path) (#1902)
* Implement clear buffer (fast path) * Remove blank line
This commit is contained in:
parent
68f6b79fd3
commit
df820a72de
8 changed files with 125 additions and 5 deletions
|
@ -821,6 +821,28 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
dstBuffer.Flush(dstAddress, size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears a buffer at a given address with the specified value.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Both the address and size must be aligned to 4 bytes.
|
||||
/// </remarks>
|
||||
/// <param name="gpuVa">GPU virtual address of the region to clear</param>
|
||||
/// <param name="size">Number of bytes to clear</param>
|
||||
/// <param name="value">Value to be written into the buffer</param>
|
||||
public void ClearBuffer(GpuVa gpuVa, ulong size, uint value)
|
||||
{
|
||||
ulong address = TranslateAndCreateBuffer(gpuVa.Pack(), size);
|
||||
|
||||
Buffer buffer = GetBuffer(address, size);
|
||||
|
||||
int offset = (int)(address - buffer.Address);
|
||||
|
||||
_context.Renderer.Pipeline.ClearBuffer(buffer.Handle, offset, (int)size, value);
|
||||
|
||||
buffer.Flush(address, size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a buffer sub-range for a given memory range.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue