GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — WebGPU surface creation / basic app lifecycle by tychedelia · Pull Request #1302 · processing/processing4

Conversation

@tychedelia

@tychedelia tychedelia commented Oct 22, 2025

Copy link
Copy Markdown
Member

Implements the basic rendering lifecycle needed to drive bevy forward from the processing event loop.

When a PSurfaceGLFW is created, we pass the window handle over ffi and import it into bevy. Bevy then will create the underlying wgpu surface via its ordinary operations for windows. The Window here we insert is a non-functional facade -- we'll make sure to synchronize it from the Java side but have no need atm to allow bi-directional communication (i.e. bevy resizes Glfw).

There's some additional work we'll need to do to think about multi-window support. Right now we're driving the wgpu renderer forward in endDraw on PGraphicsWebGPU but this may not be correct in the presence of multiple graphics contexts.

Basically, for implementing the main processing api, what we'll want to do is run all the user's functions to build up a frame's worth of abstract draw data on the Rust side (i.e. insert stuff into the ECS world as needed) and then run update once at the end of frame which will drive the world forward one tick and present to the surface.

GLFW + AWT = :(

GLFW does not play nice with AWT, especially on macOS where we have the requirement to run on the main thread. This is well documented including in this repo and will be an issue long term. Right now, I've chosen to just hard code disabling AWT when launching a sketch, but we'll need a more comprehensive solution here eventually.

How to test

Right now, I've only added support for macOS because I don't have my other machines to test on. But if you have a mac it should be pretty easy, just add a basic bevy scene to the app init. The next PR should implement our first basic actual rendering to test from Java.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Stefterv reacted with hooray emoji
All reactions
  • 🎉 1 reaction
tychedelia added 2 commits October 22, 2025 18:18
@tychedelia
Basic app lifecycle / surface creation.
bc5a524
@tychedelia
Throw when not on macos.
fa83874
tychedelia
tychedelia commented Oct 22, 2025
View reviewed changes
Comment thread core/src/processing/webgpu/PSurfaceGLFW.java
if (Platform.get() == Platform.MACOSX) {
return GLFWNativeCocoa.glfwGetCocoaWindow(window);
} else {
throw new UnsupportedOperationException("Window handle retrieval not implemented for this platform");

@tychedelia tychedelia Oct 22, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@catilac We'll need to add wayland/x11 detection here for linux. Window I think should be pretty easy I just can't test right now.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@catilac catilac Oct 24, 2025

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I'll get it going on wayland!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
catilac
catilac reviewed Oct 24, 2025
View reviewed changes

@catilac catilac left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Amazing! Merge when ready. I'll get started on wayland support since I'm running it.
Also I'm seeing how this lib can be consumed by other languages like C or python

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread libProcessing/ffi/src/error.rs
F: FnOnce() -> Result<T, ProcessingError> + panic::UnwindSafe,
{
// we'll catch panics here to prevent unwinding across the FFI boundary
panic::catch_unwind(|| match f() {

@catilac catilac Oct 24, 2025

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

ooh good catch. i'll be sure to pay attention to this

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread libProcessing/renderer/Cargo.toml
tracing = "0.1"
tracing-subscriber = "0.3"
bevy = { version = "0.16", no-default-features = true, features = [
bevy = { version = "0.17", no-default-features = true, features = [

@catilac catilac Oct 24, 2025

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

YAY

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread libProcessing/renderer/Cargo.toml
] }
thiserror = "2" No newline at end of file
thiserror = "2"
raw-window-handle = "0.6"

@catilac catilac Oct 24, 2025

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

is this a library to help us manage a raw window handle to pass into JVM world?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tychedelia tychedelia Oct 27, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

yes! it's what's used by wgpu internally

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tychedelia
tychedelia merged commit 2232a0d into processing:the-wgpu-moment Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@catilac catilac catilac left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@tychedelia @catilac
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.