Skip to content

When shall we check if feature is enabled? #5329

@beaufortfrancois

Description

@beaufortfrancois

Despite the features spec section, it is still not clear to me when content timeline or device timeline is bettter suited to check whether a GPUFeature is enabled on a device.

I've summarized below some instances in the current WebGPU spec where we check if a feature is enabled or not:

Content timeline:

  • createQuerySet()
    • If descriptor.type is "timestamp", but "timestamp-query" is not enabled for this, throw a TypeError.
  • Validate texture format required features of a format
    • If format requires a feature and device.[[features]] does not contain the feature, throw a TypeError.

Device timeline:

  • Validate timestampWrites
    • "timestamp-query" must be enabled for device.
  • Validate GPUPrimitiveState
    • If descriptor.unclippedDepth is true, "depth-clip-control" must be enabled for device.
  • Validate GPUBlendComponent
    • If component.srcFactor or component.dstFactor requires a feature according to the GPUBlendFactor table and device.[[features]] does not contain the feature, throw a TypeError.
  • createShaderModule()
    • For each enable extension in descriptor.code, the corresponding GPUFeatureName must be enabled

For info, I'm wondering about this because I'm working on the swizzle spec proposal and it's not obvious I should raise a validation error instead of TypeError when I call createView({swizzle}) if "texture-component-swizzle" feature is not enabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiWebGPU API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions