[waffle] [PATCH 6/7] nacl: add implementation for waffle_window_swap_buffers
Emil Velikov
emil.l.velikov at gmail.com
Tue Feb 3 07:57:35 PST 2015
On 23 January 2015 at 07:59, Tapani Pälli <tapani.palli at intel.com> wrote:
> Implementation for nacl is somewhat different as for other platforms,
> platform needs to ensure that the previous swap has finished before
> issuing another one. This is done by introducing a worker thread that
> does buffer swaps from a work queue.
>
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> ---
> src/waffle/nacl/nacl_container.cpp | 20 +++++++++++
> src/waffle/nacl/nacl_container.h | 1 +
> src/waffle/nacl/nacl_swap_thread.h | 72 ++++++++++++++++++++++++++++++++++++++
> src/waffle/nacl/nacl_window.c | 3 +-
> 4 files changed, 95 insertions(+), 1 deletion(-)
> create mode 100644 src/waffle/nacl/nacl_swap_thread.h
>
> diff --git a/src/waffle/nacl/nacl_container.cpp b/src/waffle/nacl/nacl_container.cpp
> index abd64fd..4ea3f2a 100644
> --- a/src/waffle/nacl/nacl_container.cpp
> +++ b/src/waffle/nacl/nacl_container.cpp
> @@ -28,11 +28,13 @@
> #include "ppapi/cpp/module.h"
> #include "ppapi/c/pp_errors.h"
> #include "nacl_container.h"
> +#include "nacl_swap_thread.h"
>
> namespace waffle {
>
> struct nacl_container {
> pp::Graphics3D ctx;
> + NaclSwapThread *swapper;
>
> bool (*glInitializePPAPI) (PPB_GetInterface);
> void (*glSetCurrentContextPPAPI) (PP_Resource);
> @@ -48,6 +50,7 @@ nacl_container_dtor(waffle::nacl_container *nc)
> nc->glSetCurrentContextPPAPI(0);
> nc->glTerminatePPAPI();
>
> + delete nc->swapper;
Would assume that you'll want this in the new nacl_context_fini ?
> delete nc;
> }
>
> @@ -123,6 +126,7 @@ nacl_context_init(waffle::nacl_container *nc, struct nacl_config *cfg)
> return false;
> }
>
> + nc->swapper = new NaclSwapThread(pp_instance, nc->ctx);
> return true;
> }
>
> @@ -145,6 +149,15 @@ nacl_makecurrent(waffle::nacl_container *nc)
> return true;
> }
>
> +static bool
> +nacl_swapbuffers(waffle::nacl_container *nc)
> +{
> + if (!nc)
> + return false;
> +
assert(nc) ?
> + return nc->swapper->swap();
Similar to Chad's comment in 4/7 and 5/7 you should be able to inline
the two functions.
-Emil
More information about the waffle
mailing list