[waffle] [PATCH 5/7] nacl: add implementation for waffle_make_current

Tapani Pälli tapani.palli at intel.com
Thu Jan 22 23:59:37 PST 2015


Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
 src/waffle/nacl/nacl_container.cpp | 17 +++++++++++++++++
 src/waffle/nacl/nacl_container.h   |  1 +
 src/waffle/nacl/nacl_platform.c    |  2 +-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/waffle/nacl/nacl_container.cpp b/src/waffle/nacl/nacl_container.cpp
index bca39eb..abd64fd 100644
--- a/src/waffle/nacl/nacl_container.cpp
+++ b/src/waffle/nacl/nacl_container.cpp
@@ -135,6 +135,16 @@ nacl_resize(struct nacl_container *nc, int32_t width, int32_t height)
     return true;
 }
 
+static bool
+nacl_makecurrent(waffle::nacl_container *nc)
+{
+    if (!nc)
+        return false;
+
+    nc->glSetCurrentContextPPAPI(nc->ctx.pp_resource());
+    return true;
+}
+
 }; // namespace waffle ends
 
 extern "C" struct nacl_container*
@@ -163,3 +173,10 @@ nacl_resize(struct nacl_container *nc, int32_t width, int32_t height)
                    reinterpret_cast<waffle::nacl_container*>(nc),
                    width, height);
 }
+
+extern "C" bool
+nacl_makecurrent(nacl_container *nc)
+{
+    return waffle::nacl_makecurrent(
+                   reinterpret_cast<waffle::nacl_container*>(nc));
+}
diff --git a/src/waffle/nacl/nacl_container.h b/src/waffle/nacl/nacl_container.h
index f3ede41..5341141 100644
--- a/src/waffle/nacl/nacl_container.h
+++ b/src/waffle/nacl/nacl_container.h
@@ -41,6 +41,7 @@ struct nacl_container *nacl_init();
 void nacl_teardown(struct nacl_container *nc);
 bool nacl_context_init(struct nacl_container *nc, struct nacl_config *cfg);
 bool nacl_resize(struct nacl_container *nc, int32_t width, int32_t height);
+bool nacl_makecurrent(struct nacl_container *nc);
 
 #ifdef __cplusplus
 };
diff --git a/src/waffle/nacl/nacl_platform.c b/src/waffle/nacl/nacl_platform.c
index b4df9d9..20a9739 100644
--- a/src/waffle/nacl/nacl_platform.c
+++ b/src/waffle/nacl/nacl_platform.c
@@ -68,7 +68,7 @@ nacl_platform_make_current(struct wcore_platform *wc_self,
                            struct wcore_window *wc_window,
                            struct wcore_context *wc_ctx)
 {
-    return false;
+    return nacl_makecurrent(nacl_platform(wc_self)->nacl);
 }
 
 struct wcore_platform*
-- 
2.1.0



More information about the waffle mailing list