google / google/filament

Regression 1.71.5: crash in beginFrame with TAA/SSAO on a TRANSLUCENT View + TextureView (OpenGL, Android)

Open
#10,112 4 comments 0 reactions 1 assignee Claimed by @pixelflinger View on GitHub
Dominant language
C++
Stars
20.5k
Forks
2.3k
Avg merge
2d 14h
Merged PRs (30d)
83

Description

**Describe the bug**

Regression between **1.71.0 and 1.71.5** (no other changes). On the **OpenGL backend**, rendering a `View` with `BlendMode.TRANSLUCENT` into a `TextureView` crashes a few frames in, whenever **TAA or SSAO** is enabled. Identical code works on 1.71.0. Reproduces with **unmodified `ModelViewer`** (`filament-utils`).

Two manifestations of the same issue:

- Default (handle use-after-free check on):
```
RuntimeException: Postcondition in handleCast:145
reason: corrupted heap Handle with id=4294967295, tag=(no tag)
at Renderer.nBeginFrame ... ModelViewer.render(ModelViewer.kt:341)
```
`id=4294967295` is `HandleBase::nullid` — the SwapChain handle reads null inside `beginFrame`, **after 2–3 frames already rendered fine on that same swapchain**, with no swapchain/surface teardown in between.

- With `disableHandleUseAfterFreeCheck = true` → native segfault: `SIGSEGV ... fault addr 0x30` on the **`FEngine::loop`** thread (`libfilament-jni.so`).

**To Reproduce**

[filament-translucent-repro.zip](https://github.com/user-attachments/files/28876662/filament-translucent-repro.zip)

Runnable minimal project attached (single Activity, no `matc`). Essentials:

```kotlin
modelViewer = ModelViewer(textureView) // textureView.isOpaque = false
modelViewer.view.blendMode = BlendMode.TRANSLUCENT
modelViewer.view.temporalAntiAliasingOptions = TemporalAntiAliasingOptions().apply { enabled = true }
// and/or ambientOcclusionOptions { enabled = true; quality = ULTRA }
// drive via Choreographer -> modelViewer.render(frameTimeNanos) // crashes within a few frames
```

**Expected behavior**

No crash — same as 1.71.0.

**Smartphone information**

- Devices: **Samsung Galaxy S22** (Android 16) and **Pixel 8 Pro** — both Adreno/Xclipse **and** Mali/Immortalis GPUs, so not GPU-specific.
- Backend: **OpenGL** (Android default)

**Additional context**

Bisection on 1.71.5 (`BlendMode.TRANSLUCENT` + `TextureView` throughout):

| TAA | SSAO | Result |
|---|---|---|
| off | off | ✅ no crash (tone-mapping/color-grading only) |
| **on** | off | ❌ crash |
| off | **on** | ❌ crash |

- SwapChain `CONFIG_TRANSPARENT` (matching the translucent View) does **not** help.
- **Downgrade to 1.71.0 → no crash** (our shipped workaround).

So the trigger is post-processing passes needing a depth/structure prepass + intermediate targets (TAA/SSAO) when compositing a translucent `View` onto a `TextureView` swapchain; plain tone-mapping post-processing alone does not crash.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.