submit.lua 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. return {
  2. tag = 'work-submission',
  3. summary = 'Submit recorded graphics work to the GPU.',
  4. description = 'Submits work to the GPU.',
  5. arguments = {
  6. ['...'] = {
  7. type = 'Pass',
  8. description = 'The pass objects to submit. Falsy values will be skipped.'
  9. },
  10. t = {
  11. type = 'table',
  12. description = 'A table of passes to submit. Falsy values will be skipped.'
  13. }
  14. },
  15. returns = {
  16. ['true'] = {
  17. type = 'boolean',
  18. description = 'Always returns true, for convenience when returning from `lovr.draw`.'
  19. }
  20. },
  21. variants = {
  22. {
  23. arguments = { '...' },
  24. returns = { 'true' }
  25. },
  26. {
  27. arguments = { 't' },
  28. returns = { 'true' }
  29. }
  30. },
  31. notes = [[
  32. The submitted `Pass` objects will run in the order specified. Commands within a single Pass do
  33. not have any ordering guarantees.
  34. Submitting work to the GPU is not thread safe. No other `lovr.graphics` or `Pass` functions may
  35. run at the same time as `lovr.graphics.submit`.
  36. Calling this function will invalidate any temporary buffers or passes that were created during
  37. the frame.
  38. Submitting work to the GPU is a relatively expensive operation. It's a good idea to batch all
  39. `Pass` objects into 1 submission if possible, unless there's a good reason not to. One such
  40. reason would be that the frame has so much work that some of it needs to be submitted early to
  41. prevent the GPU from running out of things to do. Another would be for `Readback` objects.
  42. By default, this function is called with the default pass at the end of `lovr.draw` and
  43. `lovr.mirror`.
  44. It is valid to submit zero passes. This will send an empty batch of work to the GPU.
  45. ]],
  46. related = {
  47. 'lovr.graphics.wait'
  48. }
  49. }