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
- Code runs slower when using a cached exception instance compared to creating a new one
- Broken UI in Default Preset Add Section of "Preset Manager" window
- [iOS] The Player freezes when closing the Notification Center and quickly swiping down from top
- Crash on Texture2D:SetPixelImpl when rapidly calling Texture2D.Apply()
- Graph Lines are not rendered when using Experimental GraphView or GridBackground
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.