aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-04-10 16:50:32 -0300
committergdkchan <gab.dark.100@gmail.com>2018-04-10 16:50:32 -0300
commitfeb2680a6ce1512c08980ee55c1c8215b8b5c3e4 (patch)
treeb41d2c8558ece834b2c1c5c9afba0afe226e0553 /Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs
parente9cfdef0982824b673c60b362524408a263946df (diff)
[GPU] Add more shader instructions, add support for rgb565 textures
Diffstat (limited to 'Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs')
-rw-r--r--Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs47
1 files changed, 28 insertions, 19 deletions
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs
index 559e0eda..681e6d67 100644
--- a/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs
+++ b/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs
@@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
Textures = new int[80];
}
- public void Set(int Index, GalTexture Tex)
+ public void Set(int Index, GalTexture Texture)
{
GL.ActiveTexture(TextureUnit.Texture0 + Index);
@@ -19,29 +19,38 @@ namespace Ryujinx.Graphics.Gal.OpenGL
GL.BindTexture(TextureTarget.Texture2D, Handle);
- int W = Tex.Width;
- int H = Tex.Height;
+ const int Border = 0;
- byte[] Data = Tex.Data;
-
- int Length = Data.Length;
-
- if (IsCompressedTextureFormat(Tex.Format))
+ if (IsCompressedTextureFormat(Texture.Format))
{
- PixelInternalFormat Pif = OGLEnumConverter.GetCompressedTextureFormat(Tex.Format);
-
- GL.CompressedTexImage2D(TextureTarget.Texture2D, 0, Pif, W, H, 0, Length, Data);
+ PixelInternalFormat InternalFmt = OGLEnumConverter.GetCompressedTextureFormat(Texture.Format);
+
+ GL.CompressedTexImage2D(
+ TextureTarget.Texture2D,
+ 0,
+ InternalFmt,
+ Texture.Width,
+ Texture.Height,
+ Border,
+ Texture.Data.Length,
+ Texture.Data);
}
else
{
- //TODO: Get those from Texture format.
- const PixelInternalFormat Pif = PixelInternalFormat.Rgba;
-
- const PixelFormat Pf = PixelFormat.Rgba;
-
- const PixelType Pt = PixelType.UnsignedByte;
-
- GL.TexImage2D(TextureTarget.Texture2D, 0, Pif, W, H, 0, Pf, Pt, Data);
+ const PixelInternalFormat InternalFmt = PixelInternalFormat.Rgba;
+
+ (PixelFormat, PixelType) Format = OGLEnumConverter.GetTextureFormat(Texture.Format);
+
+ GL.TexImage2D(
+ TextureTarget.Texture2D,
+ 0,
+ InternalFmt,
+ Texture.Width,
+ Texture.Height,
+ Border,
+ Format.Item1,
+ Format.Item2,
+ Texture.Data);
}
}