aboutsummaryrefslogtreecommitdiffstats
path: root/host/include/libOpenglRender
diff options
context:
space:
mode:
authorLingfeng Yang <lfy@google.com>2018-05-29 10:11:38 -0700
committerLingfeng Yang <lfy@google.com>2018-05-30 08:43:12 -0700
commit22dc42d6cf91ef90ae3fb6342d8e716666a87df8 (patch)
tree7702658bc251d61c377ca798ced6cb3125044b8f /host/include/libOpenglRender
parentcc22a7af8b2dbeeec9db7962a2652c1331e83d18 (diff)
downloaddevice_generic_goldfish-opengl-22dc42d6cf91ef90ae3fb6342d8e716666a87df8.tar.gz
device_generic_goldfish-opengl-22dc42d6cf91ef90ae3fb6342d8e716666a87df8.tar.bz2
device_generic_goldfish-opengl-22dc42d6cf91ef90ae3fb6342d8e716666a87df8.zip
Fix glReadPixels when row length != 0pie-dev
Fixes: 79208762 The pipe encoder assumes the user in the guest side has allocated all the client memory for glReadPixels including the padding between image rows (the total pitch determined by GL_PACK_ROW_LENGTH), but that is not necessarily the case; the guest can have allocated fewer bytes than the row length would suggest. This can cause memory corruption. This CL detects the case when GL_PACK_ROW_LENGTH != 0 and there is a client buffer for glReadPixels, in which case it takes the pipe buffer and only writes the pixels, row by row, to the client buffer, discarding the padding. this cl does not impact real devices Change-Id: I6fde6677897f2717c7ac05bc349225ea1e02243e Merged-In: I6fde6677897f2717c7ac05bc349225ea1e02243e (cherry picked from commit 372c425bd2d1d67eced350383e6369bca1530b4e)
Diffstat (limited to 'host/include/libOpenglRender')
-rw-r--r--host/include/libOpenglRender/IOStream.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/host/include/libOpenglRender/IOStream.h b/host/include/libOpenglRender/IOStream.h
index 445ec17d..1d32ea15 100644
--- a/host/include/libOpenglRender/IOStream.h
+++ b/host/include/libOpenglRender/IOStream.h
@@ -83,6 +83,8 @@ public:
return readFully(buf, len);
}
+ void readbackPixels(void* context, int width, int height, unsigned int format, unsigned int type, void* pixels);
+
private:
unsigned char *m_buf;