Skip to content

Leak#5151

Merged
diegoteran merged 5 commits into
masterfrom
leak
May 21, 2026
Merged

Leak#5151
diegoteran merged 5 commits into
masterfrom
leak

Conversation

@diegoteran
Copy link
Copy Markdown
Collaborator

Converts the decoded gainmap from QuadRenderer to a standalone DataTexture
using result.toDataTexture(). This allows the intermediate WebGLRenderTarget
instances and their underlying WebGL framebuffers/textures to be completely
disposed of immediately via result.dispose(true).

Includes a try-catch fallback to return the raw render target texture via
result.dispose(false) if the environment does not support the conversion.

This resolves iOS-specific WebGL context loss crashes and browser tab
reloads occurring when decoding multiple UltraHDR / Gainmap environments
in the "Lighting & Skybox" section.

Also adds:

  • A regression unit test in TextureUtils-spec.ts validating proper disposal of intermediate WebGLRenderTargets during gainmap decoding.

Converts the decoded gainmap from QuadRenderer to a standalone DataTexture
using `result.toDataTexture()`. This allows the intermediate WebGLRenderTarget
instances and their underlying WebGL framebuffers/textures to be completely
disposed of immediately via `result.dispose(true)`.
Includes a try-catch fallback to return the raw render target texture via
`result.dispose(false)` if the environment does not support the conversion.
This resolves iOS-specific WebGL context loss crashes and browser tab
reloads occurring when decoding multiple UltraHDR / Gainmap environments
in the "Lighting & Skybox" section.
…ap to DataTexture

Converts the decoded gainmap from QuadRenderer to a standalone DataTexture
using `result.toDataTexture()`. This allows the intermediate WebGLRenderTarget
instances and their underlying WebGL framebuffers/textures to be completely
disposed of immediately via `result.dispose(true)`.

Includes a try-catch fallback to return the raw render target texture via
`result.dispose(false)` if the environment does not support the conversion.

This resolves iOS-specific WebGL context loss crashes and browser tab
reloads occurring when decoding multiple UltraHDR / Gainmap environments
in the "Lighting & Skybox" section.

Also adds:
- A regression unit test in `TextureUtils-spec.ts` validating proper disposal of intermediate WebGLRenderTargets during gainmap decoding.
…map loading

Converts the decoded gainmap from QuadRenderer to a standalone DataTexture
using `result.toDataTexture()`, explicitly setting `needsUpdate = true`
to trigger GPU WebGL texture upload of the pixel buffer. This allows
the intermediate WebGLRenderTarget framebuffers and render buffers to be
completely disposed of immediately via `result.dispose(true)`.

This resolves a critical iOS-specific WebGL context loss crash loop when
scrolling through galleries with multiple environment maps (the "Lighting & Skybox" examples).

Implements a robust verification blank-check fallback:
- Dynamically inspects the decoded DataTexture pixel buffer on the CPU.
- Transparently falls back to the original render target texture if the converted DataTexture is completely black (frequent in headless testing environments with GPU-less software rendering).
- Prevents overriding of the colorSpace to SRGBColorSpace on half-float decoded textures, which is invalid under standard WebGL.

Also adds a regression unit test in `TextureUtils-spec.ts` to verify proper disposal of intermediate WebGLRenderTargets during gainmap decoding.
@diegoteran diegoteran merged commit 56d00bc into master May 21, 2026
10 checks passed
@diegoteran diegoteran deleted the leak branch May 22, 2026 16:50
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