summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/egl/common/egl_g3d_st.c
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-03-12 09:56:11 +0800
committerChia-I Wu <olv@lunarg.com>2010-04-04 21:49:24 +0800
commit776dc53f62c46e235ff8ef2e1eec1a308a036987 (patch)
tree589b41e37e5cb7a50ff90301e2f59668452c752d /src/gallium/state_trackers/egl/common/egl_g3d_st.c
parentd605b0db4d4318d2616fffc158e57732c416c5c3 (diff)
st/egl: Implement get_egl_image hook.
This hook may be used by rendering state trackers to implement EGLImage extensions.
Diffstat (limited to 'src/gallium/state_trackers/egl/common/egl_g3d_st.c')
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_st.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_st.c b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
index 6488965e5b..9573ba09d1 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_st.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
@@ -85,6 +85,37 @@ egl_g3d_create_st_api(enum st_api_type api)
return mod->create_api();
}
+static boolean
+egl_g3d_st_manager_get_egl_image(struct st_manager *smapi,
+ struct st_egl_image *stimg)
+{
+ struct egl_g3d_st_manager *gsmapi = egl_g3d_st_manager(smapi);
+ EGLImageKHR handle = (EGLImageKHR) stimg->egl_image;
+ _EGLImage *img;
+ struct egl_g3d_image *gimg;
+
+ /* this is called from state trackers */
+ _eglLockMutex(&gsmapi->display->Mutex);
+
+ img = _eglLookupImage(handle, gsmapi->display);
+ if (!img) {
+ _eglUnlockMutex(&gsmapi->display->Mutex);
+ return FALSE;
+ }
+
+ gimg = egl_g3d_image(img);
+
+ stimg->texture = NULL;
+ pipe_texture_reference(&stimg->texture, gimg->texture);
+ stimg->face = gimg->face;
+ stimg->level = gimg->level;
+ stimg->zslice = gimg->zslice;
+
+ _eglUnlockMutex(&gsmapi->display->Mutex);
+
+ return TRUE;
+}
+
struct st_manager *
egl_g3d_create_st_manager(_EGLDisplay *dpy)
{
@@ -96,6 +127,7 @@ egl_g3d_create_st_manager(_EGLDisplay *dpy)
gsmapi->display = dpy;
gsmapi->base.screen = gdpy->native->screen;
+ gsmapi->base.get_egl_image = egl_g3d_st_manager_get_egl_image;
}
return &gsmapi->base;;