OpenGL attrib_list support

Andreas Hartmetz ahartmetz at gmail.com
Wed Jul 10 04:09:21 PDT 2013


On Monday 08 July 2013 21:25:15 José Fonseca wrote:
> On Mon, Jul 8, 2013 at 2:30 PM, Alexander Monakov <amonakov at ispras.ru>wrote:
> > On Mon, 8 Jul 2013, Alexander Monakov wrote:
> > > Looks awesome.  Quick question -- is handling Xlib-style attrib-lists
> > 
> > where
> > 
> > > some keys stand alone without a corresponding value possible/easy?  This
> > > should not block the patch, I'm just asking the question while the code
> > 
> > is
> > 
> > > hot (and I'm interested to have this functionality work for
> > 
> > glXChooseVisual).
> > 
> > Ah, sorry, I spoke too soon.  My concern is addressed by the pull request
> > 
> > itself, to quote:
> > > Note that the current code assumes no value for unknown keys when
> > > determining attrib_list length, but int value when iterating over
> > > attrib_list later. This has the effect that a null value after an
> > > unknown
> > > key terminates the attrib_list as currently interpreted.
> > 
> > You seem to explain a bug in your implementation? :)
> > 
> > For GLX-style attrib-lists, you have a guarantee that a key is followed by
> > a
> > (possibly zero-bit-pattern) value.  Thus the attrib list is terminated by
> > a
> > zero-bit-pattern Int at an even position (thus, a key).  All values are at
> > odd
> > positions.
> > 
> > For Xlib-style attrib-lists, you don't have that guarantee: keys for
> > Boolean
> > arguments do not have a value (it is implicitely 'True').
> > 
> > Initially I thought your patch does not handle Xlib-style lists at all,
> > but
> > now it seems the ground work is in place?
> > 
> > Alexander
> 
> I like the direction of the patch. I'd recommend adding a bool option to
> AttribArray's constructor, so that when true, it would not assume a list of
> pairs, but that bool attributes have implicit true value.
> 
> Jose

I've done it somewhat differently, determined by the presence of keys
that have value type None. Custom terminators are also back now, they
are needed for EGL.

I've updated the pull request, and I must say that I much prefer
working with git push in some way over mailing patches around.
It's less busywork.

Remaining issues are:
- possibly missing enum values for
WGLPixelFormatEXTAttribs - I could just use the ..._ARB- suffixed
versions for most and / or add the ..._EXT variants, or maybe the way
to go is to add something machine-readable and let the scripts do some
of the work?
- WGL changes aren't even compile-tested. Any volunteers?
- No support for float-valued attrib_lists because what were they
  thinking, and who uses them anyway?
  (There don't seem to be any attributes where float makes sense, and
  encoding enums as float values is just weird. They probably checked
  that the enum values survive the int->float->int conversion, but
  still.)
- No support for keys and values in two parallel arrays - I've never
  needed them and they break the basic assumption that each parameter
  can be serialized on its own. I may or may not look at implementing
  them later.

Andreas


More information about the apitrace mailing list