Skip to content

material: start compiling a material without waiting for it - #1079

Open
benface wants to merge 1 commit into
not-fl3:masterfrom
benface:start-material
Open

benface wants to merge 1 commit into
not-fl3:masterfrom
benface:start-material

Conversation

@benface

@benface benface commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Needs a miniquad release with not-fl3/miniquad#692, which adds RenderingBackend::start_shader.

Why

load_material waits for its shader to compile, so a game that makes its materials while it loads compiles them one after the other, even where the driver could compile them all at once. In WebKit with nothing cached, a game's (CHOMP) 36 materials took 5.1 s that way, and about 1 s started together.

Change

  • start_material(shader, params) starts a material's shader with miniquad's start_shader and returns a PendingMaterial.
  • PendingMaterial::finish waits for the shader, if it's still compiling, and makes the material, as load_material would have.
  • PendingMaterial::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, and make_pipeline is now the two together. load_material is now start_material followed by finish, so its behaviour is unchanged.

Verification

`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>
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