Browse Source

Minor Pass:mesh indirect adjustments;

bjorn 6 months ago
parent
commit
aa54bbb453
2 changed files with 13 additions and 8 deletions
  1. 2 2
      api/init.lua
  2. 11 6
      api/lovr/graphics/Pass/mesh.lua

+ 2 - 2
api/init.lua

@@ -20232,7 +20232,7 @@ return {
                   returns = {}
                 },
                 {
-                  description = "Perform indirect draws by specifying a `draws` command buffer. This allows for the drawing of instanced geometry to be orchestrated by a compute shader that writes to the `draws` buffer. The `draws` buffer contains one or more commands that define how to draw instances. The `stride` is autodetected if not specified (20 for indexed geometry and 16 for non-indexed geometry).\n\nThe `draws` buffer needs to use one of these formats:\n\n    { -- drawing with vertices and indices\n      { name = 'indexCount', type = 'u32' },\n      { name = 'instanceCount', type = 'u32' },\n      { name = 'firstIndex', type = 'u32' },\n      { name = 'vertexOffset', type = 'i32' },\n      { name = 'firstInstance', type = 'u32' }\n    }\n\n    { -- drawing with vertices; indices = nil\n      { name = 'vertexCount', type = 'u32' },\n      { name = 'instanceCount', type = 'u32' },\n      { name = 'firstVertex', type = 'u32' },\n      { name = 'firstInstance', type = 'u32' }\n    }",
+                  description = "Perform indirect draws by specifying a `draws` command buffer.  This allows for the drawing of instanced geometry to be orchestrated by a compute shader that writes to the `draws` buffer.  The `draws` buffer contains one or more commands that define how to draw instances. The `stride` determines the number of bytes between each draw command.  By default the draws are assumed to be tightly packed, with 20 bytes between indexed draws and 16 bytes for non-indexed draws.\n\nThe `draws` buffer should use one of these formats:\n\n    { -- drawing with vertices and indices\n      { name = 'indexCount', type = 'u32' },\n      { name = 'instanceCount', type = 'u32' },\n      { name = 'firstIndex', type = 'u32' },\n      { name = 'vertexOffset', type = 'i32' },\n      { name = 'firstInstance', type = 'u32' }\n    }\n\n    { -- drawing with vertices; indices = nil\n      { name = 'vertexCount', type = 'u32' },\n      { name = 'instanceCount', type = 'u32' },\n      { name = 'firstVertex', type = 'u32' },\n      { name = 'firstInstance', type = 'u32' }\n    }",
                   arguments = {
                     {
                       name = "vertices",
@@ -20265,7 +20265,7 @@ return {
                     {
                       name = "stride",
                       type = "number",
-                      description = "The number of bytes between consecutive elements in the draw buffer.",
+                      description = "The number of bytes between consecutive elements in the draw buffer.  When zero or nil, the stride is autodetected, and will be 20 bytes when an index buffer is provided and 16 bytes otherwise.",
                       default = "0"
                     }
                   },

+ 11 - 6
api/lovr/graphics/Pass/mesh.lua

@@ -29,7 +29,11 @@ return {
     stride = {
       type = 'number',
       default = '0',
-      description = 'The number of bytes between consecutive elements in the draw buffer.'
+      description = [[
+        The number of bytes between consecutive elements in the draw buffer.  When zero or nil, the
+        stride is autodetected, and will be 20 bytes when an index buffer is provided and 16 bytes
+        otherwise.
+      ]]
     },
     x = {
       type = 'number',
@@ -163,13 +167,14 @@ return {
     },
     {
       description = [[
-        Perform indirect draws by specifying a `draws` command buffer. This allows for the drawing
+        Perform indirect draws by specifying a `draws` command buffer.  This allows for the drawing
         of instanced geometry to be orchestrated by a compute shader that writes to the `draws`
-        buffer. The `draws` buffer contains one or more commands that define how to draw instances.
-        The `stride` is autodetected if not specified (20 for indexed geometry and 16 for
-        non-indexed geometry).
+        buffer.  The `draws` buffer contains one or more commands that define how to draw instances.
+        The `stride` determines the number of bytes between each draw command.  By default the draws
+        are assumed to be tightly packed, with 20 bytes between indexed draws and 16 bytes for
+        non-indexed draws.
 
-        The `draws` buffer needs to use one of these formats:
+        The `draws` buffer should use one of these formats:
 
             { -- drawing with vertices and indices
               { name = 'indexCount', type = 'u32' },