summaryrefslogtreecommitdiffstats
path: root/opengl/libs/EGL/egl.cpp
diff options
context:
space:
mode:
authorDavid Li <davidxli@google.com>2011-03-10 16:40:37 -0800
committerDavid Li <davidxli@google.com>2011-03-10 16:40:37 -0800
commit5c425f2eafc3d63e475153586edcf12eb6348aad (patch)
tree4457f9e7b3c5216ce93661bf399481eaef5c73b8 /opengl/libs/EGL/egl.cpp
parente888b25fb54d2079a784da2b72a950aaafb844dc (diff)
downloadframeworks_base-5c425f2eafc3d63e475153586edcf12eb6348aad.zip
frameworks_base-5c425f2eafc3d63e475153586edcf12eb6348aad.tar.gz
frameworks_base-5c425f2eafc3d63e475153586edcf12eb6348aad.tar.bz2
GLES2Debugger: Added DbgContext and vertex data capturing.
Send VBO related commands to client, which tracks the state. Maintain index buffer content and vertex attrib pointer/buffer state on server. During glDrawArrays/Elements, send user memory data to client. Change-Id: Ia920e90479329b301ae4b5735e833eeb20293c94 Signed-off-by: David Li <davidxli@google.com>
Diffstat (limited to 'opengl/libs/EGL/egl.cpp')
-rw-r--r--opengl/libs/EGL/egl.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 8e4b0ee..861d7ac 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -45,6 +45,7 @@
#include "hooks.h"
#include "egl_impl.h"
#include "Loader.h"
+#include "glesv2dbg.h"
#define setError(_e, _r) setErrorEtc(__FUNCTION__, __LINE__, _e, _r)
@@ -223,9 +224,15 @@ struct egl_context_t : public egl_object_t
egl_context_t(EGLDisplay dpy, EGLContext context, EGLConfig config,
int impl, egl_connection_t const* cnx, int version)
: dpy(dpy), context(context), config(config), read(0), draw(0), impl(impl),
- cnx(cnx), version(version)
+ cnx(cnx), version(version), dbg(NULL)
{
}
+ ~egl_context_t()
+ {
+ if (dbg)
+ DestroyDbgContext(dbg);
+ dbg = NULL;
+ }
EGLDisplay dpy;
EGLContext context;
EGLConfig config;
@@ -234,6 +241,7 @@ struct egl_context_t : public egl_object_t
int impl;
egl_connection_t const* cnx;
int version;
+ DbgContext * dbg;
};
struct egl_image_t : public egl_object_t
@@ -325,14 +333,12 @@ static void initEglTraceLevel() {
char cmdline[256] = {};
if (fgets(cmdline, sizeof(cmdline) - 1, file))
{
- LOGD("\n*\n*\n* initEglTraceLevel cmdline='%s' \n*\n*", cmdline);
if (!strcmp(value, cmdline))
gEGLDebugLevel = 1;
}
fclose(file);
}
- extern void StartDebugServer();
if (gEGLDebugLevel > 0)
StartDebugServer();
}
@@ -341,7 +347,7 @@ static void setGLHooksThreadSpecific(gl_hooks_t const *value) {
if (gEGLTraceLevel > 0) {
setGlTraceThreadSpecific(value);
setGlThreadSpecific(&gHooksTrace);
- } else if (gEGLDebugLevel > 0) {
+ } else if (gEGLDebugLevel > 0 && value != &gHooksNoContext) {
setGlTraceThreadSpecific(value);
setGlThreadSpecific(&gHooksDebug);
LOGD("\n* setGLHooksThreadSpecific gHooksDebug");
@@ -586,6 +592,11 @@ egl_context_t* get_context(EGLContext context) {
return egl_to_native_cast<egl_context_t>(context);
}
+DbgContext * getDbgContextThreadSpecific()
+{
+ return get_context(getContext())->dbg;
+}
+
static inline
egl_image_t* get_image(EGLImageKHR image) {
return egl_to_native_cast<egl_image_t>(image);
@@ -1393,6 +1404,8 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw,
loseCurrent(cur_c);
if (ctx != EGL_NO_CONTEXT) {
+ if (!c->dbg && gEGLDebugLevel > 0)
+ c->dbg = CreateDbgContext(c->version, c->cnx->hooks[c->version]);
setGLHooksThreadSpecific(c->cnx->hooks[c->version]);
setContext(ctx);
_c.acquire();