Skip to content

Reliably clear to default clear color#137

Open
tychedelia wants to merge 4 commits intoprocessing:mainfrom
tychedelia:bugfix/134-bg-color
Open

Reliably clear to default clear color#137
tychedelia wants to merge 4 commits intoprocessing:mainfrom
tychedelia:bugfix/134-bg-color

Conversation

@tychedelia
Copy link
Copy Markdown
Member

Fixes #134

Metal on wgpu seems to reliably have issues with persisting the first render pass on a texture. We have a workaround here to ensure that we do some work on the texture before our "real" frame 0, which is typically the user's setup function.

@tychedelia tychedelia requested a review from catilac April 25, 2026 01:14
/// This is necessary on some platforms (notably macOS) to avoid issues with the first few frames of
/// rendering being corrupted or not appearing at all.
///
// TODO: why is metal particularly affected by this? can we remove this?
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.

is there a bevy issue we can track related to this? if so can we ref the issue here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, although I was able to create a reproduction in Bevy. I should try to create a reproduction in raw wgpu to confirm. It's a bit tricky because our "sketch" requirements (i.e. load semantics on the color attachment plus first frame transient raster) are very unusual for graphical applications. I tried to dig into the xcode debugger but was having trouble reproducing under instrumentation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's also possible this is just a M1/M2 thing...

@catilac
Copy link
Copy Markdown
Contributor

catilac commented Apr 26, 2026

@SableRaf would you be able to test this on your machine by any chance?

@SableRaf
Copy link
Copy Markdown

SableRaf commented Apr 26, 2026

I'm testing on crates/processing_pyo3/examples/test.py and running into this:

    size(200, 200)
    ~~~~^^^^^^^^^^
RuntimeError: Graphics not found

Note: when doing the same test on the main branch, the sketch runs fine.

@tychedelia
Copy link
Copy Markdown
Member Author

Okay, I just pushed a few small changes that should remove that error and make this work reliably.

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.

Default background color is black instead of (204, 204, 204)

3 participants