From 0b7baf9f9cce8c9d76e0eba75d4becac25922054 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 7 Mar 2013 21:58:38 +0100 Subject: [PATCH] (PS3) Return to glMapBuffer/glUnmapBuffer version of gl_copy_frame - seems to work without garbage frames when using GL_READ_WRITE instead of GL_WRITE_ONLY --- gfx/gl.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/gfx/gl.c b/gfx/gl.c index a62df1a0c4..c8f009dbab 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -1050,23 +1050,17 @@ static void gl_init_textures_data(void *data) #if defined(HAVE_PSGL) static inline void gl_copy_frame(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch) { - gl_t *gl = (gl_t*)data; - + gl_t *gl = (gl_t*)data; size_t buffer_addr = gl->tex_w * gl->tex_h * gl->tex_index * gl->base_size; size_t buffer_stride = gl->tex_w * gl->base_size; const uint8_t *frame_copy = frame; size_t frame_copy_size = width * gl->base_size; - for (unsigned h = 0; h < height; h++) - { - glBufferSubData(GL_TEXTURE_REFERENCE_BUFFER_SCE, - buffer_addr, - frame_copy_size, - frame_copy); + uint8_t *buffer = (uint8_t*)glMapBuffer(GL_TEXTURE_REFERENCE_BUFFER_SCE, GL_READ_WRITE) + buffer_addr; + for (unsigned h = 0; h < height; h++, buffer += buffer_stride, frame_copy += pitch) + memcpy(buffer, frame_copy, frame_copy_size); - frame_copy += pitch; - buffer_addr += buffer_stride; - } + glUnmapBuffer(GL_TEXTURE_REFERENCE_BUFFER_SCE); } static void gl_init_textures(void *data, const video_info_t *video)