2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2021-05-26 16:49:17 +02:00
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
|
* \ingroup gpu
|
|
|
|
|
*/
|
|
|
|
|
|
2024-03-23 01:24:18 +01:00
|
|
|
#include "GPU_compute.hh"
|
2021-05-26 16:49:17 +02:00
|
|
|
|
|
|
|
|
#include "gpu_backend.hh"
|
2025-08-27 15:43:09 +02:00
|
|
|
#include "gpu_debug_private.hh"
|
2021-05-26 16:49:17 +02:00
|
|
|
|
2025-08-11 09:34:28 +02:00
|
|
|
void GPU_compute_dispatch(blender::gpu::Shader *shader,
|
2021-05-26 16:49:17 +02:00
|
|
|
uint groups_x_len,
|
|
|
|
|
uint groups_y_len,
|
2025-05-19 17:42:55 +02:00
|
|
|
uint groups_z_len,
|
|
|
|
|
const blender::gpu::shader::SpecializationConstants *constants_state)
|
2021-05-26 16:49:17 +02:00
|
|
|
{
|
|
|
|
|
blender::gpu::GPUBackend &gpu_backend = *blender::gpu::GPUBackend::get();
|
2025-05-19 17:42:55 +02:00
|
|
|
GPU_shader_bind(shader, constants_state);
|
2025-08-27 15:43:09 +02:00
|
|
|
#ifndef NDEBUG
|
|
|
|
|
blender::gpu::debug_validate_binding_image_format();
|
|
|
|
|
#endif
|
2021-05-26 16:49:17 +02:00
|
|
|
gpu_backend.compute_dispatch(groups_x_len, groups_y_len, groups_z_len);
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-19 17:42:55 +02:00
|
|
|
void GPU_compute_dispatch_indirect(
|
2025-08-11 09:34:28 +02:00
|
|
|
blender::gpu::Shader *shader,
|
2025-08-11 10:35:53 +02:00
|
|
|
blender::gpu::StorageBuf *indirect_buf_,
|
2025-05-19 17:42:55 +02:00
|
|
|
const blender::gpu::shader::SpecializationConstants *constants_state)
|
2022-03-16 08:58:59 +01:00
|
|
|
{
|
|
|
|
|
blender::gpu::GPUBackend &gpu_backend = *blender::gpu::GPUBackend::get();
|
|
|
|
|
blender::gpu::StorageBuf *indirect_buf = reinterpret_cast<blender::gpu::StorageBuf *>(
|
|
|
|
|
indirect_buf_);
|
|
|
|
|
|
2025-05-19 17:42:55 +02:00
|
|
|
GPU_shader_bind(shader, constants_state);
|
2025-08-27 15:43:09 +02:00
|
|
|
#ifndef NDEBUG
|
|
|
|
|
blender::gpu::debug_validate_binding_image_format();
|
|
|
|
|
#endif
|
2022-03-16 08:58:59 +01:00
|
|
|
gpu_backend.compute_dispatch_indirect(indirect_buf);
|
2021-05-26 16:49:17 +02:00
|
|
|
}
|