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.pa...@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.


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle

Reply via email to