diff --git a/Ryujinx.Graphics/Gal/GalImage.cs b/Ryujinx.Graphics/Gal/GalImage.cs index 3784864ff6..a4ed8b8330 100644 --- a/Ryujinx.Graphics/Gal/GalImage.cs +++ b/Ryujinx.Graphics/Gal/GalImage.cs @@ -18,7 +18,7 @@ namespace Ryujinx.Graphics.Gal public GalTextureSource YSource; public GalTextureSource ZSource; public GalTextureSource WSource; - public GalTextureTarget TextureType; + public GalTextureTarget TextureTarget; public GalImage( int Width, @@ -28,7 +28,7 @@ namespace Ryujinx.Graphics.Gal int GobBlockHeight, GalMemoryLayout Layout, GalImageFormat Format, - GalTextureTarget TextureType, + GalTextureTarget TextureTarget, int MaxMipmapLevel = 1, GalTextureSource XSource = GalTextureSource.Red, GalTextureSource YSource = GalTextureSource.Green, @@ -47,7 +47,7 @@ namespace Ryujinx.Graphics.Gal this.YSource = YSource; this.ZSource = ZSource; this.WSource = WSource; - this.TextureType = TextureType; + this.TextureTarget = TextureTarget; Pitch = ImageUtils.GetPitch(Format, Width); } diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs index 392eb29786..e0eb6201a0 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs @@ -477,7 +477,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL (_, PixelFormat Format, PixelType Type) = OGLEnumConverter.GetImageFormat(CachedImage.Format); - TextureTarget Target = ImageUtils.GetTextureTarget(NewImage.TextureType); + TextureTarget Target = ImageUtils.GetTextureTarget(NewImage.TextureTarget); GL.BindTexture(Target, CachedImage.Handle); diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs index b4670ba6b2..75a97efc30 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs @@ -38,7 +38,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL { int Handle = GL.GenTexture(); - TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureType); + TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureTarget); GL.BindTexture(Target, Handle); @@ -123,7 +123,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL { int Handle = GL.GenTexture(); - TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureType); + TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureTarget); GL.BindTexture(Target, Handle); @@ -335,7 +335,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL { GL.ActiveTexture(TextureUnit.Texture0 + Index); - TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureType); + TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureTarget); GL.BindTexture(Target, CachedImage.Handle); @@ -360,7 +360,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL int MinFilter = (int)OGLEnumConverter.GetTextureMinFilter(Sampler.MinFilter, Sampler.MipFilter); int MagFilter = (int)OGLEnumConverter.GetTextureMagFilter(Sampler.MagFilter); - TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureType); + TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureTarget); GL.TexParameter(Target, TextureParameterName.TextureWrapS, WrapS); GL.TexParameter(Target, TextureParameterName.TextureWrapT, WrapT); diff --git a/Ryujinx.Graphics/Gal/Shader/GlslDecl.cs b/Ryujinx.Graphics/Gal/Shader/GlslDecl.cs index 8dc345ffa2..f7ae34faa5 100644 --- a/Ryujinx.Graphics/Gal/Shader/GlslDecl.cs +++ b/Ryujinx.Graphics/Gal/Shader/GlslDecl.cs @@ -235,25 +235,25 @@ namespace Ryujinx.Graphics.Gal.Shader string Name = StagePrefix + TextureName + Index; - GalTextureTarget TextureType; + GalTextureTarget TextureTarget; TextureInstructionSuffix TextureInstructionSuffix; // TODO: Non 2D texture type for TEXQ? if (Op.Inst == ShaderIrInst.Texq) { - TextureType = GalTextureTarget.TwoD; + TextureTarget = GalTextureTarget.TwoD; TextureInstructionSuffix = TextureInstructionSuffix.None; } else { ShaderIrMetaTex Meta = ((ShaderIrMetaTex)Op.MetaData); - TextureType = Meta.TextureType; + TextureTarget = Meta.TextureTarget; TextureInstructionSuffix = Meta.TextureInstructionSuffix; } - m_Textures.TryAdd(Handle, new ShaderDeclInfo(Name, Handle, false, 0, 1, TextureType, TextureInstructionSuffix)); + m_Textures.TryAdd(Handle, new ShaderDeclInfo(Name, Handle, false, 0, 1, TextureTarget, TextureInstructionSuffix)); } else if (Op.Inst == ShaderIrInst.Texb) { @@ -281,7 +281,7 @@ namespace Ryujinx.Graphics.Gal.Shader ShaderIrMetaTex Meta = ((ShaderIrMetaTex)Op.MetaData); string Name = StagePrefix + TextureName + "_cb" + Cbuf.Index + "_" + Cbuf.Pos; - m_CbTextures.Add(Op, new ShaderDeclInfo(Name, Cbuf.Pos, true, Cbuf.Index, 1, Meta.TextureType, Meta.TextureInstructionSuffix)); + m_CbTextures.Add(Op, new ShaderDeclInfo(Name, Cbuf.Pos, true, Cbuf.Index, 1, Meta.TextureTarget, Meta.TextureInstructionSuffix)); } else { diff --git a/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs b/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs index baa03a48f3..ebb017d831 100644 --- a/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs +++ b/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs @@ -275,14 +275,14 @@ namespace Ryujinx.Graphics.Gal.Shader { foreach (ShaderDeclInfo DeclInfo in IterateCbTextures()) { - TextureTarget Target = ImageUtils.GetTextureTarget(DeclInfo.TextureType); + TextureTarget Target = ImageUtils.GetTextureTarget(DeclInfo.TextureTarget); SB.AppendLine($"// {DeclInfo.TextureSuffix}"); SB.AppendLine("uniform " + GetSamplerType(Target, (DeclInfo.TextureSuffix & TextureInstructionSuffix.DC) != 0) + " " + DeclInfo.Name + ";"); } foreach (ShaderDeclInfo DeclInfo in Decl.Textures.Values.OrderBy(DeclKeySelector)) { - TextureTarget Target = ImageUtils.GetTextureTarget(DeclInfo.TextureType); + TextureTarget Target = ImageUtils.GetTextureTarget(DeclInfo.TextureTarget); SB.AppendLine($"// {DeclInfo.TextureSuffix}"); SB.AppendLine("uniform " + GetSamplerType(Target, (DeclInfo.TextureSuffix & TextureInstructionSuffix.DC) != 0) + " " + DeclInfo.Name + ";"); } @@ -1338,9 +1338,9 @@ namespace Ryujinx.Graphics.Gal.Shader bool HasDepth = (Meta.TextureInstructionSuffix & TextureInstructionSuffix.DC) != 0; - int Coords = ImageUtils.GetCoordsCountTextureType(Meta.TextureType); + int Coords = ImageUtils.GetCoordsCountTextureTarget(Meta.TextureTarget); - bool IsArray = ImageUtils.IsArray(Meta.TextureType); + bool IsArray = ImageUtils.IsArray(Meta.TextureTarget); string GetLastArgument(ShaderIrNode Node) @@ -1400,9 +1400,9 @@ namespace Ryujinx.Graphics.Gal.Shader return "(" + Operation + " >> " + index * 4 + ") & 0xF"; } - int Coords = ImageUtils.GetCoordsCountTextureType(Meta.TextureType); + int Coords = ImageUtils.GetCoordsCountTextureTarget(Meta.TextureTarget); - if (ImageUtils.IsArray(Meta.TextureType)) + if (ImageUtils.IsArray(Meta.TextureTarget)) Coords -= 1; switch (Coords) @@ -1509,7 +1509,7 @@ namespace Ryujinx.Graphics.Gal.Shader { ShaderIrMetaTex Meta = (ShaderIrMetaTex)Op.MetaData; - switch (ImageUtils.GetCoordsCountTextureType(Meta.TextureType)) + switch (ImageUtils.GetCoordsCountTextureTarget(Meta.TextureTarget)) { case 1: return GetOperExpr(Op, Meta.Coordinates[0]); diff --git a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs index a975a8cb28..f037afe4da 100644 --- a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs +++ b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs @@ -30,7 +30,7 @@ namespace Ryujinx.Graphics.Gal.Shader { RGB_, RG_A, R_BA, _GBA, RGBA, ____, ____, ____ } }; - private static GalTextureTarget TexToTextureType(int TexType, bool IsArray) + private static GalTextureTarget TexToTextureTarget(int TexType, bool IsArray) { switch (TexType) { @@ -49,7 +49,7 @@ namespace Ryujinx.Graphics.Gal.Shader } } - private static GalTextureTarget TexsToTextureType(int TexType) + private static GalTextureTarget TexsToTextureTarget(int TexType) { switch (TexType) { @@ -77,7 +77,7 @@ namespace Ryujinx.Graphics.Gal.Shader } } - public static GalTextureTarget TldsToTextureType(int TexType) + public static GalTextureTarget TldsToTextureTarget(int TexType) { switch (TexType) { @@ -279,7 +279,7 @@ namespace Ryujinx.Graphics.Gal.Shader { bool IsArray = OpCode.HasArray(); - GalTextureTarget TextureType = TexToTextureType(OpCode.Read(28, 6), IsArray); + GalTextureTarget TextureTarget = TexToTextureTarget(OpCode.Read(28, 6), IsArray); bool HasDepthCompare = OpCode.Read(0x32); @@ -288,7 +288,7 @@ namespace Ryujinx.Graphics.Gal.Shader TextureInstructionSuffix |= TextureInstructionSuffix.DC; } - ShaderIrOperGpr[] Coords = new ShaderIrOperGpr[ImageUtils.GetCoordsCountTextureType(TextureType)]; + ShaderIrOperGpr[] Coords = new ShaderIrOperGpr[ImageUtils.GetCoordsCountTextureTarget(TextureTarget)]; int IndexExtraCoord = 0; @@ -379,7 +379,7 @@ namespace Ryujinx.Graphics.Gal.Shader continue; } - ShaderIrMetaTex Meta = new ShaderIrMetaTex(Ch, TextureType, TextureInstructionSuffix, Coords) + ShaderIrMetaTex Meta = new ShaderIrMetaTex(Ch, TextureTarget, TextureInstructionSuffix, Coords) { LevelOfDetail = LevelOfDetail, Offset = Offset, @@ -430,9 +430,9 @@ namespace Ryujinx.Graphics.Gal.Shader throw new InvalidOperationException($"Invalid Suffix for TEXS instruction {RawSuffix}"); } - GalTextureTarget TextureType = TexsToTextureType(OpCode.Read(52, 0x1e)); + GalTextureTarget TextureTarget = TexsToTextureTarget(OpCode.Read(52, 0x1e)); - EmitTexs(Block, OpCode, ShaderIrInst.Texs, TextureType, Suffix); + EmitTexs(Block, OpCode, ShaderIrInst.Texs, TextureTarget, Suffix); } public static void Tlds(ShaderIrBlock Block, long OpCode, int Position) @@ -466,9 +466,9 @@ namespace Ryujinx.Graphics.Gal.Shader throw new InvalidOperationException($"Invalid Suffix for TLDS instruction {RawSuffix}"); } - GalTextureTarget TextureType = TldsToTextureType(OpCode.Read(52, 0x1e)); + GalTextureTarget TextureTarget = TldsToTextureTarget(OpCode.Read(52, 0x1e)); - EmitTexs(Block, OpCode, ShaderIrInst.Txlf, TextureType, Suffix); + EmitTexs(Block, OpCode, ShaderIrInst.Txlf, TextureTarget, Suffix); } public static void Tld4(ShaderIrBlock Block, long OpCode, int Position) @@ -497,14 +497,14 @@ namespace Ryujinx.Graphics.Gal.Shader bool IsArray = OpCode.HasArray(); int ChMask = OpCode.Read(31, 0xf); - GalTextureTarget TextureType = TexToTextureType(OpCode.Read(28, 6), IsArray); + GalTextureTarget TextureTarget = TexToTextureTarget(OpCode.Read(28, 6), IsArray); if (IsShadow) { Suffix |= TextureInstructionSuffix.DC; } - EmitTld4(Block, OpCode, TextureType, Suffix, ChMask, OpCode.Read(0x38, 0x3), false); + EmitTld4(Block, OpCode, TextureTarget, Suffix, ChMask, OpCode.Read(0x38, 0x3), false); } public static void Tld4s(ShaderIrBlock Block, long OpCode, int Position) @@ -531,17 +531,17 @@ namespace Ryujinx.Graphics.Gal.Shader private static void EmitTexs(ShaderIrBlock Block, long OpCode, ShaderIrInst Inst, - GalTextureTarget TextureType, + GalTextureTarget TextureTarget, TextureInstructionSuffix TextureInstructionSuffix) { - if (Inst == ShaderIrInst.Txlf && TextureType == GalTextureTarget.CubeArray) + if (Inst == ShaderIrInst.Txlf && TextureTarget == GalTextureTarget.CubeArray) { throw new InvalidOperationException("TLDS instructions cannot use CUBE modifier!"); } - bool IsArray = ImageUtils.IsArray(TextureType); + bool IsArray = ImageUtils.IsArray(TextureTarget); - ShaderIrOperGpr[] Coords = new ShaderIrOperGpr[ImageUtils.GetCoordsCountTextureType(TextureType)]; + ShaderIrOperGpr[] Coords = new ShaderIrOperGpr[ImageUtils.GetCoordsCountTextureTarget(TextureTarget)]; ShaderIrOperGpr OperA = OpCode.Gpr8(); ShaderIrOperGpr OperB = OpCode.Gpr20(); @@ -597,7 +597,7 @@ namespace Ryujinx.Graphics.Gal.Shader // Encoding of TEXS/TLDS is a bit special and change for 2d textures // NOTE: OperA seems to hold at best two args. // On 2D textures, if no suffix need an additional values, Y is stored in OperB, otherwise coords are in OperA and the additional values is in OperB. - if (TextureInstructionSuffix != TextureInstructionSuffix.None && TextureInstructionSuffix != TextureInstructionSuffix.LZ && TextureType == GalTextureTarget.TwoD) + if (TextureInstructionSuffix != TextureInstructionSuffix.None && TextureInstructionSuffix != TextureInstructionSuffix.LZ && TextureTarget == GalTextureTarget.TwoD) { Coords[Coords.Length - CoordStartIndex - 1] = OpCode.Gpr8(); Coords[Coords.Length - CoordStartIndex - 1].Index += Coords.Length - CoordStartIndex - 1; @@ -702,7 +702,7 @@ namespace Ryujinx.Graphics.Gal.Shader continue; } - ShaderIrMetaTex Meta = new ShaderIrMetaTex(Ch, TextureType, TextureInstructionSuffix, Coords) + ShaderIrMetaTex Meta = new ShaderIrMetaTex(Ch, TextureTarget, TextureInstructionSuffix, Coords) { LevelOfDetail = LevelOfDetail, Offset = Offset, @@ -725,7 +725,7 @@ namespace Ryujinx.Graphics.Gal.Shader ShaderIrOperGpr OperB = OpCode.Gpr20(); ShaderIrOperImm OperC = OpCode.Imm13_36(); - ShaderIrOperGpr[] Coords = new ShaderIrOperGpr[ImageUtils.GetCoordsCountTextureType(TextureType)]; + ShaderIrOperGpr[] Coords = new ShaderIrOperGpr[ImageUtils.GetCoordsCountTextureTarget(TextureType)]; ShaderIrOperGpr Offset = null; ShaderIrOperGpr DepthCompare = null; diff --git a/Ryujinx.Graphics/Gal/Shader/ShaderIrMetaTex.cs b/Ryujinx.Graphics/Gal/Shader/ShaderIrMetaTex.cs index 9ef142ff5c..72ea221ad3 100644 --- a/Ryujinx.Graphics/Gal/Shader/ShaderIrMetaTex.cs +++ b/Ryujinx.Graphics/Gal/Shader/ShaderIrMetaTex.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Gal.Shader class ShaderIrMetaTex : ShaderIrMeta { public int Elem { get; private set; } - public GalTextureTarget TextureType { get; private set; } + public GalTextureTarget TextureTarget { get; private set; } public ShaderIrNode[] Coordinates { get; private set; } public TextureInstructionSuffix TextureInstructionSuffix { get; private set; } public ShaderIrOperGpr LevelOfDetail; @@ -13,10 +13,10 @@ namespace Ryujinx.Graphics.Gal.Shader public ShaderIrOperGpr DepthCompare; public int Component; // for TLD4(S) - public ShaderIrMetaTex(int Elem, GalTextureTarget TextureType, TextureInstructionSuffix TextureInstructionSuffix, params ShaderIrNode[] Coordinates) + public ShaderIrMetaTex(int Elem, GalTextureTarget TextureTarget, TextureInstructionSuffix TextureInstructionSuffix, params ShaderIrNode[] Coordinates) { this.Elem = Elem; - this.TextureType = TextureType; + this.TextureTarget = TextureTarget; this.TextureInstructionSuffix = TextureInstructionSuffix; this.Coordinates = Coordinates; } diff --git a/Ryujinx.Graphics/Gal/ShaderDeclInfo.cs b/Ryujinx.Graphics/Gal/ShaderDeclInfo.cs index 1128cef545..ed1955cdbb 100644 --- a/Ryujinx.Graphics/Gal/ShaderDeclInfo.cs +++ b/Ryujinx.Graphics/Gal/ShaderDeclInfo.cs @@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.Gal public int Cbuf { get; private set; } public int Size { get; private set; } - public GalTextureTarget TextureType { get; private set; } + public GalTextureTarget TextureTarget { get; private set; } public TextureInstructionSuffix TextureSuffix { get; private set; } @@ -21,7 +21,7 @@ namespace Ryujinx.Graphics.Gal bool IsCb = false, int Cbuf = 0, int Size = 1, - GalTextureTarget TextureType = GalTextureTarget.TwoD, + GalTextureTarget TextureTarget = GalTextureTarget.TwoD, TextureInstructionSuffix TextureSuffix = TextureInstructionSuffix.None) { this.Name = Name; @@ -29,8 +29,8 @@ namespace Ryujinx.Graphics.Gal this.IsCb = IsCb; this.Cbuf = Cbuf; this.Size = Size; - this.TextureType = TextureType; + this.TextureTarget = TextureTarget; this.TextureSuffix = TextureSuffix; } diff --git a/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs b/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs index 129263fe4d..581a1dcd14 100644 --- a/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs +++ b/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs @@ -341,9 +341,9 @@ namespace Ryujinx.Graphics.Texture { ImageDescriptor Desc = GetImageDescriptor(Image.Format); - int ComponentCount = GetCoordsCountTextureType(Image.TextureType); + int ComponentCount = GetCoordsCountTextureTarget(Image.TextureTarget); - if (IsArray(Image.TextureType)) + if (IsArray(Image.TextureTarget)) ComponentCount--; int Width = DivRoundUp(Image.Width, Desc.BlockWidth); @@ -474,9 +474,9 @@ namespace Ryujinx.Graphics.Texture } } - public static TextureTarget GetTextureTarget(GalTextureTarget TextureType) + public static TextureTarget GetTextureTarget(GalTextureTarget GalTextureTarget) { - switch (TextureType) + switch (GalTextureTarget) { case GalTextureTarget.OneD: return TextureTarget.Texture1D; @@ -494,13 +494,13 @@ namespace Ryujinx.Graphics.Texture case GalTextureTarget.CubeArray: return TextureTarget.TextureCubeMapArray; default: - throw new NotSupportedException($"Texture type {TextureType} currently not supported!"); + throw new NotSupportedException($"Texture target {GalTextureTarget} currently not supported!"); } } - public static bool IsArray(GalTextureTarget TextureType) + public static bool IsArray(GalTextureTarget TextureTarget) { - switch (TextureType) + switch (TextureTarget) { case GalTextureTarget.OneDArray: case GalTextureTarget.TwoDArray: @@ -511,9 +511,9 @@ namespace Ryujinx.Graphics.Texture } } - public static int GetCoordsCountTextureType(GalTextureTarget TextureType) + public static int GetCoordsCountTextureTarget(GalTextureTarget TextureTarget) { - switch (TextureType) + switch (TextureTarget) { case GalTextureTarget.OneD: return 1; @@ -528,7 +528,7 @@ namespace Ryujinx.Graphics.Texture case GalTextureTarget.CubeArray: return 4; default: - throw new NotImplementedException($"TextureTpe.{TextureType} not implemented yet."); + throw new NotImplementedException($"TextureTarget.{TextureTarget} not implemented yet."); } } } diff --git a/Ryujinx.Graphics/Graphics3d/Texture/TextureFactory.cs b/Ryujinx.Graphics/Graphics3d/Texture/TextureFactory.cs index ac17b0506d..70e0b1ab68 100644 --- a/Ryujinx.Graphics/Graphics3d/Texture/TextureFactory.cs +++ b/Ryujinx.Graphics/Graphics3d/Texture/TextureFactory.cs @@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.Texture GalImageFormat Format = GetImageFormat(Tic); - GalTextureTarget TextureType = (GalTextureTarget)((Tic[4] >> 23) & 0xF); + GalTextureTarget TextureTarget = (GalTextureTarget)((Tic[4] >> 23) & 0xF); GalTextureSource XSource = (GalTextureSource)((Tic[0] >> 19) & 7); GalTextureSource YSource = (GalTextureSource)((Tic[0] >> 22) & 7); @@ -45,16 +45,16 @@ namespace Ryujinx.Graphics.Texture int Height = (Tic[5] & 0xffff) + 1; int Depth = ((Tic[5] >> 16) & 0x3fff) + 1; - if (TextureType == GalTextureTarget.OneD) + if (TextureTarget == GalTextureTarget.OneD) { Height = 1; } - if (TextureType == GalTextureTarget.TwoD || TextureType == GalTextureTarget.OneD) + if (TextureTarget == GalTextureTarget.TwoD || TextureTarget == GalTextureTarget.OneD) { Depth = 1; } - else if (TextureType == GalTextureTarget.CubeMap) + else if (TextureTarget == GalTextureTarget.CubeMap) { Depth = 6; } @@ -67,7 +67,7 @@ namespace Ryujinx.Graphics.Texture BlockHeight, Layout, Format, - TextureType, + TextureTarget, MaxMipmapLevel, XSource, YSource,