Use a new approach for shader BRX targets (#2532)
* Use a new approach for shader BRX targets * Make shader cache actually work * Improve the shader pattern matching a bit * Extend LDC search to predecessor blocks, catches more cases * Nit * Only save the amount of constant buffer data actually used. Avoids crashes on partially mapped buffers * Ignore Rd on predicate instructions, as they do not have a Rd register (catches more cases)
This commit is contained in:
parent
70f79e689b
commit
d9d18439f6
12 changed files with 472 additions and 149 deletions
|
@ -20,6 +20,8 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||
private readonly int _localMemorySize;
|
||||
private readonly int _sharedMemorySize;
|
||||
|
||||
public int Cb1DataSize { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the GPU state accessor for graphics shader translation.
|
||||
/// </summary>
|
||||
|
@ -67,6 +69,25 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||
_sharedMemorySize = sharedMemorySize;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads data from the constant buffer 1.
|
||||
/// </summary>
|
||||
/// <param name="offset">Offset in bytes to read from</param>
|
||||
/// <returns>Value at the given offset</returns>
|
||||
public uint ConstantBuffer1Read(int offset)
|
||||
{
|
||||
if (Cb1DataSize < offset + 4)
|
||||
{
|
||||
Cb1DataSize = offset + 4;
|
||||
}
|
||||
|
||||
ulong baseAddress = _compute
|
||||
? _channel.BufferManager.GetComputeUniformBufferAddress(1)
|
||||
: _channel.BufferManager.GetGraphicsUniformBufferAddress(_stageIndex, 1);
|
||||
|
||||
return _channel.MemoryManager.Physical.Read<uint>(baseAddress + (ulong)offset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prints a log message.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue