René's URL Explorer Experiment


Title: Implement basic rendering flow by tychedelia · Pull Request #1322 · processing/processing4 · GitHub

Open Graph Title: Implement basic rendering flow by tychedelia · Pull Request #1322 · processing/processing4

X Title: Implement basic rendering flow by tychedelia · Pull Request #1322 · processing/processing4

Description: Rendering Closes #1271 Processing has a rendering lifecycle for each PGraphics instance: beginDraw: called at beginning of frame or manually by the user to initialize the drawing state for a given surface. For us, this doesn't do much at the moment. flush: this lifecyle hook was added for OpenGL in order to flush accumulated state to the gpu. We'll use this similarly to render the currently accumulated draw state. TBD if the appropriate flushes are added everywhere we need them relative to what OpenGL does. endDraw: called at the end of frame or manually by the user to write to the surface/render target. Bevy's rendering loop Bevy uses pipelined rendering. Specifically, there is an ECS "main" world and "render" world that run on separate timelines. We've currently disabled ECS multi-threading to ensure comparability, which means that the render world schedule runs after the main world serially, but conceptually they should be understood as independent. This isn't relevant for reviewing this PR but is an important implementation detail to know in general. A Camera in Bevy represents a coarse grained unit of rendering work tied to an output render target. In other words, Camera == PGraphics and RenderTarget == PSurface for our concerns. Bevy really want to batch, both cameras and render state internal to cameras (i.e. opaque render items). On the contrary, processing really wants to force immediate mode. In Bevy, every camera renders to a ViewTarget, which is an intermediate texture that accumulates rendering state while walking the render graph. At the end of the render graph, that texture is blitted to the RenderTarget which will be presented at the end of the frame. This is important for understanding how clear state and ClearColorConfig works.... The clear_color field on Camera controls the clear for the internal rendering texture. Right now we are setting this with background color, but it should basically always be load in order to preserve the sketch across flushes. The output_mode field contains CameraOutputMode, which controls whether that internal texture is written to the render target at the end of the processing the camera. For us, we only want to set CameraOutputMode::Write on endDraw, which means we set Skip by default to preserve immediate mode semantics. Bridging immediate mode and batching This PR faithfully implements the processing lifecycle, which requires a bit of juggling to ensure that we are only ever processing one Camera at a time. This will be important for preserving backwards compatibility with #1320, although we may be able to do additional optimization in the future. Every time the user calls a processing API that needs to update the draw state, we record a DrawCommand that is stored in a buffer on the surface (typically the Window entity, this PR does not yet support off-screen rendering). At the start of every App update, we ensure that all cameras are disabled by setting active = false, this ensures that regardless of the configured output_mode, that camera will not be processed for rendering. In Bevy terms, this guarantees the camera is not extracted to the render world. When flush is called, we insert a market component Flushing on the surface that we intend to flush. First, we clear any previous meshes associated with this surface. Then, we ensure the camera is set to active and thus we process only that camera. We then drain the command buffer for that camera and render into a new set of meshes. We are using the lyon library to handle tessellation. See that libraries docs to understand how it works. We currently implement some very simple batching logic meant to preserve the painter's algo used by Processing. Basically, we'll continue rendering into what I affectionately call a "mega mesh" that contains all the primitives (i.e. vertex data) for items that share the same material state. In this way, vertex order preserves the imperative draw order. We also apply a small z offset to ensure that when breaking up batches, we still draw in the correct order. Right now, we don't really support much material configuration besides setting the alpha mode. This may change in the future when we enable users to write their own materials. Entity hierarchy We're currently using the following entity hierarchy to help keep track of state per surface: (Window, CommandBuffer): This is our "root" entity and the entity id that the Java side stores. Camera: The camera configured for this surface which points to the surface as render target. This is what "sees" everything that we render for a given PGraphics as controlled by the RenderLayers we insert on both camera and mesh. TransientMesh these (potentially multiple children) are meshes that we render into for this PGraphics. Right now we clear them at the beginning of each draw cycle. Testing You can run the new WebGPU.java example to easily test. Minor changes Formatted all our rust files. Oops! We should probably add a CI hook for this. I use the following nightly options: imports_granularity and group_imports to make the imports clean. Renamed window to surface in most places. Technically in the future a surface may also be an off screen texture, so this is more accurate.

Open Graph Description: Rendering Closes #1271 Processing has a rendering lifecycle for each PGraphics instance: beginDraw: called at beginning of frame or manually by the user to initialize the drawing state for a given...

X Description: Rendering Closes #1271 Processing has a rendering lifecycle for each PGraphics instance: beginDraw: called at beginning of frame or manually by the user to initialize the drawing state for a given...

Opengraph URL: https://github.com/processing/processing4/pull/1322

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:097b4e5a-e4a5-af90-3b34-5148d33cabf4
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8E08:1C9D94:A5ECF60:DF4C9DB:6A5EAAF4
html-safe-nonce2c9a880cb747bc8575b67a3174eecbecc465a9d746bb22a987262d5803026837
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTA4OjFDOUQ5NDpBNUVDRjYwOkRGNEM5REI6NkE1RUFBRjQiLCJ2aXNpdG9yX2lkIjoiNjMxMzI1Mzg4ODUyNDcyNDk4MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacec10b506ee2653588a5d89fbd45201017f26df6548597c8a7c7a5611459f025f
hovercard-subject-tagpull_request:3000509970
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/processing/processing4/pull/1322/files
twitter:imagehttps://avatars.githubusercontent.com/u/10366310?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/10366310?s=400&v=4
og:image:altRendering Closes #1271 Processing has a rendering lifecycle for each PGraphics instance: beginDraw: called at beginning of frame or manually by the user to initialize the drawing state for a given...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None7c7e31acb6a895494e518b880f5ccf39604f7fa9a8f2f3c64145efc3b776256d
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/processing/processing4 git https://github.com/processing/processing4.git
octolytics-dimension-user_id1617169
octolytics-dimension-user_loginprocessing
octolytics-dimension-repository_id844382769
octolytics-dimension-repository_nwoprocessing/processing4
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id844382769
octolytics-dimension-repository_network_root_nwoprocessing/processing4
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2d2ac9bdd71d5f53f2b731c9330677e38624e301
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/processing/processing4/pull/1322/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fprocessing%2Fprocessing4%2Fpull%2F1322%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fprocessing%2Fprocessing4%2Fpull%2F1322%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=processing%2Fprocessing4
Reloadhttps://github.com/processing/processing4/pull/1322/files
Reloadhttps://github.com/processing/processing4/pull/1322/files
Reloadhttps://github.com/processing/processing4/pull/1322/files
Please reload this pagehttps://github.com/processing/processing4/pull/1322/files
processing https://github.com/processing
processing4https://github.com/processing/processing4
Please reload this pagehttps://github.com/processing/processing4/pull/1322/files
Notifications https://github.com/login?return_to=%2Fprocessing%2Fprocessing4
Fork 175 https://github.com/login?return_to=%2Fprocessing%2Fprocessing4
Star 442 https://github.com/login?return_to=%2Fprocessing%2Fprocessing4
Code https://github.com/processing/processing4
Issues 249 https://github.com/processing/processing4/issues
Pull requests 26 https://github.com/processing/processing4/pulls
Actions https://github.com/processing/processing4/actions
Projects https://github.com/processing/processing4/projects
Wiki https://github.com/processing/processing4/wiki
Security and quality 0 https://github.com/processing/processing4/security
Insights https://github.com/processing/processing4/pulse
Code https://github.com/processing/processing4
Issues https://github.com/processing/processing4/issues
Pull requests https://github.com/processing/processing4/pulls
Actions https://github.com/processing/processing4/actions
Projects https://github.com/processing/processing4/projects
Wiki https://github.com/processing/processing4/wiki
Security and quality https://github.com/processing/processing4/security
Insights https://github.com/processing/processing4/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fprocessing%2Fprocessing4%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fprocessing%2Fprocessing4%2Fissues%2Fnew%2Fchoose
catilachttps://github.com/catilac
processing:the-wgpu-momenthttps://github.com/processing/processing4/tree/the-wgpu-moment
tychedelia:1271-renderhttps://github.com/tychedelia/processing4/tree/1271-render
Conversation 3 https://github.com/processing/processing4/pull/1322
Commits 3 https://github.com/processing/processing4/pull/1322/commits
Checks 0 https://github.com/processing/processing4/pull/1322/checks
Files changed https://github.com/processing/processing4/pull/1322/files
Please reload this pagehttps://github.com/processing/processing4/pull/1322/files
Implement basic rendering flow https://github.com/processing/processing4/pull/1322/files#top
Show all changes 3 commits https://github.com/processing/processing4/pull/1322/files
c39fb34 Implement basic rendering flow tychedelia Nov 5, 2025 https://github.com/processing/processing4/pull/1322/commits/c39fb34be8e2841014f089593359e808201adbaa
c198e16 Fix naming. tychedelia Nov 13, 2025 https://github.com/processing/processing4/pull/1322/commits/c198e16e890c0db8f2ec6c951d58797859d8921e
42a1928 Actually fix rename. tychedelia Nov 20, 2025 https://github.com/processing/processing4/pull/1322/commits/42a1928e50286bc80be8ff6db072d5a9172abdba
Clear filters https://github.com/processing/processing4/pull/1322/files
Please reload this pagehttps://github.com/processing/processing4/pull/1322/files
Please reload this pagehttps://github.com/processing/processing4/pull/1322/files
WebGPU.java https://github.com/processing/processing4/pull/1322/files#diff-55b855df1ae3047e7cf877a2137209f0032f9c1f4ecde8cda0705f95d9da6b3d
PGraphicsWebGPU.java https://github.com/processing/processing4/pull/1322/files#diff-5c287ec90f640185d635e60c39d326e9b4fa351d48df06c86a0ce2151e778dc2
PWebGPU.java https://github.com/processing/processing4/pull/1322/files#diff-0085c138866e2716ecabe57a153bd4863eccc7e77d6c04f97e09f7378b4d8167
Cargo.lock https://github.com/processing/processing4/pull/1322/files#diff-a424153eb24e183472d49762f0f3b334690d38d7e8ac07fb8fc2302689cbfbfc
build.rs https://github.com/processing/processing4/pull/1322/files#diff-3d4232f402afe88254b43747b676c07a6da8138f29fc006fc836401d68ccd567
color.rs https://github.com/processing/processing4/pull/1322/files#diff-6481399ee70b657e8fd841c181a2d8a0d4f87cc5b99a23c5eeccf044556b7f46
error.rs https://github.com/processing/processing4/pull/1322/files#diff-4edff8fb405bc6bfa7dc0745a1ed1ddb080fb44b0a0845b6d5b6686410f30be0
lib.rs https://github.com/processing/processing4/pull/1322/files#diff-fe9468adbd7a77f4af7ac0dd93af54f9490c5da61be9282f725f8f7a562f7b96
Cargo.toml https://github.com/processing/processing4/pull/1322/files#diff-d35d03d326453cdc2f7ddfd939df8e4b157861c5e7ec34bd1138264287ae1995
error.rs https://github.com/processing/processing4/pull/1322/files#diff-3e7212da2d810504624e8df5161d7cd3a62826803c046e28cd86c60aa6eff0d8
lib.rs https://github.com/processing/processing4/pull/1322/files#diff-2b5b62f564e7d8ecb4db92c6b6f4fa8a4c1a91885625bf9190ac2b95d0944bd3
command.rs https://github.com/processing/processing4/pull/1322/files#diff-dc74a4eb8d08130e008c6d227c56164b7a4b6c5b73411b5a45866b17b1449746
material.rs https://github.com/processing/processing4/pull/1322/files#diff-089b518fcdabb7bb5da8320ea1d33ca24661b5c6686e41d8a23741fef9200857
mesh_builder.rs https://github.com/processing/processing4/pull/1322/files#diff-4010de7089eef8adc0a74108f0878bbfd9a63c1253c6d6e6e52464217ab0258e
mod.rs https://github.com/processing/processing4/pull/1322/files#diff-14da20ff8d5febb20a2d2834f537c90c80fb189f1f76efc74ae79c4bb2175394
mod.rs https://github.com/processing/processing4/pull/1322/files#diff-f5a871bb0a31b3823209444ab8f6f0c2664af9852acfc419cfb86e90c95b2937
rect.rs https://github.com/processing/processing4/pull/1322/files#diff-bb37cb1120ec74726a26d91218a55fc654f0a2d1f6d7c82afacc02a976687736
core/examples/src/main/java/WebGPU.javahttps://github.com/processing/processing4/pull/1322/files#diff-55b855df1ae3047e7cf877a2137209f0032f9c1f4ecde8cda0705f95d9da6b3d
View file https://github.com/tychedelia/processing4/blob/42a1928e50286bc80be8ff6db072d5a9172abdba/core/examples/src/main/java/WebGPU.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/processing/processing4/pull/1322/{{ revealButtonHref }}
catilachttps://github.com/catilac
Nov 18, 2025https://github.com/processing/processing4/pull/1322/files#r2538513724
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/processing/processing4/pull/1322/files
core/src/processing/webgpu/PGraphicsWebGPU.javahttps://github.com/processing/processing4/pull/1322/files#diff-5c287ec90f640185d635e60c39d326e9b4fa351d48df06c86a0ce2151e778dc2
View file https://github.com/tychedelia/processing4/blob/42a1928e50286bc80be8ff6db072d5a9172abdba/core/src/processing/webgpu/PGraphicsWebGPU.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/processing/processing4/pull/1322/{{ revealButtonHref }}
https://github.com/processing/processing4/pull/1322/files#diff-5c287ec90f640185d635e60c39d326e9b4fa351d48df06c86a0ce2151e778dc2
core/src/processing/webgpu/PWebGPU.javahttps://github.com/processing/processing4/pull/1322/files#diff-0085c138866e2716ecabe57a153bd4863eccc7e77d6c04f97e09f7378b4d8167
View file https://github.com/tychedelia/processing4/blob/42a1928e50286bc80be8ff6db072d5a9172abdba/core/src/processing/webgpu/PWebGPU.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/processing/processing4/pull/1322/{{ revealButtonHref }}
https://github.com/processing/processing4/pull/1322/files#diff-0085c138866e2716ecabe57a153bd4863eccc7e77d6c04f97e09f7378b4d8167
https://github.com/processing/processing4/pull/1322/files#diff-0085c138866e2716ecabe57a153bd4863eccc7e77d6c04f97e09f7378b4d8167
https://github.com/processing/processing4/pull/1322/files#diff-0085c138866e2716ecabe57a153bd4863eccc7e77d6c04f97e09f7378b4d8167
https://github.com/processing/processing4/pull/1322/files#diff-0085c138866e2716ecabe57a153bd4863eccc7e77d6c04f97e09f7378b4d8167
Please reload this pagehttps://github.com/processing/processing4/pull/1322/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.