Browse Source

Add skeletons for remaining Pass methods;

bjorn 3 years ago
parent
commit
d97589c90b

+ 86 - 0
api/lovr/graphics/Pass/blit.lua

@@ -0,0 +1,86 @@
+return {
+  tag = 'transfer',
+  summary = 'Copy data between textures with scaling.',
+  description = 'TODO',
+  arguments = {
+    src = {
+      type = 'Texture',
+      description = 'TODO'
+    },
+    dst = {
+      type = 'Texture',
+      description = 'TODO'
+    },
+    srcx = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    srcy = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    srcz = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    dstx = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    dsty = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    dstz = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    srcw = {
+      type = 'number',
+      default = 'nil',
+      description = 'TODO'
+    },
+    srch = {
+      type = 'number',
+      default = 'nil',
+      description = 'TODO'
+    },
+    srcd = {
+      type = 'number',
+      default = 'nil',
+      description = 'TODO'
+    },
+    dstw = {
+      type = 'number',
+      default = 'nil',
+      description = 'TODO'
+    },
+    dsth = {
+      type = 'number',
+      default = 'nil',
+      description = 'TODO'
+    },
+    dstd = {
+      type = 'number',
+      default = 'nil',
+      description = 'TODO'
+    },
+    srclevel = {
+      type = 'number',
+      default = '1',
+      description = 'TODO'
+    },
+    dstlevel = {
+      type = 'number',
+      default = '1',
+      description = 'TODO'
+    }
+  },
+  returns = {}
+}

+ 39 - 0
api/lovr/graphics/Pass/capsule.lua

@@ -0,0 +1,39 @@
+return {
+  tag = 'drawing',
+  summary = 'Draw a capsule.',
+  description = 'TODO',
+  arguments = {
+    transform = {
+      type = 'TransformXY2',
+      description = [[
+        The transform to apply to the capsule.  The x and y scale is the radius, the z scale is the
+        length.
+      ]]
+    },
+    p1 = {
+      type = 'Point3',
+      description = 'The starting point of the capsule.'
+    },
+    p2 = {
+      type = 'Point3',
+      description = 'The ending point of the capsule.'
+    },
+    segments = {
+      type = 'number',
+      default = '32',
+      description = 'The number of circular segments to render.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'transform', 'segments' },
+      returns = {}
+    },
+    {
+      arguments = { 'p1', 'p2', 'segments' },
+      returns = {}
+    }
+  },
+  returns = {},
+  notes = 'TODO'
+}

+ 23 - 0
api/lovr/graphics/Pass/cone.lua

@@ -0,0 +1,23 @@
+return {
+  tag = 'drawing',
+  summary = 'Draw a cone.',
+  description = 'TODO',
+  arguments = {
+    {
+      name = 'transform',
+      type = 'TransformXY2',
+      description = [[
+        The transform to apply to the cone.  The x and y scale is the radius, the z scale is the
+        length.
+      ]]
+    },
+    {
+      name = 'segments',
+      type = 'number',
+      default = '64',
+      description = 'The number of circular segments to render.'
+    }
+  }
+  returns = {},
+  notes = 'TODO'
+}

+ 157 - 0
api/lovr/graphics/Pass/copy.lua

@@ -0,0 +1,157 @@
+return {
+  tag = 'transfer',
+  summary = 'Copy data to or between GPU resources.',
+  description = 'TODO',
+  arguments = {
+    table = {
+      type = 'table',
+      description = 'TODO'
+    },
+    blob = {
+      type = 'Blob',
+      description = 'TODO'
+    },
+    buffersrc = {
+      type = 'Buffer',
+      description = 'TODO'
+    },
+    image = {
+      type = 'Image',
+      description = 'TODO'
+    }
+    texturesrc = {
+      type = 'Texture',
+      description = 'TODO'
+    },
+    tally = {
+      type = 'Tally',
+      description = 'TODO'
+    },
+    bufferdst = {
+      type = 'Buffer',
+      description = 'TODO'
+    },
+    texturedst = {
+      type = 'Texture',
+      description = 'TODO'
+    },
+    srcindex = {
+      type = 'number',
+      default = '1',
+      description = 'TODO'
+    },
+    dstindex = {
+      type = 'number',
+      default = '1',
+      description = 'TODO'
+    },
+    srcoffset = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    dstoffset = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    count = {
+      type = 'number',
+      default = 'nil',
+      description = 'TODO'
+    },
+    size = {
+      type = 'number',
+      default = 'nil',
+      description = 'TODO'
+    },
+    srcx = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    srcy = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    dstx = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    dsty = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    width = {
+      type = 'number',
+      default = 'nil',
+      description = 'TODO'
+    },
+    height = {
+      type = 'number',
+      default = 'nil',
+      description = 'TODO'
+    },
+    srclayer = {
+      type = 'number',
+      default = '1',
+      description = 'TODO'
+    },
+    dstlayer = {
+      type = 'number',
+      default = '1',
+      description = 'TODO'
+    },
+    layers = {
+      type = 'number',
+      default = 'nil',
+      description = 'TODO'
+    },
+    srclevel = {
+      type = 'number',
+      default = '1',
+      description = 'TODO'
+    },
+    dstlevel = {
+      type = 'number',
+      default = '1',
+      description = 'TODO'
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      description = 'Copy table data to a Buffer.',
+      arguments = { 'table', 'bufferdst', 'srcindex', 'dstindex', 'count' },
+      returns = {}
+    },
+    {
+      description = 'Copy binary data to a Buffer.',
+      arguments = { 'blob', 'bufferdst', 'srcoffset', 'dstoffset', 'size' },
+      returns = {}
+    },
+    {
+      description = 'Copy data between Buffers.',
+      arguments = { 'buffersrc', 'bufferdst', 'srcoffset', 'dstoffset', 'size' },
+      returns = {}
+    },
+    {
+      description = 'Copy Image data to a Texture.',
+      arguments = { 'image', 'texturedst', 'srcx', 'srcy', 'dstx', 'dsty', 'width', 'height', 'srclayer', 'dstlayer', 'layers', 'srclevel', 'dstlevel' },
+      returns = {}
+    },
+    {
+      description = 'Copy data between Textures.',
+      arguments = { 'texturesrc', 'texturedst', 'srcx', 'srcy', 'dstx', 'dsty', 'width', 'height', 'srclayer', 'dstlayer', 'layers', 'srclevel', 'dstlevel' },
+      returns = {}
+    },
+    {
+      description = 'Copy tally data to a Buffer.',
+      arguments = { 'tally', 'srcindex', 'dstoffset', 'count' },
+      returns = {}
+    }
+  }
+}

+ 23 - 10
api/lovr/graphics/Pass/cylinder.lua

@@ -3,39 +3,52 @@ return {
   summary = 'Draw a cylinder.',
   description = 'TODO',
   arguments = {
-    {
-      name = 'transform',
+    transform = {
       type = 'TransformXY2',
       description = [[
         The transform to apply to the cylinder.  The x and y scale is the radius, the z scale is the
         length.
       ]]
     },
-    {
-      name = 'capped',
+    p1 = {
+      type = 'Point3',
+      description = 'The starting point of the cylinder.'
+    },
+    p2 = {
+      type = 'Point3',
+      description = 'The ending point of the cylinder.'
+    },
+    capped = {
       type = 'boolean',
       default = 'true',
       description = 'Whether the tops and bottoms of the cylinder should be rendered.'
     },
-    {
-      name = 'angle1',
+    angle1 = {
       type = 'number',
       default = '0',
       description = 'The angle of the beginning of the arc.'
     },
-    {
-      name = 'angle2',
+    angle2 = {
       type = 'number',
       default = '2 * math.pi',
       description = 'angle of the end of the arc.'
     },
-    {
-      name = 'segments',
+    segments = {
       type = 'number',
       default = '64',
       description = 'The number of circular segments to render.'
     }
   },
+  variants = {
+    {
+      arguments = { 'transform', 'capped', 'angle1', 'angle2', 'segments' },
+      returns = {}
+    },
+    {
+      arguments = { 'p1', 'p2', 'capped', 'angle1', 'angle2', 'segments' },
+      returns = {}
+    }
+  },
   returns = {},
   notes = 'TODO'
 }

+ 12 - 0
api/lovr/graphics/Pass/getClear.lua

@@ -0,0 +1,12 @@
+return {
+  summary = 'TODO',
+  description = 'TODO',
+  arguments = {},
+  returns = {
+    clears = {
+      type = 'table',
+      description = 'TODO'
+    }
+  },
+  notes = 'TODO'
+}

+ 17 - 0
api/lovr/graphics/Pass/getDimensions.lua

@@ -0,0 +1,17 @@
+return {
+  summary = 'TODO',
+  description = 'TODO',
+  arguments = {},
+  returns = {
+    {
+      name = 'width',
+      type = 'number',
+      description = 'TODO'
+    },
+    {
+      name = 'height',
+      type = 'number',
+      description = 'TODO'
+    }
+  }
+}

+ 12 - 0
api/lovr/graphics/Pass/getHeight.lua

@@ -0,0 +1,12 @@
+return {
+  summary = 'TODO',
+  description = 'TODO',
+  arguments = {},
+  returns = {
+    {
+      name = 'height',
+      type = 'number',
+      description = 'TODO'
+    }
+  }
+}

+ 12 - 0
api/lovr/graphics/Pass/getSampleCount.lua

@@ -0,0 +1,12 @@
+return {
+  summary = 'TODO',
+  description = 'TODO',
+  arguments = {},
+  returns = {
+    {
+      name = 'samples',
+      type = 'number',
+      description = 'TODO'
+    }
+  }
+}

+ 12 - 0
api/lovr/graphics/Pass/getTarget.lua

@@ -0,0 +1,12 @@
+return {
+  summary = 'TODO',
+  description = 'TODO',
+  arguments = {},
+  returns = {
+    {
+      name = 'target',
+      type = 'table',
+      description = 'TODO'
+    }
+  }
+}

+ 12 - 0
api/lovr/graphics/Pass/getViewCount.lua

@@ -0,0 +1,12 @@
+return {
+  summary = 'TODO',
+  description = 'TODO',
+  arguments = {},
+  returns = {
+    {
+      name = 'views',
+      type = 'number',
+      description = 'TODO'
+    }
+  }
+}

+ 12 - 0
api/lovr/graphics/Pass/getWidth.lua

@@ -0,0 +1,12 @@
+return {
+  summary = 'TODO',
+  description = 'TODO',
+  arguments = {},
+  returns = {
+    {
+      name = 'width',
+      type = 'number',
+      description = 'TODO'
+    }
+  }
+}

+ 20 - 0
api/lovr/graphics/Pass/mesh.lua

@@ -12,6 +12,22 @@ return {
       type = 'Buffer',
       description = 'TODO'
     },
+    draws = {
+      type = 'Buffer',
+      description = 'TODO'
+    },
+    drawcount = {
+      type = 'number',
+      description = 'TODO'
+    },
+    offset = {
+      type = 'number',
+      description = 'TODO'
+    },
+    stride = {
+      type = 'number',
+      description = 'TODO'
+    }
     transform = {
       type = 'transform',
       description = 'The transform to apply to the mesh.'
@@ -48,6 +64,10 @@ return {
     {
       arguments = { 'vertices', 'indices', 'transform', 'start', 'count', 'instances' },
       returns = {}
+    },
+    {
+      arguments = { 'vertices', 'indices', 'draws', 'drawcount', 'offset', 'stride' },
+      returns = {}
     }
   },
   notes = 'TODO'

+ 24 - 0
api/lovr/graphics/Pass/mipmap.lua

@@ -0,0 +1,24 @@
+return {
+  tag = 'transfer',
+  summary = 'Generate mipmaps for a texture.',
+  description = 'TODO',
+  arguments = {
+    {
+      name = 'texture',
+      type = 'Texture',
+      description = 'TODO'
+    },
+    {
+      name = 'base',
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    {
+      name = 'count',
+      type = 'number',
+      default = 'nil',
+      description = 'TODO'
+    }
+  }
+}

+ 75 - 0
api/lovr/graphics/Pass/read.lua

@@ -0,0 +1,75 @@
+return {
+  tag = 'transfer',
+  summary = 'Download data from a GPU resource.',
+  description = 'TODO',
+  arguments = {
+    buffer = {
+      type = 'Buffer',
+      description = 'TODO'
+    },
+    texture = {
+      type = 'Texture',
+      description = 'TODO'
+    },
+    tally = {
+      type = 'Tally',
+      description = 'TODO'
+    },
+    index = {
+      type = 'number',
+      description = 'TODO'
+    },
+    count = {
+      type = 'number',
+      description = 'TODO'
+    },
+    x = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    y = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    layer = {
+      type = 'number',
+      default = '1',
+      description = 'TODO'
+    },
+    level = {
+      type = 'number',
+      default = '1',
+      description = 'TODO'
+    },
+    width = {
+      type = 'number',
+      default = 'nil',
+      description = 'TODO'
+    },
+    height = {
+      type = 'number',
+      default = 'nil',
+      description = 'TODO'
+    },
+    readback = {
+      type = 'Readback',
+      description = 'TODO'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'buffer', 'index', 'count' },
+      returns = { 'readback' }
+    },
+    {
+      arguments = { 'texture', 'x', 'y', 'layer', 'level', 'width', 'height' },
+      returns = { 'readback' }
+    },
+    {
+      arguments = { 'tally', 'index', 'count' },
+      returns = { 'readback' }
+    }
+  }
+}

+ 9 - 0
api/lovr/graphics/Pass/reset.lua

@@ -0,0 +1,9 @@
+return {
+  summary = 'Reset the Pass.',
+  description = 'TODO',
+  arguments = {},
+  returns = {},
+  related = {
+    'lovr.graphics.submit'
+  }
+}

+ 30 - 0
api/lovr/graphics/Pass/setClear.lua

@@ -0,0 +1,30 @@
+return {
+  summary = 'TODO',
+  description = 'TODO',
+  arguments = {
+    table = {
+      type = 'table',
+      description = 'TODO'
+    },
+    color = {
+      type = 'Color',
+      description = 'TODO'
+    },
+    ['...'] = {
+      type = '*',
+      description = 'Additional colors.'
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'table' },
+      returns = {}
+    },
+    {
+      arguments = { 'color', '...' },
+      returns = {}
+    }
+  },
+  notes = 'TODO'
+}

+ 16 - 0
api/lovr/graphics/Pass/setFont.lua

@@ -0,0 +1,16 @@
+return {
+  tag = 'pipeline',
+  summary = 'Enable or disable depth clamp.',
+  description = 'TODO',
+  arguments = {
+    {
+      name = 'font',
+      type = 'Font',
+      description = 'The Font to use when rendering text.'
+    }
+  },
+  returns = {},
+  related = {
+    'Pass:text'
+  }
+}

+ 7 - 28
api/lovr/graphics/Pass/setProjection.lua

@@ -7,8 +7,9 @@ return {
     used for other types of projections like orthographic, oblique, etc.  There is also a shorthand
     string "orthographic" that can be used to configure an orthographic projection.
 
-    Up to 6 views are supported, one for each eye.  When rendering to the headset, both projections
-    are changed to match the ones used by the headset.
+    Up to 6 views are supported.  When rendering to the headset, both projections are changed to
+    match the ones used by the headset.  This is also available by calling
+    `lovr.headset.getViewAngles`.
   ]],
   arguments = {
     view = {
@@ -44,28 +45,6 @@ return {
     matrix = {
       type = 'Mat4',
       description = 'The projection matrix for the view.'
-    },
-    orthographic = {
-      type = 'string',
-      description = 'The shortcut string \'orthographic\'.'
-    },
-    width = {
-      type = 'number',
-      description = 'The width of the orthographic projection.'
-    },
-    height = {
-      type = 'number',
-      description = 'The height of the orthographic projection.'
-    },
-    clipNear = {
-      type = 'number',
-      default = '-1.0',
-      description = 'The near clipping plane.'
-    },
-    clipFar = {
-      type = 'number',
-      default = '1.0',
-      description = 'The far clipping plane.'
     }
   },
   returns = {},
@@ -77,12 +56,12 @@ return {
     {
       arguments = { 'view', 'matrix' },
       returns = {}
-    },
-    {
-      arguments = { 'view', 'orthographic', 'width', 'height', 'clipNear', 'clipFar' },
-      returns = {}
     }
   },
+  notes = [[
+    A far clipping plane of 0.0 can be used for an infinite far plane with reversed Z range.  This
+    is the default.
+  ]],
   related = {
     'lovr.headset.getViewAngles',
     'lovr.headset.getViewCount',

+ 29 - 0
api/lovr/graphics/Pass/setTarget.lua

@@ -0,0 +1,29 @@
+return {
+  summary = 'TODO',
+  description = 'TODO',
+  arguments = {
+    texture = {
+      type = 'Texture',
+      description = 'TODO'
+    },
+    ['...'] = {
+      type = 'Texture',
+      description = 'Additional textures.'
+    },
+    textures = {
+      type = 'table',
+      description = 'A table of textures, with an optional `depth` key for the depth texture.'
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'texture', '...' },
+      returns = {}
+    },
+    {
+      arguments = { 'textures' },
+      returns = {}
+    }
+  }
+}

+ 2 - 3
api/lovr/graphics/Pass/setViewPose.lua

@@ -5,9 +5,8 @@ return {
     Sets the pose for a single view.  Objects rendered in this view will appear as though the camera
     is positioned using the given pose.
 
-    Up to 6 views are supported, one for each eye.  When rendering to the headset, both views are
-    changed to match the estimated eye positions.  These view poses are also available using
-    `lovr.headset.getViewPose`.
+    Up to 6 views are supported.  When rendering to the headset, views are changed to match the eye
+    positions.  These view poses are also available using `lovr.headset.getViewPose`.
   ]],
   arguments = {
     view = {

+ 18 - 0
api/lovr/graphics/Pass/tick.lua

@@ -0,0 +1,18 @@
+return {
+  tag = 'transfer',
+  summary = 'Begin measuring GPU counters.',
+  description = 'TODO',
+  arguments = {
+    {
+      name = 'tally',
+      type = 'Tally',
+      description = 'TODO'
+    },
+    {
+      name = 'index',
+      type = 'number',
+      description = 'TODO'
+    }
+  },
+  returns = {}
+}

+ 18 - 0
api/lovr/graphics/Pass/tock.lua

@@ -0,0 +1,18 @@
+return {
+  tag = 'transfer',
+  summary = 'Stop measuring GPU counters.',
+  description = 'TODO',
+  arguments = {
+    {
+      name = 'tally',
+      type = 'Tally',
+      description = 'TODO'
+    },
+    {
+      name = 'index',
+      type = 'number',
+      description = 'TODO'
+    }
+  },
+  returns = {}
+}

+ 1 - 1
api/lovr/graphics/StackType.lua

@@ -7,7 +7,7 @@ return {
       description = 'TODO'
     },
     {
-      name = 'pipeline',
+      name = 'state',
       descriptioin = 'TODO'
     }
   }