mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-11-15 09:35:27 +00:00
Use mirrored texture wraps when available (#361)
This commit is contained in:
parent
a42ab2e40c
commit
43c4e7c78d
|
@ -220,12 +220,27 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
case GalTextureWrap.ClampToEdge: return TextureWrapMode.ClampToEdge;
|
case GalTextureWrap.ClampToEdge: return TextureWrapMode.ClampToEdge;
|
||||||
case GalTextureWrap.ClampToBorder: return TextureWrapMode.ClampToBorder;
|
case GalTextureWrap.ClampToBorder: return TextureWrapMode.ClampToBorder;
|
||||||
case GalTextureWrap.Clamp: return TextureWrapMode.Clamp;
|
case GalTextureWrap.Clamp: return TextureWrapMode.Clamp;
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: Those needs extensions (and are currently wrong).
|
if (OGLExtension.HasTextureMirrorClamp())
|
||||||
|
{
|
||||||
|
switch (Wrap)
|
||||||
|
{
|
||||||
|
case GalTextureWrap.MirrorClampToEdge: return (TextureWrapMode)ExtTextureMirrorClamp.MirrorClampToEdgeExt;
|
||||||
|
case GalTextureWrap.MirrorClampToBorder: return (TextureWrapMode)ExtTextureMirrorClamp.MirrorClampToBorderExt;
|
||||||
|
case GalTextureWrap.MirrorClamp: return (TextureWrapMode)ExtTextureMirrorClamp.MirrorClampExt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Fallback to non-mirrored clamps
|
||||||
|
switch (Wrap)
|
||||||
|
{
|
||||||
case GalTextureWrap.MirrorClampToEdge: return TextureWrapMode.ClampToEdge;
|
case GalTextureWrap.MirrorClampToEdge: return TextureWrapMode.ClampToEdge;
|
||||||
case GalTextureWrap.MirrorClampToBorder: return TextureWrapMode.ClampToBorder;
|
case GalTextureWrap.MirrorClampToBorder: return TextureWrapMode.ClampToBorder;
|
||||||
case GalTextureWrap.MirrorClamp: return TextureWrapMode.Clamp;
|
case GalTextureWrap.MirrorClamp: return TextureWrapMode.Clamp;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
throw new ArgumentException(nameof(Wrap));
|
throw new ArgumentException(nameof(Wrap));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
|
|
||||||
private static bool EnhancedLayouts;
|
private static bool EnhancedLayouts;
|
||||||
|
|
||||||
|
private static bool TextureMirrorClamp;
|
||||||
|
|
||||||
public static bool HasEnhancedLayouts()
|
public static bool HasEnhancedLayouts()
|
||||||
{
|
{
|
||||||
EnsureInitialized();
|
EnsureInitialized();
|
||||||
|
@ -15,6 +17,13 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
return EnhancedLayouts;
|
return EnhancedLayouts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool HasTextureMirrorClamp()
|
||||||
|
{
|
||||||
|
EnsureInitialized();
|
||||||
|
|
||||||
|
return TextureMirrorClamp;
|
||||||
|
}
|
||||||
|
|
||||||
private static void EnsureInitialized()
|
private static void EnsureInitialized()
|
||||||
{
|
{
|
||||||
if (Initialized)
|
if (Initialized)
|
||||||
|
@ -23,6 +32,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
}
|
}
|
||||||
|
|
||||||
EnhancedLayouts = HasExtension("GL_ARB_enhanced_layouts");
|
EnhancedLayouts = HasExtension("GL_ARB_enhanced_layouts");
|
||||||
|
|
||||||
|
TextureMirrorClamp = HasExtension("GL_EXT_texture_mirror_clamp");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool HasExtension(string Name)
|
private static bool HasExtension(string Name)
|
||||||
|
|
Loading…
Reference in a new issue