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
- [Quest] Pitch Shifter causes audio degradation on Quest 2 devices when sped up
- "GUI Error: Invalid GUILayout" and "NullReferenceException" are thrown when adding Scenes to "Scenes in Baking Set" in Adaptive Probe Volumes
- Inspector window not updating when switching GameObjects in Play Mode while having a VR headset connected
- “UnityException: GetInvalidFilenameChars” errors are thrown, and the Overlay Save Preset button becomes unusable when entering Play Mode with a shortcut while Overlay Save Preset window is opened
- "UnityException: GetName can only be called from the main thread." erors are thrown when the Shortcuts window is opened and entering Play Mode with a shortcut
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.