Browse Source

BlockType;

bjorn 6 years ago
parent
commit
f305ffc429

+ 33 - 8
api/init.lua

@@ -5540,6 +5540,29 @@ return {
             "lovr.graphics.setBlendMode"
           }
         },
+        {
+          name = "BlockType",
+          summary = "Different types of ShaderBlocks.",
+          description = "There are two types of ShaderBlocks that can be used: `uniform` and `compute`.\n\nUniform blocks are read only in shaders, can sometimes be a bit faster than compute blocks, and have a limited size (but the limit will be at least 16KB, you can check `lovr.graphics.getSystemLimits` to check).\n\nCompute blocks can be written to by compute shaders, might be slightly slower than uniform blocks, and have a much, much larger maximum size.",
+          key = "BlockType",
+          module = "lovr.graphics",
+          values = {
+            {
+              name = "uniform",
+              description = "A uniform block."
+            },
+            {
+              name = "compute",
+              description = "A compute block."
+            }
+          },
+          related = {
+            "ShaderBlock",
+            "lovr.graphics.newShaderBlock",
+            "ShaderBlock:getType",
+            "lovr.graphics.getSystemLimits"
+          }
+        },
         {
           name = "CompareMode",
           summary = "Different depth test modes.",
@@ -13160,22 +13183,24 @@ return {
               }
             },
             {
-              name = "isWritable",
-              summary = "Check if Shaders can write to the ShaderBlock.",
-              description = "Returns whether or not compute shaders can write to the ShaderBlock data.  This is set when the block is created using `lovr.graphics.newShaderBlock`.",
-              key = "ShaderBlock:isWritable",
+              name = "getType",
+              summary = "Get the type of the ShaderBlock.",
+              description = "Returns the type of the ShaderBlock.",
+              key = "ShaderBlock:getType",
               module = "lovr.graphics",
               related = {
-                "lovr.graphics.newShaderBlock"
+                "ShaderBlock:getOffset",
+                "lovr.graphics.newShaderBlock",
+                "lovr.graphics.getSystemLimits"
               },
               variants = {
                 {
                   arguments = {},
                   returns = {
                     {
-                      name = "writable",
-                      type = "boolean",
-                      description = "Whether or not the block is writable by Shaders."
+                      name = "type",
+                      type = "BlockType",
+                      description = "The type of the ShaderBlock."
                     }
                   }
                 }

+ 29 - 0
api/lovr/graphics/BlockType.lua

@@ -0,0 +1,29 @@
+return {
+  summary = 'Different types of ShaderBlocks.',
+  description = [[
+    There are two types of ShaderBlocks that can be used: `uniform` and `compute`.
+
+    Uniform blocks are read only in shaders, can sometimes be a bit faster than compute blocks, and
+    have a limited size (but the limit will be at least 16KB, you can check
+    `lovr.graphics.getSystemLimits` to check).
+
+    Compute blocks can be written to by compute shaders, might be slightly slower than uniform
+    blocks, and have a much, much larger maximum size.
+  ]],
+  values = {
+    {
+      name = 'uniform',
+      description = 'A uniform block.'
+    },
+    {
+      name = 'compute',
+      description = 'A compute block.'
+    }
+  },
+  related = {
+    'ShaderBlock',
+    'lovr.graphics.newShaderBlock',
+    'ShaderBlock:getType',
+    'lovr.graphics.getSystemLimits'
+  }
+}

+ 17 - 0
api/lovr/graphics/ShaderBlock/getType.lua

@@ -0,0 +1,17 @@
+return {
+  summary = 'Get the type of the ShaderBlock.',
+  description = 'Returns the type of the ShaderBlock.',
+  arguments = {},
+  returns = {
+    {
+      name = 'type',
+      type = 'BlockType',
+      description = 'The type of the ShaderBlock.'
+    }
+  },
+  related = {
+    'ShaderBlock:getOffset',
+    'lovr.graphics.newShaderBlock',
+    'lovr.graphics.getSystemLimits'
+  }
+}

+ 0 - 18
api/lovr/graphics/ShaderBlock/isWritable.lua

@@ -1,18 +0,0 @@
-return {
-  summary = 'Check if Shaders can write to the ShaderBlock.',
-  description = [[
-    Returns whether or not compute shaders can write to the ShaderBlock data.  This is set when the
-    block is created using `lovr.graphics.newShaderBlock`.
-  ]],
-  arguments = {},
-  returns = {
-    {
-      name = 'writable',
-      type = 'boolean',
-      description = 'Whether or not the block is writable by Shaders.'
-    }
-  },
-  related = {
-    'lovr.graphics.newShaderBlock'
-  }
-}