[waffle] [PATCH 2/7] nacl: add implementation for waffle_config_choose

Chad Versace chad.versace at intel.com
Mon Feb 2 15:06:29 PST 2015


On 01/22/2015 11:59 PM, Tapani Pälli wrote:
> Patch fills attributes table suitable for Pepper API from
> wcore_config_attrs passed by the application.
> 
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> ---
>  src/waffle/nacl/nacl_config.c | 30 ++++++++++++++++++++++++++++++
>  src/waffle/nacl/nacl_config.h |  2 ++
>  2 files changed, 32 insertions(+)
> 
> diff --git a/src/waffle/nacl/nacl_config.c b/src/waffle/nacl/nacl_config.c
> index 27a75e1..d31bf97 100644
> --- a/src/waffle/nacl/nacl_config.c
> +++ b/src/waffle/nacl/nacl_config.c
> @@ -50,6 +50,36 @@ nacl_config_choose(struct wcore_platform *wc_plat,
>      if (self == NULL)
>          return NULL;
>  
> +    // Currently only OpenGL ES 2.0 is supported.
> +    if (attrs->context_api != WAFFLE_CONTEXT_OPENGL_ES2)
> +        return NULL;

When config creation fails, Waffle needs to emit an error to tell
the user why. This check should look like this:

if (attrs->context_api != WAFFLE_CONTEXT_OPENGL_ES2) {
    wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
                 "CGL does not support debug contexts");
    return false;  
}

> +
> +    unsigned attr = 0;
> +
> +#define PUSH_ATTRIB(a, val) \
> +    if (val != WAFFLE_DONT_CARE) {\
> +        self->attribs[attr++] = a; \
> +        self->attribs[attr++] = val;\
> +    }
> +
> +    PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_ALPHA_SIZE,     attrs->alpha_size);
> +    PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_BLUE_SIZE,      attrs->blue_size);
> +    PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_GREEN_SIZE,     attrs->green_size);
> +    PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_RED_SIZE,       attrs->red_size);
> +    PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_DEPTH_SIZE,     attrs->depth_size);
> +    PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_STENCIL_SIZE,   attrs->stencil_size);
> +    PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_SAMPLES,        attrs->samples);
> +    PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, attrs->sample_buffers);
> +
> +    // Note, we have to have at least 1x1 size initially so that initial
> +    // context backing surface creation will succeed without errors. Later
> +    // on it is resized by window creation/resize.
> +    PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_WIDTH,  1);
> +    PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_HEIGHT, 1);
> +    PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_NONE, 0);

Interesting. I didn't know that NaCl bound the render dimensions into the config.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 884 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/waffle/attachments/20150202/c1a3aa48/attachment-0001.sig>


More information about the waffle mailing list