summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/yagl/yagl_apis/gles/yagl_host_gles_calls.c14
-rw-r--r--hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.c15
2 files changed, 19 insertions, 10 deletions
diff --git a/hw/yagl/yagl_apis/gles/yagl_host_gles_calls.c b/hw/yagl/yagl_apis/gles/yagl_host_gles_calls.c
index 0f85d5f5db..5e16e30927 100644
--- a/hw/yagl/yagl_apis/gles/yagl_host_gles_calls.c
+++ b/hw/yagl/yagl_apis/gles/yagl_host_gles_calls.c
@@ -2804,7 +2804,7 @@ void yagl_host_glUpdateOffscreenImageYAGL(GLuint texture,
{
GLenum format = 0;
GLuint cur_tex = 0;
- GLsizei unpack_alignment = 0;
+ GLsizei unpack[3];
YAGL_LOG_FUNC_SET(glUpdateOffscreenImageYAGL);
@@ -2823,10 +2823,13 @@ void yagl_host_glUpdateOffscreenImageYAGL(GLuint texture,
gles_api_ts->driver->GetIntegerv(GL_TEXTURE_BINDING_2D,
(GLint*)&cur_tex);
- gles_api_ts->driver->GetIntegerv(GL_UNPACK_ALIGNMENT,
- &unpack_alignment);
+ gles_api_ts->driver->GetIntegerv(GL_UNPACK_ALIGNMENT, &unpack[0]);
+ gles_api_ts->driver->GetIntegerv(GL_UNPACK_ROW_LENGTH, &unpack[1]);
+ gles_api_ts->driver->GetIntegerv(GL_UNPACK_IMAGE_HEIGHT, &unpack[2]);
gles_api_ts->driver->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ gles_api_ts->driver->PixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ gles_api_ts->driver->PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
gles_api_ts->driver->BindTexture(GL_TEXTURE_2D,
yagl_gles_object_get(texture));
@@ -2844,8 +2847,9 @@ void yagl_host_glUpdateOffscreenImageYAGL(GLuint texture,
GL_UNSIGNED_INT_8_8_8_8_REV,
pixels);
- gles_api_ts->driver->PixelStorei(GL_UNPACK_ALIGNMENT,
- unpack_alignment);
+ gles_api_ts->driver->PixelStorei(GL_UNPACK_ALIGNMENT, unpack[0]);
+ gles_api_ts->driver->PixelStorei(GL_UNPACK_ROW_LENGTH, unpack[1]);
+ gles_api_ts->driver->PixelStorei(GL_UNPACK_IMAGE_HEIGHT, unpack[2]);
gles_api_ts->driver->BindTexture(GL_TEXTURE_2D, cur_tex);
}
diff --git a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.c b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.c
index e832324ba7..b7e31ff28c 100644
--- a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.c
+++ b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.c
@@ -115,7 +115,7 @@ bool yagl_egl_offscreen_context_read_pixels(struct yagl_egl_offscreen_context *c
((struct yagl_egl_offscreen*)ctx->base.dpy->backend)->gles_driver;
bool ret = false;
GLuint current_fb = 0;
- GLint current_pack_alignment = 0;
+ GLint current_pack[3];
GLuint current_pbo = 0;
uint32_t rp_line_size = width * bpp;
uint32_t rp_size = rp_line_size * height;
@@ -129,11 +129,12 @@ bool yagl_egl_offscreen_context_read_pixels(struct yagl_egl_offscreen_context *c
gles_driver->GetIntegerv(GL_READ_FRAMEBUFFER_BINDING,
(GLint*)&current_fb);
- gles_driver->GetIntegerv(GL_PACK_ALIGNMENT,
- &current_pack_alignment);
-
gles_driver->BindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+ gles_driver->GetIntegerv(GL_PACK_ALIGNMENT, &current_pack[0]);
+ gles_driver->GetIntegerv(GL_PACK_ROW_LENGTH, &current_pack[1]);
+ gles_driver->GetIntegerv(GL_PACK_IMAGE_HEIGHT, &current_pack[2]);
+
if (!ctx->rp_pbo) {
/*
* No buffer yet, create one.
@@ -186,6 +187,8 @@ bool yagl_egl_offscreen_context_read_pixels(struct yagl_egl_offscreen_context *c
}
gles_driver->PixelStorei(GL_PACK_ALIGNMENT, 1);
+ gles_driver->PixelStorei(GL_PACK_ROW_LENGTH, 0);
+ gles_driver->PixelStorei(GL_PACK_IMAGE_HEIGHT, 0);
gles_driver->ReadPixels(0, 0,
width, height, format, GL_UNSIGNED_INT_8_8_8_8_REV,
@@ -215,7 +218,9 @@ out:
if (mapped_pixels) {
gles_driver->UnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB);
}
- gles_driver->PixelStorei(GL_PACK_ALIGNMENT, current_pack_alignment);
+ gles_driver->PixelStorei(GL_PACK_ALIGNMENT, current_pack[0]);
+ gles_driver->PixelStorei(GL_PACK_ROW_LENGTH, current_pack[1]);
+ gles_driver->PixelStorei(GL_PACK_IMAGE_HEIGHT, current_pack[2]);
gles_driver->BindBuffer(GL_PIXEL_PACK_BUFFER_ARB,
current_pbo);
gles_driver->BindFramebuffer(GL_READ_FRAMEBUFFER, current_fb);