Skip to content

Commit

Permalink
Deduplicate TimestampWrites structs
Browse files Browse the repository at this point in the history
Fixes 430
  • Loading branch information
kainino0x committed Nov 26, 2024
1 parent 73f3e51 commit 5f3dfbc
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 106 deletions.
100 changes: 34 additions & 66 deletions webgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ struct WGPUColor;
struct WGPUCommandBufferDescriptor;
struct WGPUCommandEncoderDescriptor;
struct WGPUCompilationMessage;
struct WGPUComputePassTimestampWrites;
struct WGPUConstantEntry;
struct WGPUExtent3D;
struct WGPUFuture;
struct WGPUInstanceCapabilities;
struct WGPULimits;
struct WGPUMultisampleState;
struct WGPUOrigin3D;
struct WGPUPassTimestampWrites;
struct WGPUPipelineLayoutDescriptor;
struct WGPUPrimitiveState;
struct WGPUQuerySetDescriptor;
Expand All @@ -209,7 +209,6 @@ struct WGPURenderBundleDescriptor;
struct WGPURenderBundleEncoderDescriptor;
struct WGPURenderPassDepthStencilAttachment;
struct WGPURenderPassMaxDrawCount;
struct WGPURenderPassTimestampWrites;
struct WGPURequestAdapterOptions;
struct WGPUSamplerBindingLayout;
struct WGPUSamplerDescriptor;
Expand Down Expand Up @@ -1859,37 +1858,6 @@ typedef struct WGPUCompilationMessage {
/*.length=*/0 _wgpu_COMMA \
})

/**
* Default values can be set using @ref WGPU_COMPUTE_PASS_TIMESTAMP_WRITES_INIT as initializer.
*/
typedef struct WGPUComputePassTimestampWrites {
WGPUChainedStruct const * nextInChain;
/**
* Query set to write timestamps to.
*
* The `INIT` macro sets this to `NULL`.
*/
WGPUQuerySet querySet;
/**
* The `INIT` macro sets this to @ref WGPU_QUERY_SET_INDEX_UNDEFINED.
*/
uint32_t beginningOfPassWriteIndex;
/**
* The `INIT` macro sets this to @ref WGPU_QUERY_SET_INDEX_UNDEFINED.
*/
uint32_t endOfPassWriteIndex;
} WGPUComputePassTimestampWrites WGPU_STRUCTURE_ATTRIBUTE;

/**
* Initializer for @ref WGPUComputePassTimestampWrites.
*/
#define WGPU_COMPUTE_PASS_TIMESTAMP_WRITES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUComputePassTimestampWrites, { \
/*.nextInChain=*/NULL _wgpu_COMMA \
/*.querySet=*/NULL _wgpu_COMMA \
/*.beginningOfPassWriteIndex=*/WGPU_QUERY_SET_INDEX_UNDEFINED _wgpu_COMMA \
/*.endOfPassWriteIndex=*/WGPU_QUERY_SET_INDEX_UNDEFINED _wgpu_COMMA \
})

/**
* Default values can be set using @ref WGPU_CONSTANT_ENTRY_INIT as initializer.
*/
Expand Down Expand Up @@ -2221,6 +2189,37 @@ typedef struct WGPUOrigin3D {
/*.z=*/0 _wgpu_COMMA \
})

/**
* Default values can be set using @ref WGPU_PASS_TIMESTAMP_WRITES_INIT as initializer.
*/
typedef struct WGPUPassTimestampWrites {
WGPUChainedStruct const * nextInChain;
/**
* Query set to write timestamps to.
*
* The `INIT` macro sets this to `NULL`.
*/
WGPUQuerySet querySet;
/**
* The `INIT` macro sets this to @ref WGPU_QUERY_SET_INDEX_UNDEFINED.
*/
uint32_t beginningOfPassWriteIndex;
/**
* The `INIT` macro sets this to @ref WGPU_QUERY_SET_INDEX_UNDEFINED.
*/
uint32_t endOfPassWriteIndex;
} WGPUPassTimestampWrites WGPU_STRUCTURE_ATTRIBUTE;

/**
* Initializer for @ref WGPUPassTimestampWrites.
*/
#define WGPU_PASS_TIMESTAMP_WRITES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUPassTimestampWrites, { \
/*.nextInChain=*/NULL _wgpu_COMMA \
/*.querySet=*/NULL _wgpu_COMMA \
/*.beginningOfPassWriteIndex=*/WGPU_QUERY_SET_INDEX_UNDEFINED _wgpu_COMMA \
/*.endOfPassWriteIndex=*/WGPU_QUERY_SET_INDEX_UNDEFINED _wgpu_COMMA \
})

/**
* Default values can be set using @ref WGPU_PIPELINE_LAYOUT_DESCRIPTOR_INIT as initializer.
*/
Expand Down Expand Up @@ -2490,37 +2489,6 @@ typedef struct WGPURenderPassMaxDrawCount {
/*.maxDrawCount=*/50000000 _wgpu_COMMA \
})

/**
* Default values can be set using @ref WGPU_RENDER_PASS_TIMESTAMP_WRITES_INIT as initializer.
*/
typedef struct WGPURenderPassTimestampWrites {
WGPUChainedStruct const * nextInChain;
/**
* Query set to write timestamps to.
*
* The `INIT` macro sets this to `NULL`.
*/
WGPUQuerySet querySet;
/**
* The `INIT` macro sets this to @ref WGPU_QUERY_SET_INDEX_UNDEFINED.
*/
uint32_t beginningOfPassWriteIndex;
/**
* The `INIT` macro sets this to @ref WGPU_QUERY_SET_INDEX_UNDEFINED.
*/
uint32_t endOfPassWriteIndex;
} WGPURenderPassTimestampWrites WGPU_STRUCTURE_ATTRIBUTE;

/**
* Initializer for @ref WGPURenderPassTimestampWrites.
*/
#define WGPU_RENDER_PASS_TIMESTAMP_WRITES_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderPassTimestampWrites, { \
/*.nextInChain=*/NULL _wgpu_COMMA \
/*.querySet=*/NULL _wgpu_COMMA \
/*.beginningOfPassWriteIndex=*/WGPU_QUERY_SET_INDEX_UNDEFINED _wgpu_COMMA \
/*.endOfPassWriteIndex=*/WGPU_QUERY_SET_INDEX_UNDEFINED _wgpu_COMMA \
})

/**
* Default values can be set using @ref WGPU_REQUEST_ADAPTER_OPTIONS_INIT as initializer.
*/
Expand Down Expand Up @@ -3488,7 +3456,7 @@ typedef struct WGPUComputePassDescriptor {
/**
* The `INIT` macro sets this to `NULL`.
*/
WGPU_NULLABLE WGPUComputePassTimestampWrites const * timestampWrites;
WGPU_NULLABLE WGPUPassTimestampWrites const * timestampWrites;
} WGPUComputePassDescriptor WGPU_STRUCTURE_ATTRIBUTE;

/**
Expand Down Expand Up @@ -4004,7 +3972,7 @@ typedef struct WGPURenderPassDescriptor {
/**
* The `INIT` macro sets this to `NULL`.
*/
WGPU_NULLABLE WGPURenderPassTimestampWrites const * timestampWrites;
WGPU_NULLABLE WGPUPassTimestampWrites const * timestampWrites;
} WGPURenderPassDescriptor WGPU_STRUCTURE_ATTRIBUTE;

/**
Expand Down
61 changes: 21 additions & 40 deletions webgpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1823,28 +1823,9 @@ structs:
- name: timestamp_writes
doc: |
TODO
type: struct.compute_pass_timestamp_writes
type: struct.pass_timestamp_writes
pointer: immutable
optional: true
- name: compute_pass_timestamp_writes
doc: |
TODO
type: base_in
members:
- name: query_set
doc: |
Query set to write timestamps to.
type: object.query_set
- name: beginning_of_pass_write_index
doc: |
TODO
type: uint32
default: constant.query_set_index_undefined
- name: end_of_pass_write_index
doc: |
TODO
type: uint32
default: constant.query_set_index_undefined
- name: compute_pipeline_descriptor
doc: |
TODO
Expand Down Expand Up @@ -2255,6 +2236,25 @@ structs:
TODO
type: uint32
default: 0
- name: pass_timestamp_writes
doc: |
TODO
type: base_in
members:
- name: query_set
doc: |
Query set to write timestamps to.
type: object.query_set
- name: beginning_of_pass_write_index
doc: |
TODO
type: uint32
default: constant.query_set_index_undefined
- name: end_of_pass_write_index
doc: |
TODO
type: uint32
default: constant.query_set_index_undefined
- name: pipeline_layout_descriptor
doc: |
TODO
Expand Down Expand Up @@ -2475,7 +2475,7 @@ structs:
- name: timestamp_writes
doc: |
TODO
type: struct.render_pass_timestamp_writes
type: struct.pass_timestamp_writes
pointer: immutable
optional: true
- name: render_pass_max_draw_count
Expand All @@ -2490,25 +2490,6 @@ structs:
TODO
type: uint64
default: 50000000
- name: render_pass_timestamp_writes
doc: |
TODO
type: base_in
members:
- name: query_set
doc: |
Query set to write timestamps to.
type: object.query_set
- name: beginning_of_pass_write_index
doc: |
TODO
type: uint32
default: constant.query_set_index_undefined
- name: end_of_pass_write_index
doc: |
TODO
type: uint32
default: constant.query_set_index_undefined
- name: render_pipeline_descriptor
doc: |
TODO
Expand Down

0 comments on commit 5f3dfbc

Please sign in to comment.