mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 18:40:49 +00:00
Fix up some texture format code
This commit is contained in:
parent
3449324ab4
commit
3392f3996b
@ -51,6 +51,22 @@ void gl_ff_matrix(const math_matrix_4x4 *mat)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void size_format(GLint* internalFormat)
|
||||||
|
{
|
||||||
|
switch (*internalFormat)
|
||||||
|
{
|
||||||
|
case GL_RGB:
|
||||||
|
*internalFormat = GL_RGB565;
|
||||||
|
break;
|
||||||
|
case GL_RGBA:
|
||||||
|
#ifdef HAVE_OPENGLES2
|
||||||
|
*internalFormat = GL_RGBA8_OES;
|
||||||
|
#else
|
||||||
|
*internalFormat = GL_RGBA8;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
/* This function should only be used without mipmaps
|
/* This function should only be used without mipmaps
|
||||||
and when data == NULL */
|
and when data == NULL */
|
||||||
void gl_load_texture_image(GLenum target,
|
void gl_load_texture_image(GLenum target,
|
||||||
@ -67,36 +83,23 @@ void gl_load_texture_image(GLenum target,
|
|||||||
#ifdef HAVE_OPENGLES2
|
#ifdef HAVE_OPENGLES2
|
||||||
if (gl_check_capability(GL_CAPS_TEX_STORAGE_EXT))
|
if (gl_check_capability(GL_CAPS_TEX_STORAGE_EXT))
|
||||||
{
|
{
|
||||||
switch (internalFormat)
|
size_format(&internalFormat);
|
||||||
{
|
|
||||||
case GL_RGB:
|
|
||||||
internalFormat = GL_RGB565;
|
|
||||||
break;
|
|
||||||
case GL_RGBA:
|
|
||||||
internalFormat = GL_RGBA8_OES;
|
|
||||||
break;
|
|
||||||
case GL_BGRA_EXT:
|
|
||||||
internalFormat = GL_BGRA8_EXT;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
glTexStorage2DEXT(target, 1, internalFormat, width, height);
|
glTexStorage2DEXT(target, 1, internalFormat, width, height);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (gl_check_capability(GL_CAPS_TEX_STORAGE))
|
if (gl_check_capability(GL_CAPS_TEX_STORAGE))
|
||||||
{
|
{
|
||||||
switch (internalFormat)
|
size_format(&internalFormat);
|
||||||
{
|
|
||||||
case GL_RGB:
|
|
||||||
internalFormat = GL_RGB565;
|
|
||||||
break;
|
|
||||||
case GL_RGBA:
|
|
||||||
internalFormat = GL_RGBA8;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
glTexStorage2D(target, 1, internalFormat, width, height);
|
glTexStorage2D(target, 1, internalFormat, width, height);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
#ifdef HAVE_OPENGLES
|
||||||
|
if (gl_check_capability(GL_CAPS_GLES3_SUPPORTED))
|
||||||
|
#endif
|
||||||
|
size_format(&internalFormat);
|
||||||
glTexImage2D(target, level, internalFormat, width, height, border, format, type, data);
|
glTexImage2D(target, level, internalFormat, width, height, border, format, type, data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,12 +121,7 @@
|
|||||||
#ifndef GL_BGRA8_EXT
|
#ifndef GL_BGRA8_EXT
|
||||||
#define GL_BGRA8_EXT 0x93A1
|
#define GL_BGRA8_EXT 0x93A1
|
||||||
#endif
|
#endif
|
||||||
#ifdef IOS
|
|
||||||
/* Stupid Apple. */
|
|
||||||
#define RARCH_GL_INTERNAL_FORMAT32 GL_RGBA
|
#define RARCH_GL_INTERNAL_FORMAT32 GL_RGBA
|
||||||
#else
|
|
||||||
#define RARCH_GL_INTERNAL_FORMAT32 GL_BGRA_EXT
|
|
||||||
#endif
|
|
||||||
#define RARCH_GL_INTERNAL_FORMAT16 GL_RGB
|
#define RARCH_GL_INTERNAL_FORMAT16 GL_RGB
|
||||||
#define RARCH_GL_TEXTURE_TYPE32 GL_BGRA_EXT
|
#define RARCH_GL_TEXTURE_TYPE32 GL_BGRA_EXT
|
||||||
#define RARCH_GL_TEXTURE_TYPE16 GL_RGB
|
#define RARCH_GL_TEXTURE_TYPE16 GL_RGB
|
||||||
|
Loading…
x
Reference in New Issue
Block a user