Skip to content

Commit b8e8372

Browse files
refactor(types)!: promote Features::SUBGROUPS to WebGPU
1 parent c68828b commit b8e8372

1 file changed

Lines changed: 34 additions & 32 deletions

File tree

wgpu-types/src/features.rs

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ mod webgpu_impl {
6565
#[doc(hidden)]
6666
pub const WEBGPU_FEATURE_DUAL_SOURCE_BLENDING: u64 = 1 << 14;
6767

68-
// TODO: SUBGROUPS
68+
#[doc(hidden)]
69+
pub const WEBGPU_FEATURE_SUBGROUPS: u64 = 1 << 15;
6970

7071
// TODO: TEXTURE_FORMATS_TIER1
7172

@@ -76,7 +77,7 @@ mod webgpu_impl {
7677
// TODO: TEXTURE_COMPONENT_SWIZZLE
7778

7879
#[doc(hidden)]
79-
pub const WEBGPU_FEATURE_IMMEDIATES: u64 = 1 << 15;
80+
pub const WEBGPU_FEATURE_IMMEDIATES: u64 = 1 << 16;
8081
}
8182

8283
macro_rules! bitflags_array_impl {
@@ -1047,24 +1048,14 @@ bitflags_array! {
10471048
///
10481049
/// This is a native only feature.
10491050
const SHADER_INT64 = 1 << 37;
1050-
/// Allows compute and fragment shaders to use the subgroup operation
1051-
/// built-ins and perform subgroup operations (except barriers).
1052-
///
1053-
/// Supported Platforms:
1054-
/// - Vulkan
1055-
/// - DX12
1056-
/// - Metal
1057-
///
1058-
/// This is a native only feature.
1059-
const SUBGROUPS = 1 << 38;
10601051
/// Allows vertex shaders to use the subgroup operation built-ins and
10611052
/// perform subgroup operations (except barriers).
10621053
///
10631054
/// Supported Platforms:
10641055
/// - Vulkan
10651056
///
10661057
/// This is a native only feature.
1067-
const SUBGROUPS_VERTEX = 1 << 39;
1058+
const SUBGROUPS_VERTEX = 1 << 38;
10681059
/// Allows compute shaders to use the subgroup barrier.
10691060
///
10701061
/// Requires [`Features::SUBGROUPS`]. Without it, enables nothing.
@@ -1074,7 +1065,7 @@ bitflags_array! {
10741065
/// - Metal
10751066
///
10761067
/// This is a native only feature.
1077-
const SUBGROUPS_BARRIER = 1 << 40;
1068+
const SUBGROUPS_BARRIER = 1 << 39;
10781069
/// Allows the use of pipeline cache objects
10791070
///
10801071
/// Supported platforms:
@@ -1083,7 +1074,7 @@ bitflags_array! {
10831074
/// Unimplemented Platforms:
10841075
/// - DX12
10851076
/// - Metal
1086-
const PIPELINE_CACHE = 1 << 41;
1077+
const PIPELINE_CACHE = 1 << 40;
10871078
/// Allows shaders to use i64 and u64 atomic min and max.
10881079
///
10891080
/// Supported platforms:
@@ -1092,15 +1083,15 @@ bitflags_array! {
10921083
/// - Metal (with MSL 2.4+)
10931084
///
10941085
/// This is a native only feature.
1095-
const SHADER_INT64_ATOMIC_MIN_MAX = 1 << 42;
1086+
const SHADER_INT64_ATOMIC_MIN_MAX = 1 << 41;
10961087
/// Allows shaders to use all i64 and u64 atomic operations.
10971088
///
10981089
/// Supported platforms:
10991090
/// - Vulkan (with VK_KHR_shader_atomic_int64)
11001091
/// - DX12 (with SM 6.6+)
11011092
///
11021093
/// This is a native only feature.
1103-
const SHADER_INT64_ATOMIC_ALL_OPS = 1 << 43;
1094+
const SHADER_INT64_ATOMIC_ALL_OPS = 1 << 42;
11041095
/// Allows using the [VK_GOOGLE_display_timing] Vulkan extension.
11051096
///
11061097
/// This is used for frame pacing to reduce latency, and is generally only available on Android.
@@ -1116,7 +1107,7 @@ bitflags_array! {
11161107
///
11171108
/// [VK_GOOGLE_display_timing]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_GOOGLE_display_timing.html
11181109
#[doc = link_to_wgpu_docs!(["`Surface::as_hal()`"]: "struct.Surface.html#method.as_hal")]
1119-
const VULKAN_GOOGLE_DISPLAY_TIMING = 1 << 44;
1110+
const VULKAN_GOOGLE_DISPLAY_TIMING = 1 << 43;
11201111

11211112
/// Allows using the [VK_KHR_external_memory_win32] Vulkan extension.
11221113
///
@@ -1126,7 +1117,7 @@ bitflags_array! {
11261117
/// This is a native only feature.
11271118
///
11281119
/// [VK_KHR_external_memory_win32]: https://registry.khronos.org/vulkan/specs/latest/man/html/VK_KHR_external_memory_win32.html
1129-
const VULKAN_EXTERNAL_MEMORY_WIN32 = 1 << 45;
1120+
const VULKAN_EXTERNAL_MEMORY_WIN32 = 1 << 44;
11301121

11311122
/// Enables R64Uint image atomic min and max.
11321123
///
@@ -1136,7 +1127,7 @@ bitflags_array! {
11361127
/// - Metal (with MSL 3.1+)
11371128
///
11381129
/// This is a native only feature.
1139-
const TEXTURE_INT64_ATOMIC = 1 << 46;
1130+
const TEXTURE_INT64_ATOMIC = 1 << 45;
11401131

11411132
/// Allows uniform buffers to be bound as binding arrays.
11421133
///
@@ -1153,7 +1144,7 @@ bitflags_array! {
11531144
/// - Vulkan 1.2+ (or VK_EXT_descriptor_indexing)'s `shaderUniformBufferArrayNonUniformIndexing` feature)
11541145
///
11551146
/// This is a native only feature.
1156-
const UNIFORM_BUFFER_BINDING_ARRAYS = 1 << 47;
1147+
const UNIFORM_BUFFER_BINDING_ARRAYS = 1 << 46;
11571148

11581149
/// Enables mesh shaders and task shaders in mesh shader pipelines. This extension does NOT imply support for
11591150
/// compiling mesh shaders at runtime.
@@ -1172,7 +1163,7 @@ bitflags_array! {
11721163
/// [this Mesa issue.](https://gitlab.freedesktop.org/mesa/mesa/-/issues/14376)
11731164
///
11741165
/// This is a native only feature.
1175-
const EXPERIMENTAL_MESH_SHADER = 1 << 48;
1166+
const EXPERIMENTAL_MESH_SHADER = 1 << 47;
11761167

11771168
/// ***THIS IS EXPERIMENTAL:*** Features enabled by this may have
11781169
/// major bugs in them and are expected to be subject to breaking changes, suggestions
@@ -1187,7 +1178,7 @@ bitflags_array! {
11871178
/// This is a native only feature
11881179
///
11891180
/// [`AccelerationStructureFlags::ALLOW_RAY_HIT_VERTEX_RETURN`]: super::AccelerationStructureFlags::ALLOW_RAY_HIT_VERTEX_RETURN
1190-
const EXPERIMENTAL_RAY_HIT_VERTEX_RETURN = 1 << 49;
1181+
const EXPERIMENTAL_RAY_HIT_VERTEX_RETURN = 1 << 48;
11911182

11921183
/// Enables multiview in mesh shader pipelines
11931184
///
@@ -1199,7 +1190,7 @@ bitflags_array! {
11991190
/// - Metal
12001191
///
12011192
/// This is a native only feature.
1202-
const EXPERIMENTAL_MESH_SHADER_MULTIVIEW = 1 << 50;
1193+
const EXPERIMENTAL_MESH_SHADER_MULTIVIEW = 1 << 49;
12031194

12041195
/// Allows usage of additional vertex formats in [BlasTriangleGeometrySizeDescriptor::vertex_format]
12051196
///
@@ -1208,7 +1199,7 @@ bitflags_array! {
12081199
/// - DX12
12091200
///
12101201
/// [BlasTriangleGeometrySizeDescriptor::vertex_format]: super::BlasTriangleGeometrySizeDescriptor
1211-
const EXTENDED_ACCELERATION_STRUCTURE_VERTEX_FORMATS = 1 << 51;
1202+
const EXTENDED_ACCELERATION_STRUCTURE_VERTEX_FORMATS = 1 << 50;
12121203

12131204
/// Enables creating shaders from passthrough with reflection info (unsafe)
12141205
///
@@ -1226,7 +1217,7 @@ bitflags_array! {
12261217
/// [this comment](https://github.com/gfx-rs/wgpu/issues/3103#issuecomment-2833058367).
12271218
///
12281219
#[doc = link_to_wgpu_docs!(["`Device::create_shader_module_passthrough`"]: "struct.Device.html#method.create_shader_module_passthrough")]
1229-
const EXPERIMENTAL_PASSTHROUGH_SHADERS = 1 << 52;
1220+
const EXPERIMENTAL_PASSTHROUGH_SHADERS = 1 << 51;
12301221

12311222
/// Enables shader barycentric coordinates.
12321223
///
@@ -1236,7 +1227,7 @@ bitflags_array! {
12361227
/// - Metal (with MSL 2.2+)
12371228
///
12381229
/// This is a native only feature.
1239-
const SHADER_BARYCENTRICS = 1 << 53;
1230+
const SHADER_BARYCENTRICS = 1 << 52;
12401231

12411232
/// Enables using multiview where not all texture array layers are rendered to in a single render pass/render pipeline. Making
12421233
/// use of this feature also requires enabling `Features::MULTIVIEW`.
@@ -1247,7 +1238,7 @@ bitflags_array! {
12471238
///
12481239
///
12491240
/// While metal supports this in theory, the behavior of `view_index` differs from vulkan and dx12 so the feature isn't exposed.
1250-
const SELECTIVE_MULTIVIEW = 1 << 54;
1241+
const SELECTIVE_MULTIVIEW = 1 << 53;
12511242

12521243
/// Enables the use of point-primitive outputs from mesh shaders. Making use of this feature also requires enabling
12531244
/// `Features::EXPERIMENTAL_MESH_SHADER`.
@@ -1257,7 +1248,7 @@ bitflags_array! {
12571248
/// - Metal
12581249
///
12591250
/// This is a native only feature.
1260-
const EXPERIMENTAL_MESH_SHADER_POINTS = 1 << 55;
1251+
const EXPERIMENTAL_MESH_SHADER_POINTS = 1 << 54;
12611252

12621253
/// Enables creating texture arrays that are also multisampled.
12631254
///
@@ -1266,7 +1257,7 @@ bitflags_array! {
12661257
///
12671258
/// Supported platforms:
12681259
/// - Vulkan (except VK_KHR_portability_subset if multisampleArrayImage is not available)
1269-
const MULTISAMPLE_ARRAY = 1 << 56;
1260+
const MULTISAMPLE_ARRAY = 1 << 55;
12701261

12711262
/// Enables cooperative matrix operations (also known as tensor cores on NVIDIA GPUs
12721263
/// or simdgroup matrix operations on Apple GPUs).
@@ -1285,15 +1276,15 @@ bitflags_array! {
12851276
/// - Vulkan (with [VK_KHR_cooperative_matrix](https://registry.khronos.org/vulkan/specs/latest/man/html/VK_KHR_cooperative_matrix.html), if 8x8 f32 is supported)
12861277
///
12871278
/// This is a native only feature.
1288-
const EXPERIMENTAL_COOPERATIVE_MATRIX = 1 << 57;
1279+
const EXPERIMENTAL_COOPERATIVE_MATRIX = 1 << 56;
12891280

12901281
/// Enables shader per-vertex attributes.
12911282
///
12921283
/// Supported platforms:
12931284
/// - Vulkan (with VK_KHR_fragment_shader_barycentric)
12941285
///
12951286
/// This is a native only feature.
1296-
const SHADER_PER_VERTEX = 1 << 58;
1287+
const SHADER_PER_VERTEX = 1 << 57;
12971288
}
12981289

12991290
/// Features that are not guaranteed to be supported.
@@ -1544,6 +1535,17 @@ bitflags_array! {
15441535
/// This is a web and native feature.
15451536
const DUAL_SOURCE_BLENDING = WEBGPU_FEATURE_DUAL_SOURCE_BLENDING;
15461537

1538+
/// Allows compute and fragment shaders to use the subgroup operation
1539+
/// built-ins and perform subgroup operations (except barriers).
1540+
///
1541+
/// Supported Platforms:
1542+
/// - Vulkan
1543+
/// - DX12
1544+
/// - Metal
1545+
///
1546+
/// This is a web and native feature.
1547+
const SUBGROUPS = WEBGPU_FEATURE_SUBGROUPS;
1548+
15471549
/// Allows the use of immediate data: small, fast bits of memory that can be updated
15481550
/// inside a [`RenderPass`].
15491551
///

0 commit comments

Comments
 (0)