Skip to content

Naming of sentinel values not present in JS #234

Closed
@kainino0x

Description

@kainino0x

In the C API we have a few sentinel enum values that don't have equivalents in JS:

We also have Undefined variants for a bunch of enums which are used as optional-without-default in JS.

And finally, constants for sentinel values of numeric fields:

#define WGPU_ARRAY_LAYER_COUNT_UNDEFINED (0xffffffffUL)
#define WGPU_COPY_STRIDE_UNDEFINED (0xffffffffUL)
#define WGPU_LIMIT_U32_UNDEFINED (0xffffffffUL)
#define WGPU_LIMIT_U64_UNDEFINED (0xffffffffffffffffULL)
#define WGPU_MIP_LEVEL_COUNT_UNDEFINED (0xffffffffUL)
#define WGPU_QUERY_SET_INDEX_UNDEFINED (0xffffffffUL)
#define WGPU_WHOLE_MAP_SIZE SIZE_MAX
#define WGPU_WHOLE_SIZE (0xffffffffffffffffULL)

Should we call all of them "undefined"?
Or should we be trying to use more meaningful names, like VertexBufferNotUsed and WHOLE_SIZE?
Or should we have both?

Examples of meaningful names:

  • WGPUTextureFormat_ColorTargetNotUsed
  • WGPUBufferBindingType_NotUsed
  • WGPU_ARRAY_LAYER_COUNT_DEFAULT or e.g. TO_END or ALL_REMAINING
  • WGPU_QUERY_SET_INDEX_NOT_WRITTEN

Metadata

Metadata

Assignees

Labels

has resolutionIssue is resolved, just needs to be donenamingBikeshedding names

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions