summaryrefslogtreecommitdiffstats
path: root/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
diff options
context:
space:
mode:
authorDavid Li <davidxli@google.com>2011-04-08 18:41:00 -0700
committerDavid Li <davidxli@google.com>2011-04-12 15:56:10 -0700
commite2ad4d0e3748c2f0180d24d1b3468aac79adac3a (patch)
treebfa8647edf051ce768ee9c855d7d488924fc1377 /opengl/libs/GLES2_dbg/src/dbgcontext.cpp
parentce30eb8a90a1ac458e15e773057a8a73b0918ae6 (diff)
downloadframeworks_base-e2ad4d0e3748c2f0180d24d1b3468aac79adac3a.zip
frameworks_base-e2ad4d0e3748c2f0180d24d1b3468aac79adac3a.tar.gz
frameworks_base-e2ad4d0e3748c2f0180d24d1b3468aac79adac3a.tar.bz2
GLES2Dbg: add EXTEND_AFTER_CALL_Debug_* macro and improve protocol
To allow auto generate of Debug_glReadPixels function. Also added AfterGeneratedCall messag type, and client override of expectResponse for improving protocol. Also implemented callers for client to get shader/program iv & infolog Change-Id: I8426de0be4b7ffcb8b2b4f063ad85d19a9d2d72e Signed-off-by: David Li <davidxli@google.com>
Diffstat (limited to 'opengl/libs/GLES2_dbg/src/dbgcontext.cpp')
-rw-r--r--opengl/libs/GLES2_dbg/src/dbgcontext.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
index 40a77d7..eb0e1a9 100644
--- a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
+++ b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
@@ -124,6 +124,7 @@ void DbgContext::Compress(const void * in_data, unsigned int in_len,
{
if (!lzf_buf)
lzf_buf = (char *)malloc(LZF_CHUNK_SIZE);
+ assert(lzf_buf);
const uint32_t totalDecompSize = in_len;
outStr->append((const char *)&totalDecompSize, sizeof(totalDecompSize));
for (unsigned int i = 0; i < in_len; i += LZF_CHUNK_SIZE) {
@@ -146,8 +147,10 @@ void * DbgContext::GetReadPixelsBuffer(const unsigned size)
if (lzf_refBufSize < size + 8) {
lzf_refBufSize = size + 8;
lzf_ref[0] = (unsigned *)realloc(lzf_ref[0], lzf_refBufSize);
+ assert(lzf_ref[0]);
memset(lzf_ref[0], 0, lzf_refBufSize);
lzf_ref[1] = (unsigned *)realloc(lzf_ref[1], lzf_refBufSize);
+ assert(lzf_ref[1]);
memset(lzf_ref[1], 0, lzf_refBufSize);
}
if (lzf_refSize != size) // need to clear unused ref to maintain consistency
@@ -162,6 +165,7 @@ void * DbgContext::GetReadPixelsBuffer(const unsigned size)
void DbgContext::CompressReadPixelBuffer(std::string * const outStr)
{
+ assert(lzf_ref[0] && lzf_ref[1]);
unsigned * const ref = lzf_ref[lzf_readIndex ^ 1];
unsigned * const src = lzf_ref[lzf_readIndex];
for (unsigned i = 0; i < lzf_refSize / sizeof(*ref) + 1; i++)
@@ -169,6 +173,25 @@ void DbgContext::CompressReadPixelBuffer(std::string * const outStr)
Compress(ref, lzf_refSize, outStr);
}
+char * DbgContext::GetBuffer()
+{
+ if (!lzf_buf)
+ lzf_buf = (char *)malloc(LZF_CHUNK_SIZE);
+ assert(lzf_buf);
+ return lzf_buf;
+}
+
+unsigned int DbgContext::GetBufferSize()
+{
+ if (!lzf_buf)
+ lzf_buf = (char *)malloc(LZF_CHUNK_SIZE);
+ assert(lzf_buf);
+ if (lzf_buf)
+ return LZF_CHUNK_SIZE;
+ else
+ return 0;
+}
+
void DbgContext::glUseProgram(GLuint program)
{
while (GLenum error = hooks->gl.glGetError())