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; + + 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); + +#undef PUSH_ATTRIB + ok = wcore_config_init(&self->wcore, wc_dpy, attrs); if (!ok) goto error; diff --git a/src/waffle/nacl/nacl_config.h b/src/waffle/nacl/nacl_config.h index 3270179..ff73e6c 100644 --- a/src/waffle/nacl/nacl_config.h +++ b/src/waffle/nacl/nacl_config.h @@ -27,12 +27,14 @@ #include "wcore_config.h" #include "wcore_util.h" +#include "ppapi/c/pp_graphics_3d.h" struct wcore_config_attrs; struct wcore_platform; struct nacl_config { struct wcore_config wcore; + int32_t attribs[64]; }; DEFINE_CONTAINER_CAST_FUNC(nacl_config, -- 2.1.0 _______________________________________________ waffle mailing list waffle@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/waffle