Search Issue Tracker
Won't Fix
Votes
5
Found in [Package]
2021.1.1f1
Issue ID
1338329
Regression
No
[Mobile][SRP][URP] CommandBuffer.SetRenderTarget doesn't work
Steps to reproduce:
1. Open the user's attached project "RenderTargetTest.zip"
2. Build on Android
3. Open the app
Expected results: Spheres are red
Actual results: Spheres are white
Reproducible with: 2019.4.27f1(7.6.0), 2020.3.10f1(10.5.0), 2021.2.0a18(12.0.0)
Reproducible devices:
----------, Huawei - (ELS-NX9), Android 10, CPU: NOT FOUND, GPU: Mali-G76
VLNQA00264, Samsung Galaxy S10+ (SM-G975F), Android 10, CPU: NOT FOUND, GPU: Mali-G76
iPhone 12 (iOS 14.1)
iPad Pro 12.9 1st gen (iOS 13.4.1)
Not Reproducible devices:
VLNQA00279, Samsung Galaxy S10+ (SM-G975U), Android 9, CPU: Snapdragon 855 SM8150, GPU: Adreno (TM) 640
Notes:
- Reproduces with Vulkan and OpenGles3
- Does not reproduce with Windows Standalone
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
- [OpenGLES][XR] Zooming in on the camera's URP opaque texture causes "double vision" on Quest in OpenGLES3
- “[Worker0] Could not generate preview image“ error when opening macOS native plugin in the Inspector with Architecture to build for set to ARM 64-bit
- [iOS] Application.absoluteURL is empty on Awake/Start when opening via deep link with Splash Screen disabled
- Crash on MemoryManager::Deallocate when rapidly calling Addressables.LoadAssetAsync
- Crash on physx::shdfnd::atomicIncrement when adjusting values on a character controller component after entering Play mode in Prefab edit mode
Resolution Note:
This line causes the results of the pass to never be stored to the render target because of a wrong store action:
buffer.SetRenderTarget(renderBufferID, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.DontCare);
RenderBufferStoreAction.DontCare tells to the device to never write back to memory the contents of the render target, this setting only affects mobile TBDR GPUs and this explains why the issue is not reproducible on desktop standalone or editor.
To fix it please make sure the results are stored in the render target by using the RenderBufferStoreAction.Store action.
the correct code then should be:
buffer.SetRenderTarget(renderBufferID, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store);
In general please pay extra attention to the Load and Store actions when targeting mobile hardware because they specify to the device what to do with the results of a specific pass (i.e. store in memory or completely discard)
for more info:
https://docs.unity3d.com/ScriptReference/Rendering.RenderBufferLoadAction.html
https://docs.unity3d.com/ScriptReference/Rendering.RenderBufferStoreAction.html