mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
102.21k stars 35.34k forks source link

WebGPURenderer: Concurrency issue. #29497

Open WestLangley opened 2 weeks ago

WestLangley commented 2 weeks ago

Description

I believe @sunag is working on this, but posting here for reference:

This code block is leading to a concurrency problem.

https://github.com/mrdoob/three.js/blob/7b9a543a488cd842c41d9cee4fd4a826082475f2/src/renderers/common/PostProcessing.js#L69-L85

While awaiting renderAsync() to resolve, other asychronous calls to renderer.render() can occur -- in a loader callback, for example.

Adding some print statememts to the above block, I get results like this:

renderer.toneMapping temporarily set to:  0
renderer.toneMapping temporarily set to:  0

renderer.toneMapping restored to:  2
renderer.toneMapping restored to:  0

renderer.toneMapping temporarily set to:  0
renderer.toneMapping restored to:  0

renderer.toneMapping temporarily set to:  0
renderer.toneMapping restored to:  0

         .
         .

Reproduction steps

see above

Code

see above

Live example

n/a

Screenshots

No response

Version

r169dev

Device

No response

Browser

No response

OS

No response

sunag commented 2 weeks ago

Currently we need to wait for an asynchronous render to start another, we should have an internal render state to be able to improve this support.