diff --git a/gfx/common/gl_common.c b/gfx/common/gl_common.c index 59fe717806..0c8e01af92 100644 --- a/gfx/common/gl_common.c +++ b/gfx/common/gl_common.c @@ -65,11 +65,23 @@ void gl_load_texture_image(GLenum target, { #ifndef HAVE_PSGL #ifdef HAVE_OPENGLES2 - if (gl_check_capability(GL_CAPS_TEX_STORAGE_EXT)) + if (gl_check_capability(GL_CAPS_TEX_STORAGE_EXT)) { + if (internalFormat == GL_RGB) + internalFormat = GL_RGB565; + else if (internalFormat == GL_RGBA) + internalFormat = GL_RGBA8_OES; + else if (internalFormat == GL_BGRA_EXT) + internalFormat = GL_BGRA8_EXT; glTexStorage2DEXT(target, 1, internalFormat, width, height); + } #else - if (gl_check_capability(GL_CAPS_TEX_STORAGE)) + if (gl_check_capability(GL_CAPS_TEX_STORAGE)) { + if (internalFormat == GL_RGB) + internalFormat = GL_RGB565; + else if (internalFormat == GL_RGBA) + internalFormat = GL_RGBA8; glTexStorage2D(target, 1, internalFormat, width, height); + } #endif else #endif diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index cbef52184d..70508af209 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -642,7 +642,7 @@ static void gl_init_textures(gl_t *gl, const video_info_t *video) texture_fmt = gl->texture_fmt; #endif -#ifdef HAVE_OPENGLES +#ifdef HAVE_OPENGLES2 /* GLES is picky about which format we use here. * Without extensions, we can *only* render to 16-bit FBOs. */ @@ -650,12 +650,7 @@ static void gl_init_textures(gl_t *gl, const video_info_t *video) { if (gl_check_capability(GL_CAPS_ARGB8)) { -#if !defined(HAVE_PSGL) - if (gl_check_capability(GL_CAPS_GLES3_SUPPORTED)) - internal_fmt = GL_RGBA8_OES; - else -#endif - internal_fmt = GL_RGBA; + internal_fmt = GL_RGBA; texture_type = GL_RGBA; texture_fmt = GL_UNSIGNED_BYTE; } diff --git a/gfx/drivers/gl_symlinks.h b/gfx/drivers/gl_symlinks.h index 39cf2ced39..6e43c96654 100644 --- a/gfx/drivers/gl_symlinks.h +++ b/gfx/drivers/gl_symlinks.h @@ -118,6 +118,9 @@ #ifndef GL_BGRA_EXT #define GL_BGRA_EXT 0x80E1 #endif +#ifndef GL_BGRA8_EXT +#define GL_BGRA8_EXT 0x93A1 +#endif #ifdef IOS /* Stupid Apple. */ #define RARCH_GL_INTERNAL_FORMAT32 GL_RGBA