How to pass StorageBuffer into ComputeShader?

I added a new StorageBuffer to the simple compute shader example and always got the error. ComputeShader is totally new to me and I am confused now.




By the way, it’s hard to find examples or learning materials about the ComputeShader on the internet. Could you recommend me some study materials?

You don’t use result1 in the shader itself. You just define the bindings.

Simply adding this line solves the issue:

      resultMatrix.numbers[index] = result;
      result1.numbers[index] = result; <-- added
2 Likes

Hard to believe dude :stuck_out_tongue: , just on Udemy:

Google/Youtube for free ones.

https://www.youtube.com/results?search_query=compute+shaders

1 Like

:), so simple! Thank you so much!

1 Like

You can also use the phony-assignment if you want to fix the problem without actually using the buffer in your code:

2 Likes

Thank you! This makes it easier.