Browse Source

Start documenting begin/submit/render;

bjorn 4 years ago
parent
commit
e8290e48e8

File diff suppressed because it is too large
+ 0 - 0
api/init.lua


+ 8 - 0
api/lovr/graphics/Buffer/init.lua

@@ -0,0 +1,8 @@
+return {
+  summary = 'A block of memory on the GPU.',
+  description = 'Put dispenser here.',
+  constructors = {
+    'lovr.graphics.newBuffer',
+    'lovr.graphics.getBuffer'
+  }
+}

+ 9 - 0
api/lovr/graphics/begin.lua

@@ -0,0 +1,9 @@
+return {
+  summary = 'Begin a chunk of work.',
+  description = '',
+  arguments = {},
+  returns = {},
+  related = {
+    'lovr.graphics.submit'
+  }
+}

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

@@ -0,0 +1,9 @@
+return {
+  summary = 'Run compute shaders.',
+  description = 'Runs compute shaders.',
+  arguments = {},
+  returns = {},
+  related = {
+    'lovr.graphics.render'
+  }
+}

+ 16 - 0
api/lovr/graphics/getFeatures.lua

@@ -0,0 +1,16 @@
+return {
+  summary = 'Get the set of supported GPU features.',
+  description = '',
+  arguments = {},
+  returns = {
+    {
+      name = 'features',
+      type = 'table',
+      description = 'GPU features.'
+    }
+  },
+  related = {
+    'lovr.graphics.getHardware',
+    'lovr.graphics.getLimits'
+  }
+}

+ 16 - 0
api/lovr/graphics/getHardware.lua

@@ -0,0 +1,16 @@
+return {
+  summary = 'Get information about the current GPU.',
+  description = '',
+  arguments = {},
+  returns = {
+    {
+      name = 'hardware',
+      type = 'table',
+      description = 'GPU info.'
+    }
+  },
+  related = {
+    'lovr.graphics.getFeatures',
+    'lovr.graphics.getLimits'
+  }
+}

+ 16 - 0
api/lovr/graphics/getLimits.lua

@@ -0,0 +1,16 @@
+return {
+  summary = 'Get the limits of the current GPU.',
+  description = '',
+  arguments = {},
+  returns = {
+    {
+      name = 'limits',
+      type = 'table',
+      description = 'GPU limits.'
+    }
+  },
+  related = {
+    'lovr.graphics.getHardware',
+    'lovr.graphics.getFeatures'
+  }
+}

+ 101 - 0
api/lovr/graphics/render.lua

@@ -0,0 +1,101 @@
+return {
+  summary = 'Render to a set of textures.',
+  description = [[
+    Renders to a set of textures.  Up to 4 color textures may be provided, as well as an optional
+    depth buffer.
+
+    The content to render can be provided by a callback function or a set of prerecorded `Batch`
+    objects.  When using a callback, its first argument will be a temporary Batch to fill out, which
+    will get immediately rendered.
+  ]],
+  arguments = {
+    texture = {
+      type = 'Texture',
+      description = 'A texture to render to.'
+    },
+    canvas = {
+      type = 'table',
+      description = 'A set of textures and other rendering settings.',
+      table = {}
+    },
+    ['...batches'] = {
+      type = 'Batch',
+      description = 'One or more batches to render.'
+    },
+    callback = {
+      type = 'function',
+      description = [[
+        A callback function used to record rendering work.  It will be passed a temporary Batch as
+        its single argument.  The Batch becomes invalid at the end of the callback.
+      ]]
+    },
+    order = {
+      type = 'number',
+      default = '50',
+      description = [[
+        A number from 1 to 100 used to sequence this rendering work with other work in the frame.
+        Smaller order values will run before larger values, and any render/compute work with the
+        same value will run in the order it was submitted.  This is intended to be used to order
+        work across multiple threads.
+      ]]
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'texture', 'callback', 'order' },
+      returns = {}
+    },
+    {
+      arguments = { 'canvas', 'callback', 'order' },
+      returns = {}
+    },
+    {
+      arguments = { 'texture', '...batches', 'order' },
+      returns = {}
+    },
+    {
+      arguments = { 'canvas', '...batches', 'order' },
+      returns = {}
+    }
+  },
+  notes = [[
+    This function must be called between `lovr.graphics.begin` and `lovr.graphics.submit`.
+
+    The special value `'window'` can be used instead of a Texture to render to the window.
+
+    The default clear for color textures will be the background color, which can be set using
+    `lovr.graphics.setBackgroundColor`.
+
+    Setting clear to `true` for either color or depth textures will leave garbage data in the
+    textures, which is the fastest way to initialize them.  Setting clear to `false` will load the
+    old data from the texture, which is very slow on mobile GPUs.
+
+    The stencil buffer is currently always cleared to zero.
+
+    A depth format can be provided instead of a Texture.  In this case, an internal temporary depth
+    buffer will be used.
+
+    It's valid to have zero color textures, but in that case a depth texture must be provided.
+
+    All textures must be created with the 'render' usage flag.  The textures must have the same
+    dimensions and sample counts, and array textures must have the same number of layers.  Textures
+    can have any renderable format and any number of mipmap levels.  It is valid to render to a view
+    of a texture.
+
+    If the textures have a single sample and the `samples` option is set to a number bigger than 1,
+    internal multisampled buffers will be used and the antialiased result will be copied to the
+    color textures once rendering is complete.
+
+    The topmost mipmap level of each texture will be rendered to.  If the `mipmaps` flag is `true`,
+    mipmaps will be regenerated for each texture once rendering is complete.
+
+    If the textures are array textures with multiple layers, draws get broadcasted to every layer.
+    Each layer can use its own camera.  The first layer uses the first camera view of the Batch, the
+    second layer uses the second view, and so on.  The maximum number of views is given by the
+    `renderViews` limit, and is currently always 6.
+  ]],
+  related = {
+    'lovr.graphics.compute'
+  }
+}

+ 9 - 0
api/lovr/graphics/submit.lua

@@ -0,0 +1,9 @@
+return {
+  summary = 'Submit a chunk of work.',
+  description = '',
+  arguments = {},
+  returns = {},
+  related = {
+    'lovr.graphics.begin'
+  }
+}

Some files were not shown because too many files changed in this diff