Add support for saturation on some shader instructions, fix ReadTexture alignment and add ColorMask support (#451)

* Add support for saturation on some shader instructions, fix ReadTexture alignment

* Add ColorMask support, other tweaks
This commit is contained in:
gdkchan 2018-10-13 23:54:14 -03:00 committed by GitHub
parent 894459fcd7
commit 72317d7777
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 63 additions and 12 deletions

View file

@ -235,18 +235,23 @@ namespace Ryujinx.Graphics.Texture
int BytesPerPixel = Desc.BytesPerPixel;
int OutOffs = 0;
//Note: Each row of the texture needs to be aligned to 4 bytes.
int Pitch = (Width * BytesPerPixel + 3) & ~3;
byte[] Data = new byte[Width * Height * BytesPerPixel];
byte[] Data = new byte[Height * Pitch];
for (int Y = 0; Y < Height; Y++)
for (int X = 0; X < Width; X++)
{
long Offset = (uint)Swizzle.GetSwizzleOffset(X, Y);
int OutOffs = Y * Pitch;
CpuMemory.ReadBytes(Position + Offset, Data, OutOffs, BytesPerPixel);
for (int X = 0; X < Width; X++)
{
long Offset = (uint)Swizzle.GetSwizzleOffset(X, Y);
OutOffs += BytesPerPixel;
CpuMemory.ReadBytes(Position + Offset, Data, OutOffs, BytesPerPixel);
OutOffs += BytesPerPixel;
}
}
return Data;