compute.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. return {
  2. tag = 'graphicsPrimitives',
  3. summary = 'Run a compute shader.',
  4. description = [[
  5. This function runs a compute shader on the GPU. Compute shaders must be created with
  6. `lovr.graphics.newComputeShader` and they should implement the `void compute();` GLSL function.
  7. Running a compute shader doesn't actually do anything, but the Shader can modify data stored in
  8. `Texture`s or `ShaderBlock`s to get interesting things to happen.
  9. When running the compute shader, you can specify the number of times to run it in 3 dimensions,
  10. which is useful to iterate over large numbers of elements like pixels or array elements.
  11. ]],
  12. arguments = {
  13. {
  14. name = 'shader',
  15. type = 'Shader',
  16. description = 'The compute shader to run.'
  17. },
  18. {
  19. name = 'x',
  20. type = 'number',
  21. default = '1',
  22. description = 'The amount of times to run in the x direction.'
  23. },
  24. {
  25. name = 'y',
  26. type = 'number',
  27. default = '1',
  28. description = 'The amount of times to run in the y direction.'
  29. },
  30. {
  31. name = 'z',
  32. type = 'number',
  33. default = '1',
  34. description = 'The amount of times to run in the z direction.'
  35. }
  36. },
  37. returns = {},
  38. notes = [[
  39. Only compute shaders created with `lovr.graphics.newComputeShader` can be used here.
  40. There are GPU-specific limits on the `x`, `y`, and `z` values which can be queried in the
  41. `compute` entry of `lovr.graphics.getLimits`.
  42. ]],
  43. related = {
  44. 'lovr.graphics.newComputeShader',
  45. 'lovr.graphics.getShader',
  46. 'lovr.graphics.setShader',
  47. 'Shader'
  48. }
  49. }