aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/Gpu/Texture/TextureWriter.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-07-19 02:30:21 -0300
committerGitHub <noreply@github.com>2018-07-19 02:30:21 -0300
commit60f2198a1e8e61fe1cfb8da30a6afcd86a672a85 (patch)
treebe608a9f483e751d6d4bf4d9037048c94d495b0d /Ryujinx.HLE/Gpu/Texture/TextureWriter.cs
parent8b685b12f0b7a901139999dff17b24b049b9084b (diff)
Support deswizzle of sparse tiled textures and some frame buffer fixes (#275)
* Attempt to support deswizzle of sparse tiled textures * Use correct frame buffer and viewport sizes, started to clean up the copy engine * Correct texture width alignment * Use Scale/Translate registers to calculate viewport rect * Allow texture copy between frame buffers
Diffstat (limited to 'Ryujinx.HLE/Gpu/Texture/TextureWriter.cs')
-rw-r--r--Ryujinx.HLE/Gpu/Texture/TextureWriter.cs28
1 files changed, 4 insertions, 24 deletions
diff --git a/Ryujinx.HLE/Gpu/Texture/TextureWriter.cs b/Ryujinx.HLE/Gpu/Texture/TextureWriter.cs
index b64302a5..a87d4545 100644
--- a/Ryujinx.HLE/Gpu/Texture/TextureWriter.cs
+++ b/Ryujinx.HLE/Gpu/Texture/TextureWriter.cs
@@ -6,29 +6,9 @@ namespace Ryujinx.HLE.Gpu.Texture
{
static class TextureWriter
{
- public static void Write(
- IAMemory Memory,
- TextureInfo Texture,
- byte[] Data,
- int Width,
- int Height)
+ public unsafe static void Write(IAMemory Memory, TextureInfo Texture, byte[] Data)
{
- switch (Texture.Format)
- {
- case GalTextureFormat.A8B8G8R8: Write4Bpp(Memory, Texture, Data, Width, Height); break;
-
- default: throw new NotImplementedException(Texture.Format.ToString());
- }
- }
-
- private unsafe static void Write4Bpp(
- IAMemory Memory,
- TextureInfo Texture,
- byte[] Data,
- int Width,
- int Height)
- {
- ISwizzle Swizzle = TextureHelper.GetSwizzle(Texture, Width, 4);
+ ISwizzle Swizzle = TextureHelper.GetSwizzle(Texture, 1, 4);
(AMemory CpuMem, long Position) = TextureHelper.GetMemoryAndPosition(
Memory,
@@ -38,8 +18,8 @@ namespace Ryujinx.HLE.Gpu.Texture
{
long InOffs = 0;
- for (int Y = 0; Y < Height; Y++)
- for (int X = 0; X < Width; X++)
+ for (int Y = 0; Y < Texture.Height; Y++)
+ for (int X = 0; X < Texture.Width; X++)
{
long Offset = (uint)Swizzle.GetSwizzleOffset(X, Y);