mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Better error message for 16 byte alignment error (#3414)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com> Co-authored-by: gilescope <gilescope@gmail.com> Closes https://github.com/gfx-rs/wgpu/pull/3099 Closes https://github.com/gfx-rs/wgpu/issues/2832
This commit is contained in:
parent
5da2b8ad6b
commit
bb876f372a
@ -38,8 +38,6 @@ Bottom level categories:
|
||||
- Hal
|
||||
-->
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Major Changes
|
||||
|
||||
#### Backend selection by features
|
||||
@ -186,6 +184,7 @@ let texture = device.create_texture(&wgpu::TextureDescriptor {
|
||||
- Add validation in accordance with WebGPU `GPUSamplerDescriptor` valid usage for `lodMinClamp` and `lodMaxClamp`. By @James2022-rgb in [#3353](https://github.com/gfx-rs/wgpu/pull/3353)
|
||||
- Remove panics in `Deref` implementations for `QueueWriteBufferView` and `BufferViewMut`. Instead, warnings are logged, since reading from these types is not recommended. By @botahamec in [#3336]
|
||||
- Implement `view_formats` in TextureDescriptor to match the WebGPU spec. By @jinleili in [#3237](https://github.com/gfx-rs/wgpu/pull/3237)
|
||||
- Show more information in error message for non-aligned buffer bindings in WebGL [#3414](https://github.com/gfx-rs/wgpu/pull/3414)
|
||||
- Update `TextureView` validation according to the WebGPU spec. By @teoxoy in [#3410](https://github.com/gfx-rs/wgpu/pull/3410)
|
||||
|
||||
#### WebGPU
|
||||
@ -197,7 +196,7 @@ let texture = device.create_texture(&wgpu::TextureDescriptor {
|
||||
|
||||
- Browsers that support `OVR_multiview2` now report the `MULTIVIEW` feature by @expenses in [#3121](https://github.com/gfx-rs/wgpu/pull/3121).
|
||||
- `Limits::max_push_constant_size` on GLES is now 256 by @Dinnerbone in [#3374](https://github.com/gfx-rs/wgpu/pull/3374).
|
||||
- Creating multiple pipelines with the same shaders will now be faster, by @Dinnerbone in [#3380](https://github.com/gfx-rs/wgpu/pull/3380).
|
||||
- Creating multiple pipelines with the same shaders will now be faster, by @Dinnerbone in [#3380](https://github.com/gfx-rs/wgpu/pull/3380).
|
||||
|
||||
#### Vulkan
|
||||
|
||||
|
@ -2997,11 +2997,19 @@ impl<A: HalApi> Device<A> {
|
||||
self.require_features(wgt::Features::MULTIVIEW)?;
|
||||
}
|
||||
|
||||
for size in shader_binding_sizes.values() {
|
||||
if size.get() % 16 != 0 {
|
||||
self.require_downlevel_flags(
|
||||
wgt::DownlevelFlags::BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED,
|
||||
)?;
|
||||
if !self
|
||||
.downlevel
|
||||
.flags
|
||||
.contains(wgt::DownlevelFlags::BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED)
|
||||
{
|
||||
for (binding, size) in shader_binding_sizes.iter() {
|
||||
if size.get() % 16 != 0 {
|
||||
return Err(pipeline::CreateRenderPipelineError::UnalignedShader {
|
||||
binding: binding.binding,
|
||||
group: binding.group,
|
||||
size: size.get(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,6 +373,8 @@ pub enum CreateRenderPipelineError {
|
||||
stage: wgt::ShaderStages,
|
||||
error: String,
|
||||
},
|
||||
#[error("In the provided shader, the type given for group {group} binding {binding} has a size of {size}. As the device does not support `DownlevelFlags::BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED`, the type must have a size that is a multiple of 16 bytes.")]
|
||||
UnalignedShader { group: u32, binding: u32, size: u64 },
|
||||
}
|
||||
|
||||
bitflags::bitflags! {
|
||||
|
Loading…
Reference in New Issue
Block a user