Blender V4.5
gpu_uniform_buffer.cc File Reference
#include "MEM_guardedalloc.h"
#include <cstring>
#include "BLI_listbase.h"
#include "BLI_math_base.h"
#include "BLI_string.h"
#include "BKE_global.hh"
#include "gpu_backend.hh"
#include "gpu_node_graph.hh"
#include "GPU_context.hh"
#include "GPU_material.hh"
#include "GPU_uniform_buffer.hh"
#include "gpu_context_private.hh"
#include "gpu_uniform_buffer_private.hh"

Go to the source code of this file.

Namespaces

namespace  blender
namespace  blender::gpu

Macros

#define MAX_UBO_GPU_TYPE   GPU_MAT4

Functions

Uniform buffer from GPUInput list
static eGPUType get_padded_gpu_type (LinkData *link)
static int inputs_cmp (const void *a, const void *b)
static void buffer_from_list_inputs_sort (ListBase *inputs)
static size_t buffer_size_from_list (ListBase *inputs)
static void buffer_fill_from_list (void *data, ListBase *inputs)
C-API
GPUUniformBuf * GPU_uniformbuf_create_ex (size_t size, const void *data, const char *name)
GPUUniformBuf * GPU_uniformbuf_create_from_list (ListBase *inputs, const char *name)
void GPU_uniformbuf_free (GPUUniformBuf *ubo)
void GPU_uniformbuf_update (GPUUniformBuf *ubo, const void *data)
void GPU_uniformbuf_bind (GPUUniformBuf *ubo, int slot)
void GPU_uniformbuf_bind_as_ssbo (GPUUniformBuf *ubo, int slot)
void GPU_uniformbuf_unbind (GPUUniformBuf *ubo)
void GPU_uniformbuf_debug_unbind_all ()
void GPU_uniformbuf_clear_to_zero (GPUUniformBuf *ubo)

Macro Definition Documentation

◆ MAX_UBO_GPU_TYPE

#define MAX_UBO_GPU_TYPE   GPU_MAT4

Function Documentation

◆ buffer_fill_from_list()

void buffer_fill_from_list ( void * data,
ListBase * inputs )
inlinestatic

◆ buffer_from_list_inputs_sort()

void buffer_from_list_inputs_sort ( ListBase * inputs)
static

◆ buffer_size_from_list()

size_t buffer_size_from_list ( ListBase * inputs)
inlinestatic

◆ get_padded_gpu_type()

eGPUType get_padded_gpu_type ( LinkData * link)
static

We need to pad some data types (vec3) on the C side To match the GPU expected memory block alignment.

Definition at line 61 of file gpu_uniform_buffer.cc.

References LinkData::data, get_padded_gpu_type(), GPU_backend_get_type(), GPU_BACKEND_METAL, GPU_FLOAT, GPU_VEC3, GPU_VEC4, input, and LinkData::next.

Referenced by buffer_fill_from_list(), buffer_size_from_list(), and get_padded_gpu_type().

◆ GPU_uniformbuf_bind()

◆ GPU_uniformbuf_bind_as_ssbo()

void GPU_uniformbuf_bind_as_ssbo ( GPUUniformBuf * ubo,
int slot )

◆ GPU_uniformbuf_clear_to_zero()

void GPU_uniformbuf_clear_to_zero ( GPUUniformBuf * ubo)

◆ GPU_uniformbuf_create_ex()

◆ GPU_uniformbuf_create_from_list()

GPUUniformBuf * GPU_uniformbuf_create_from_list ( ListBase * inputs,
const char * name )

◆ GPU_uniformbuf_debug_unbind_all()

void GPU_uniformbuf_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 253 of file gpu_uniform_buffer.cc.

References blender::gpu::Context::debug_unbind_all_ubo(), blender::gpu::Context::get(), and GPU_uniformbuf_debug_unbind_all().

Referenced by blender::draw::command::RecordingState::cleanup(), blender::compositor::ShaderOperation::execute(), GPU_uniformbuf_debug_unbind_all(), and blender::draw::command::StateSet::set().

◆ GPU_uniformbuf_free()

◆ GPU_uniformbuf_unbind()

◆ GPU_uniformbuf_update()

◆ inputs_cmp()

int inputs_cmp ( const void * a,
const void * b )
static

Returns 1 if the first item should be after second item. We make sure the vec4 uniforms come first.

Definition at line 82 of file gpu_uniform_buffer.cc.

References b, LinkData::data, inputs_cmp(), and GPUInput::type.

Referenced by buffer_from_list_inputs_sort(), and inputs_cmp().