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
- URP Realtime reflection probes do not update when RenderProbe() is being called once per second
- Addressable terrain shader variants are stripped from the Player
- [iOS] Debug.Log() appears as <private> in Console app
- UI stays in the background when it is disabled in simulator
- A wrong log file is attached when project is launched with a "-logFile" command line argument
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.