Quantcast
Channel: Questions in topic: "compute shader"
Viewing all articles
Browse latest Browse all 287

Debugging compute shader driver crash in editor

$
0
0
I'm writing a custom editor tool that uses compute shaders to generate meshes from implicit surfaces. This tool runs inside the Unity Editor, not inside the final executable. My invocation code is basically public class MesherWindow : EditorWindow { ComputeShader shader; float[] input; float[] output; int numThreads; private void OnGUI() { if (GUILayout.Button("Compute mesh")) { // input, kernel, numThreads, shader, etc. are all properly initialised here ComputeBuffer inputBuffer = new ComputeBuffer(..); ComputeBuffer outputBuffer = new ComputeBuffer(..); inputBuffer.SetData(input); shader.SetBuffer(kernel, "_input", inputBuffer); shader.SetBuffer(kernel, "_output", outputBuffer); int tgroups = input.Length / numThreads; shader.Dispatch(kernel, tgroups, 1, 1); // Driver crash here outputBuffer.GetData(output); inputBuffer.Dispose(); outputBuffer.Dispose(); One of my shaders consistently causes a driver crash on Windows and Mac OSX, with nVidia and AMD hardware. There is no exception raised in Unity, the program continues, but receives dummy values from subsequent Dispatch calls. Given that the shader causes a driver crash on two OSes and GPUs from different vendors, I'm almost certain the problem is in my shader and not the driver implementation. Is the problem that I'm dispatching during GUI draws? How can I figure out what is causing the crash?

Viewing all articles
Browse latest Browse all 287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>