pygfx / wgpu-py

WebGPU for Python

Home Page:https://wgpu-py.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inconsistent naming of required features

fyellin opened this issue · 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.

commented

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?

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.