diff options
Diffstat (limited to 'Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs')
| -rw-r--r-- | Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs index b7c8999e..9ea25056 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs @@ -15,10 +15,9 @@ namespace Ryujinx.Graphics.Gal.OpenGL { GL.ActiveTexture(TextureUnit.Texture0 + Index); - int Handle = EnsureTextureInitialized(Index); - - GL.BindTexture(TextureTarget.Texture2D, Handle); + Bind(Index); + const int Level = 0; //TODO: Support mipmap textures. const int Border = 0; if (IsCompressedTextureFormat(Texture.Format)) @@ -27,7 +26,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL GL.CompressedTexImage2D( TextureTarget.Texture2D, - 0, + Level, InternalFmt, Texture.Width, Texture.Height, @@ -39,27 +38,30 @@ namespace Ryujinx.Graphics.Gal.OpenGL { const PixelInternalFormat InternalFmt = PixelInternalFormat.Rgba; - (PixelFormat, PixelType) Format = OGLEnumConverter.GetTextureFormat(Texture.Format); + (PixelFormat Format, PixelType Type) = OGLEnumConverter.GetTextureFormat(Texture.Format); GL.TexImage2D( TextureTarget.Texture2D, - 0, + Level, InternalFmt, Texture.Width, Texture.Height, Border, - Format.Item1, - Format.Item2, + Format, + Type, Texture.Data); } } - public void Set(int Index, GalTextureSampler Sampler) + public void Bind(int Index) { int Handle = EnsureTextureInitialized(Index); GL.BindTexture(TextureTarget.Texture2D, Handle); + } + public static void Set(GalTextureSampler Sampler) + { int WrapS = (int)OGLEnumConverter.GetTextureWrapMode(Sampler.AddressU); int WrapT = (int)OGLEnumConverter.GetTextureWrapMode(Sampler.AddressV); |
