diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLHelper.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLHelper.cs index 0106673e5b..258baae13b 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLHelper.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLHelper.cs @@ -62,38 +62,38 @@ namespace Ryujinx.Graphics.Gal.OpenGL break; case TextureTarget.TextureCubeMap: + { + long FaceSize = Data.LongLength / 6; + + for (int Face = 0; Face < 6; Face++) { - long FaceSize = Data.LongLength / 6; - - for (int Face = 0; Face < 6; Face++) + fixed (byte* DataPtr = Data) { - fixed (byte* DataPtr = Data) + IntPtr Addr; + + if (Data != null) { - IntPtr Addr; - - if (Data != null) - { - Addr = new IntPtr(DataPtr + FaceSize * Face); - } - else - { - Addr = new IntPtr(0); - } - - GL.TexImage2D( - TextureTarget.TextureCubeMapPositiveX + Face, - Level, - InternalFormat, - Width, - Height, - Border, - PixelFormat, - PixelType, - Addr); + Addr = new IntPtr(DataPtr + FaceSize * Face); } + else + { + Addr = new IntPtr(0); + } + + GL.TexImage2D( + TextureTarget.TextureCubeMapPositiveX + Face, + Level, + InternalFormat, + Width, + Height, + Border, + PixelFormat, + PixelType, + Addr); } - break; } + break; + } default: throw new NotImplementedException(Target.ToString()); @@ -112,6 +112,17 @@ namespace Ryujinx.Graphics.Gal.OpenGL { switch (Target) { + case TextureTarget.Texture1D: + GL.CompressedTexImage1D( + Target, + Level, + InternalFormat, + Width, + Border, + Data.Length, + Data); + break; + case TextureTarget.Texture2D: GL.CompressedTexImage2D( Target, diff --git a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs index 1ae572725c..4fbda458d2 100644 --- a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs +++ b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs @@ -31,12 +31,12 @@ namespace Ryujinx.Graphics.Gal.Shader { RGB_, RG_A, R_BA, _GBA, RGBA, ____, ____, ____ } }; - private static ShaderTextureType[] TexTypes = new ShaderTextureType[] + private static ShaderTextureType[,] TexTypes = new ShaderTextureType[,] { - ShaderTextureType._1d, - ShaderTextureType._2d, - ShaderTextureType._3d, - ShaderTextureType.Cube, + { ShaderTextureType._1d, ShaderTextureType._1dArray }, + { ShaderTextureType._2d, ShaderTextureType._2dArray }, + { ShaderTextureType._3d, ShaderTextureType.Invalid }, + { ShaderTextureType.Cube, ShaderTextureType.Invalid } }; private static int[] TexTypeCoords = new int[] { 1, 2, 3, 3 }; @@ -169,13 +169,20 @@ namespace Ryujinx.Graphics.Gal.Shader private static void EmitTex(ShaderIrBlock Block, long OpCode, bool GprHandle) { + bool IsArray = ((OpCode >> 28) & 1) != 0; + int TypeId = (int)((OpCode >> 29) & 3); ShaderIrOperGpr[] Coords = new ShaderIrOperGpr[3]; - ShaderTextureType Type = TexTypes[TypeId]; + ShaderTextureType Type = TexTypes[TypeId, IsArray ? 1 : 0]; - for (int Index = 0; Index < TexTypeCoords[TypeId]; Index++) + if (Type == ShaderTextureType.Invalid) + { + throw new InvalidOperationException(); + } + + for (int Index = 0; Index < TexTypeCoords[TypeId] + (IsArray ? 1 : 0); Index++) { Coords[Index] = GetOperGpr8(OpCode) + Index; diff --git a/Ryujinx.Graphics/Gal/Shader/ShaderTextureType.cs b/Ryujinx.Graphics/Gal/Shader/ShaderTextureType.cs index 27cab30804..81059e7e41 100644 --- a/Ryujinx.Graphics/Gal/Shader/ShaderTextureType.cs +++ b/Ryujinx.Graphics/Gal/Shader/ShaderTextureType.cs @@ -2,7 +2,9 @@ { enum ShaderTextureType { + Invalid, _1d, + _1dArray, _2d, _2dArray, _3d, diff --git a/Ryujinx/Ryujinx.conf b/Ryujinx/Ryujinx.conf index 8e736d38c9..6e15a6ac29 100644 --- a/Ryujinx/Ryujinx.conf +++ b/Ryujinx/Ryujinx.conf @@ -2,7 +2,7 @@ Enable_Memory_Checks = false #Dump shaders in local directory (e.g. `C:\ShaderDumps`) -Graphics_Shaders_Dump_Path = D:\Shaders +Graphics_Shaders_Dump_Path = #Enable print debug logs Logging_Enable_Debug = false