lovr.graphics.compute
This function runs a compute shader on the GPU. Compute shaders must be created with lovr.graphics.newComputeShader
and they should implement the void compute();
GLSL function. Running a compute shader doesn't actually do anything, but the Shader can modify data stored in Texture
s or ShaderBlock
s to get interesting things to happen.
When running the compute shader, you can specify the number of times to run it in 3 dimensions, which is useful to iterate over large numbers of elements like pixels or array elements.
lovr.graphics.compute(shader, x, y, z)
Arguments
Name | Type | Default | Description |
shader | Shader | The compute shader to run. | |
x | number | 1 | The amount of times to run in the x direction. |
y | number | 1 | The amount of times to run in the y direction. |
z | number | 1 | The amount of times to run in the z direction. |
Returns
Nothing
Notes
Only compute shaders created with lovr.graphics.newComputeShader
can be used here.
There are GPU-specific limits on the x
, y
, and z
values which can be queried in the compute
entry of lovr.graphics.getLimits
.
See also
lovr.graphics.newComputeShader
lovr.graphics.getShader
lovr.graphics.setShader
Shader
lovr.graphics