Get the latest Blender, older versions, or experimental builds.
Stay up-to-date with the new features in the latest Blender releases.
Access production assets and knowledge from the open movies.
Documentation on the usage and features in Blender.
Latest development updates, by Blender developers.
Guidelines, release notes and development docs.
A platform to collect and share results of the Blender Benchmark.
The yearly event that brings the community together.
Support core development with a monthly contribution.
Perform a single donation with more payment options available.
Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.
/* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*
* GPU Compute Pipeline
* Allows to dispatch compute shader tasks on the GPU.
* Every dispatch is sent to the active `GPUContext`.
*/
#pragma once
#include "BLI_sys_types.h"
#include "GPU_shader.h"
#include "GPU_storage_buffer.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Dispatch a compute shader task.
* The number of work groups (aka thread groups) is bounded by `GPU_max_work_group_count()` which
* might be different in each of the 3 dimensions.
void GPU_compute_dispatch(GPUShader *shader,
uint groups_x_len,
uint groups_y_len,
uint groups_z_len);
* Dispatch a compute shader task. The size of the dispatch is sourced from a \a indirect_buf
* which must follow this layout:
* \code{.c}
* typedef struct {
* uint groups_x_len;
* uint groups_y_len;
* uint groups_z_len;
* } DispatchIndirectCommand;
* \encode
* \note The writes to the \a indirect_buf do not need to be synchronized as a memory barrier is
* emitted internally.
void GPU_compute_dispatch_indirect(GPUShader *shader, GPUStorageBuf *indirect_buf);
}