Skip to content

quad_gl: start macroquad's two shaders before finishing either - #1080

Open
benface wants to merge 2 commits into
not-fl3:masterfrom
benface:start-default-shaders
Open

benface wants to merge 2 commits into
not-fl3:masterfrom
benface:start-default-shaders

Conversation

@benface

@benface benface commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Builds on #1079, whose commit it includes: only the last commit is new here. Like #1079, it needs a miniquad release with not-fl3/miniquad#692, which adds RenderingBackend::start_shader.

Why

QuadGl::new makes two shaders, the default pipelines' and the snapshotter's, with new_shader, which waits for each to compile. The second only starts once the first has finished, before the first frame. In WebKit with nothing cached, that took about 0.39 s, the two one after the other.

Change

  • PipelinesStorage and MagicSnapshotter each gain a start_shader, and their new takes the started shader and finishes it.
  • QuadGl::new starts both before finishing either, so they compile at once where the driver can: about 0.24 s together in WebKit.
  • Where miniquad's start_shader compiles straight away, as on Metal, nothing changes.

Verification

  • Builds for aarch64-apple-darwin and wasm32-unknown-unknown against miniquad with gl: start compiling a shader without waiting for it miniquad#692.
  • CHOMP's web build in WebKit (Safari 27's engine) on an M2 Max, Forest's first level, with every shader uncached: the two took a median 393 ms before and 236 ms after, over 7 runs each.

benface and others added 2 commits October 17, 2026 14:35
`load_material` waits for its shader to compile, so a game that makes
its materials as it loads compiles them one after the other, even
where the driver could compile them all at once.

`start_material` starts a material's shader with miniquad's
`start_shader` and returns a `PendingMaterial`, whose `finish` waits
for it and makes the material, as `load_material` would have.
`is_compiling` says whether `finish` would still wait, so a game can
start every material, keep drawing its loading screen while they
compile, and finish each once it's ready. `QuadGl` gains
`start_pipeline` and `finish_pipeline` to match `make_pipeline`.

Needs a miniquad release with `RenderingBackend::start_shader`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`QuadGl::new` made the default pipelines' shader and the snapshotter's
with `new_shader`, which waits for each to compile, so the second only
started once the first had finished.

Both are now started with miniquad's `start_shader` before either is
finished, so they compile at once where the driver can. In WebKit with
nothing cached, the two took about 0.39 s one after the other and
0.24 s together.

Needs a miniquad release with `RenderingBackend::start_shader`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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