Implement wgpu-sync#4317
Open
timon-schelling wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
2 issues found across 12 files
Confidence score: 3/5
- In
libraries/wgpu-sync/src/lib.rs,Surface::get_current_texturerelies on adebug_assert!for the Queue/Instance invariant, so release builds can proceed with an unsynchronizedSurfacewhen aQueuefrom a differentInstanceis passed, risking rendering corruption or hard-to-debug runtime failures — enforce this check at runtime (and return an error) before merging. - In
desktop/src/window.rs, surface creation still usesexpect(), so an initialization failure will crash the app process instead of failing gracefully, which is user-visible even if this panic risk existed before — replace the panic path with propagated/handled errors prior to merge.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="desktop/src/window.rs">
<violation number="1" location="desktop/src/window.rs:91">
P2: Surface creation failure crashes the process via `expect()` instead of propagating the error or handling it gracefully. The previous `.unwrap()` was already a panic risk, and this change keeps the panicking behavior — the team convention prefers returning `Option`/`Result` or using early return/`continue` to avoid whole-application crashes even for invariant violations.</violation>
</file>
<file name="libraries/wgpu-sync/src/lib.rs">
<violation number="1" location="libraries/wgpu-sync/src/lib.rs:154">
P1: A `Surface` can still be used unsynchronized in release builds if `get_current_texture` is called with a `Queue` from a different `Instance`. The invariant is only enforced by `debug_assert!`, but the method then locks `queue.lock` rather than `self.lock`; in optimized builds the check disappears and `Surface::configure` can run concurrently with acquisition/presentation on a different lock. Consider making this invariant part of the API contract at runtime (for example by returning an error for mismatched locks or otherwise making mismatched surface/queue pairs unrepresentable) so the wrapper preserves its synchronization guarantee outside debug builds.
(Based on your team's feedback about avoiding panicking assertions in application code.) [FEEDBACK_USED]</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Contributor
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
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.
No description provided.