A helper class for using compute shaders in Godot 4.
## create new GPUComputer instancevargc:=GPUComputer.new()
# Called when the node enters the scene tree for the first time.func_ready():
## set shader file pathgc.shader_file=load("res://shader.glsl")
## initialize shadergc._load_shader()
## create data array and convert to bytesvarexample_array:=PackedFloat32Array([1.0, 2.0, 3.0, 4.0, 5.0])
varexample_bytes:=example_array.to_byte_array()
## create a buffer from the byte arraygc._add_buffer(0, 0, example_bytes)
## create uniforms from buffers, make render pipeline, set workgroup sizegc._make_pipeline(Vector3i(5, 1, 1), true)
## send to GPUgc._submit()
# Called every frame. 'delta' is the elapsed time since the previous frame.func_process(delta):
## request return datagc._sync()
## get buffer outputvarexample_output_bytes:=gc.output(0, 0)
varexample_output:=example_output_bytes.to_float32_array()
## if you wish to modify the buffer here, you may do so and update it## otherwise this is unnecessarygc._update_buffer(example_output_bytes, 0, 0)
gc._make_pipeline(Vector3i(5, 1, 1))
gc._submit()