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
- Visible instance buffer returns 0 for every instance when using BatchDrawCommandIndirect on Adreno devices with Vulkan API
- [Android][Vulkan] Native crash in AndroidVulkanVideo::ProcessFrame and AndroidVulkanVideo::Context::~Context() when switching screens
- Screen brightness is not set to a default value when Screen.brightness is set to a negative value
- macOS app window title is not localized when built from generated Xcode project
- Unity Hub doesn't preserve the changed Channel when manually restarting the Hub
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