Skip to content

Commit

Permalink
force wgpu core adapater to report min_uniform_buffer_offset_alignmen…
Browse files Browse the repository at this point in the history
…t/min_storage_buffer_offset_alignment of at least 32
  • Loading branch information
Wumpf committed Dec 17, 2022
1 parent 7539be9 commit b787007
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion wgpu-core/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,19 @@ pub struct Adapter<A: hal::Api> {
}

impl<A: HalApi> Adapter<A> {
fn new(raw: hal::ExposedAdapter<A>) -> Self {
fn new(mut raw: hal::ExposedAdapter<A>) -> Self {
// WebGPU requires this offset alignment as lower bound on all adapters.
const MIN_BUFFER_OFFSET_ALIGNMENT_LOWER_BOUND: u32 = 32;

let limits = &mut raw.capabilities.limits;

limits.min_uniform_buffer_offset_alignment = limits
.min_uniform_buffer_offset_alignment
.min(MIN_BUFFER_OFFSET_ALIGNMENT_LOWER_BOUND);
limits.min_storage_buffer_offset_alignment = limits
.min_storage_buffer_offset_alignment
.min(MIN_BUFFER_OFFSET_ALIGNMENT_LOWER_BOUND);

Self {
raw,
life_guard: LifeGuard::new("<Adapter>"),
Expand Down

0 comments on commit b787007

Please sign in to comment.