GPU: Add indirect dispatch support.
This uses a StorageBuf as the source of indirect dispatch argument. The user needs to make sure the parameters are in the right order. There is no support for argument offset for the moment as there is no need for it. But this might be added in the future. Note that the indirect buffer is synchronized at the backend level. This is done for practical reasons and because this feature is almost always used for GPU driven pipeline.
This commit is contained in:
@@ -35,6 +35,7 @@ class GPUBackend {
|
||||
|
||||
virtual void samplers_update() = 0;
|
||||
virtual void compute_dispatch(int groups_x_len, int groups_y_len, int groups_z_len) = 0;
|
||||
virtual void compute_dispatch_indirect(StorageBuf *indirect_buf) = 0;
|
||||
|
||||
virtual Context *context_alloc(void *ghost_window) = 0;
|
||||
|
||||
|
||||
@@ -7,10 +7,7 @@
|
||||
#include "GPU_compute.h"
|
||||
|
||||
#include "gpu_backend.hh"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "gpu_storage_buffer_private.hh"
|
||||
|
||||
void GPU_compute_dispatch(GPUShader *shader,
|
||||
uint groups_x_len,
|
||||
@@ -22,6 +19,12 @@ void GPU_compute_dispatch(GPUShader *shader,
|
||||
gpu_backend.compute_dispatch(groups_x_len, groups_y_len, groups_z_len);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
void GPU_compute_dispatch_indirect(GPUShader *shader, GPUStorageBuf *indirect_buf_)
|
||||
{
|
||||
blender::gpu::GPUBackend &gpu_backend = *blender::gpu::GPUBackend::get();
|
||||
blender::gpu::StorageBuf *indirect_buf = reinterpret_cast<blender::gpu::StorageBuf *>(
|
||||
indirect_buf_);
|
||||
|
||||
GPU_shader_bind(shader);
|
||||
gpu_backend.compute_dispatch_indirect(indirect_buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user