google / google/filament

METAL backend visual corruption with ClearOptions::clear=false

Open
#8,229 2 comments 0 reactions 1 assignee Claimed by @bejado View on GitHub
metal
Dominant language
C++
Stars
20.5k
Forks
2.3k
Avg merge
2d 16h
Merged PRs (30d)
74

Description

**Describe the bug**
On the METAL backend, various weird screen corruption occurs if ClearOptions::clear = false.

For whatever reason, it is very easy to reproduce in my app, but it is also possible to get gltf_viewer to do weird things.

Here's a video showing the corruption in my app: https://youtu.be/1Nca9RJ3Ucg.

**To Reproduce**
Steps to reproduce the behavior:
1. On MacOS with the METAL backend
2. Edit filament/libs/viewer/src/Settings.cpp, change renderer->setClearOptions() to set .clear = false (line 640)
3. Build and run gltf_viewer
4. Play around with settings until corruption happens.
5. For me, I found I could reliably get corruption with Dithering=true Bloom=true Screen-space-guard=true BloomThreshold=false
6. Also cranking up the bloom amount, you can sometimes then rotate the camera until weird corruption occurs

**Expected behavior**
There should not be any visual corruption, particularly when there's a skybox.

I understand that there is corruption behind the imgui menus -- that's not what I'm talking about. It's corruption in the 3D view, with white boxes appearing, or with the bloom flickering in weird ways.

**Screenshots**
If applicable, add screenshots to help explain your problem.

Here's an example of what it looks like with .clear=true:
![Image](https://github.com/user-attachments/assets/611673ba-01b7-49ae-a96a-9704277cb354)

And here it is with .clear=false:
![Image](https://github.com/user-attachments/assets/9a9f7aea-f26f-40fc-95da-6247ed0264ea)

**Logs**
I1024 23:17:40.172563 0x1709cf000.1 model_renderer.cc:99] [Filament I]: FEngine (64 bits) created at 0x133839800 (threading is enabled)
I1024 23:17:40.172622 0x170da3000.0 model_renderer.cc:99] [Filament I]: FEngine resolved backend: Metal
I1024 23:17:40.176935 0x170da3000.0 model_renderer.cc:99] [Filament I]: Selected physical device 'Apple M1'
I1024 23:17:40.177008 0x170da3000.0 model_renderer.cc:104] [Filament V]: Supported GPU families:
I1024 23:17:40.177010 0x170da3000.0 model_renderer.cc:104] [Filament V]: MTLGPUFamilyCommon3
I1024 23:17:40.177011 0x170da3000.0 model_renderer.cc:104] [Filament V]: MTLGPUFamilyApple7
I1024 23:17:40.177012 0x170da3000.0 model_renderer.cc:104] [Filament V]: MTLGPUFamilyMac2
I1024 23:17:40.177013 0x170da3000.0 model_renderer.cc:104] [Filament V]: Features:
I1024 23:17:40.177016 0x170da3000.0 model_renderer.cc:104] [Filament V]: readWriteTextureSupport: true
I1024 23:17:40.177276 0x1709cf000.1 model_renderer.cc:99] [Filament I]: Backend feature level: 3
I1024 23:17:40.177281 0x1709cf000.1 model_renderer.cc:99] [Filament I]: FEngine feature level: 1

**Desktop (please complete the following information):**
- OS: MacOS
- GPU: Macbook M1 pro
- Backend: Metal

**Smartphone (please complete the following information):**
N/A

**Additional context**
N/A

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.