Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
mptp's avatar
mptp
Explorer
6 years ago

Strange vertex-buffer corruption in Unity on Quest using compute shaders + Graphics.DrawProcedural?

So here's a bug that's been plaguing me for the last 18 months. Initially I chalked it up to the Quest being quite new, and just walked away from it as a dev platform expecting it to be fixed eventually. I tried again recently, and this is still a problem!





Basically, when drawing more than a few thousand vertices with Graphics.DrawProcedural in a shader that uses SV_VertexID to fetch elements from a StructuredBuffer, things work perfectly fine in standalone builds, but on Quest everything goes crazy. All the vertices end up with bizarre positions, normals, etc, resulting in huge triangles going everywhere. Even stranger, vertices that aren't part of my system, such as the default Avatar hands, also have their vertices corrupted! I've experienced similar problems in the past using Graphics.DrawMeshInstancedIndirect





There's no difference if I'm running in OpenGL ES 3.1+AEP, OpenGL ES 3.2, or Vulkan. I've tried messing with all sorts of settings, with no luck. Has anyone had any luck with Compute Shaders + Quest? I have a sneaky suspicion that there's just some difficult-to-find documentation about threadgroup sizes or compute shader features that need to be managed properly for writing Compute Shaders in Unity for Open GL or Vulkan. But I'm also worried that there's just some bug in the integration of the Oculus SDK in Unity. Help?

I have a pair of videos, one showing what an earlier version of one of my apps looks like on PC, and the second video showing what the same app looks like through the lens on Quest. Notice both the complete polygonal mess in the background, and the strange spiky vertices on the Avatar hands. You can view the videos in this post on my website.

I also made several posts about a related issue with Graphics.DrawMeshInstancedIndirect on the Unity forum over a year ago, which you can view here

2 Replies