mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Shrink the default max binding index to 640 and expose it in Limits.
Following the corresponding changes happening in WebGPU.
This commit is contained in:
parent
7892b0f96e
commit
0a3e209c90
@ -31,9 +31,6 @@ pub mod queue;
|
||||
#[cfg(any(feature = "trace", feature = "replay"))]
|
||||
pub mod trace;
|
||||
|
||||
// Per WebGPU specification.
|
||||
pub const MAX_BINDING_INDEX: u32 = 65535;
|
||||
|
||||
pub const SHADER_STAGE_COUNT: usize = 3;
|
||||
// Should be large enough for the largest possible texture row. This value is enough for a 16k texture with float4 format.
|
||||
pub(crate) const ZERO_BUFFER_SIZE: BufferAddress = 512 << 10;
|
||||
@ -4134,10 +4131,10 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
|
||||
let mut entry_map = FastHashMap::default();
|
||||
for entry in desc.entries.iter() {
|
||||
if entry.binding > MAX_BINDING_INDEX {
|
||||
if entry.binding > device.limits.max_bindings_per_bind_group {
|
||||
break 'outer binding_model::CreateBindGroupLayoutError::InvalidBindingIndex {
|
||||
binding: entry.binding,
|
||||
maximum: MAX_BINDING_INDEX,
|
||||
maximum: device.limits.max_bindings_per_bind_group,
|
||||
};
|
||||
}
|
||||
if entry_map.insert(entry.binding, *entry).is_some() {
|
||||
|
||||
@ -198,6 +198,7 @@ impl super::Adapter {
|
||||
max_texture_dimension_3d,
|
||||
max_texture_array_layers: max_texture_dimension_3d,
|
||||
max_bind_groups: u32::MAX,
|
||||
max_bindings_per_bind_group: 65535,
|
||||
max_dynamic_uniform_buffers_per_pipeline_layout: max_constant_buffers,
|
||||
max_dynamic_storage_buffers_per_pipeline_layout: 0,
|
||||
max_sampled_textures_per_shader_stage: max_sampled_textures,
|
||||
|
||||
@ -248,6 +248,7 @@ impl super::Adapter {
|
||||
max_texture_dimension_3d: d3d12::D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION,
|
||||
max_texture_array_layers: d3d12::D3D12_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION,
|
||||
max_bind_groups: crate::MAX_BIND_GROUPS as u32,
|
||||
max_bindings_per_bind_group: 65535,
|
||||
// dynamic offsets take a root constant, so we expose the minimum here
|
||||
max_dynamic_uniform_buffers_per_pipeline_layout: base
|
||||
.max_dynamic_uniform_buffers_per_pipeline_layout,
|
||||
|
||||
@ -443,6 +443,7 @@ impl super::Adapter {
|
||||
max_texture_dimension_3d: max_texture_3d_size,
|
||||
max_texture_array_layers: gl.get_parameter_i32(glow::MAX_ARRAY_TEXTURE_LAYERS) as u32,
|
||||
max_bind_groups: crate::MAX_BIND_GROUPS as u32,
|
||||
max_bindings_per_bind_group: 65535,
|
||||
max_dynamic_uniform_buffers_per_pipeline_layout: max_uniform_buffers_per_shader_stage,
|
||||
max_dynamic_storage_buffers_per_pipeline_layout: max_storage_buffers_per_shader_stage,
|
||||
max_sampled_textures_per_shader_stage: super::MAX_TEXTURE_SLOTS as u32,
|
||||
|
||||
@ -832,6 +832,7 @@ impl super::PrivateCapabilities {
|
||||
max_texture_dimension_3d: self.max_texture_3d_size as u32,
|
||||
max_texture_array_layers: self.max_texture_layers as u32,
|
||||
max_bind_groups: 8,
|
||||
max_bindings_per_bind_group: 65535,
|
||||
max_dynamic_uniform_buffers_per_pipeline_layout: base
|
||||
.max_dynamic_uniform_buffers_per_pipeline_layout,
|
||||
max_dynamic_storage_buffers_per_pipeline_layout: base
|
||||
|
||||
@ -693,6 +693,7 @@ impl PhysicalDeviceCapabilities {
|
||||
max_bind_groups: limits
|
||||
.max_bound_descriptor_sets
|
||||
.min(crate::MAX_BIND_GROUPS as u32),
|
||||
max_bindings_per_bind_group: 640,
|
||||
max_dynamic_uniform_buffers_per_pipeline_layout: limits
|
||||
.max_descriptor_set_uniform_buffers_dynamic,
|
||||
max_dynamic_storage_buffers_per_pipeline_layout: limits
|
||||
|
||||
@ -159,6 +159,7 @@ mod inner {
|
||||
max_texture_dimension_3d,
|
||||
max_texture_array_layers,
|
||||
max_bind_groups,
|
||||
max_bindings_per_bind_group,
|
||||
max_dynamic_uniform_buffers_per_pipeline_layout,
|
||||
max_dynamic_storage_buffers_per_pipeline_layout,
|
||||
max_sampled_textures_per_shader_stage,
|
||||
@ -188,6 +189,7 @@ mod inner {
|
||||
println!("\t\t Max Texture Dimension 3d: {}", max_texture_dimension_3d);
|
||||
println!("\t\t Max Texture Array Layers: {}", max_texture_array_layers);
|
||||
println!("\t\t Max Bind Groups: {}", max_bind_groups);
|
||||
println!("\t\t Max Bindings Per Bind Group: {}", max_bindings_per_bind_group);
|
||||
println!("\t\t Max Dynamic Uniform Buffers Per Pipeline Layout: {}", max_dynamic_uniform_buffers_per_pipeline_layout);
|
||||
println!("\t\t Max Dynamic Storage Buffers Per Pipeline Layout: {}", max_dynamic_storage_buffers_per_pipeline_layout);
|
||||
println!("\t\t Max Sampled Textures Per Shader Stage: {}", max_sampled_textures_per_shader_stage);
|
||||
|
||||
@ -711,6 +711,8 @@ pub struct Limits {
|
||||
pub max_texture_array_layers: u32,
|
||||
/// Amount of bind groups that can be attached to a pipeline at the same time. Defaults to 4. Higher is "better".
|
||||
pub max_bind_groups: u32,
|
||||
/// Maximum binding index allowed in `create_bind_group_layout`. Defaults to 640.
|
||||
pub max_bindings_per_bind_group: u32,
|
||||
/// Amount of uniform buffer bindings that can be dynamic in a single pipeline. Defaults to 8. Higher is "better".
|
||||
pub max_dynamic_uniform_buffers_per_pipeline_layout: u32,
|
||||
/// Amount of storage buffer bindings that can be dynamic in a single pipeline. Defaults to 4. Higher is "better".
|
||||
@ -793,6 +795,7 @@ impl Default for Limits {
|
||||
max_texture_dimension_3d: 2048,
|
||||
max_texture_array_layers: 256,
|
||||
max_bind_groups: 4,
|
||||
max_bindings_per_bind_group: 640,
|
||||
max_dynamic_uniform_buffers_per_pipeline_layout: 8,
|
||||
max_dynamic_storage_buffers_per_pipeline_layout: 4,
|
||||
max_sampled_textures_per_shader_stage: 16,
|
||||
@ -829,6 +832,7 @@ impl Limits {
|
||||
max_texture_dimension_3d: 256,
|
||||
max_texture_array_layers: 256,
|
||||
max_bind_groups: 4,
|
||||
max_bindings_per_bind_group: 640,
|
||||
max_dynamic_uniform_buffers_per_pipeline_layout: 8,
|
||||
max_dynamic_storage_buffers_per_pipeline_layout: 4,
|
||||
max_sampled_textures_per_shader_stage: 16,
|
||||
|
||||
@ -1191,6 +1191,7 @@ impl crate::Context for Context {
|
||||
max_texture_dimension_3d: limits.max_texture_dimension_3d(),
|
||||
max_texture_array_layers: limits.max_texture_array_layers(),
|
||||
max_bind_groups: limits.max_bind_groups(),
|
||||
max_bindings_per_bind_group: limits.max_bindings_per_bind_group(),
|
||||
max_dynamic_uniform_buffers_per_pipeline_layout: limits
|
||||
.max_dynamic_uniform_buffers_per_pipeline_layout(),
|
||||
max_dynamic_storage_buffers_per_pipeline_layout: limits
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user