Skip to content

fix: dynamic uniform/storage buffer offsets (#343) - #348

Merged
kolkov merged 1 commit into
mainfrom
fix/dynamic-ubo-343
Sep 2, 2026
Merged

fix: dynamic uniform/storage buffer offsets (#343)#348
kolkov merged 1 commit into
mainfrom
fix/dynamic-ubo-343

Conversation

@kolkov

@kolkov kolkov commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Dynamic uniform/storage buffer offsets silently ignored on Vulkan and Software backends.

Root Cause

bufferBindingTypeToVk() always returned static descriptor types, ignoring HasDynamicOffset. Vulkan driver silently ignored dynamic offsets when layout is static.

Fixed

  • Vulkan: VK_DESCRIPTOR_TYPE_*_BUFFER_DYNAMIC when HasDynamicOffset true. DescriptorCounts + pool sizes updated. Matches Rust wgpu-hal conv.rs:834-858.
  • Software: buildExecutionContext() checks HasDynamicOffset per-binding before consuming offset.
  • DX12: Documented as TODO — requires root CBV descriptor architecture.
  • GLES + Metal: Already correct (unchanged).

Fixes #343

Test plan

  • Build: Windows + Linux
  • Tests: 19/19 pass
  • Lint: 0 issues
  • Vulkan convert_test: 7 cases (was 4), covers dynamic variants

Vulkan: bufferBindingTypeToVk() now returns VK_DESCRIPTOR_TYPE_*_DYNAMIC
when HasDynamicOffset is true. DescriptorCounts tracks dynamic counts
separately. Descriptor pool includes dynamic pool sizes. Matches Rust
wgpu-hal conv.rs:834-858.

Software: buildExecutionContext() checks HasDynamicOffset per-binding
before consuming from dynamic offsets array. BindGroupLayout stores
entries for HasDynamicOffset lookup.

DX12: documented as TODO — requires root CBV descriptor architecture
(Rust wgpu-hal dx12/command.rs:1175-1236).

GLES + Metal already correct (unchanged).

Fixes #343
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kolkov
kolkov merged commit f3d29fc into main Sep 2, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[hal/vulkan] Dynamic uniform buffer offsets ignored because CreateBindGroupLayout creates static VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER

1 participant