summaryrefslogtreecommitdiff
path: root/retrace/glretrace_egl.cpp
diff options
context:
space:
mode:
authorImre Deak <imre.deak@intel.com>2012-06-04 14:14:24 +0300
committerJosé Fonseca <jose.r.fonseca@gmail.com>2012-08-02 07:13:49 +0100
commit2b745f6c67ac66bb31d6e4da6436a031f9c9ae42 (patch)
tree11e740e652788749adb26a5c678736233ac9bc1d /retrace/glretrace_egl.cpp
parent9a40d9e636d026a3e60af2ebe8be50ebdae608a8 (diff)
egl: EGL image trace support
Getting the dimension / format of EGL images is not straitghforward. One way to get these would be through glGetTexLevelParameter, but it's not supported by GLES. Another way is to attach the EGL image to a renderbuffer and call glGetRenderbufferParameter on it, but at least mesa doesn't support attaching images in RGBA_REV format. And that format happens to be an important one in applications we care about (like the Android browser). We could also check the parameters of the underlying native buffer, but these are not exposed through any API (for either Xpixmaps or Android native buffers) So the only way I found is to try a non-destructive glCopyTexSubImage2D with sizes starting from GL_MAX_TEXTURE_SIZE down to 1 and determine the correct size based on whether this returns an error or not. Signed-off-by: Imre Deak <imre.deak@intel.com>
Diffstat (limited to 'retrace/glretrace_egl.cpp')
-rw-r--r--retrace/glretrace_egl.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/retrace/glretrace_egl.cpp b/retrace/glretrace_egl.cpp
index 70fe3546..72368a9c 100644
--- a/retrace/glretrace_egl.cpp
+++ b/retrace/glretrace_egl.cpp
@@ -32,6 +32,7 @@
#include "retrace.hpp"
#include "glretrace.hpp"
#include "os.hpp"
+#include "eglsize.hpp"
#ifndef EGL_OPENGL_ES_API
#define EGL_OPENGL_ES_API 0x30A0
@@ -224,6 +225,23 @@ static void retrace_eglSwapBuffers(trace::Call &call) {
}
}
+static void retrace_glEGLImageTargetTexture2DOES(trace::Call &call)
+{
+ EGLenum target = call.arg(0).toUInt();
+ struct image_blob *iblob;
+ struct image_info *info;
+
+ if (target != GL_TEXTURE_2D) {
+ os::log("%s: target %d not supported\n", __func__, target);
+ return;
+ }
+ iblob = static_cast<struct image_blob *>((call.arg(1)).toPointer());
+ info = &iblob->info;
+
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, info->width, info->height, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, iblob->data);
+}
+
const retrace::Entry glretrace::egl_callbacks[] = {
{"eglGetError", &retrace::ignore},
{"eglGetDisplay", &retrace::ignore},
@@ -259,5 +277,7 @@ const retrace::Entry glretrace::egl_callbacks[] = {
{"eglSwapBuffers", &retrace_eglSwapBuffers},
//{"eglCopyBuffers", &retrace::ignore},
{"eglGetProcAddress", &retrace::ignore},
+ {"eglCreateImageKHR", &retrace::ignore},
+ {"glEGLImageTargetTexture2DOES", &retrace_glEGLImageTargetTexture2DOES},
{NULL, NULL},
};