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
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
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