Skip to content

Commit

Permalink
Support "subgroups" optional feature
Browse files Browse the repository at this point in the history
struct adapter_properties_subgroups is chained out from adapter_info,
and reports minimum and maximum supported subgroup sizes for the
adapter.

Issue: webgpu-native#428
  • Loading branch information
dneto0 committed Nov 22, 2024
1 parent c4ac882 commit fe6119d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
33 changes: 33 additions & 0 deletions webgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ typedef struct WGPUTextureViewImpl* WGPUTextureView WGPU_OBJECT_ATTRIBUTE;
/** @} */
// Structure forward declarations
struct WGPUAdapterInfo;
struct WGPUAdapterPropertiesSubgroups;
struct WGPUBindGroupEntry;
struct WGPUBlendComponent;
struct WGPUBufferBindingLayout;
Expand Down Expand Up @@ -742,6 +743,7 @@ typedef enum WGPUSType {
WGPUSType_SurfaceSourceWaylandSurface = 0x00000007,
WGPUSType_SurfaceSourceAndroidNativeWindow = 0x00000008,
WGPUSType_SurfaceSourceXCBWindow = 0x00000009,
WGPUSType_AdapterPropertiesSubgroups = 0x0000000A,
WGPUSType_Force32 = 0x7FFFFFFF
} WGPUSType WGPU_ENUM_ATTRIBUTE;

Expand Down Expand Up @@ -1566,6 +1568,37 @@ typedef struct WGPUAdapterInfo {
/*.deviceID=*/0 _wgpu_COMMA \
})

/**
* Enabled by the "subgroups" feature.
* Provides bounds on the sizes of subgroups supported by the adapter.
*
* Default values can be set using @ref WGPU_ADAPTER_PROPERTIES_SUBGROUPS_INIT as initializer.
*/
typedef struct WGPUAdapterPropertiesSubgroups {
WGPUChainedStructOut * nextInChain;
/**
* If the "subgroups" feature is supported, the minimum supported subgroup size for the adapter.
*
* Defaults to `0`.
*/
uint32_t minSubgroupSize;
/**
* If the "subgroups" feature is supported, the maximum supported subgroup size for the adapter.
*
* Defaults to `0`.
*/
uint32_t maxSubgroupSize;
} WGPUAdapterPropertiesSubgroups WGPU_STRUCTURE_ATTRIBUTE;

/**
* Initializer for @ref WGPUAdapterPropertiesSubgroups.
*/
#define WGPU_ADAPTER_PROPERTIES_SUBGROUPS_INIT _wgpu_MAKE_INIT_STRUCT(WGPUAdapterPropertiesSubgroups, { \
/*.nextInChain=*/NULL _wgpu_COMMA \
/*.minSubgroupSize=*/0 _wgpu_COMMA \
/*.maxSubgroupSize=*/0 _wgpu_COMMA \
})

/**
* Default values can be set using @ref WGPU_BIND_GROUP_ENTRY_INIT as initializer.
*/
Expand Down
17 changes: 17 additions & 0 deletions webgpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,9 @@ enums:
- name: surface_source_XCB_window
doc: |
TODO
- name: adapter_properties_subgroups
doc: |
TODO
- name: sampler_binding_type
doc: |
TODO
Expand Down Expand Up @@ -1528,6 +1531,20 @@ structs:
doc: |
TODO
type: uint32
- name: adapter_properties_subgroups
doc: |
Enabled by the "subgroups" feature.
Provides bounds on the sizes of subgroups supported by the adapter.
type: base_out
members:
- name: min_subgroup_size
doc: |
If the "subgroups" feature is supported, the minimum supported subgroup size for the adapter.
type: uint32
- name: max_subgroup_size
doc: |
If the "subgroups" feature is supported, the maximum supported subgroup size for the adapter.
type: uint32
- name: bind_group_descriptor
doc: |
TODO
Expand Down

0 comments on commit fe6119d

Please sign in to comment.