|
Blender V5.0
|
#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_capabilities.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 GPUType | 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 | |
| blender::gpu::UniformBuf * | GPU_uniformbuf_create_ex (size_t size, const void *data, const char *name) |
| blender::gpu::UniformBuf * | GPU_uniformbuf_create_from_list (ListBase *inputs, const char *name) |
| void | GPU_uniformbuf_free (blender::gpu::UniformBuf *ubo) |
| void | GPU_uniformbuf_update (blender::gpu::UniformBuf *ubo, const void *data) |
| void | GPU_uniformbuf_bind (blender::gpu::UniformBuf *ubo, int slot) |
| void | GPU_uniformbuf_bind_as_ssbo (blender::gpu::UniformBuf *ubo, int slot) |
| void | GPU_uniformbuf_unbind (blender::gpu::UniformBuf *ubo) |
| void | GPU_uniformbuf_debug_unbind_all () |
| void | GPU_uniformbuf_clear_to_zero (blender::gpu::UniformBuf *ubo) |
| #define MAX_UBO_GPU_TYPE GPU_MAT4 |
Referenced by buffer_from_list_inputs_sort().
|
inlinestatic |
Definition at line 176 of file gpu_uniform_buffer.cc.
References data, get_padded_gpu_type(), input, inputs, and LISTBASE_FOREACH.
Referenced by GPU_uniformbuf_create_from_list().
|
static |
Make sure we respect the expected alignment of UBOs. mat4, vec4, pad vec3 as vec4, then vec2, then floats.
Definition at line 95 of file gpu_uniform_buffer.cc.
References BLI_assert_msg, BLI_insertlinkafter(), BLI_listbase_sort(), BLI_remlink(), LinkData::data, GPU_backend_get_type(), GPU_BACKEND_METAL, GPU_FLOAT, GPU_MAT3, GPU_VEC3, input, inputs, inputs_cmp(), LISTBASE_FOREACH, MAX_UBO_GPU_TYPE, and LinkData::next.
Referenced by GPU_uniformbuf_create_from_list().
|
inlinestatic |
Definition at line 162 of file gpu_uniform_buffer.cc.
References divide_ceil_u(), float, get_padded_gpu_type(), inputs, and LISTBASE_FOREACH.
Referenced by GPU_uniformbuf_create_from_list().
We need to pad some data types (vec3) on the C side To match the GPU expected memory block alignment.
Definition at line 62 of file gpu_uniform_buffer.cc.
References LinkData::data, GPU_backend_get_type(), GPU_BACKEND_METAL, GPU_FLOAT, GPU_VEC3, GPU_VEC4, input, and LinkData::next.
Referenced by buffer_fill_from_list(), and buffer_size_from_list().
| void GPU_uniformbuf_bind | ( | blender::gpu::UniformBuf * | ubo, |
| int | slot ) |
Definition at line 242 of file gpu_uniform_buffer.cc.
References blender::gpu::UniformBuf::bind().
Referenced by blender::draw::View::bind(), blender::nodes::node_composite_planetrackdeform_cc::PlaneTrackDeformOperation::compute_plane_gpu(), blender::nodes::node_composite_planetrackdeform_cc::PlaneTrackDeformOperation::compute_plane_mask_gpu(), blender::draw::View::compute_procedural_bounds(), blender::draw::View::compute_visibility(), blender::draw::draw_subdiv_ubo_update_and_bind(), blender::draw::command::ResourceBind::execute(), blender::ed::vse::StripsDrawBatch::flush_batch(), blender::ed::vse::ThumbsDrawBatch::flush_batch(), immBindUniformBuf(), pygpu_shader_uniform_block(), and blender::draw::Manager::resource_bind().
| void GPU_uniformbuf_bind_as_ssbo | ( | blender::gpu::UniformBuf * | ubo, |
| int | slot ) |
Definition at line 247 of file gpu_uniform_buffer.cc.
References blender::gpu::UniformBuf::bind_as_ssbo().
Referenced by blender::draw::View::compute_procedural_bounds(), and blender::draw::command::ResourceBind::execute().
| void GPU_uniformbuf_clear_to_zero | ( | blender::gpu::UniformBuf * | ubo | ) |
Definition at line 262 of file gpu_uniform_buffer.cc.
References blender::gpu::UniformBuf::clear_to_zero().
Referenced by blender::eevee::ShadowModule::set_view().
| blender::gpu::UniformBuf * GPU_uniformbuf_create_ex | ( | size_t | size, |
| const void * | data, | ||
| const char * | name ) |
Definition at line 195 of file gpu_uniform_buffer.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::data(), data, G, G_DEBUG_GPU, blender::gpu::GPUBackend::get(), name, size(), blender::gpu::GPUBackend::uniformbuf_alloc(), and blender::gpu::UniformBuf::update().
Referenced by blender::ocio::GPUShaderBinder::create_gpu_shader(), blender::ed::greasepencil::image_render::create_shader_ubo(), blender::draw::draw_subdiv_ubo_update_and_bind(), blender::nodes::node_composite_planetrackdeform_cc::PlaneTrackDeformOperation::execute_gpu(), GPU_material_from_nodetree(), blender::ed::space_node::nodelink_batch_draw(), pygpu_uniformbuffer__tp_new(), blender::ed::vse::StripsDrawBatch::StripsDrawBatch(), ui_draw_but_UNITVEC(), and blender::draw::detail::UniformCommon< T, len, device_only >::UniformCommon().
| blender::gpu::UniformBuf * GPU_uniformbuf_create_from_list | ( | ListBase * | inputs, |
| const char * | name ) |
Create UBO from inputs list.
| inputs | ListBase of BLI_genericNodeN(GPUInput). |
Definition at line 211 of file gpu_uniform_buffer.cc.
References blender::gpu::UniformBuf::attach_data(), BLI_listbase_is_empty(), buffer_fill_from_list(), buffer_from_list_inputs_sort(), buffer_size_from_list(), data, blender::gpu::GPUBackend::get(), GPU_max_uniform_buffer_size(), inputs, MEM_mallocN(), name, and blender::gpu::GPUBackend::uniformbuf_alloc().
Referenced by GPU_material_uniform_buffer_create().
| 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 257 of file gpu_uniform_buffer.cc.
References blender::gpu::Context::debug_unbind_all_ubo(), and blender::gpu::Context::get().
Referenced by blender::draw::command::RecordingState::cleanup(), blender::compositor::ShaderOperation::execute(), and blender::draw::command::StateSet::set().
| void GPU_uniformbuf_free | ( | blender::gpu::UniformBuf * | ubo | ) |
Definition at line 232 of file gpu_uniform_buffer.cc.
Referenced by BPyGPUUniformBuf__tp_dealloc(), blender::ed::greasepencil::image_render::draw_grease_pencil_stroke(), blender::draw::draw_subdiv_cache_free(), blender::nodes::node_composite_planetrackdeform_cc::PlaneTrackDeformOperation::execute_gpu(), blender::ed::space_node::nodelink_batch_draw(), ui_draw_but_UNITVEC(), blender::ocio::internal::GPUDisplayShader::~GPUDisplayShader(), GPUMaterial::~GPUMaterial(), blender::ocio::internal::GPUTextures::~GPUTextures(), blender::ed::vse::StripsDrawBatch::~StripsDrawBatch(), blender::ed::vse::ThumbsDrawBatch::~ThumbsDrawBatch(), and blender::draw::detail::UniformCommon< T, len, device_only >::~UniformCommon().
| void GPU_uniformbuf_unbind | ( | blender::gpu::UniformBuf * | ubo | ) |
Definition at line 252 of file gpu_uniform_buffer.cc.
References blender::gpu::UniformBuf::unbind().
Referenced by blender::nodes::node_composite_planetrackdeform_cc::PlaneTrackDeformOperation::compute_plane_gpu(), blender::nodes::node_composite_planetrackdeform_cc::PlaneTrackDeformOperation::compute_plane_mask_gpu(), blender::ed::space_node::nodelink_batch_draw(), blender::gpu::MTLContext::~MTLContext(), blender::ed::vse::StripsDrawBatch::~StripsDrawBatch(), and blender::ed::vse::ThumbsDrawBatch::~ThumbsDrawBatch().
| void GPU_uniformbuf_update | ( | blender::gpu::UniformBuf * | ubo, |
| const void * | data ) |
Definition at line 237 of file gpu_uniform_buffer.cc.
References data, and blender::gpu::UniformBuf::update().
Referenced by blender::draw::draw_subdiv_ubo_update_and_bind(), blender::draw::gpencil::Instance::end_sync(), blender::ed::vse::StripsDrawBatch::flush_batch(), blender::ed::vse::ThumbsDrawBatch::flush_batch(), blender::draw::detail::UniformCommon< T, len, device_only >::push_update(), and pygpu_uniformbuffer_update().
|
static |
Returns 1 if the first item should be after second item. We make sure the vec4 uniforms come first.
Definition at line 83 of file gpu_uniform_buffer.cc.
References b, LinkData::data, and GPUInput::type.
Referenced by buffer_from_list_inputs_sort().