From ce79649c02edd1e167815cfc72e4c3b986237894 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 8 Oct 2022 16:06:39 -0700 Subject: [PATCH] GLES: Use GL_LUMINANCE on GLES for indexed tex. See #16176, used for rendered CLUTs. --- Common/GPU/D3D9/D3D9StateCache.h | 12 ------------ Common/GPU/OpenGL/DataFormatGL.cpp | 13 +++++++++++-- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Common/GPU/D3D9/D3D9StateCache.h b/Common/GPU/D3D9/D3D9StateCache.h index ae2dbd0ff4..1478442c0f 100644 --- a/Common/GPU/D3D9/D3D9StateCache.h +++ b/Common/GPU/D3D9/D3D9StateCache.h @@ -398,15 +398,3 @@ public: #undef STATE2 extern DirectXState dxstate; - -struct GLExtensions { - bool OES_depth24; - bool OES_packed_depth_stencil; - bool OES_depth_texture; - bool EXT_discard_framebuffer; - bool FBO_ARB; -}; - -extern GLExtensions gl_extensions; - -void CheckGLExtensions(); diff --git a/Common/GPU/OpenGL/DataFormatGL.cpp b/Common/GPU/OpenGL/DataFormatGL.cpp index 48e439a76d..1b2af548d8 100644 --- a/Common/GPU/OpenGL/DataFormatGL.cpp +++ b/Common/GPU/OpenGL/DataFormatGL.cpp @@ -1,4 +1,5 @@ #include "Common/GPU/OpenGL/DataFormatGL.h" +#include "Common/GPU/OpenGL/GLFeatures.h" #include "Common/Log.h" namespace Draw { @@ -15,8 +16,16 @@ bool Thin3DFormatToGLFormatAndType(DataFormat fmt, GLuint &internalFormat, GLuin break; case DataFormat::R8_UNORM: - internalFormat = GL_RGBA; - format = GL_RED; + if (gl_extensions.IsGLES) { + internalFormat = GL_LUMINANCE; + format = GL_LUMINANCE; + } else if (gl_extensions.VersionGEThan(3, 0)) { + internalFormat = GL_RED; + format = GL_RED; + } else { + internalFormat = GL_RGBA; + format = GL_RED; + } type = GL_UNSIGNED_BYTE; alignment = 1; break;