Skip to content

Extension enum numbering: block 0 core vs block 1 multi-vendor #490

@kainino0x

Description

@kainino0x

Yet another question on the minutiae of these blocks :)
Over in #482 (comment) we've been discussing the relation between enum value block 0x0000_???? "Core"/"required to implement" and block 0x0001_???? "Multi-Implementation Extension"/"optional to implement".

The particular issue arises because (1) both of them are unprefixed and (2) "multi-implementation" extensions could be promoted to "required". We thought of 4 strategies for handling this:

  1. Allow things in block 1 to become required in the future.
  • Potentially we could do this in the future with implementation-specific extensions too (WGPUSType_DawnNewThing = 0x0005_000a), at which point it would make sense to add an unprefixed name, but we could still use a prefixed enum value (WGPUSType_NewThing = 0x0005_000a.
  1. Just merge blocks 0 and 1 into block 0, and have some extensions be required and some be optional.
  2. Give block 1 a prefix so we can have duplicate things (WGPUSType_ExtNewThing = 0x0001_000a) into block 0 (WGPUSType_NewThing = 0x0000_0015`).
  • These can mean the same thing, or be two incompatible versions of the extension, but that's kind of hazardous; various problems have arisen from doing so in GL, though sometimes it's not really avoidable when taking an implementation-specific extension and making it multi-implementation or core.
  1. When making something optional (WGPUSType_NewThing = 0x0001_000a) required, have the header renumber it into core (WGPUSType_NewThing = 0x0000_0015) while having implementations (that accepted both values) keep accepting the old value (0x0001_000a, which could be, but does not necessarily have to be, named in the header)

TBH it doesn't really matter because the point of numbering blocks is really just so that implementations have namespaces to work with, so with that in mind I think option 2 makes the most sense, but option 1 is also totally fine.

cc @lokokung @cwfitzgerald

Metadata

Metadata

Assignees

Labels

extensibilityAdding features without breaking API changes

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions