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
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
- “[Worker0] Could not generate preview image“ error when opening macOS native plugin in the Inspector with Architecture to build for set to ARM 64-bit
- [iOS] Application.absoluteURL is empty on Awake/Start when opening via deep link with Splash Screen disabled
- Crash on MemoryManager::Deallocate when rapidly calling Addressables.LoadAssetAsync
- Crash on physx::shdfnd::atomicIncrement when adjusting values on a character controller component after entering Play mode in Prefab edit mode
- [Rendering Debugger] [NewInputSystem] Debug Overlays in Play mode throws InvalidOperationException when using New Input System
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.