(GLES2 GL) Query GL_EXT_unpack_subimage and if it's there, use it -
Tegra 4 should support it etc.
This commit is contained in:
parent
9be4fe705b
commit
aaa8fc1f37
18
gfx/gl.c
18
gfx/gl.c
|
@ -1234,6 +1234,15 @@ static inline void gl_copy_frame(void *data, const void *frame, unsigned width,
|
||||||
0, 0, 0, width, height, gl->texture_type,
|
0, 0, 0, width, height, gl->texture_type,
|
||||||
gl->texture_fmt, gl->conv_buffer);
|
gl->texture_fmt, gl->conv_buffer);
|
||||||
}
|
}
|
||||||
|
else if (gl->support_unpack_row_length)
|
||||||
|
{
|
||||||
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, pitch / gl->base_size);
|
||||||
|
glTexSubImage2D(GL_TEXTURE_2D,
|
||||||
|
0, 0, 0, width, height, gl->texture_type,
|
||||||
|
gl->texture_fmt, frame);
|
||||||
|
|
||||||
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No GL_UNPACK_ROW_LENGTH ;(
|
// No GL_UNPACK_ROW_LENGTH ;(
|
||||||
|
@ -2152,6 +2161,15 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
||||||
gl_init_pbo_readback(gl);
|
gl_init_pbo_readback(gl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_OPENGLES)
|
||||||
|
gl->support_unpack_row_length = false;
|
||||||
|
if (gl_query_extension(gl, "GL_EXT_unpack_subimage"))
|
||||||
|
{
|
||||||
|
RARCH_LOG("[GL]: Extension GL_EXT_unpack_subimage, can copy textures faster using UNPACK_ROW_LENGTH.\n");
|
||||||
|
gl->support_unpack_row_length = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!gl_check_error())
|
if (!gl_check_error())
|
||||||
{
|
{
|
||||||
context_destroy_func();
|
context_destroy_func();
|
||||||
|
|
|
@ -209,6 +209,9 @@ typedef struct gl
|
||||||
GLenum texture_fmt;
|
GLenum texture_fmt;
|
||||||
GLenum wrap_mode;
|
GLenum wrap_mode;
|
||||||
unsigned base_size; // 2 or 4
|
unsigned base_size; // 2 or 4
|
||||||
|
#ifdef HAVE_OPENGLES
|
||||||
|
bool support_unpack_row_length;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Fonts
|
// Fonts
|
||||||
void *font;
|
void *font;
|
||||||
|
@ -309,8 +312,12 @@ typedef struct gl
|
||||||
#define NO_GL_CLAMP_TO_BORDER
|
#define NO_GL_CLAMP_TO_BORDER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_OPENGLES2) // It's an extension. Don't bother checking for it atm.
|
#if defined(HAVE_OPENGLES)
|
||||||
#undef GL_UNPACK_ROW_LENGTH
|
|
||||||
|
#ifndef GL_UNPACK_ROW_LENGTH
|
||||||
|
#define GL_UNPACK_ROW_LENGTH 0x0CF2
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void gl_set_projection(void *data, struct gl_ortho *ortho, bool allow_rotate);
|
void gl_set_projection(void *data, struct gl_ortho *ortho, bool allow_rotate);
|
||||||
|
|
Loading…
Reference in New Issue