mirror of
https://github.com/par274/sharpemu.git
synced 2026-07-25 20:28:48 +08:00
shader: allow larger bounded Gen5 programs (#514)
This commit is contained in:
@@ -80,7 +80,7 @@ public static class Gen5ShaderTranslator
|
||||
public static bool IsScalarConsumed(ulong[] mask, uint register) =>
|
||||
register < 256 && (mask[register >> 6] & (1UL << (int)(register & 63))) != 0;
|
||||
|
||||
private const int MaxInstructions = 4096;
|
||||
private const int MaxInstructions = 16384;
|
||||
private const uint PsUserDataRegister = 0x0C;
|
||||
private const uint VsUserDataRegister = 0x4C;
|
||||
private const uint GsUserDataRegister = 0x8C;
|
||||
|
||||
@@ -13,7 +13,8 @@ public sealed class Gen5ShaderDecoderBoundaryTests
|
||||
private const ulong ShaderAddress = 0x1_0000_0000;
|
||||
private const uint Export = 0xF8000000;
|
||||
private const uint Nop = 0xBF800000;
|
||||
private const int MaximumInstructionCount = 4096;
|
||||
private const uint EndPgm = 0xBF810000;
|
||||
private const int MaximumInstructionCount = 16384;
|
||||
|
||||
[Fact]
|
||||
public void MissingAddress_IsRejectedWithoutReadingGuestMemory()
|
||||
@@ -99,6 +100,23 @@ public sealed class Gen5ShaderDecoderBoundaryTests
|
||||
memory.Reads[^1]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ProgramMayEndAfterPreviousDecoderLimit()
|
||||
{
|
||||
const int previousDecoderLimit = 4096;
|
||||
var words = new uint[previousDecoderLimit + 1];
|
||||
Array.Fill(words, Nop);
|
||||
words[^1] = EndPgm;
|
||||
var memory = RecordingCpuMemory.FromWords(ShaderAddress, words);
|
||||
|
||||
var decoded = Decode(memory, ShaderAddress, out var program, out var error);
|
||||
|
||||
Assert.True(decoded, error);
|
||||
Assert.Equal(words.Length, program.Instructions.Count);
|
||||
Assert.Equal("SEndpgm", program.Instructions[^1].Opcode);
|
||||
Assert.Equal(words.Length, memory.Reads.Count);
|
||||
}
|
||||
|
||||
private static bool Decode(
|
||||
RecordingCpuMemory memory,
|
||||
ulong address,
|
||||
|
||||
Reference in New Issue
Block a user