[waffle] [PATCH 3/7] nacl: add implementation for waffle_context_create

Emil Velikov emil.l.velikov at gmail.com
Tue Feb 3 07:53:12 PST 2015


On 3 February 2015 at 15:37, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> On 23 January 2015 at 07:59, Tapani Pälli <tapani.palli at intel.com> wrote:
>> Patch creates and initializes pp::Graphics3D context for OpenGL ES 2.0.
>>
>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>> ---
> [...]
>
>> @@ -37,6 +43,10 @@ nacl_container_dtor(waffle::nacl_container *nc)
>>  {
>>      if (!nc)
>>          return;
>> +
> +   nc->ctx = pp::Graphics3D();
> I would guess that you want to nuke the Graphics3D ctx first ?
>
>> +    nc->glSetCurrentContextPPAPI(0);
>> +    nc->glTerminatePPAPI();
>> +
> Imho the teardown should be symmetrical to the setup - i.e. create a
> new function nacl_context_fini (or similar) which has the above three
> calls, and gets executed in nacl_context_destroy.
>
Completely forgot - some of the func ptrs can be NULL.

> +static bool
> +nacl_context_init(waffle::nacl_container *nc, struct nacl_config *cfg)
[...]
> +    if (!pp_instance->BindGraphics(nc->ctx)) {
> +        wcore_errorf(WAFFLE_ERROR_FATAL, "Unable to bind 3D context.\n");
> +        nc->ctx = pp::Graphics3D();
> +        nc->glSetCurrentContextPPAPI(0);
As nacl_context_fini comes along you might want to drop the above two calls.

-Emil


More information about the waffle mailing list