From 4731c7545d31900c44e25f40d6bbc1ad5e8cba66 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 2 Jun 2018 11:44:52 -0300 Subject: [PATCH] Fix mistake on astc conversion, make some static methods that shouldn't be public private, remove old commmented out code --- ChocolArm64/Instruction/AInstEmitAlu.cs | 6 +++--- ChocolArm64/Instruction/AInstEmitMemory.cs | 4 ++-- ChocolArm64/Instruction/AInstEmitSimdLogical.cs | 2 +- Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs | 15 +++++++++++---- Ryujinx.Graphics/Gal/Shader/ShaderDecodeAlu.cs | 2 +- Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs | 5 ----- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ChocolArm64/Instruction/AInstEmitAlu.cs b/ChocolArm64/Instruction/AInstEmitAlu.cs index 4fba5094..0e546f7a 100644 --- a/ChocolArm64/Instruction/AInstEmitAlu.cs +++ b/ChocolArm64/Instruction/AInstEmitAlu.cs @@ -218,7 +218,7 @@ namespace ChocolArm64.Instruction EmitSubsCCheck(Context); EmitSubsVCheck(Context); EmitDataStoreS(Context); - } + } public static void Orn(AILEmitterCtx Context) { @@ -244,7 +244,7 @@ namespace ChocolArm64.Instruction nameof(ASoftFallback.ReverseBytes32_32), nameof(ASoftFallback.ReverseBytes32_64)); - public static void EmitFallback32_64(AILEmitterCtx Context, string Name32, string Name64) + private static void EmitFallback32_64(AILEmitterCtx Context, string Name32, string Name64) { AOpCodeAlu Op = (AOpCodeAlu)Context.CurrOp; @@ -320,7 +320,7 @@ namespace ChocolArm64.Instruction EmitDataLoadRn(Context); Context.EmitLdc_I(IntMin); - + Context.Emit(OpCodes.Ceq); EmitDataLoadRm(Context); diff --git a/ChocolArm64/Instruction/AInstEmitMemory.cs b/ChocolArm64/Instruction/AInstEmitMemory.cs index af7de3ba..67653ed0 100644 --- a/ChocolArm64/Instruction/AInstEmitMemory.cs +++ b/ChocolArm64/Instruction/AInstEmitMemory.cs @@ -27,7 +27,7 @@ namespace ChocolArm64.Instruction public static void Ldr(AILEmitterCtx Context) => EmitLdr(Context, false); public static void Ldrs(AILEmitterCtx Context) => EmitLdr(Context, true); - public static void EmitLdr(AILEmitterCtx Context, bool Signed) + private static void EmitLdr(AILEmitterCtx Context, bool Signed) { AOpCodeMem Op = (AOpCodeMem)Context.CurrOp; @@ -131,7 +131,7 @@ namespace ChocolArm64.Instruction EmitReadAndStore(Op.Rt2); EmitWBackIfNeeded(Context); - } + } public static void Str(AILEmitterCtx Context) { diff --git a/ChocolArm64/Instruction/AInstEmitSimdLogical.cs b/ChocolArm64/Instruction/AInstEmitSimdLogical.cs index 9c897bfe..cb6ee4cd 100644 --- a/ChocolArm64/Instruction/AInstEmitSimdLogical.cs +++ b/ChocolArm64/Instruction/AInstEmitSimdLogical.cs @@ -50,7 +50,7 @@ namespace ChocolArm64.Instruction EmitBitBif(Context, false); } - public static void EmitBitBif(AILEmitterCtx Context, bool NotRm) + private static void EmitBitBif(AILEmitterCtx Context, bool NotRm) { AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp; diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs index 75f09faa..46c15dcc 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs @@ -40,7 +40,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL { if (Texture.Format >= GalTextureFormat.Astc2D4x4) { - ConvertAstcTextureToRgba(Texture); + Texture = ConvertAstcTextureToRgba(Texture); } const PixelInternalFormat InternalFmt = PixelInternalFormat.Rgba; @@ -70,14 +70,21 @@ namespace Ryujinx.Graphics.Gal.OpenGL GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureSwizzleA, SwizzleA); } - private void ConvertAstcTextureToRgba(GalTexture Texture) + private GalTexture ConvertAstcTextureToRgba(GalTexture Texture) { + int TextureBlockWidth = GetAstcBlockWidth(Texture.Format); + int TextureBlockHeight = GetAstcBlockWidth(Texture.Format); + Texture.Data = ASTCDecoder.DecodeToRGBA8888( Texture.Data, - GetAstcBlockWidth(Texture.Format), - GetAstcBlockHeight(Texture.Format), 1, + TextureBlockWidth, + TextureBlockHeight, 1, Texture.Width, Texture.Height, 1); + + Texture.Format = GalTextureFormat.A8B8G8R8; + + return Texture; } private int GetAstcBlockWidth(GalTextureFormat Format) diff --git a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeAlu.cs b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeAlu.cs index 2e3fb6dd..065ab344 100644 --- a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeAlu.cs +++ b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeAlu.cs @@ -620,7 +620,7 @@ namespace Ryujinx.Graphics.Gal.Shader } } - public static void EmitRro(ShaderIrBlock Block, long OpCode, ShaderOper Oper) + private static void EmitRro(ShaderIrBlock Block, long OpCode, ShaderOper Oper) { //Note: this is a range reduction instruction and is supposed to //be used with Mufu, here it just moves the value and ignores the operation. diff --git a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs index ec03622d..c50f0144 100644 --- a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs +++ b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs @@ -216,11 +216,6 @@ namespace Ryujinx.Graphics.Gal.Shader } Block.AddNode(GetPredNode(new ShaderIrAsg(Dst, Src), OpCode)); - - /*if (IsScalar) - { - break; - }*/ } }