Struct rerun::external::eframe::egui_wgpu::wgpu::Limits

source ·
#[repr(C)]
pub struct Limits {
Show 30 fields pub max_texture_dimension_1d: u32, pub max_texture_dimension_2d: u32, pub max_texture_dimension_3d: u32, pub max_texture_array_layers: u32, pub max_bind_groups: u32, pub max_bindings_per_bind_group: u32, pub max_dynamic_uniform_buffers_per_pipeline_layout: u32, pub max_dynamic_storage_buffers_per_pipeline_layout: u32, pub max_sampled_textures_per_shader_stage: u32, pub max_samplers_per_shader_stage: u32, pub max_storage_buffers_per_shader_stage: u32, pub max_storage_textures_per_shader_stage: u32, pub max_uniform_buffers_per_shader_stage: u32, pub max_uniform_buffer_binding_size: u32, pub max_storage_buffer_binding_size: u32, pub max_vertex_buffers: u32, pub max_buffer_size: u64, pub max_vertex_attributes: u32, pub max_vertex_buffer_array_stride: u32, pub min_uniform_buffer_offset_alignment: u32, pub min_storage_buffer_offset_alignment: u32, pub max_inter_stage_shader_components: u32, pub max_compute_workgroup_storage_size: u32, pub max_compute_invocations_per_workgroup: u32, pub max_compute_workgroup_size_x: u32, pub max_compute_workgroup_size_y: u32, pub max_compute_workgroup_size_z: u32, pub max_compute_workgroups_per_dimension: u32, pub max_push_constant_size: u32, pub max_non_sampler_bindings: u32,
}
Expand description

Represents the sets of limits an adapter/device supports.

We provide three different defaults.

  • Limits::downlevel_defaults(). This is a set of limits that is guaranteed to work on almost all backends, including “downlevel” backends such as OpenGL and D3D11, other than WebGL. For most applications we recommend using these limits, assuming they are high enough for your application, and you do not intent to support WebGL.
  • Limits::downlevel_webgl2_defaults() This is a set of limits that is lower even than the downlevel_defaults(), configured to be low enough to support running in the browser using WebGL2.
  • Limits::default(). This is the set of limits that is guaranteed to work on all modern backends and is guaranteed to be supported by WebGPU. Applications needing more modern features can use this as a reasonable set of limits if they are targeting only desktop and modern mobile devices.

We recommend starting with the most restrictive limits you can and manually increasing the limits you need boosted. This will let you stay running on all hardware that supports the limits you need.

Limits “better” than the default must be supported by the adapter and requested when requesting a device. If limits “better” than the adapter supports are requested, requesting a device will panic. Once a device is requested, you may only use resources up to the limits requested even if the adapter supports “better” limits.

Requesting limits that are “better” than you need may cause performance to decrease because the implementation needs to support more than is needed. You should ideally only request exactly what you need.

Corresponds to WebGPU GPUSupportedLimits.

Fields§

§max_texture_dimension_1d: u32

Maximum allowed value for the size.width of a texture created with TextureDimension::D1. Defaults to 8192. Higher is “better”.

§max_texture_dimension_2d: u32

Maximum allowed value for the size.width and size.height of a texture created with TextureDimension::D2. Defaults to 8192. Higher is “better”.

§max_texture_dimension_3d: u32

Maximum allowed value for the size.width, size.height, and size.depth_or_array_layers of a texture created with TextureDimension::D3. Defaults to 2048. Higher is “better”.

§max_texture_array_layers: u32

Maximum allowed value for the size.depth_or_array_layers of a texture created with TextureDimension::D2. Defaults to 256. Higher is “better”.

§max_bind_groups: u32

Amount of bind groups that can be attached to a pipeline at the same time. Defaults to 4. Higher is “better”.

§max_bindings_per_bind_group: u32

Maximum binding index allowed in create_bind_group_layout. Defaults to 1000. Higher is “better”.

§max_dynamic_uniform_buffers_per_pipeline_layout: u32

Amount of uniform buffer bindings that can be dynamic in a single pipeline. Defaults to 8. Higher is “better”.

§max_dynamic_storage_buffers_per_pipeline_layout: u32

Amount of storage buffer bindings that can be dynamic in a single pipeline. Defaults to 4. Higher is “better”.

§max_sampled_textures_per_shader_stage: u32

Amount of sampled textures visible in a single shader stage. Defaults to 16. Higher is “better”.

§max_samplers_per_shader_stage: u32

Amount of samplers visible in a single shader stage. Defaults to 16. Higher is “better”.

§max_storage_buffers_per_shader_stage: u32

Amount of storage buffers visible in a single shader stage. Defaults to 8. Higher is “better”.

§max_storage_textures_per_shader_stage: u32

Amount of storage textures visible in a single shader stage. Defaults to 4. Higher is “better”.

§max_uniform_buffers_per_shader_stage: u32

Amount of uniform buffers visible in a single shader stage. Defaults to 12. Higher is “better”.

§max_uniform_buffer_binding_size: u32

Maximum size in bytes of a binding to a uniform buffer. Defaults to 64 KiB. Higher is “better”.

§max_storage_buffer_binding_size: u32

Maximum size in bytes of a binding to a storage buffer. Defaults to 128 MiB. Higher is “better”.

§max_vertex_buffers: u32

Maximum length of VertexState::buffers when creating a RenderPipeline. Defaults to 8. Higher is “better”.

§max_buffer_size: u64

A limit above which buffer allocations are guaranteed to fail. Defaults to 256 MiB. Higher is “better”.

Buffer allocations below the maximum buffer size may not succeed depending on available memory, fragmentation and other factors.

§max_vertex_attributes: u32

Maximum length of VertexBufferLayout::attributes, summed over all VertexState::buffers, when creating a RenderPipeline. Defaults to 16. Higher is “better”.

§max_vertex_buffer_array_stride: u32

Maximum value for VertexBufferLayout::array_stride when creating a RenderPipeline. Defaults to 2048. Higher is “better”.

§min_uniform_buffer_offset_alignment: u32

Required BufferBindingType::Uniform alignment for BufferBinding::offset when creating a BindGroup, or for set_bind_group dynamicOffsets. Defaults to 256. Lower is “better”.

§min_storage_buffer_offset_alignment: u32

Required BufferBindingType::Storage alignment for BufferBinding::offset when creating a BindGroup, or for set_bind_group dynamicOffsets. Defaults to 256. Lower is “better”.

§max_inter_stage_shader_components: u32

Maximum allowed number of components (scalars) of input or output locations for inter-stage communication (vertex outputs to fragment inputs). Defaults to 60. Higher is “better”.

§max_compute_workgroup_storage_size: u32

Maximum number of bytes used for workgroup memory in a compute entry point. Defaults to 16352. Higher is “better”.

§max_compute_invocations_per_workgroup: u32

Maximum value of the product of the workgroup_size dimensions for a compute entry-point. Defaults to 256. Higher is “better”.

§max_compute_workgroup_size_x: u32

The maximum value of the workgroup_size X dimension for a compute stage ShaderModule entry-point. Defaults to 256. Higher is “better”.

§max_compute_workgroup_size_y: u32

The maximum value of the workgroup_size Y dimension for a compute stage ShaderModule entry-point. Defaults to 256. Higher is “better”.

§max_compute_workgroup_size_z: u32

The maximum value of the workgroup_size Z dimension for a compute stage ShaderModule entry-point. Defaults to 64. Higher is “better”.

§max_compute_workgroups_per_dimension: u32

The maximum value for each dimension of a ComputePass::dispatch(x, y, z) operation. Defaults to 65535. Higher is “better”.

§max_push_constant_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.

Expect the size to be:

  • Vulkan: 128-256 bytes
  • DX12: 256 bytes
  • Metal: 4096 bytes
  • OpenGL doesn’t natively support push constants, and are emulated with uniforms, so this number is less useful but likely 256.
§max_non_sampler_bindings: u32

Maximum number of live non-sampler bindings.

This limit only affects the d3d12 backend. Using a large number will allow the device to create many bind groups at the cost of a large up-front allocation at device creation.

Implementations§

source§

impl Limits

source

pub fn downlevel_defaults() -> 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 *):

assert_eq!(Limits::downlevel_defaults(), 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, // * (16 KiB)
    max_storage_buffer_binding_size: 128 << 20, // (128 MiB)
    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_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, // (256 MiB)
    max_non_sampler_bindings: 1_000_000,
});
source

pub fn downlevel_webgl2_defaults() -> Limits

These default limits are guaranteed to be compatible with GLES-3.0, and D3D11, and WebGL2

Those limits are as follows (different from downlevel_defaults are marked with +, *’s from downlevel_defaults shown as well.):

assert_eq!(Limits::downlevel_webgl2_defaults(), 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: 0, // +
    max_sampled_textures_per_shader_stage: 16,
    max_samplers_per_shader_stage: 16,
    max_storage_buffers_per_shader_stage: 0, // * +
    max_storage_textures_per_shader_stage: 0, // +
    max_uniform_buffers_per_shader_stage: 11, // +
    max_uniform_buffer_binding_size: 16 << 10, // * (16 KiB)
    max_storage_buffer_binding_size: 0, // * +
    max_vertex_buffers: 8,
    max_vertex_attributes: 16,
    max_vertex_buffer_array_stride: 255, // +
    max_push_constant_size: 0,
    min_uniform_buffer_offset_alignment: 256,
    min_storage_buffer_offset_alignment: 256,
    max_inter_stage_shader_components: 31,
    max_compute_workgroup_storage_size: 0, // +
    max_compute_invocations_per_workgroup: 0, // +
    max_compute_workgroup_size_x: 0, // +
    max_compute_workgroup_size_y: 0, // +
    max_compute_workgroup_size_z: 0, // +
    max_compute_workgroups_per_dimension: 0, // +
    max_buffer_size: 256 << 20, // (256 MiB),
    max_non_sampler_bindings: 1_000_000,
});
source

pub fn using_resolution(self, other: Limits) -> Limits

Modify the current limits to use the resolution limits of the other.

This is useful because the swapchain might need to be larger than any other image in the application.

If your application only needs 512x512, you might be running on a 4k display and need extremely high resolution limits.

source

pub fn using_alignment(self, other: Limits) -> Limits

Modify the current limits to use the buffer alignment limits of the adapter.

This is useful for when you’d like to dynamically use the “best” supported buffer alignments.

source

pub fn check_limits(&self, allowed: &Limits) -> bool

Compares every limits within self is within the limits given in allowed.

If you need detailed information on failures, look at Limits::check_limits_with_fail_fn.

source

pub fn check_limits_with_fail_fn( &self, allowed: &Limits, fatal: bool, fail_fn: impl FnMut(&'static str, u64, u64) )

Compares every limits within self is within the limits given in allowed. For an easy to use binary choice, use Limits::check_limits.

If a value is not within the allowed limit, this function calls the fail_fn with the:

  • limit name
  • self’s limit
  • allowed’s limit.

If fatal is true, a single failure bails out the comparison after a single failure.

Trait Implementations§

source§

impl Clone for Limits

source§

fn clone(&self) -> Limits

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Limits

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for Limits

source§

fn default() -> Limits

Returns the “default value” for a type. Read more
source§

impl Hash for Limits

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Limits

source§

fn eq(&self, other: &Limits) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Limits

source§

impl StructuralPartialEq for Limits

Auto Trait Implementations§

§

impl Freeze for Limits

§

impl RefUnwindSafe for Limits

§

impl Send for Limits

§

impl Sync for Limits

§

impl Unpin for Limits

§

impl UnwindSafe for Limits

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
source§

impl<T> Downcast<T> for T

source§

fn downcast(&self) -> &T

source§

impl<T> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

source§

fn lossy_into(self) -> Dst

Performs the conversion.
source§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

source§

fn null_value() -> T

The none-equivalent value.
source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> Upcast<T> for T

source§

fn upcast(&self) -> Option<&T>

source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSendSync for T

source§

impl<T> WasmNotSync for T
where T: Sync,