Search Issue Tracker
By Design
Votes
0
Found in
2017.3.0b5
Issue ID
961977
Regression
Yes
[Metal] Compute shader buffer returns zeros on iOS device using camera render texture
To reproduce:
1. Download project attached by QA
2. Build it for iOS
3. Run it on a device
4. In the console notice, that compute buffer returned zeros
Expected result: Compute shader buffer should return correct values when using camera render texture
API: Metal
Reproduced with: 2017.3.0b1, 2017.3.0b6, 2018.1.0a1
Not reproducible with: 5.6.4p1, 2017.3.0a7
Regression since: 2017.3.0b1
Comments (1)
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
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
Cyril-Mishakin
Nov 02, 2017 12:22
For some reason "BuiltinRenderTextureType.CameraTarget" cant be passed into ComputeShader by "CommandBuffer.SetComputeTextureParam".
Were able to find simple temporary solution for this:
Not working example:
cmdBuffer.SetComputeTextureParam (computeShader, 0, "_texture", BuiltinRenderTextureType.CameraTarget);
cmdBuffer.DispatchCompute (computeShader, 0, 1, 1, 1);
Working example:
int tempTextureId = Shader.PropertyToID("_Temp");
cmdBuffer.GetTemporaryRT(tempTextureId, -1, -1, 24, FilterMode.Point);
cmdBuffer.Blit (BuiltinRenderTextureType.CameraTarget, tempTextureId);
cmdBuffer.SetComputeTextureParam (computeShader, 0, "_texture", tempTextureId);
cmdBuffer.DispatchCompute (computeShader, 0, 1, 1, 1);
cmdBuffer.ReleaseTemporaryRT (tempTextureId);
So BuiltinRenderTextureType.CameraTarget can't be passed into ComputeShader but manually created RT can and CameraTarget can be easily copied into our manually created temporary RT.