Skip to content

Conversation

MarijnS95
Copy link
Member

Draft PR, currently containing the following improvements:

  • gl_generator: Invert extension lookup based on filter
  • gl_generator: Handle api filters in <enum> and <require>
  • gl_generator: Handle box as keyword, which is used in some parameters
  • gl_generator: Make lookups more robust based on unstripped name
  • gl_generator: Replace deprecated <groups> parsing with direct <enums group=""> parsing

This allows us to panic whenever the user passed an extension that is
not defined for a given API, instead of silently continuing and leaving
them wonder if/why any output is generated based on what they specified.
Some enums (currently only `GL_ACTIVE_PROGRAM_EXT`) have duplicate
definitions with different values based on the selected API.  Without
this filter both will be emitted based on a simple regex filter
by name only, thus make sure we only read the enums

At the same time `api` filters apply to `<require>` blocks too: this
allows certain extensions to pull in different names or bindings
based on the API they're defined for, and we must make sure to only
handle the block that matches `filter.api`.
By stripping and later appending a *possible* prefix for enum constants
and command names we're not only spending a lot of CPU and human
cycles (because this logic is impossible to understand), we're also
loosing out on a few WGL commands that weren't prefixed with the
`wgl` name.  Conveniently these functions were referencing a typo'd
`PIXELFORMATDESCRIPTOR` without leading `P`, which might otherwise not
have been found.

Do this by keeping all commands and enums keyed by their full name
in `BTreeMap`s so that we can also track completely accurately when a
`<delete>` or `<require>` would erroneously specify a name that doesn't
exist.
…ms group="">` parsing

Note that groups are currently entirely unused in the generator,
but could become useful soon to emit typed APIs for existing `<param
group="">` command arguments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant