summaryrefslogtreecommitdiffstats
path: root/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
diff options
context:
space:
mode:
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())