Skip to content

Make output buffer copying optional#423

Merged
mkeeter merged 2 commits into
mainfrom
optional-output-buffer
Jun 13, 2026
Merged

Make output buffer copying optional#423
mkeeter merged 2 commits into
mainfrom
optional-output-buffer

Conversation

@mkeeter

@mkeeter mkeeter commented Jun 13, 2026

Copy link
Copy Markdown
Owner

This allows us to more tightly integrate with complex GPU pipelines.

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.

Pull request overview

This PR refactors the fidget-wgpu voxel rendering API to make the GPU→CPU readback/copy step optional, enabling tighter integration with GPU-only pipelines by allowing callers to skip producing a mapped CPU buffer.

Changes:

  • Split “render buffers” from “readback buffers” by introducing ImageReadBuffer and adding Context::image_buffer(&Buffers).
  • Update Context::{run, run_with_vars, run_async, submit, map_image} to take &Buffers plus an explicit &mut ImageReadBuffer (or Option<&mut ImageReadBuffer> for submit*), so output copying can be omitted.
  • Adjust buffer sizing checks in GenericFlexBuffer and update tests/demo CLI to the new calling pattern.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
fidget/tests/voxel_render.rs Updates voxel rendering tests to use Buffers + ImageReadBuffer.
fidget-wgpu/src/voxel.rs Introduces ImageReadBuffer, makes submit/readback optional, and updates mapping/readback flow.
fidget-wgpu/src/lib.rs Refactors GenericFlexBuffer size checking to validate from item counts consistently.
demos/cli/src/main.rs Updates CLI demo to use submit(..., Some(&mut out), ...) and map from ImageReadBuffer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread fidget-wgpu/src/voxel.rs Outdated
Comment thread fidget-wgpu/src/voxel.rs Outdated
Comment thread fidget-wgpu/src/voxel.rs Outdated
Comment thread fidget-wgpu/src/voxel.rs
@mkeeter mkeeter merged commit e2d37d3 into main Jun 13, 2026
14 checks passed
@mkeeter mkeeter deleted the optional-output-buffer branch June 13, 2026 15:03
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