Clean up image size tracking and buffers - #465
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 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(aGenericFlexBuffersized byVoxelSize) 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_forto accept anyGenericFlexBufferwhose size can convert intoImageSize.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DepthImageBufferto avoid tracking depth separately (it still only containswidth * heightitems)