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
- [iOS] Application frequently crashes on Social.LoadAchievements call when many achievements are registered
- Errors “RenderPass: Attachment 0 is declared as depth attachment but RGBA8 sRGB is not a valid depth format.“ and “BeginSubPass: Not inside a Renderpass“ are present when using Native RenderPass with a RenderTexture that only has depth output
- ArgumentOutOfRangeException is thrown when an empty DropdownField is clicked at runtime
- [tvOS] "EXC_BAD_ACCESS" error is thrown when Painter2D.ClosePath is called
- Bad Naming Convention in Shortcuts Window for Sprite Shape Editing
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