No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ComputeShaderExample.compute 612B

12345678910111213141516
  1. // Each #kernel tells which function to compile; you can have many kernels
  2. #pragma kernel CSMain
  3. // Create a StructuredBuffer/ComputeBuffer with read only flag.
  4. StructuredBuffer<int> inputData;
  5. // Create a StructuredBuffer/ComputeBuffer with read & write flag.
  6. RWStructuredBuffer<int> outputData;
  7. // We allocate 20 threads one for each number given to the shader.
  8. // CSMain is the entry point we use we have to define the entry points as kernel.
  9. [numthreads(20,1,1)]
  10. void CSMain (uint3 id : SV_DispatchThreadID)
  11. {
  12. // We use the thead id as index for the data.
  13. outputData[id.x] = 2 * inputData[id.x];
  14. }