Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TrackedRenderPass::wgpu_pass may compromize invariants #13225

Closed
fintelia opened this issue May 4, 2024 · 1 comment · Fixed by #14948
Closed

TrackedRenderPass::wgpu_pass may compromize invariants #13225

fintelia opened this issue May 4, 2024 · 1 comment · Fixed by #14948
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Comments

@fintelia
Copy link
Contributor

fintelia commented May 4, 2024

Raising this as a issue as requested in #3595 (comment)...

The TrackedRenderPass type internally tracks which pipeline and bind group are active on a render pass. However, I think the wgpu_pass method may allow compromising its tracking:

tracked_render_pass.set_render_pipeline(&x); // Set render pipeline to "x"
tracked_render_pass.wgpu_pass().set_pipeline(&y); // Render pipeline is now "y"
tracked_render_pass.set_render_pipeline(&x); // No-op since tracked_render_pass thinks "x" is still active
@fintelia fintelia added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels May 4, 2024
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen S-Needs-Investigation This issue requires detective work to figure out what's going wrong and removed S-Needs-Triage This issue needs to be labelled labels May 13, 2024
@PPakalns
Copy link
Contributor

Had problem with this when trying to migrate plain wgpu project rendering gradually to bevy rendering approach.

When rendering something inside egui window using egui::PaintCallback , some views are rendered using native wgpu rendering libraries that use RenderPass instead of TrackedRenderPass. Due to this TrackedRenderPass doesn't work correctly after render implementation tries to restore bindings to previous ones after custom Paint callback.

If instead RenderPass is passed around:

  1. bevy does not reexport this type.
    wgpu re-exports are inconsistent and confusing #3823 .
  2. Additionally such approach doesn't play nicely with render phases.

@alice-i-cecile alice-i-cecile added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Needs-Investigation This issue requires detective work to figure out what's going wrong labels Aug 27, 2024
github-merge-queue bot pushed a commit that referenced this issue Sep 12, 2024
# Objective

Fixes #13225

## Solution

Invalidate `TrackedRenderPass` internal state upon accessing internal
`wgpu::RenderPass`.

## Testing

- Tested by calling `set_bind_group` on `RenderPass` returned by
`TrackedRenderPass::wgpu_pass` and checking if in later `set_bind_group`
calls on `TrackedRenderPass` correct bind group is restored.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants