mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 18:40:09 +00:00
Merge pull request #84 from meancoot/gles-texturepack
OpenGL ES width != pitch texture speed improvement
This commit is contained in:
commit
7bfc029565
28
gfx/gl.c
28
gfx/gl.c
@ -997,13 +997,27 @@ static inline void gl_copy_frame(gl_t *gl, const void *frame, unsigned width, un
|
|||||||
}
|
}
|
||||||
else // Slower path.
|
else // Slower path.
|
||||||
{
|
{
|
||||||
const uint8_t *src = (const uint8_t*)frame;
|
const unsigned frame_bytes = width * height * gl->base_size;
|
||||||
for (unsigned h = 0; h < height; h++, src += pitch)
|
const unsigned line_bytes = width * gl->base_size;
|
||||||
|
|
||||||
|
if (gl->tex_pack_buf_size < frame_bytes)
|
||||||
{
|
{
|
||||||
glTexSubImage2D(GL_TEXTURE_2D,
|
free(gl->tex_pack_buf);
|
||||||
0, 0, h, width, 1, gl->texture_type,
|
gl->tex_pack_buf = malloc(frame_bytes);
|
||||||
gl->texture_fmt, src);
|
gl->tex_pack_buf_size = frame_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t* dst = gl->tex_pack_buf;
|
||||||
|
const uint8_t *src = (const uint8_t*)frame;
|
||||||
|
|
||||||
|
for (unsigned h = 0; h < height; h++, src += pitch, dst += line_bytes)
|
||||||
|
{
|
||||||
|
memcpy(dst, src, line_bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
glTexSubImage2D(GL_TEXTURE_2D,
|
||||||
|
0, 0, 0, width, height, gl->texture_type,
|
||||||
|
gl->texture_fmt, gl->tex_pack_buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -1248,6 +1262,10 @@ static void gl_free(void *data)
|
|||||||
free(gl->empty_buf);
|
free(gl->empty_buf);
|
||||||
free(gl->conv_buffer);
|
free(gl->conv_buffer);
|
||||||
|
|
||||||
|
#if defined(HAVE_OPENGLES)
|
||||||
|
free(gl->tex_pack_buf);
|
||||||
|
#endif
|
||||||
|
|
||||||
free(gl);
|
free(gl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,6 +292,12 @@ typedef struct gl
|
|||||||
unsigned pbo_readback_index;
|
unsigned pbo_readback_index;
|
||||||
struct scaler_ctx pbo_readback_scaler;
|
struct scaler_ctx pbo_readback_scaler;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_OPENGLES)
|
||||||
|
uint8_t* tex_pack_buf;
|
||||||
|
unsigned tex_pack_buf_size;
|
||||||
|
#endif
|
||||||
|
|
||||||
} gl_t;
|
} gl_t;
|
||||||
|
|
||||||
// Windows ... <_<
|
// Windows ... <_<
|
||||||
|
Loading…
x
Reference in New Issue
Block a user