Skip to content

Implement wgpu-sync#4317

Open
timon-schelling wants to merge 1 commit into
masterfrom
wgpu-sync
Open

Implement wgpu-sync#4317
timon-schelling wants to merge 1 commit into
masterfrom
wgpu-sync

Conversation

@timon-schelling

Copy link
Copy Markdown
Member

No description provided.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 issues found across 12 files

Confidence score: 3/5

  • In libraries/wgpu-sync/src/lib.rs, Surface::get_current_texture relies on a debug_assert! for the Queue/Instance invariant, so release builds can proceed with an unsynchronized Surface when a Queue from a different Instance is 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 uses expect(), 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

Comment thread libraries/wgpu-sync/src/lib.rs
Comment thread desktop/src/window.rs
Comment thread node-graph/libraries/canvas-utils/src/wasm.rs
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

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.

1 participant