Search Issue Tracker
By Design
Votes
0
Found in
2021.3.29f1
2022.3.6f1
2023.1.7f1
2023.2.0b3
Issue ID
UUM-45041
Regression
No
[Android][OpenGL] Not every RenderPass calls glInvalidateFramebuffer when Blit Type is set to Never
Steps to reproduce:
1. Open the attached “LegacyEmpty” project
2. In Project Settings → Player → Other Settings change Scripting Backend to IL2CPP and enable ARM64 Target Architecture
3. Build and install the app on the device
4. Open Graphics Analyzer
5. Open the Device Manager and select “com.DefaultCompany.LegacyEmpty” under Packages when the device is connected
6. Start capture
7. In the toolbar capture a few frames (camera icon) and suspend the application (pause icon)
8. In the Trace Outline tab on the left of the program, enable “Show Only Frames With Features Enabled” and extend all frames and render passes
Expected result: glInvalidateFramebuffer is called at every render pass
Actual result: glInvalidateFramebuffer isn’t called in some render passes
Reproducible with: 2021.3.29f1, 2022.3.6f1, 2023.1.7f1, 2023.2.0b3
Testing environment: macOS Ventura 13.5 (Intel)
Reproducible with devices:
VLNQA00526 - Samsung Galaxy A12 (SM-A125F), CPU: Mediatek MT6765 Helio P35 (12nm), GPU: PowerVR Rogue GE8320, OS: 11
VLNQA00336 - HUAWEI Y6p (MED-LX9N), CPU: MediaTek MT6762R, GPU: PowerVR Rogue GE8320, OS: 10
Nokia TA-1418, GPU: Mali-G57 (by user)
Not reproducible with devices:
VLNQA00498 - Google Pixel 7 (Pixel 7), CPU: Google Tensor G2, GPU: Mali-G710, OS: 13
VLNQA00334 - Xiaomi Mi A3 (Mi A3), CPU: Snapdragon 665 SM6125, GPU: Adreno 610, OS: 11
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Certain textures are incorrectly marked in the render pass list when observed through Render Graph Viewer
- "Assertion failed on expression" error occurs when multiple Animation Components are instantiated after changing the Culling Type
- MacOS persistentDataPath uses old path when built compared to Editor Play mode
- Crash on RaiseException when entering Play Mode in a specific project
- Debug Console does not reappear when disabling and re-enabling Debug.developerConsoleEnabled
Resolution Note:
1. Issue interpreted by CQA:
CQA interpreted this issue as every RenderPass seen in Android Graphics Analyzer should have a call to glInvalidateFramebuffer. The devices that reproduces this issue were PowerVR GPU devices. I see the first misconception that you must call glInvalidateFramebuffer to prevent loading memory at the start of the RenderPass if the Framebuffer contents will be overwritten anyway. That is not true, both glInvalidateFramebuffer and Clear commands prevent tile read from memory. On Tile-based renderers clears at the start of the RenderPass are free, since they can just initialize the tile memory to a given clear value. [source](https://developer.arm.com/documentation/102479/0100/Efficient-Render-Passes), [source2](https://developer.arm.com/documentation/101897/0301/Fragment-shading/Efficient-render-passes-with-OpenGL-ES?lang=en)
In our core engine settings we have PowerVR GPUs blacklisted from using glInvalidateFramebuffer. I don't know the reasons for it, but must likely PowerVR has performance or general issues with this when using as a hint to prevent restoring Framebuffer contents at the start of a RP.
Do note that glInvalidateFramebuffer is just a hint to the driver, that the contents of the Framebuffer can be discarded.
2. Android Blit Type Never
The main misconception is what this option does. It should be pretty clear what this does from our documentation [source](https://docs.unity3d.com/ScriptReference/AndroidBlitType.html). This option simply lets you control whether the default rendering uses an intermediate Framebuffer for rendering. This is useful because it avoids various bugs with compositors, hardware scalers, allows switching MSAA at runtime, multi-display, allows read access to backbuffer and etc.
Of course there's the added performance impact of an extra blit operation.
3. In either of these modes, does our implementation avoid writing tile memory back to main memory?
Our engine always tries to make sure we avoid unnecessary read/writes to memory. We even have API to manually control rendering buffer memory loading and storing https://docs.unity3d.com/ScriptReference/Rendering.RenderBufferLoadAction.html. Android Blit Type Never makes sure we directly render to the backbuffer and avoid any additional blit operations that would be used for various compatibility reasons with Android Blit Type Always.
Some platforms may still fallback to Android Blit Type Always behaviour due to some driver or compatibility issues that we want to work around.