Skip to content

feat: VRMUtils.precompileShaders#1554

Draft
0b5vr wants to merge 4 commits intodevfrom
precompile-shaders
Draft

feat: VRMUtils.precompileShaders#1554
0b5vr wants to merge 4 commits intodevfrom
precompile-shaders

Conversation

@0b5vr
Copy link
Copy Markdown
Contributor

@0b5vr 0b5vr commented Dec 10, 2024

This PR introduces VRMUtils.precompileShaders.

precompileShaders is a function to time slice the shader compilations to prevent the main thread from being blocked.

This function only supports WebGLRenderer at the moment.

Points need review

  • Is it nice to have in three-vrm?
    • We have a lot of stuff inside VRMUtils lately,,,
  • Is the signature name appropriate?
    • Related APIs: WebGLRenderer.compile(), WebGLRenderer.compileAsync(), WebGLRenderer.initTexture()
    • Candidates: precompileShaders, compileShaders, compileShadersAsync, precompile, compile, timeslicedCompile, timeslicedCompileAsync, prepareMaterials, prepareMaterialsAsync, ...
      • It seems this is the first time we expose functions or methods that return Promise other than loader plugins.

`precompileShaders` is a function to time slice the shader compilations to prevent the main thread from being blocked

This function only supports WebGLRenderer at the moment
@0b5vr 0b5vr added the performance Performance issue label Dec 10, 2024
improve time slicing efficiency by using `renderer.compileAsync`
scene.add should be at after the precompileShaders
@0b5vr
Copy link
Copy Markdown
Contributor Author

0b5vr commented Feb 12, 2025

We are reluctant to merge this since this is a feature that each application requires their specific interfaces / implementations by demand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant