diff options
Diffstat (limited to 'third_party/rust/wgpu-types/src/lib.rs')
-rw-r--r-- | third_party/rust/wgpu-types/src/lib.rs | 100 |
1 files changed, 63 insertions, 37 deletions
diff --git a/third_party/rust/wgpu-types/src/lib.rs b/third_party/rust/wgpu-types/src/lib.rs index b36801e941..7049cd3a8d 100644 --- a/third_party/rust/wgpu-types/src/lib.rs +++ b/third_party/rust/wgpu-types/src/lib.rs @@ -890,6 +890,30 @@ bitflags::bitflags! { /// /// This is a native only feature. const SHADER_INT64 = 1 << 55; + /// Allows compute and fragment shaders to use the subgroup operation built-ins + /// + /// Supported Platforms: + /// - Vulkan + /// - DX12 + /// - Metal + /// + /// This is a native only feature. + const SUBGROUP = 1 << 56; + /// Allows vertex shaders to use the subgroup operation built-ins + /// + /// Supported Platforms: + /// - Vulkan + /// + /// This is a native only feature. + const SUBGROUP_VERTEX = 1 << 57; + /// Allows shaders to use the subgroup barrier + /// + /// Supported Platforms: + /// - Vulkan + /// - Metal + /// + /// This is a native only feature. + const SUBGROUP_BARRIER = 1 << 58; } } @@ -1119,7 +1143,7 @@ pub struct Limits { /// pipeline output data, across all color attachments. pub max_color_attachment_bytes_per_sample: u32, /// Maximum number of bytes used for workgroup memory in a compute entry point. Defaults to - /// 16352. Higher is "better". + /// 16384. Higher is "better". pub max_compute_workgroup_storage_size: u32, /// Maximum value of the product of the `workgroup_size` dimensions for a compute entry-point. /// Defaults to 256. Higher is "better". @@ -1136,6 +1160,11 @@ pub struct Limits { /// The maximum value for each dimension of a `ComputePass::dispatch(x, y, z)` operation. /// Defaults to 65535. Higher is "better". pub max_compute_workgroups_per_dimension: u32, + + /// Minimal number of invocations in a subgroup. Higher is "better". + pub min_subgroup_size: u32, + /// Maximal number of invocations in a subgroup. Lower is "better". + pub max_subgroup_size: u32, /// Amount of storage available for push constants in bytes. Defaults to 0. Higher is "better". /// Requesting more than 0 during device creation requires [`Features::PUSH_CONSTANTS`] to be enabled. /// @@ -1146,7 +1175,6 @@ pub struct Limits { /// - OpenGL doesn't natively support push constants, and are emulated with uniforms, /// so this number is less useful but likely 256. pub max_push_constant_size: u32, - /// Maximum number of live non-sampler bindings. /// /// This limit only affects the d3d12 backend. Using a large number will allow the device @@ -1156,6 +1184,14 @@ pub struct Limits { impl Default for Limits { fn default() -> Self { + Self::defaults() + } +} + +impl Limits { + // Rust doesn't allow const in trait implementations, so we break this out + // to allow reusing these defaults in const contexts like `downlevel_defaults` + const fn defaults() -> Self { Self { max_texture_dimension_1d: 8192, max_texture_dimension_2d: 8192, @@ -1170,10 +1206,10 @@ impl Default for Limits { max_storage_buffers_per_shader_stage: 8, max_storage_textures_per_shader_stage: 4, max_uniform_buffers_per_shader_stage: 12, - max_uniform_buffer_binding_size: 64 << 10, - max_storage_buffer_binding_size: 128 << 20, + max_uniform_buffer_binding_size: 64 << 10, // (64 KiB) + max_storage_buffer_binding_size: 128 << 20, // (128 MiB) max_vertex_buffers: 8, - max_buffer_size: 256 << 20, + max_buffer_size: 256 << 20, // (256 MiB) max_vertex_attributes: 16, max_vertex_buffer_array_stride: 2048, min_uniform_buffer_offset_alignment: 256, @@ -1187,13 +1223,13 @@ impl Default for Limits { max_compute_workgroup_size_y: 256, max_compute_workgroup_size_z: 64, max_compute_workgroups_per_dimension: 65535, + min_subgroup_size: 0, + max_subgroup_size: 0, max_push_constant_size: 0, max_non_sampler_bindings: 1_000_000, } } -} -impl Limits { /// These default limits are guaranteed to be compatible with GLES-3.1, and D3D11 /// /// Those limits are as follows (different from default are marked with *): @@ -1218,13 +1254,15 @@ impl Limits { /// max_vertex_buffers: 8, /// max_vertex_attributes: 16, /// max_vertex_buffer_array_stride: 2048, + /// min_subgroup_size: 0, + /// max_subgroup_size: 0, /// max_push_constant_size: 0, /// min_uniform_buffer_offset_alignment: 256, /// min_storage_buffer_offset_alignment: 256, /// max_inter_stage_shader_components: 60, /// max_color_attachments: 8, /// max_color_attachment_bytes_per_sample: 32, - /// max_compute_workgroup_storage_size: 16352, + /// max_compute_workgroup_storage_size: 16352, // * /// max_compute_invocations_per_workgroup: 256, /// max_compute_workgroup_size_x: 256, /// max_compute_workgroup_size_y: 256, @@ -1239,35 +1277,11 @@ impl Limits { max_texture_dimension_1d: 2048, max_texture_dimension_2d: 2048, max_texture_dimension_3d: 256, - max_texture_array_layers: 256, - max_bind_groups: 4, - max_bindings_per_bind_group: 1000, - max_dynamic_uniform_buffers_per_pipeline_layout: 8, - max_dynamic_storage_buffers_per_pipeline_layout: 4, - max_sampled_textures_per_shader_stage: 16, - max_samplers_per_shader_stage: 16, max_storage_buffers_per_shader_stage: 4, - max_storage_textures_per_shader_stage: 4, - max_uniform_buffers_per_shader_stage: 12, - max_uniform_buffer_binding_size: 16 << 10, - max_storage_buffer_binding_size: 128 << 20, - max_vertex_buffers: 8, - max_vertex_attributes: 16, - max_vertex_buffer_array_stride: 2048, - max_push_constant_size: 0, - min_uniform_buffer_offset_alignment: 256, - min_storage_buffer_offset_alignment: 256, - max_inter_stage_shader_components: 60, - max_color_attachments: 8, - max_color_attachment_bytes_per_sample: 32, + max_uniform_buffer_binding_size: 16 << 10, // (16 KiB) + // see: https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf#page=7 max_compute_workgroup_storage_size: 16352, - max_compute_invocations_per_workgroup: 256, - max_compute_workgroup_size_x: 256, - max_compute_workgroup_size_y: 256, - max_compute_workgroup_size_z: 64, - max_compute_workgroups_per_dimension: 65535, - max_buffer_size: 256 << 20, - max_non_sampler_bindings: 1_000_000, + ..Self::defaults() } } @@ -1296,6 +1310,8 @@ impl Limits { /// max_vertex_buffers: 8, /// max_vertex_attributes: 16, /// max_vertex_buffer_array_stride: 255, // + + /// min_subgroup_size: 0, + /// max_subgroup_size: 0, /// max_push_constant_size: 0, /// min_uniform_buffer_offset_alignment: 256, /// min_storage_buffer_offset_alignment: 256, @@ -1326,6 +1342,8 @@ impl Limits { max_compute_workgroup_size_y: 0, max_compute_workgroup_size_z: 0, max_compute_workgroups_per_dimension: 0, + min_subgroup_size: 0, + max_subgroup_size: 0, // Value supported by Intel Celeron B830 on Windows (OpenGL 3.1) max_inter_stage_shader_components: 31, @@ -1418,6 +1436,10 @@ impl Limits { compare!(max_vertex_buffers, Less); compare!(max_vertex_attributes, Less); compare!(max_vertex_buffer_array_stride, Less); + if self.min_subgroup_size > 0 && self.max_subgroup_size > 0 { + compare!(min_subgroup_size, Greater); + compare!(max_subgroup_size, Less); + } compare!(max_push_constant_size, Less); compare!(min_uniform_buffer_offset_alignment, Greater); compare!(min_storage_buffer_offset_alignment, Greater); @@ -4942,6 +4964,9 @@ pub enum VertexFormat { Float64x3 = 32, /// Four double-precision floats (f64). `vec4<f32>` in shaders. Requires [`Features::VERTEX_ATTRIBUTE_64BIT`]. Float64x4 = 33, + /// Three unsigned 10-bit integers and one 2-bit integer, packed into a 32-bit integer (u32). [0, 1024] converted to float [0, 1] `vec4<f32>` in shaders. + #[cfg_attr(feature = "serde", serde(rename = "unorm10-10-10-2"))] + Unorm10_10_10_2 = 34, } impl VertexFormat { @@ -4960,7 +4985,8 @@ impl VertexFormat { | Self::Float16x2 | Self::Float32 | Self::Uint32 - | Self::Sint32 => 4, + | Self::Sint32 + | Self::Unorm10_10_10_2 => 4, Self::Uint16x4 | Self::Sint16x4 | Self::Unorm16x4 @@ -7068,7 +7094,7 @@ pub struct InstanceDescriptor { pub flags: InstanceFlags, /// Which DX12 shader compiler to use. pub dx12_shader_compiler: Dx12Compiler, - /// Which OpenGL ES 3 minor version to request. + /// Which OpenGL ES 3 minor version to request. Will be ignored if OpenGL is available. pub gles_minor_version: Gles3MinorVersion, } |