Skip to content

Commit 73d0ce3

Browse files
authored
Remove WGPUVertexStepMode_VertexBufferNotUsed, make 1:1 mapping with JS (#439)
Issue: 432
1 parent f018a92 commit 73d0ce3

File tree

3 files changed

+33
-25
lines changed

3 files changed

+33
-25
lines changed

doc/articles/SentinelValues.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ WebIDL's more flexible typing:
3636
- \ref WGPUFuture has a special null value
3737
- Special cases to indicate the parent struct is null, avoiding extra layers of
3838
pointers just for nullability:
39-
- \ref WGPUVertexBufferLayout::stepMode = \ref WGPUVertexStepMode_VertexBufferNotUsed
39+
- \ref WGPUVertexBufferLayout::stepMode = \ref WGPUVertexStepMode_Undefined with \ref WGPUVertexBufferLayout::attributeCount
4040
- \ref WGPUBufferBindingLayout::type = \ref WGPUBufferBindingType_BindingNotUsed
4141
- \ref WGPUSamplerBindingLayout::type = \ref WGPUSamplerBindingType_BindingNotUsed
4242
- \ref WGPUTextureBindingLayout::sampleType = \ref WGPUTextureSampleType_BindingNotUsed

webgpu.h

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,17 +1080,11 @@ typedef enum WGPUVertexFormat {
10801080
typedef enum WGPUVertexStepMode {
10811081
/**
10821082
* `0x00000000`.
1083-
* This @ref WGPUVertexBufferLayout is a "hole" in the @ref WGPUVertexState `buffers` array.
1084-
* (See also @ref SentinelValues.)
1085-
*/
1086-
WGPUVertexStepMode_VertexBufferNotUsed = 0x00000000,
1087-
/**
1088-
* `0x00000001`.
10891083
* Indicates no value is passed for this argument. See @ref SentinelValues.
10901084
*/
1091-
WGPUVertexStepMode_Undefined = 0x00000001,
1092-
WGPUVertexStepMode_Vertex = 0x00000002,
1093-
WGPUVertexStepMode_Instance = 0x00000003,
1085+
WGPUVertexStepMode_Undefined = 0x00000000,
1086+
WGPUVertexStepMode_Vertex = 0x00000001,
1087+
WGPUVertexStepMode_Instance = 0x00000002,
10941088
WGPUVertexStepMode_Force32 = 0x7FFFFFFF
10951089
} WGPUVertexStepMode WGPU_ENUM_ATTRIBUTE;
10961090

@@ -3866,16 +3860,25 @@ typedef struct WGPUTextureDescriptor {
38663860
})
38673861

38683862
/**
3863+
* If `attributes` is empty *and* `stepMode` is @ref WGPUVertexStepMode_Undefined,
3864+
* indicates a "hole" in the parent @ref WGPUVertexState `buffers` array,
3865+
* with behavior equivalent to `null` in the JS API.
3866+
*
3867+
* If `attributes` is empty but `stepMode` is *not* @ref WGPUVertexStepMode_Undefined,
3868+
* indicates a vertex buffer with no attributes, with behavior equivalent to
3869+
* `{ attributes: [] }` in the JS API. (TODO: If the JS API changes not to
3870+
* distinguish these cases, then this distinction doesn't matter and we can
3871+
* remove this documentation.)
3872+
*
3873+
* If `stepMode` is @ref WGPUVertexStepMode_Undefined but `attributes` is *not* empty,
3874+
* `stepMode` [defaults](@ref SentinelValues) to @ref WGPUVertexStepMode_Vertex.
3875+
*
38693876
* Default values can be set using @ref WGPU_VERTEX_BUFFER_LAYOUT_INIT as initializer.
38703877
*/
38713878
typedef struct WGPUVertexBufferLayout {
38723879
WGPUChainedStruct const * nextInChain;
38733880
/**
3874-
* The step mode for the vertex buffer. If @ref WGPUVertexStepMode_VertexBufferNotUsed,
3875-
* indicates a "hole" in the parent @ref WGPUVertexState `buffers` array:
3876-
* the pipeline does not use a vertex buffer at this `location`.
3877-
*
3878-
* The `INIT` macro sets this to @ref WGPUVertexStepMode_VertexBufferNotUsed.
3881+
* The `INIT` macro sets this to @ref WGPUVertexStepMode_Undefined.
38793882
*/
38803883
WGPUVertexStepMode stepMode;
38813884
/**
@@ -3894,7 +3897,7 @@ typedef struct WGPUVertexBufferLayout {
38943897
*/
38953898
#define WGPU_VERTEX_BUFFER_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUVertexBufferLayout, { \
38963899
/*.nextInChain=*/NULL _wgpu_COMMA \
3897-
/*.stepMode=*/WGPUVertexStepMode_VertexBufferNotUsed _wgpu_COMMA \
3900+
/*.stepMode=*/WGPUVertexStepMode_Undefined _wgpu_COMMA \
38983901
/*.arrayStride=*/0 _wgpu_COMMA \
38993902
/*.attributeCount=*/0 _wgpu_COMMA \
39003903
/*.attributes=*/NULL _wgpu_COMMA \

webgpu.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,10 +1330,6 @@ enums:
13301330
doc: |
13311331
TODO
13321332
entries:
1333-
- name: vertex_buffer_not_used
1334-
doc: |
1335-
This @ref WGPUVertexBufferLayout is a "hole" in the @ref WGPUVertexState `buffers` array.
1336-
(See also @ref SentinelValues.)
13371333
- name: undefined
13381334
doc: Indicates no value is passed for this argument. See @ref SentinelValues.
13391335
- name: vertex
@@ -3086,16 +3082,25 @@ structs:
30863082
type: uint32
30873083
- name: vertex_buffer_layout
30883084
doc: |
3089-
TODO
3085+
If `attributes` is empty *and* `stepMode` is @ref WGPUVertexStepMode_Undefined,
3086+
indicates a "hole" in the parent @ref WGPUVertexState `buffers` array,
3087+
with behavior equivalent to `null` in the JS API.
3088+
3089+
If `attributes` is empty but `stepMode` is *not* @ref WGPUVertexStepMode_Undefined,
3090+
indicates a vertex buffer with no attributes, with behavior equivalent to
3091+
`{ attributes: [] }` in the JS API. (TODO: If the JS API changes not to
3092+
distinguish these cases, then this distinction doesn't matter and we can
3093+
remove this documentation.)
3094+
3095+
If `stepMode` is @ref WGPUVertexStepMode_Undefined but `attributes` is *not* empty,
3096+
`stepMode` [defaults](@ref SentinelValues) to @ref WGPUVertexStepMode_Vertex.
30903097
type: base_in
30913098
members:
30923099
- name: step_mode
30933100
doc: |
3094-
The step mode for the vertex buffer. If @ref WGPUVertexStepMode_VertexBufferNotUsed,
3095-
indicates a "hole" in the parent @ref WGPUVertexState `buffers` array:
3096-
the pipeline does not use a vertex buffer at this `location`.
3101+
TODO
30973102
type: enum.vertex_step_mode
3098-
default: vertex_buffer_not_used
3103+
default: undefined
30993104
- name: array_stride
31003105
doc: |
31013106
TODO

0 commit comments

Comments
 (0)