Compute Shader#
- class arcade.gl.ComputeShader(ctx: Context, glsl_source: str)[source]#
Bases:
object
A higher level wrapper for an OpenGL compute shader.
- use()[source]#
Use/activate the compute shader.
Note
This is not necessary to call in normal use cases since
run()
already does this for you.
- run(group_x=1, group_y=1, group_z=1) None [source]#
Run the compute shader.
When running a compute shader we specify how many work groups should be executed on the
x
,y
andz
dimension. The size of the work group is defined in the compute shader.// Work group with one dimension. 16 work groups executed. layout(local_size_x=16) in; // Work group with two dimensions. 256 work groups executed. layout(local_size_x=16, local_size_y=16) in; // Work group with three dimensions. 4096 work groups executed. layout(local_size_x=16, local_size_y=16, local_size_z=16) in;
Group sizes are
1
by default. If your compute shader doesn’t specify a size for a dimension or uses1
as size you don’t have to supply this parameter.