bjorn 2 years ago
parent
commit
0fac16a5e6

+ 63 - 20
api/init.lua

@@ -7944,7 +7944,7 @@ return {
         },
         },
         {
         {
           name = "Material",
           name = "Material",
-          summary = "TODO",
+          summary = "A set of properties and textures that define the appearance of a surface.",
           description = "TODO",
           description = "TODO",
           key = "Material",
           key = "Material",
           module = "lovr.graphics",
           module = "lovr.graphics",
@@ -9955,7 +9955,7 @@ return {
         {
         {
           name = "Pass",
           name = "Pass",
           summary = "A stream of graphics commands.",
           summary = "A stream of graphics commands.",
-          description = "TODO",
+          description = "Pass objects are used to record commands for the GPU.  Commands can be recorded by calling functions on the Pass.  After recording a set of passes, they can be submitted for the GPU to process using `lovr.graphics.submit`.\n\nPass objects are **temporary** and only exist for a single frame.  Once `lovr.graphics.submit` is called to end the frame, any passes that were created during that frame become **invalid**. Each frame, a new set of passes must be created and recorded.  LÖVR tries to detect if you use a pass after it's invalid, but this error checking is not 100% accurate at the moment.\n\nThere are 3 types of passes.  Each type can record a specific type of command:\n\n- `render` passes render graphics to textures.  The `lovr.draw` callback receives a render pass\n  as an argument.\n- `compute` passes run compute shaders.\n- `transfer` passes can transfer data to/from GPU objects, like `Buffer` and `Texture`.",
           key = "Pass",
           key = "Pass",
           module = "lovr.graphics",
           module = "lovr.graphics",
           sections = {
           sections = {
@@ -10928,10 +10928,11 @@ return {
             },
             },
             {
             {
               name = "getDimensions",
               name = "getDimensions",
-              summary = "TODO",
-              description = "TODO",
+              summary = "Get the texture dimensions of a render pass.",
+              description = "Returns the dimensions of the textures attached to the render pass.",
               key = "Pass:getDimensions",
               key = "Pass:getDimensions",
               module = "lovr.graphics",
               module = "lovr.graphics",
+              notes = "If the pass is not a render pass, this function returns zeros.",
               variants = {
               variants = {
                 {
                 {
                   arguments = {},
                   arguments = {},
@@ -10939,23 +10940,32 @@ return {
                     {
                     {
                       name = "width",
                       name = "width",
                       type = "number",
                       type = "number",
-                      description = "TODO"
+                      description = "The texture width."
                     },
                     },
                     {
                     {
                       name = "height",
                       name = "height",
                       type = "number",
                       type = "number",
-                      description = "TODO"
+                      description = "The texture height."
                     }
                     }
                   }
                   }
                 }
                 }
+              },
+              related = {
+                "Pass:getWidth",
+                "Pass:getHeight",
+                "Pass:getViewCount",
+                "lovr.graphics.getPass",
+                "lovr.system.getWindowDimensions",
+                "lovr.headset.getDisplayDimensions"
               }
               }
             },
             },
             {
             {
               name = "getHeight",
               name = "getHeight",
-              summary = "TODO",
-              description = "TODO",
+              summary = "Get the texture height of a render pass.",
+              description = "Returns the height of the textures attached to the render pass.",
               key = "Pass:getHeight",
               key = "Pass:getHeight",
               module = "lovr.graphics",
               module = "lovr.graphics",
+              notes = "If the pass is not a render pass, this function returns zero.",
               variants = {
               variants = {
                 {
                 {
                   arguments = {},
                   arguments = {},
@@ -10963,10 +10973,18 @@ return {
                     {
                     {
                       name = "height",
                       name = "height",
                       type = "number",
                       type = "number",
-                      description = "TODO"
+                      description = "The texture height."
                     }
                     }
                   }
                   }
                 }
                 }
+              },
+              related = {
+                "Pass:getWidth",
+                "Pass:getDimensions",
+                "Pass:getViewCount",
+                "lovr.graphics.getPass",
+                "lovr.system.getWindowHeight",
+                "lovr.headset.getDisplayHeight"
               }
               }
             },
             },
             {
             {
@@ -11096,10 +11114,11 @@ return {
             },
             },
             {
             {
               name = "getViewCount",
               name = "getViewCount",
-              summary = "TODO",
-              description = "TODO",
+              summary = "Returns the view count of a render pass.",
+              description = "Returns the view count of a render pass.  This is the layer count of the textures it is rendering to.",
               key = "Pass:getViewCount",
               key = "Pass:getViewCount",
               module = "lovr.graphics",
               module = "lovr.graphics",
+              notes = "A render pass has one \"camera\" for each view.  Whenever something is drawn, it is broadcast to each view (layer) of each texture, using the corresponding camera.",
               variants = {
               variants = {
                 {
                 {
                   arguments = {},
                   arguments = {},
@@ -11107,10 +11126,17 @@ return {
                     {
                     {
                       name = "views",
                       name = "views",
                       type = "number",
                       type = "number",
-                      description = "TODO"
+                      description = "The view count."
                     }
                     }
                   }
                   }
                 }
                 }
+              },
+              related = {
+                "Pass:getViewPose",
+                "Pass:setViewPose",
+                "Pass:getProjection",
+                "Pass:setProjection",
+                "lovr.headset.getViewCount"
               }
               }
             },
             },
             {
             {
@@ -11203,10 +11229,11 @@ return {
             },
             },
             {
             {
               name = "getWidth",
               name = "getWidth",
-              summary = "TODO",
-              description = "TODO",
+              summary = "Get the texture width of a render pass.",
+              description = "Returns the width of the textures attached to the render pass.",
               key = "Pass:getWidth",
               key = "Pass:getWidth",
               module = "lovr.graphics",
               module = "lovr.graphics",
+              notes = "If the pass is not a render pass, this function returns zero.",
               variants = {
               variants = {
                 {
                 {
                   arguments = {},
                   arguments = {},
@@ -11214,10 +11241,18 @@ return {
                     {
                     {
                       name = "width",
                       name = "width",
                       type = "number",
                       type = "number",
-                      description = "TODO"
+                      description = "The texture width."
                     }
                     }
                   }
                   }
                 }
                 }
+              },
+              related = {
+                "Pass:getHeight",
+                "Pass:getDimensions",
+                "Pass:getViewCount",
+                "lovr.graphics.getPass",
+                "lovr.system.getWindowWidth",
+                "lovr.headset.getDisplayWidth"
               }
               }
             },
             },
             {
             {
@@ -14543,7 +14578,7 @@ return {
           name = "getPass",
           name = "getPass",
           tag = "graphics-objects",
           tag = "graphics-objects",
           summary = "Get a temporary Pass.",
           summary = "Get a temporary Pass.",
-          description = "Creates and returns a Pass object, which is used to record commands for the GPU.  Commands can be recorded by calling functions on the Pass.  After recording a set of passes, they can be submitted for the GPU to process using `lovr.graphics.submit`.\n\nPass objects are **temporary** and only exist for a single frame.  Once `lovr.graphics.submit` is called to end the frame, any passes that were created during that frame become **invalid**. Each frame, a new set of passes must be created and recorded. LÖVR tries to detect if you use a pass after it's invalid, but this error checking is not 100% accurate at the moment.\n\nThere are 3 types of passes.  Each type can record a specific type of command:\n\n- `render` passes render graphics to textures.  The `lovr.draw` callback receives a render pass\n  as an argument.\n- `compute` passes run compute shaders.\n- `transfer` passes can transfer data to/from GPU objects, like `Buffer` and `Texture`.",
+          description = "Creates and returns a temporary Pass object.",
           key = "lovr.graphics.getPass",
           key = "lovr.graphics.getPass",
           module = "lovr.graphics",
           module = "lovr.graphics",
           notes = "Fun facts about render passes:\n\n- Textures must have the same dimensions, layer counts, and sample counts.\n- Textures must have been created with the `render` `TextureUsage`.\n- If `mipmap` is true, then any textures with mipmaps must have the `transfer` `TextureUsage`.\n- It's okay to have zero color textures, but in this case there must be a depth texture.\n- Setting `clear` to `false` for textures is usually very slow on mobile GPUs.\n\nFor `compute` and `transfer` passes, all of the commands in the pass act as though they run in parallel.  This means that writing to the same element of a buffer twice, or writing to it and reading from it again is not guaranteed to work properly on all GPUs.  LÖVR is not currently able to check for this.  If compute or transfers need to be sequenced, multiple passes should be used.  It is, however, completely fine to read and write to non-overlapping regions of the same buffer or texture.",
           notes = "Fun facts about render passes:\n\n- Textures must have the same dimensions, layer counts, and sample counts.\n- Textures must have been created with the `render` `TextureUsage`.\n- If `mipmap` is true, then any textures with mipmaps must have the `transfer` `TextureUsage`.\n- It's okay to have zero color textures, but in this case there must be a depth texture.\n- Setting `clear` to `false` for textures is usually very slow on mobile GPUs.\n\nFor `compute` and `transfer` passes, all of the commands in the pass act as though they run in parallel.  This means that writing to the same element of a buffer twice, or writing to it and reading from it again is not guaranteed to work properly on all GPUs.  LÖVR is not currently able to check for this.  If compute or transfers need to be sequenced, multiple passes should be used.  It is, however, completely fine to read and write to non-overlapping regions of the same buffer or texture.",
@@ -14554,6 +14589,7 @@ return {
           },
           },
           variants = {
           variants = {
             {
             {
+              description = "Create a compute or transfer pass.",
               arguments = {
               arguments = {
                 {
                 {
                   name = "type",
                   name = "type",
@@ -14570,6 +14606,7 @@ return {
               }
               }
             },
             },
             {
             {
+              description = "Create a render pass.",
               arguments = {
               arguments = {
                 {
                 {
                   name = "type",
                   name = "type",
@@ -14591,6 +14628,7 @@ return {
               }
               }
             },
             },
             {
             {
+              description = "Create a render pass, with options.",
               arguments = {
               arguments = {
                 {
                 {
                   name = "type",
                   name = "type",
@@ -14663,7 +14701,7 @@ return {
           description = "Returns the window pass.  This is a builtin render `Pass` object that renders to the desktop window texture.  If the desktop window was not open when the graphics module was initialized, this function will return `nil`.",
           description = "Returns the window pass.  This is a builtin render `Pass` object that renders to the desktop window texture.  If the desktop window was not open when the graphics module was initialized, this function will return `nil`.",
           key = "lovr.graphics.getWindowPass",
           key = "lovr.graphics.getWindowPass",
           module = "lovr.graphics",
           module = "lovr.graphics",
-          notes = "- TODO is the same pass always returned\n- TODO does the texture change\n- TODO what settings does the Pass use (incl conf.lua)\n- TODO is it reset",
+          notes = "`lovr.conf` may be used to change the settings for the pass:  `t.graphics.antialias` enables antialiasing, and `t.graphics.stencil` enables the stencil buffer.\n\nThis pass clears the window texture to the background color, which can be changed using `lovr.graphics.setBackgroundColor`.",
           variants = {
           variants = {
             {
             {
               arguments = {},
               arguments = {},
@@ -16246,17 +16284,22 @@ return {
         {
         {
           name = "ShaderType",
           name = "ShaderType",
           summary = "Different types of Shaders.",
           summary = "Different types of Shaders.",
-          description = "TODO",
+          description = "The two types of shaders that can be created.",
           key = "ShaderType",
           key = "ShaderType",
           module = "lovr.graphics",
           module = "lovr.graphics",
+          related = {
+            "lovr.graphics.newShader",
+            "Shader:getType",
+            "ShaderStage"
+          },
           values = {
           values = {
             {
             {
               name = "graphics",
               name = "graphics",
-              description = "TODO"
+              description = "A graphics shader with a vertex and pixel stage."
             },
             },
             {
             {
               name = "compute",
               name = "compute",
-              description = "TODO"
+              description = "A compute shader with a single compute stage."
             }
             }
           }
           }
         },
         },

+ 1 - 1
api/lovr/graphics/Material/init.lua

@@ -1,5 +1,5 @@
 return {
 return {
-  summary = 'TODO',
+  summary = 'A set of properties and textures that define the appearance of a surface.',
   description = 'TODO',
   description = 'TODO',
   constructors = {
   constructors = {
     'lovr.graphics.newMaterial'
     'lovr.graphics.newMaterial'

+ 15 - 4
api/lovr/graphics/Pass/getDimensions.lua

@@ -1,17 +1,28 @@
 return {
 return {
-  summary = 'TODO',
-  description = 'TODO',
+  summary = 'Get the texture dimensions of a render pass.',
+  description = 'Returns the dimensions of the textures attached to the render pass.',
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     {
     {
       name = 'width',
       name = 'width',
       type = 'number',
       type = 'number',
-      description = 'TODO'
+      description = 'The texture width.'
     },
     },
     {
     {
       name = 'height',
       name = 'height',
       type = 'number',
       type = 'number',
-      description = 'TODO'
+      description = 'The texture height.'
     }
     }
+  },
+  notes = [[
+    If the pass is not a render pass, this function returns zeros.
+  ]],
+  related = {
+    'Pass:getWidth',
+    'Pass:getHeight',
+    'Pass:getViewCount',
+    'lovr.graphics.getPass',
+    'lovr.system.getWindowDimensions',
+    'lovr.headset.getDisplayDimensions'
   }
   }
 }
 }

+ 14 - 3
api/lovr/graphics/Pass/getHeight.lua

@@ -1,12 +1,23 @@
 return {
 return {
-  summary = 'TODO',
-  description = 'TODO',
+  summary = 'Get the texture height of a render pass.',
+  description = 'Returns the height of the textures attached to the render pass.',
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     {
     {
       name = 'height',
       name = 'height',
       type = 'number',
       type = 'number',
-      description = 'TODO'
+      description = 'The texture height.'
     }
     }
+  },
+  notes = [[
+    If the pass is not a render pass, this function returns zero.
+  ]],
+  related = {
+    'Pass:getWidth',
+    'Pass:getDimensions',
+    'Pass:getViewCount',
+    'lovr.graphics.getPass',
+    'lovr.system.getWindowHeight',
+    'lovr.headset.getDisplayHeight'
   }
   }
 }
 }

+ 17 - 3
api/lovr/graphics/Pass/getViewCount.lua

@@ -1,12 +1,26 @@
 return {
 return {
-  summary = 'TODO',
-  description = 'TODO',
+  summary = 'Returns the view count of a render pass.',
+  description = [[
+    Returns the view count of a render pass.  This is the layer count of the textures it is
+    rendering to.
+  ]],
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     {
     {
       name = 'views',
       name = 'views',
       type = 'number',
       type = 'number',
-      description = 'TODO'
+      description = 'The view count.'
     }
     }
+  },
+  notes = [[
+    A render pass has one "camera" for each view.  Whenever something is drawn, it is broadcast to
+    each view (layer) of each texture, using the corresponding camera.
+  ]],
+  related = {
+    'Pass:getViewPose',
+    'Pass:setViewPose',
+    'Pass:getProjection',
+    'Pass:setProjection',
+    'lovr.headset.getViewCount'
   }
   }
 }
 }

+ 14 - 3
api/lovr/graphics/Pass/getWidth.lua

@@ -1,12 +1,23 @@
 return {
 return {
-  summary = 'TODO',
-  description = 'TODO',
+  summary = 'Get the texture width of a render pass.',
+  description = 'Returns the width of the textures attached to the render pass.',
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     {
     {
       name = 'width',
       name = 'width',
       type = 'number',
       type = 'number',
-      description = 'TODO'
+      description = 'The texture width.'
     }
     }
+  },
+  notes = [[
+    If the pass is not a render pass, this function returns zero.
+  ]],
+  related = {
+    'Pass:getHeight',
+    'Pass:getDimensions',
+    'Pass:getViewCount',
+    'lovr.graphics.getPass',
+    'lovr.system.getWindowWidth',
+    'lovr.headset.getDisplayWidth'
   }
   }
 }
 }

+ 17 - 1
api/lovr/graphics/Pass/init.lua

@@ -1,6 +1,22 @@
 return {
 return {
   summary = 'A stream of graphics commands.',
   summary = 'A stream of graphics commands.',
-  description = 'TODO',
+  description = [[
+    Pass objects are used to record commands for the GPU.  Commands can be recorded by calling
+    functions on the Pass.  After recording a set of passes, they can be submitted for the GPU to
+    process using `lovr.graphics.submit`.
+
+    Pass objects are **temporary** and only exist for a single frame.  Once `lovr.graphics.submit`
+    is called to end the frame, any passes that were created during that frame become **invalid**.
+    Each frame, a new set of passes must be created and recorded.  LÖVR tries to detect if you use a
+    pass after it's invalid, but this error checking is not 100% accurate at the moment.
+
+    There are 3 types of passes.  Each type can record a specific type of command:
+
+    - `render` passes render graphics to textures.  The `lovr.draw` callback receives a render pass
+      as an argument.
+    - `compute` passes run compute shaders.
+    - `transfer` passes can transfer data to/from GPU objects, like `Buffer` and `Texture`.
+  ]],
   sections = {
   sections = {
     {
     {
       name = 'Drawing',
       name = 'Drawing',

+ 8 - 3
api/lovr/graphics/ShaderType.lua

@@ -1,14 +1,19 @@
 return {
 return {
   summary = 'Different types of Shaders.',
   summary = 'Different types of Shaders.',
-  description = 'TODO',
+  description = 'The two types of shaders that can be created.',
   values = {
   values = {
     {
     {
       name = 'graphics',
       name = 'graphics',
-      description = 'TODO'
+      description = 'A graphics shader with a vertex and pixel stage.'
     },
     },
     {
     {
       name = 'compute',
       name = 'compute',
-      description = 'TODO'
+      description = 'A compute shader with a single compute stage.'
     }
     }
+  },
+  related = {
+    'lovr.graphics.newShader',
+    'Shader:getType',
+    'ShaderStage'
   }
   }
 }
 }

+ 4 - 17
api/lovr/graphics/getPass.lua

@@ -1,23 +1,7 @@
 return {
 return {
   tag = 'graphics-objects',
   tag = 'graphics-objects',
   summary = 'Get a temporary Pass.',
   summary = 'Get a temporary Pass.',
-  description = [[
-    Creates and returns a Pass object, which is used to record commands for the GPU.  Commands can
-    be recorded by calling functions on the Pass.  After recording a set of passes, they can be
-    submitted for the GPU to process using `lovr.graphics.submit`.
-
-    Pass objects are **temporary** and only exist for a single frame.  Once `lovr.graphics.submit`
-    is called to end the frame, any passes that were created during that frame become **invalid**.
-    Each frame, a new set of passes must be created and recorded. LÖVR tries to detect if you use a
-    pass after it's invalid, but this error checking is not 100% accurate at the moment.
-
-    There are 3 types of passes.  Each type can record a specific type of command:
-
-    - `render` passes render graphics to textures.  The `lovr.draw` callback receives a render pass
-      as an argument.
-    - `compute` passes run compute shaders.
-    - `transfer` passes can transfer data to/from GPU objects, like `Buffer` and `Texture`.
-  ]],
+  description = 'Creates and returns a temporary Pass object.',
   arguments = {
   arguments = {
     type = {
     type = {
       type = 'PassType',
       type = 'PassType',
@@ -111,14 +95,17 @@ return {
   },
   },
   variants = {
   variants = {
     {
     {
+      description = 'Create a compute or transfer pass.',
       arguments = { 'type' },
       arguments = { 'type' },
       returns = { 'pass' }
       returns = { 'pass' }
     },
     },
     {
     {
+      description = 'Create a render pass.',
       arguments = { 'type', 'texture' },
       arguments = { 'type', 'texture' },
       returns = { 'pass' }
       returns = { 'pass' }
     },
     },
     {
     {
+      description = 'Create a render pass, with options.',
       arguments = { 'type', 'canvas' },
       arguments = { 'type', 'canvas' },
       returns = { 'pass' }
       returns = { 'pass' }
     }
     }

+ 5 - 4
api/lovr/graphics/getWindowPass.lua

@@ -20,9 +20,10 @@ return {
     }
     }
   },
   },
   notes = [[
   notes = [[
-    - TODO is the same pass always returned
-    - TODO does the texture change
-    - TODO what settings does the Pass use (incl conf.lua)
-    - TODO is it reset
+    `lovr.conf` may be used to change the settings for the pass:  `t.graphics.antialias` enables
+    antialiasing, and `t.graphics.stencil` enables the stencil buffer.
+
+    This pass clears the window texture to the background color, which can be changed using
+    `lovr.graphics.setBackgroundColor`.
   ]]
   ]]
 }
 }