瀏覽代碼

lovr.graphics.compute;

bjorn 3 年之前
父節點
當前提交
c6e3f42939
共有 2 個文件被更改,包括 106 次插入0 次删除
  1. 55 0
      api/init.lua
  2. 51 0
      api/lovr/graphics/compute.lua

+ 55 - 0
api/init.lua

@@ -4684,6 +4684,61 @@ return {
             }
           }
         },
+        {
+          name = "compute",
+          tag = "compute",
+          summary = "Dispatch a compute shader.",
+          description = "TODO",
+          key = "lovr.graphics.compute",
+          module = "lovr.graphics",
+          notes = "TODO",
+          related = {
+            "lovr.graphics.prepare",
+            "lovr.graphics.submit"
+          },
+          variants = {
+            {
+              arguments = {
+                {
+                  name = "x",
+                  type = "number",
+                  description = "How many workgroups to dispatch in the x dimension.",
+                  default = "1"
+                },
+                {
+                  name = "y",
+                  type = "number",
+                  description = "How many workgroups to dispatch in the y dimension.",
+                  default = "1"
+                },
+                {
+                  name = "z",
+                  type = "number",
+                  description = "How many workgroups to dispatch in the z dimension.",
+                  default = "1"
+                }
+              },
+              returns = {}
+            },
+            {
+              description = "Perform an \"indirect\" dispatch, sourcing workgroup counts from a Buffer.",
+              arguments = {
+                {
+                  name = "buffer",
+                  type = "Buffer",
+                  description = "A Buffer object containing the x, y, and z workgroup counts, stored as 4 byte unsigned integers."
+                },
+                {
+                  name = "offset",
+                  type = "number",
+                  description = "The byte offset to read the workgroup counts from in the Buffer.",
+                  default = "0"
+                }
+              },
+              returns = {}
+            }
+          }
+        },
         {
           name = "finish",
           tag = "work-submission",

+ 51 - 0
api/lovr/graphics/compute.lua

@@ -0,0 +1,51 @@
+return {
+  tag = 'compute',
+  summary = 'Dispatch a compute shader.',
+  description = 'TODO',
+  arguments = {
+     x = {
+       type = 'number',
+       default = '1',
+       description = 'How many workgroups to dispatch in the x dimension.'
+     },
+     y = {
+       type = 'number',
+       default = '1',
+       description = 'How many workgroups to dispatch in the y dimension.'
+     },
+     z = {
+       type = 'number',
+       default = '1',
+       description = 'How many workgroups to dispatch in the z dimension.'
+     },
+     buffer = {
+       type = 'Buffer',
+       description = [[
+         A Buffer object containing the x, y, and z workgroup counts, stored as 4 byte unsigned
+         integers.
+       ]]
+     },
+     offset = {
+       type = 'number',
+       default = '0',
+       description = 'The byte offset to read the workgroup counts from in the Buffer.'
+     }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'x', 'y', 'z' },
+      returns = {}
+    },
+    {
+      description = 'Perform an "indirect" dispatch, sourcing workgroup counts from a Buffer.',
+      arguments = { 'buffer', 'offset' },
+      returns = {}
+    }
+  },
+  notes = 'TODO',
+  related = {
+    'lovr.graphics.prepare',
+    'lovr.graphics.submit'
+  }
+}