wgpu-py icon indicating copy to clipboard operation
wgpu-py copied to clipboard

Inconsistent naming of required features

Open fyellin opened this issue 1 year ago • 2 comments

When specifying required features in adapter.request_device(), the naming convention of features found in the enummap have a different format then the native features that are part of WGPU.

  • The former must be specified precisely in lower case with a hyphen separating the words.
  • The latter must be specified either in CamelCase or in any mixture of upper and lower with _ separating the words.

So one writes:

    device = adapter.request_device(
          required_features=["indirect-first-instance", "VERTEX_WRITABLE_STORAGE", ]
    )

This seems inconsistent and confusing. A required feature is a required feature. Both should be specifed the same way.

My preference is for lower-case-words-separated-by-hyphens.

fyellin avatar Aug 10 '24 00:08 fyellin

Looks like the wgpu.h feature names are different from those in _mappings.py and therefore enumus.py perhaps it is a Parsing issue that is missed by codegen?

Vipitis avatar Aug 10 '24 08:08 Vipitis

IIRC this is because the webgpu spec (idl) specifies the names for the former, but since the names for wgpu-specific names are (obviously) not specified, the enum names are used.

I agree that it'd be better to auto-convert these for a consistent format. Or perhaps even case (and hyphen/underscore) insensitive.

almarklein avatar Aug 25 '24 20:08 almarklein