@@ -613,9 +613,56 @@ impl Default for Limits {
613613}
614614
615615impl Limits {
616- // Rust doesn't allow const in trait implementations, so we break this out
617- // to allow reusing these defaults in const contexts like `downlevel_defaults`
618- const fn defaults ( ) -> Self {
616+ /// These default limits are guaranteed to to work on all modern
617+ /// backends and guaranteed to be supported by WebGPU
618+ ///
619+ /// Those limits are as follows:
620+ /// ```rust
621+ /// # use wgpu_types::Limits;
622+ /// assert_eq!(Limits::defaults(), Limits {
623+ /// max_texture_dimension_1d: 8192,
624+ /// max_texture_dimension_2d: 8192,
625+ /// max_texture_dimension_3d: 2048,
626+ /// max_texture_array_layers: 256,
627+ /// max_bind_groups: 4,
628+ /// max_bindings_per_bind_group: 1000,
629+ /// max_dynamic_uniform_buffers_per_pipeline_layout: 8,
630+ /// max_dynamic_storage_buffers_per_pipeline_layout: 4,
631+ /// max_sampled_textures_per_shader_stage: 16,
632+ /// max_samplers_per_shader_stage: 16,
633+ /// max_storage_buffers_per_shader_stage: 8,
634+ /// max_storage_textures_per_shader_stage: 4,
635+ /// max_uniform_buffers_per_shader_stage: 12,
636+ /// max_binding_array_elements_per_shader_stage: 0,
637+ /// max_binding_array_sampler_elements_per_shader_stage: 0,
638+ /// max_uniform_buffer_binding_size: 64 << 10, // (64 KiB)
639+ /// max_storage_buffer_binding_size: 128 << 20, // (128 MiB)
640+ /// max_vertex_buffers: 8,
641+ /// max_buffer_size: 256 << 20, // (256 MiB)
642+ /// max_vertex_attributes: 16,
643+ /// max_vertex_buffer_array_stride: 2048,
644+ /// min_uniform_buffer_offset_alignment: 256,
645+ /// min_storage_buffer_offset_alignment: 256,
646+ /// max_inter_stage_shader_components: 60,
647+ /// max_color_attachments: 8,
648+ /// max_color_attachment_bytes_per_sample: 32,
649+ /// max_compute_workgroup_storage_size: 16384,
650+ /// max_compute_invocations_per_workgroup: 256,
651+ /// max_compute_workgroup_size_x: 256,
652+ /// max_compute_workgroup_size_y: 256,
653+ /// max_compute_workgroup_size_z: 64,
654+ /// max_compute_workgroups_per_dimension: 65535,
655+ /// min_subgroup_size: 0,
656+ /// max_subgroup_size: 0,
657+ /// max_push_constant_size: 0,
658+ /// max_non_sampler_bindings: 1_000_000,
659+ /// });
660+ /// ```
661+ ///
662+ /// Rust doesn't allow const in trait implementations, so we break this out
663+ /// to allow reusing these defaults in const contexts
664+ #[ must_use]
665+ pub const fn defaults ( ) -> Self {
619666 Self {
620667 max_texture_dimension_1d : 8192 ,
621668 max_texture_dimension_2d : 8192 ,
0 commit comments