Godot Version
4.5.1 Stable mono
Question
when trying to get BufferGetDataAsync from a buffer of a compute shader, it doesn’t get the data at all, it doesn’t even execute the function that is attached to the callable, first thing that comes to mind is the data size being 64MB, but weirdly also, the BufferGetData (non-async) works just fine, so now i don’t know whats going on.
//pseudocode kinda
//callable
Callable voronoi_get_async_cb;
voronoi_get_async_cb = new Callable(this, nameof(voronoi_noise_async));
Rid voronoi_return_buffer = rd.StorageBufferCreate(67108864 * span_length);
//The shader boilerplate
RDUniform uniformVoronoi = new RDUniform();
uniformVoronoi.UniformType = RenderingDevice.UniformType.StorageBuffer;
uniformVoronoi.Binding = 0;
uniformVoronoi.AddId(voronoi_return_buffer);
Rid uniform_set_voronoi = rd.UniformSetCreate([uniformVoronoi, uniformChunkOff], voronoi_gpu, 0);
long compute_list_voronoi = rd.ComputeListBegin();
rd.ComputeListBindComputePipeline(compute_list_voronoi, pipeline_voronoi);
rd.ComputeListBindUniformSet(compute_list_voronoi, uniform_set_voronoi, 0);
rd.ComputeListDispatch(compute_list_voronoi, 512 * span_length, 1, 1);
rd.ComputeListEnd();
rd.Submit();
rd.Sync();
// packed[1] = byte_to_float(rd.BufferGetData(voronoi_return_buffer));
rd.BufferGetDataAsync(voronoi_return_buffer, voronoi_get_async_cb);
//the function the callable is attached to
public void voronoi_noise_async(byte[] data)
{
Span<byte> byte_span = new Span<byte>(data);
Span<float> to_float = MemoryMarshal.Cast<byte, float>(byte_span);
voronoi_result = to_float.ToArray();
}
thanks in advance. (also the cpu code above is executed on the main thread)