mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-02-14 13:23:36 +00:00
Make global memory emulation work on OpenGL again
This commit is contained in:
parent
01ca055d38
commit
6df5c17a67
2 changed files with 13 additions and 30 deletions
|
@ -1,36 +1,19 @@
|
||||||
|
struct PTType
|
||||||
|
{
|
||||||
|
uint blockIndices[1 << 14];
|
||||||
|
uvec2 pointers[1 << 28];
|
||||||
|
};
|
||||||
|
|
||||||
uvec2 Helper_TranslateAddress(uvec2 address)
|
uvec2 Helper_TranslateAddress(uvec2 address)
|
||||||
{
|
{
|
||||||
uvec4* buffer_regions = (uvec4*)packPtr(s_page_table.xy);
|
PTType* br = (PTType*)packPtr(s_page_table.xy);
|
||||||
|
|
||||||
uint64_t address64 = packUint2x32(address);
|
uint l0 = (address.x >> 12) & 0x3fff;
|
||||||
uint count = buffer_regions[0].x;
|
uint l1 = ((address.x >> 26) & 0x3f) | ((address.y << 6) & 0x3fc0);
|
||||||
uint left = 0;
|
|
||||||
uint right = count;
|
|
||||||
|
|
||||||
while (left != right)
|
uvec2 hostAddress = br->pointers[br->blockIndices[l1] + l0];
|
||||||
{
|
|
||||||
uint middle = left + ((right - left) >> 1);
|
|
||||||
uint offset = middle * 2;
|
|
||||||
uvec4 guest_info = buffer_regions[1 + offset];
|
|
||||||
uvec4 host_info = buffer_regions[2 + offset];
|
|
||||||
|
|
||||||
uint64_t start_address = packUint2x32(guest_info.xy);
|
hostAddress.x += (address.x & 0xfff);
|
||||||
uint64_t end_address = packUint2x32(guest_info.zw);
|
|
||||||
if (address64 >= start_address && address64 < end_address)
|
|
||||||
{
|
|
||||||
uint64_t host_address = packUint2x32(host_info.xy);
|
|
||||||
return unpackUint2x32((address64 - start_address) + host_address);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (address64 < start_address)
|
return hostAddress;
|
||||||
{
|
|
||||||
right = middle;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
left = middle + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return uvec2(0, 0);
|
|
||||||
}
|
}
|
|
@ -283,7 +283,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
while (passthroughAttributes != 0)
|
while (passthroughAttributes != 0)
|
||||||
{
|
{
|
||||||
int bit = BitOperations.TrailingZeroCount(passthroughAttributes);
|
int bit = BitOperations.TrailingZeroCount(passthroughAttributes);
|
||||||
NextInputAttributesComponents |= new UInt128(0xf, 0) << (bit * 4);
|
NextInputAttributesComponents |= new UInt128(0, 0xf) << (bit * 4);
|
||||||
passthroughAttributes &= ~(1 << bit);
|
passthroughAttributes &= ~(1 << bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue