浏览代码

Add missing enum summaries and validate it;

bjorn 1 年之前
父节点
当前提交
1c08adbd06

+ 9 - 0
api/init.lua

@@ -3280,6 +3280,7 @@ return {
         },
         },
         {
         {
           name = "TextureFormat",
           name = "TextureFormat",
+          summary = "Different pixel formats in `Image` and `Texture` objects.",
           description = "Different data layouts for pixels in `Image` and `Texture` objects.\n\nFormats starting with `d` are depth formats, used for depth/stencil render targets.\n\nFormats starting with `bc` and `astc` are compressed formats.  Compressed formats have better performance since they stay compressed on the CPU and GPU, reducing the amount of memory bandwidth required to look up all the pixels needed for shading.\n\nFormats without the `f` suffix are unsigned normalized formats, which store values in the range `[0,1]`.  The `f` suffix indicates a floating point format which can store values outside this range, and is used for HDR rendering or storing data in a texture.",
           description = "Different data layouts for pixels in `Image` and `Texture` objects.\n\nFormats starting with `d` are depth formats, used for depth/stencil render targets.\n\nFormats starting with `bc` and `astc` are compressed formats.  Compressed formats have better performance since they stay compressed on the CPU and GPU, reducing the amount of memory bandwidth required to look up all the pixels needed for shading.\n\nFormats without the `f` suffix are unsigned normalized formats, which store values in the range `[0,1]`.  The `f` suffix indicates a floating point format which can store values outside this range, and is used for HDR rendering or storing data in a texture.",
           key = "TextureFormat",
           key = "TextureFormat",
           module = "lovr.data",
           module = "lovr.data",
@@ -9713,6 +9714,7 @@ return {
         },
         },
         {
         {
           name = "DataLayout",
           name = "DataLayout",
+          summary = "Different ways of padding GPU buffer data.",
           description = "The different ways to pack Buffer fields into memory.\n\nThe default is `packed`, which is suitable for vertex buffers and index buffers.  It doesn't add any padding between elements, and so it doesn't waste any space.  However, this layout won't necessarily work for uniform buffers and storage buffers.\n\nThe `std140` layout corresponds to the std140 layout used for uniform buffers in GLSL.  It adds the most padding between fields, and requires the stride to be a multiple of 16.  Example:\n\n    layout(std140) uniform ObjectScales { float scales[64]; };\n\nThe `std430` layout corresponds to the std430 layout used for storage buffers in GLSL.  It adds some padding between certain types, and may round up the stride.  Example:\n\n    layout(std430) buffer TileSizes { vec2 sizes[]; }",
           description = "The different ways to pack Buffer fields into memory.\n\nThe default is `packed`, which is suitable for vertex buffers and index buffers.  It doesn't add any padding between elements, and so it doesn't waste any space.  However, this layout won't necessarily work for uniform buffers and storage buffers.\n\nThe `std140` layout corresponds to the std140 layout used for uniform buffers in GLSL.  It adds the most padding between fields, and requires the stride to be a multiple of 16.  Example:\n\n    layout(std140) uniform ObjectScales { float scales[64]; };\n\nThe `std430` layout corresponds to the std430 layout used for storage buffers in GLSL.  It adds some padding between certain types, and may round up the stride.  Example:\n\n    layout(std430) buffer TileSizes { vec2 sizes[]; }",
           key = "DataLayout",
           key = "DataLayout",
           module = "lovr.graphics",
           module = "lovr.graphics",
@@ -9739,6 +9741,7 @@ return {
         },
         },
         {
         {
           name = "DataType",
           name = "DataType",
+          summary = "Different types for `Buffer` fields.",
           description = "Different types for `Buffer` fields.  These are scalar, vector, or matrix types, usually packed into small amounts of space to reduce the amount of memory they occupy.\n\nThe names are encoded as follows:\n\n- The data type:\n  - `i` for signed integer\n  - `u` for unsigned integer\n  - `sn` for signed normalized (-1 to 1)\n  - `un` for unsigned normalized (0 to 1)\n  - `f` for floating point\n- The bit depth of each component\n- The letter `x` followed by the component count (for vectors)",
           description = "Different types for `Buffer` fields.  These are scalar, vector, or matrix types, usually packed into small amounts of space to reduce the amount of memory they occupy.\n\nThe names are encoded as follows:\n\n- The data type:\n  - `i` for signed integer\n  - `u` for unsigned integer\n  - `sn` for signed normalized (-1 to 1)\n  - `un` for unsigned normalized (0 to 1)\n  - `f` for floating point\n- The bit depth of each component\n- The letter `x` followed by the component count (for vectors)",
           key = "DataType",
           key = "DataType",
           module = "lovr.graphics",
           module = "lovr.graphics",
@@ -10234,6 +10237,7 @@ return {
         },
         },
         {
         {
           name = "TextureType",
           name = "TextureType",
+          summary = "The different types of textures.",
           description = "Different types of textures.  Textures are multidimensional blocks of GPU memory, and the texture's type determines how many dimensions there are, and adds some semantics about what the 3rd dimension means.",
           description = "Different types of textures.  Textures are multidimensional blocks of GPU memory, and the texture's type determines how many dimensions there are, and adds some semantics about what the 3rd dimension means.",
           key = "TextureType",
           key = "TextureType",
           module = "lovr.graphics",
           module = "lovr.graphics",
@@ -10258,6 +10262,7 @@ return {
         },
         },
         {
         {
           name = "TextureUsage",
           name = "TextureUsage",
+          summary = "Different operations `Texture` can be used for.",
           description = "These are the different things `Texture`s can be used for.  When creating a Texture, a set of these flags can be provided, restricting what operations are allowed on the texture.  Using a smaller set of flags may improve performance.  If none are provided, the only usage flag applied is `sample`.",
           description = "These are the different things `Texture`s can be used for.  When creating a Texture, a set of these flags can be provided, restricting what operations are allowed on the texture.  Using a smaller set of flags may improve performance.  If none are provided, the only usage flag applied is `sample`.",
           key = "TextureUsage",
           key = "TextureUsage",
           module = "lovr.graphics",
           module = "lovr.graphics",
@@ -23783,6 +23788,7 @@ return {
       enums = {
       enums = {
         {
         {
           name = "Device",
           name = "Device",
+          summary = "Different types of input devices supported by the `lovr.headset` module.",
           description = "Different types of input devices supported by the `lovr.headset` module.",
           description = "Different types of input devices supported by the `lovr.headset` module.",
           key = "Device",
           key = "Device",
           module = "lovr.headset",
           module = "lovr.headset",
@@ -23926,6 +23932,7 @@ return {
         },
         },
         {
         {
           name = "DeviceAxis",
           name = "DeviceAxis",
+          summary = "Different axes on an input device.",
           description = "Axes on an input device.",
           description = "Axes on an input device.",
           key = "DeviceAxis",
           key = "DeviceAxis",
           module = "lovr.headset",
           module = "lovr.headset",
@@ -23954,6 +23961,7 @@ return {
         },
         },
         {
         {
           name = "DeviceButton",
           name = "DeviceButton",
+          summary = "Different buttons on an input device.",
           description = "Buttons on an input device.",
           description = "Buttons on an input device.",
           key = "DeviceButton",
           key = "DeviceButton",
           module = "lovr.headset",
           module = "lovr.headset",
@@ -24062,6 +24070,7 @@ return {
         },
         },
         {
         {
           name = "ViewMask",
           name = "ViewMask",
+          summary = "Different eyes a Layer can show up in.",
           description = "The different eyes a Layer can show up in",
           description = "The different eyes a Layer can show up in",
           key = "ViewMask",
           key = "ViewMask",
           module = "lovr.headset",
           module = "lovr.headset",

+ 1 - 0
api/lovr/data/TextureFormat.lua

@@ -1,4 +1,5 @@
 return {
 return {
+  summary = 'Different pixel formats in `Image` and `Texture` objects.',
   description = [[
   description = [[
     Different data layouts for pixels in `Image` and `Texture` objects.
     Different data layouts for pixels in `Image` and `Texture` objects.
 
 

+ 1 - 0
api/lovr/graphics/DataLayout.lua

@@ -1,4 +1,5 @@
 return {
 return {
+  summary = 'Different ways of padding GPU buffer data.',
   description = [[
   description = [[
     The different ways to pack Buffer fields into memory.
     The different ways to pack Buffer fields into memory.
 
 

+ 1 - 0
api/lovr/graphics/DataType.lua

@@ -1,4 +1,5 @@
 return {
 return {
+  summary = 'Different types for `Buffer` fields.',
   description = [[
   description = [[
     Different types for `Buffer` fields.  These are scalar, vector, or matrix types, usually packed
     Different types for `Buffer` fields.  These are scalar, vector, or matrix types, usually packed
     into small amounts of space to reduce the amount of memory they occupy.
     into small amounts of space to reduce the amount of memory they occupy.

+ 1 - 0
api/lovr/graphics/TextureType.lua

@@ -1,4 +1,5 @@
 return {
 return {
+  summary = 'The different types of textures.',
   description = [[
   description = [[
     Different types of textures.  Textures are multidimensional blocks of GPU memory, and the
     Different types of textures.  Textures are multidimensional blocks of GPU memory, and the
     texture's type determines how many dimensions there are, and adds some semantics about what the
     texture's type determines how many dimensions there are, and adds some semantics about what the

+ 1 - 0
api/lovr/graphics/TextureUsage.lua

@@ -1,4 +1,5 @@
 return {
 return {
+  summary = 'Different operations `Texture` can be used for.',
   description = [[
   description = [[
     These are the different things `Texture`s can be used for.  When creating a Texture, a set of
     These are the different things `Texture`s can be used for.  When creating a Texture, a set of
     these flags can be provided, restricting what operations are allowed on the texture.  Using a
     these flags can be provided, restricting what operations are allowed on the texture.  Using a

+ 1 - 0
api/lovr/headset/Device.lua

@@ -1,4 +1,5 @@
 return {
 return {
+  summary = 'Different types of input devices supported by the `lovr.headset` module.',
   description = 'Different types of input devices supported by the `lovr.headset` module.',
   description = 'Different types of input devices supported by the `lovr.headset` module.',
   values = {
   values = {
     {
     {

+ 1 - 0
api/lovr/headset/DeviceAxis.lua

@@ -1,4 +1,5 @@
 return {
 return {
+  summary = 'Different axes on an input device.',
   description = 'Axes on an input device.',
   description = 'Axes on an input device.',
   values = {
   values = {
     {
     {

+ 1 - 0
api/lovr/headset/DeviceButton.lua

@@ -1,4 +1,5 @@
 return {
 return {
+  summary = 'Different buttons on an input device.',
   description = 'Buttons on an input device.',
   description = 'Buttons on an input device.',
   values = {
   values = {
     {
     {

+ 1 - 0
api/lovr/headset/ViewMask.lua

@@ -1,4 +1,5 @@
 return {
 return {
+  summary = 'Different eyes a Layer can show up in.',
   description = 'The different eyes a Layer can show up in',
   description = 'The different eyes a Layer can show up in',
   values = {
   values = {
     {
     {

+ 3 - 0
api/main.lua

@@ -273,6 +273,9 @@ local function validateRelated(item)
 end
 end
 
 
 local function validateEnum(enum)
 local function validateEnum(enum)
+  warnIf(not enum.summary, 'Enum %s is missing summary', enum.name)
+  warnIf(not enum.description, 'Enum %s is missing description', enum.name)
+
   for i, value in ipairs(enum.values) do
   for i, value in ipairs(enum.values) do
     warnIf(not value.name, 'Enum %s value #%d is missing name', enum.name, i)
     warnIf(not value.name, 'Enum %s value #%d is missing name', enum.name, i)
     warnIf(not value.description, 'Enum %s value #%d is missing description', enum.name, i)
     warnIf(not value.description, 'Enum %s value #%d is missing description', enum.name, i)