Blender V5.0
GPU_storage_buffer.hh File Reference
#include "GPU_texture.hh"
#include "GPU_vertex_buffer.hh"

Go to the source code of this file.

Namespaces

namespace  blender
namespace  blender::gpu

Macros

#define GPU_storagebuf_create(size)

Functions

blender::gpu::StorageBufGPU_storagebuf_create_ex (size_t size, const void *data, GPUUsageType usage, const char *name)
void GPU_storagebuf_free (blender::gpu::StorageBuf *ssbo)
void GPU_storagebuf_usage_size_set (blender::gpu::StorageBuf *ssbo, size_t size)
void GPU_storagebuf_update (blender::gpu::StorageBuf *ssbo, const void *data)
void GPU_storagebuf_bind (blender::gpu::StorageBuf *ssbo, int slot)
void GPU_storagebuf_unbind (blender::gpu::StorageBuf *ssbo)
void GPU_storagebuf_debug_unbind_all ()
void GPU_storagebuf_clear_to_zero (blender::gpu::StorageBuf *ssbo)
void GPU_storagebuf_clear (blender::gpu::StorageBuf *ssbo, uint32_t clear_value)
void GPU_storagebuf_sync_to_host (blender::gpu::StorageBuf *ssbo)
void GPU_storagebuf_read (blender::gpu::StorageBuf *ssbo, void *data)
void GPU_storagebuf_copy_sub_from_vertbuf (blender::gpu::StorageBuf *ssbo, blender::gpu::VertBuf *src, uint dst_offset, uint src_offset, uint copy_size)
 Copy a part of a vertex buffer to a storage buffer.
void GPU_storagebuf_sync_as_indirect_buffer (blender::gpu::StorageBuf *ssbo)

Detailed Description

Storage buffers API. Used to handle many way bigger buffers than Uniform buffers update at once. Make sure that the data structure is compatible with what the implementation expect. (see "7.8 Shader Buffer Variables and Shader Storage Blocks" from the OpenGL spec for more info about std430 layout) Rule of thumb: Padding to 16bytes, don't use vec3.

Definition in file GPU_storage_buffer.hh.

Macro Definition Documentation

◆ GPU_storagebuf_create

#define GPU_storagebuf_create ( size)
Value:
blender::gpu::StorageBuf * GPU_storagebuf_create_ex(size_t size, const void *data, GPUUsageType usage, const char *name)
@ GPU_USAGE_DYNAMIC
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52

Definition at line 29 of file GPU_storage_buffer.hh.

Referenced by blender::ed::space_node::nodelink_batch_init(), and blender::gpu::printf_begin().

Function Documentation

◆ GPU_storagebuf_bind()

◆ GPU_storagebuf_clear()

◆ GPU_storagebuf_clear_to_zero()

◆ GPU_storagebuf_copy_sub_from_vertbuf()

void GPU_storagebuf_copy_sub_from_vertbuf ( blender::gpu::StorageBuf * ssbo,
blender::gpu::VertBuf * src,
uint dst_offset,
uint src_offset,
uint copy_size )

Copy a part of a vertex buffer to a storage buffer.

Parameters
ssbodestination storage buffer
srcsource vertex buffer
dst_offsetwhere to start copying to (in bytes).
src_offsetwhere to start copying from (in bytes).
copy_sizebyte size of the segment to copy.

Definition at line 117 of file gpu_storage_buffer.cc.

References blender::gpu::StorageBuf::copy_sub().

Referenced by blender::eevee::VelocityModule::geometry_steps_fill(), and blender::gpu::tests::test_storage_buffer_copy_from_vertex_buffer().

◆ GPU_storagebuf_create_ex()

◆ GPU_storagebuf_debug_unbind_all()

void GPU_storagebuf_debug_unbind_all ( )

Resets the internal slot usage tracking. But there is no guarantee that this actually undo the bindings for the next draw call. Only has effect when G_DEBUG_GPU is set.

Definition at line 102 of file gpu_storage_buffer.cc.

References blender::gpu::Context::debug_unbind_all_ssbo(), and blender::gpu::Context::get().

Referenced by blender::draw::command::RecordingState::cleanup(), and blender::draw::command::StateSet::set().

◆ GPU_storagebuf_free()

◆ GPU_storagebuf_read()

void GPU_storagebuf_read ( blender::gpu::StorageBuf * ssbo,
void * data )

Read back content of the buffer to CPU for inspection. Slow! Only use for inspection / debugging.

NOTE: If GPU_storagebuf_sync_to_host is called, this command is synchronized against that call. If pending GPU updates to the storage buffer are not yet visible to the host, the command will stall until dependent GPU work has completed.

Otherwise, this command is synchronized against this call and will stall the CPU until the buffer content can be read by the host.

Definition at line 131 of file gpu_storage_buffer.cc.

References data, and blender::gpu::StorageBuf::read().

Referenced by blender::gpu::printf_end(), blender::draw::detail::StorageCommon< T, len, device_only >::read(), blender::gpu::tests::CallData::read_back(), blender::gpu::tests::test_buffer_texture(), blender::gpu::tests::test_shader_compute_ssbo(), blender::gpu::tests::test_storage_buffer_clear(), blender::gpu::tests::test_storage_buffer_clear_byte_pattern(), blender::gpu::tests::test_storage_buffer_clear_zero(), blender::gpu::tests::test_storage_buffer_copy_from_vertex_buffer(), blender::gpu::tests::test_storage_buffer_create_update_read(), and blender::gpu::tests::ShaderSpecializationConst::validate().

◆ GPU_storagebuf_sync_as_indirect_buffer()

void GPU_storagebuf_sync_as_indirect_buffer ( blender::gpu::StorageBuf * ssbo)

Ensure the ssbo is ready to be used as an indirect buffer in GPU_batch_draw_indirect. NOTE: Internally, this is only required for the OpenGL backend.

Definition at line 136 of file gpu_storage_buffer.cc.

References blender::gpu::StorageBuf::sync_as_indirect_buffer().

Referenced by blender::draw::command::DrawMultiBuf::generate_commands().

◆ GPU_storagebuf_sync_to_host()

void GPU_storagebuf_sync_to_host ( blender::gpu::StorageBuf * ssbo)

Explicitly sync updated storage buffer contents back to host within the GPU command stream. This ensures any changes made by the GPU are visible to the host. NOTE: This command is only valid for host-visible storage buffers.

Definition at line 126 of file gpu_storage_buffer.cc.

References blender::gpu::StorageBuf::async_flush_to_host().

Referenced by blender::draw::detail::StorageCommon< T, len, device_only >::async_flush_to_host().

◆ GPU_storagebuf_unbind()

◆ GPU_storagebuf_update()

◆ GPU_storagebuf_usage_size_set()

void GPU_storagebuf_usage_size_set ( blender::gpu::StorageBuf * ssbo,
size_t size )

Limit the size of the storage buffer.

Backends can optimize data transfers using the size that is actually used.

Definition at line 82 of file gpu_storage_buffer.cc.

References blender::gpu::StorageBuf::usage_size_set().

Referenced by blf_batch_draw().