[waffle] [PATCH] core, man: Fix range and default value of WAFFLE_*_SIZE attrs
Chad Versace
chad.versace at linux.intel.com
Fri Dec 28 11:49:04 PST 2012
For each of the WAFFLE_*_SIZE attributes:
- change the default value from WAFFLE_DONT_CARE(-1) to 0, and
- change the valid range of values from [-1, +inf) to [0, +inf).
This change aligns waffle's behavior to that of GLX [1], EGL [2], and (if
I interpreted the CGL documentation correctly) CGL [3].
This fixes a bug where, if the user didn't specify the value of a size
attribute, then waffle passed WAFFLE_DONT_CARE(-1) to glXChooseFBConfig
and eglChooseConfig. Per the GLX, EGL specs, -1 is an illegal value for
size attributes.
[1] GLX 1.4 spec (2005.12.16), Table 3.4
[2] EGL 1.4 spec (2011.04.06), Table 3.4
[3] https://developer.apple.com/library/mac/documentation/graphicsimaging/reference/CGL_OpenGL/Reference/reference.html#//apple_ref/c/func/CGLChoosePixelFormat
Reported-by: Brian Paul <brian.e.paul at gmail.com>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
man/waffle_config.3.xml | 6 +++++-
src/waffle/core/wcore_config_attrs.c | 20 +++++++++++++-------
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/man/waffle_config.3.xml b/man/waffle_config.3.xml
index 402ed26..00631af 100644
--- a/man/waffle_config.3.xml
+++ b/man/waffle_config.3.xml
@@ -352,7 +352,11 @@ struct waffle_config;
<term><constant>WAFFLE_STENCIL_SIZE</constant></term>
<listitem>
<para>
- The default value for each size attribute is <constant>WAFFLE_DONT_CARE</constant>. If the requested size
+ The default value for each size attribute is <constant>0</constant>.
+
+ The range of valid values is the non-negative integers.
+
+ If the requested size
for a channel is 0, then any surface created with the config will lack that channel. If the requested size
for a channel is positive, then the number of bits in that channel for any surface created with the config
will be at least the requested size.
diff --git a/src/waffle/core/wcore_config_attrs.c b/src/waffle/core/wcore_config_attrs.c
index 1276e56..fa75e44 100644
--- a/src/waffle/core/wcore_config_attrs.c
+++ b/src/waffle/core/wcore_config_attrs.c
@@ -279,13 +279,19 @@ parse_context_profile(struct wcore_config_attrs *attrs,
static bool
set_misc_defaults(struct wcore_config_attrs *attrs)
{
+ // Per the GLX [1] and EGL [2] specs, the default value of each size
+ // attribute and `samples` is 0.
+ //
+ // [1] GLX 1.4 spec (2005.12.16), Table 3.4
+ // [2] EGL 1.4 spec (2011.04.06), Table 3.4
+
attrs->rgba_size = 0;
- attrs->red_size = WAFFLE_DONT_CARE;
- attrs->green_size = WAFFLE_DONT_CARE;
- attrs->blue_size = WAFFLE_DONT_CARE;
- attrs->alpha_size = WAFFLE_DONT_CARE;
- attrs->depth_size = WAFFLE_DONT_CARE;
- attrs->stencil_size = WAFFLE_DONT_CARE;
+ attrs->red_size = 0;
+ attrs->green_size = 0;
+ attrs->blue_size = 0;
+ attrs->alpha_size = 0;
+ attrs->depth_size = 0;
+ attrs->stencil_size = 0;
attrs->sample_buffers = 0;
attrs->samples = 0;
attrs->double_buffered = true;
@@ -306,7 +312,7 @@ parse_misc(struct wcore_config_attrs *attrs,
#define CASE_INT(enum_name, struct_memb) \
case enum_name: \
- if (value < -1) { \
+ if (value < 0) { \
wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE, \
#enum_name " has bad value %d", value); \
return false; \
--
1.8.0.3
More information about the waffle
mailing list