mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Validate BindGroup based limits
This commit is contained in:
@@ -48,6 +48,8 @@ pub enum BindGroupError {
|
||||
/// The given sampler is/is not a comparison sampler,
|
||||
/// while the layout type indicates otherwise.
|
||||
WrongSamplerComparison,
|
||||
/// Uniform buffer binding range exceeds [`wgt::Limits::max_uniform_buffer_binding_size`] limit
|
||||
UniformBufferRangeTooLarge,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
||||
@@ -1589,6 +1589,12 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
None => (buffer.size - bb.offset, buffer.size),
|
||||
};
|
||||
|
||||
if pub_usage == wgt::BufferUsage::UNIFORM
|
||||
&& (device.limits.max_uniform_buffer_binding_size as u64) < bind_size
|
||||
{
|
||||
return Err(BindGroupError::UniformBufferRangeTooLarge);
|
||||
}
|
||||
|
||||
// Record binding info for validating dynamic offsets
|
||||
if dynamic {
|
||||
dynamic_binding_info.push(binding_model::BindGroupDynamicBindingData {
|
||||
|
||||
Reference in New Issue
Block a user