GLES2Dbg: added reference frame for glReadPixels
Change-Id: I37398d8d835e54a1764dfabd617fdc2c640864c2
diff --git a/opengl/libs/GLES2_dbg/src/header.h b/opengl/libs/GLES2_dbg/src/header.h
index 21b1dfb..0623a5d 100644
--- a/opengl/libs/GLES2_dbg/src/header.h
+++ b/opengl/libs/GLES2_dbg/src/header.h
@@ -59,14 +59,19 @@
struct DbgContext {
private:
unsigned lzf_bufSize;
-
+
+ // used as buffer and reference frame for ReadPixels; malloc/free
+ unsigned * lzf_ref [2];
+ unsigned lzf_readIndex; // 0 or 1
+ unsigned lzf_refSize, lzf_refBufSize; // bytes
+
public:
- char * lzf_buf;
-
+ char * lzf_buf; // auto malloc/free; output of lzf_compress
+
const unsigned version; // 0 is GLES1, 1 is GLES2
const gl_hooks_t * const hooks;
const unsigned MAX_VERTEX_ATTRIBS;
-
+
struct VertexAttrib {
GLenum type; // element data type
unsigned size; // number of data per element
@@ -100,7 +105,12 @@
void Fetch(const unsigned index, std::string * const data) const;
unsigned Compress(const void * in_data, unsigned in_len); // compressed to lzf_buf
-
+ void * GetReadPixelsBuffer(const unsigned size);
+ bool IsReadPixelBuffer(const void * const ptr) {
+ return ptr == lzf_ref[lzf_readIndex];
+ }
+ unsigned CompressReadPixelBuffer();
+
void glUseProgram(GLuint program);
void glEnableVertexAttribArray(GLuint index);
void glDisableVertexAttribArray(GLuint index);