WebGLRenderer: Introduce asyncShaderCompilation
flag.
#26964
Closed
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.
Related issue: #19752 (comment)
Description
Thanks to @toji's preparation in #19745, this change was actually easy to implement.
WebGLRenderer
now has a new flag calledasyncShaderCompilation
. When set totrue
, the renderer automatically makes use ofKHR_parallel_shader_compile
for all shader programs.Using the new async mode potentially breaks apps if they rely on certain patterns like on-demand rendering though. Sync renderings like the code below do not work anymore (it just produces a black screen since the shader program isn't ready in the first frame):
Unfortunately, a global async mode also breaks modules like
PMREMGenerator
which rely on a sync pattern as well.