KhronosGroup / SPIRV-Headers

SPIRV-Headers
Other
269 stars 254 forks source link

Enforce naming conventions for aliased tokens #429

Closed alan-baker closed 4 months ago

alan-baker commented 5 months ago

Currently the grammar file has duplicate entries for when tokens from extensions are promoted to KHR or core. #426 added some utility methods for getting the names of enumerants. We should ensure to always follow a convention preferring the "highest" priority suffix:

  1. No suffix (core)
  2. KHR
  3. EXT
  4. Vendor

The best way to do this would be to modify the grammar to satisfy this ranking and enforce it via our build checks.

This is related to #138, but easier to act on until we resolve the larger aliasing question.

alan-baker commented 4 months ago

Ran across a current instance of this for reference. In the BuiltIn enumerants:

        {
          "enumerant" : "RayTmaxNV",
          "value" : 5326,
          "capabilities" : [ "RayTracingNV" , "RayTracingKHR" ],
          "extensions" : [ "SPV_NV_ray_tracing" , "SPV_KHR_ray_tracing" ],
          "version" : "None"
        },
        {
          "enumerant" : "RayTmaxKHR",
          "value" : 5326,
          "capabilities" : [ "RayTracingNV" , "RayTracingKHR" ],
          "extensions" : [ "SPV_NV_ray_tracing" , "SPV_KHR_ray_tracing" ],
          "version" : "None"
        },