Browse Source

Shader:sendImage;

bjorn 7 years ago
parent
commit
2fa2fae837

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


+ 1 - 0
api/lovr/graphics/Shader/send.lua

@@ -41,6 +41,7 @@ return {
     ]=]
   },
   related = {
+    'ShaderBlock:sendBlock',
     'Shader:sendBlock'
   }
 }

+ 2 - 1
api/lovr/graphics/Shader/sendBlock.lua

@@ -25,7 +25,7 @@ return {
   },
   returns = {},
   notes = [[
-    The shader does not need to send it a block.
+    The Shader does not need to be active to send it a block.
 
     Make sure the ShaderBlock's variables line up with the block variables declared in the shader
     code, otherwise you'll get garbage data in the block.  An easy way to do this is to use
@@ -33,6 +33,7 @@ return {
   ]],
   related = {
     'Shader:send',
+    'ShaderBlock:send',
     'ShaderBlock:getShaderCode',
     'UniformAccess',
     'ShaderBlock'

+ 52 - 0
api/lovr/graphics/Shader/sendImage.lua

@@ -0,0 +1,52 @@
+return {
+  summary = 'Send a Texture to a Shader for writing.',
+  description = [[
+    Sends a Texture to a Shader for writing.  This is meant to be used with compute shaders and only
+    works with uniforms declared as `image2D`, `imageCube`, `image2DArray`, and `image3D`.  The
+    normal `Shader:send` function accepts Textures and should be used most of the time.
+  ]],
+  arguments = {
+    name = {
+      name = 'name',
+      type = 'string',
+      description = 'The name of the image uniform.'
+    },
+    index = {
+      type = 'number',
+      description = 'The array index to set.'
+    },
+    slice = {
+      type = 'number',
+      default = 'nil',
+      description = 'The slice of a cube, array, or volume texture to use, or nil for all slices.'
+    },
+    mipmap = {
+      type = 'number',
+      default = '1',
+      description = 'The mipmap of the texture to use.'
+    },
+    access = {
+      type = 'UniformAccess',
+      default = 'readwrite',
+      description = 'Whether the image will be read from, written to, or both.'
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'name', 'slice', 'mipmap', 'access' },
+      returns = {}
+    },
+    {
+      arguments = { 'name', 'index', 'slice', 'mipmap', 'access' },
+      returns = {}
+    }
+  },
+  related = {
+    'Shader:send',
+    'ShaderBlock:send',
+    'ShaderBlock:getShaderCode',
+    'UniformAccess',
+    'ShaderBlock'
+  }
+}

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