summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorStanislav Vorobiov <s.vorobiov@samsung.com>2014-01-23 20:49:32 +0400
committerStanislav Vorobiov <s.vorobiov@samsung.com>2014-01-23 20:49:32 +0400
commit98eda2651a0a6cdd112ab9f1df437acaba185a3e (patch)
treed99665126ac0cc6b69da6ce579afbc788951b4c6 /hw
parent01b1361b535202aa8e0abdb6019d27ff587f7a2d (diff)
downloadqemu-98eda2651a0a6cdd112ab9f1df437acaba185a3e.tar.gz
qemu-98eda2651a0a6cdd112ab9f1df437acaba185a3e.tar.bz2
qemu-98eda2651a0a6cdd112ab9f1df437acaba185a3e.zip
YaGL: Support GL_EXT_unpack_subimage and GL_NV_pack_subimage
Change-Id: I0dfd41ecae60e1dfffb4b9feea4e289c9f139dda
Diffstat (limited to 'hw')
-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);