Improve async webgl2 device methods #8049
Open
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.
The changes in the WebGL subsystem (WebglGraphicsDevice) are related to asynchronous pixel reading from the GPU and handling synchronization for waiting on read results.
Key updates:
clientWaitAsync
now accepts an additional abort signal parameter (AbortSignal), allowing cancellation of the asynchronous wait if needed.readPixelsAsync
is added, which uses a Pixel Buffer Object (PBO) for efficient async reading of pixels from the GPU.readPixelsAsync
:gl.readPixels
using format and type parameters obtained from the current color buffer.clientWaitAsync
with support for aborting.readTextureAsync
, which now supports passing an abort signal and uses the updatedreadPixelsAsync
.Overall, these changes improve asynchronous handling and control over GPU pixel reading operations with the ability to cancel operations, enhancing responsiveness and resource management in WebGL applications.
I have read the contributing guidelines