Skip to content

Clean up image size tracking and buffers - #465

Merged
mkeeter merged 2 commits into
mainfrom
wgpu-depth-image-buffer
Aug 30, 2026
Merged

Clean up image size tracking and buffers#465
mkeeter merged 2 commits into
mainfrom
wgpu-depth-image-buffer

Conversation

@mkeeter

@mkeeter mkeeter commented Aug 30, 2026

Copy link
Copy Markdown
Owner
  • Add dedicated DepthImageBuffer to avoid tracking depth separately (it still only contains width * height items)
  • Removed size argument from many buffer construction functions, because we always resize them when they're used

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There is a confirmed state bug in submit_merge (stale image_count on empty input) plus a misleading depth-omitting size mismatch error message that should be corrected.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR simplifies GPU image-buffer sizing in the WGPU voxel pipeline by introducing a depth-aware buffer type (DepthImageBuffer) and removing explicit size parameters from several effect buffer constructors, relying on automatic resizing at submission time.

Changes:

  • Added DepthImageBuffer (a GenericFlexBuffer sized by VoxelSize) to preserve depth metadata without separately tracking it.
  • Updated voxel/effects buffer APIs (merge_buffers, shade_buffers, ssao_buffers) to be constructed without an explicit size and resized on first use.
  • Generalized Gpu::read_buffer_for to accept any GenericFlexBuffer whose size can convert into ImageSize.
File summaries
File Description
fidget-wgpu/src/voxel/mod.rs Switches voxel geometry storage to DepthImageBuffer and updates related sizing/growth logic and tests.
fidget-wgpu/src/voxel/effects/mod.rs Converts merge/shade outputs to depth-aware buffers and removes size args from buffer constructors.
fidget-wgpu/src/lib.rs Generalizes read_buffer_for to work with depth-aware buffers via Into<ImageSize>.
fidget-wgpu/src/buf.rs Introduces DepthImageBuffer alias and implements BufferItemCount for VoxelSize.
demos/cli/src/main.rs Updates CLI usage to new no-size buffer constructors.
CHANGELOG.md Documents the API changes and the new DepthImageBuffer type.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread fidget-wgpu/src/voxel/effects/mod.rs
Comment thread fidget-wgpu/src/voxel/effects/mod.rs
Comment thread fidget-wgpu/src/voxel/effects/mod.rs
@mkeeter
mkeeter merged commit f8f623b into main Aug 30, 2026
14 checks passed
@mkeeter
mkeeter deleted the wgpu-depth-image-buffer branch August 30, 2026 15:27
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.

2 participants