Blender V5.0
gpu_batch.cc File Reference
#include "BLI_math_base.h"
#include "BLI_utildefines.h"
#include "GPU_batch.hh"
#include "GPU_batch_presets.hh"
#include "GPU_shader.hh"
#include "GPU_index_buffer.hh"
#include "GPU_vertex_buffer.hh"
#include "gpu_backend.hh"
#include "gpu_context_private.hh"
#include "gpu_debug_private.hh"
#include "gpu_shader_private.hh"
#include <cstring>

Go to the source code of this file.

Functions

Creation & Deletion
void GPU_batch_zero (Batch *batch)
Batch * GPU_batch_calloc ()
Batch * GPU_batch_create_ex (GPUPrimType primitive_type, VertBuf *vertex_buf, IndexBuf *index_buf, GPUBatchFlag owns_flag)
void GPU_batch_init_ex (Batch *batch, GPUPrimType primitive_type, VertBuf *vertex_buf, IndexBuf *index_buf, GPUBatchFlag owns_flag)
Batch * GPU_batch_create_procedural (GPUPrimType primitive_type, int32_t vertex_count)
void GPU_batch_copy (Batch *batch_dst, Batch *batch_src)
void GPU_batch_clear (Batch *batch)
void GPU_batch_discard (Batch *batch)
Buffers Management
void GPU_batch_elembuf_set (Batch *batch, blender::gpu::IndexBuf *index_buf, bool own_ibo)
int GPU_batch_vertbuf_add (Batch *batch, VertBuf *vertex_buf, bool own_vbo)
bool GPU_batch_vertbuf_has (const Batch *batch, const VertBuf *vertex_buf)
Uniform setters
void GPU_batch_set_shader (Batch *batch, blender::gpu::Shader *shader, const shader::SpecializationConstants *constants_state)
static uint16_t bind_attribute_as_ssbo (const ShaderInterface *interface, blender::gpu::Shader *shader, VertBuf *vbo)
void GPU_batch_bind_as_resources (Batch *batch, blender::gpu::Shader *shader, const shader::SpecializationConstants *constants)
Drawing / Draw-call functions
void GPU_batch_draw_parameter_get (Batch *batch, int *r_vertex_count, int *r_vertex_first, int *r_base_index, int *r_instance_count)
blender::IndexRange GPU_batch_draw_expanded_parameter_get (GPUPrimType input_prim_type, GPUPrimType output_prim_type, int vertex_count, int vertex_first, int output_primitive_cout)
static void polyline_draw_workaround (Batch *batch, int vertex_first, int vertex_count, int instance_first, int instance_count)
void GPU_batch_draw (Batch *batch)
void GPU_batch_draw_range (Batch *batch, int vertex_first, int vertex_count)
void GPU_batch_draw_instance_range (Batch *batch, int instance_first, int instance_count)
void GPU_batch_draw_advanced (Batch *batch, int vertex_first, int vertex_count, int instance_first, int instance_count)
void GPU_batch_draw_indirect (Batch *batch, blender::gpu::StorageBuf *indirect_buf, intptr_t offset)
void GPU_batch_multi_draw_indirect (Batch *batch, blender::gpu::StorageBuf *indirect_buf, int count, intptr_t offset, intptr_t stride)
Utilities
void GPU_batch_program_set_builtin_with_config (Batch *batch, GPUBuiltinShader shader_id, GPUShaderConfig sh_cfg)
void GPU_batch_program_set_builtin (Batch *batch, GPUBuiltinShader shader_id)
void GPU_batch_program_set_imm_shader (Batch *batch)
blender::gpu::Batch * GPU_batch_procedural_points_get ()
blender::gpu::Batch * GPU_batch_procedural_lines_get ()
blender::gpu::Batch * GPU_batch_procedural_triangles_get ()
blender::gpu::Batch * GPU_batch_procedural_triangle_strips_get ()
Init/Exit
void gpu_batch_init ()
void gpu_batch_exit ()

Detailed Description

GPU geometry batch Contains VAOs + VBOs + Shader representing a drawable entity.

Definition in file gpu_batch.cc.

Function Documentation

◆ bind_attribute_as_ssbo()

◆ GPU_batch_bind_as_resources()

◆ GPU_batch_calloc()

◆ GPU_batch_clear()

◆ GPU_batch_copy()

void GPU_batch_copy ( Batch * batch_dst,
Batch * batch_src )

◆ GPU_batch_create_ex()

Batch * GPU_batch_create_ex ( GPUPrimType primitive_type,
blender::gpu::VertBuf * vertex_buf,
blender::gpu::IndexBuf * index_buf,
GPUBatchFlag owns_flag )

◆ GPU_batch_create_procedural()

◆ GPU_batch_discard()

void GPU_batch_discard ( Batch * batch)

Definition at line 127 of file gpu_batch.cc.

References batch, and GPU_batch_clear().

◆ GPU_batch_draw()

void GPU_batch_draw ( Batch * batch)

◆ GPU_batch_draw_advanced()

void GPU_batch_draw_advanced ( Batch * batch,
int vertex_first,
int vertex_count,
int instance_first,
int instance_count )

◆ GPU_batch_draw_expanded_parameter_get()

blender::IndexRange GPU_batch_draw_expanded_parameter_get ( GPUPrimType input_prim_type,
GPUPrimType output_prim_type,
int vertex_count,
int vertex_first,
int output_primitive_cout )

◆ GPU_batch_draw_indirect()

void GPU_batch_draw_indirect ( Batch * batch,
blender::gpu::StorageBuf * indirect_buf,
intptr_t offset )

◆ GPU_batch_draw_instance_range()

void GPU_batch_draw_instance_range ( Batch * batch,
int instance_first,
int instance_count )

Definition at line 410 of file gpu_batch.cc.

References batch, BLI_assert, GPU_batch_draw_advanced(), and GPU_shader_bind().

◆ GPU_batch_draw_parameter_get()

void GPU_batch_draw_parameter_get ( Batch * batch,
int * r_vertex_count,
int * r_vertex_first,
int * r_base_index,
int * r_instance_count )

Definition at line 298 of file gpu_batch.cc.

References batch.

◆ GPU_batch_draw_range()

void GPU_batch_draw_range ( Batch * batch,
int vertex_first,
int vertex_count )

◆ GPU_batch_elembuf_set()

void GPU_batch_elembuf_set ( Batch * batch,
blender::gpu::IndexBuf * index_buf,
bool own_ibo )

◆ gpu_batch_exit()

void gpu_batch_exit ( )

Definition at line 541 of file gpu_batch.cc.

References gpu_batch_presets_exit().

Referenced by GPU_exit().

◆ gpu_batch_init()

void gpu_batch_init ( )

Definition at line 536 of file gpu_batch.cc.

References gpu_batch_presets_init().

Referenced by GPU_init().

◆ GPU_batch_init_ex()

void GPU_batch_init_ex ( Batch * batch,
GPUPrimType primitive_type,
VertBuf * vertex_buf,
IndexBuf * index_buf,
GPUBatchFlag owns_flag )

◆ GPU_batch_multi_draw_indirect()

void GPU_batch_multi_draw_indirect ( Batch * batch,
blender::gpu::StorageBuf * indirect_buf,
int count,
intptr_t offset,
intptr_t stride )

◆ GPU_batch_procedural_lines_get()

blender::gpu::Batch * GPU_batch_procedural_lines_get ( )

Batch with no attributes, suited for rendering procedural geometry. IMPORTANT: The returned batch is only valid for the current context.

Definition at line 515 of file gpu_batch.cc.

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

Referenced by blender::draw::command::procedural_batch_get(), and blender::draw::detail::PassBase< DrawCommandBufType >::procedural_batch_get().

◆ GPU_batch_procedural_points_get()

blender::gpu::Batch * GPU_batch_procedural_points_get ( )

Batch with no attributes, suited for rendering procedural geometry. IMPORTANT: The returned batch is only valid for the current context.

Definition at line 510 of file gpu_batch.cc.

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

Referenced by blender::draw::command::procedural_batch_get(), and blender::draw::detail::PassBase< DrawCommandBufType >::procedural_batch_get().

◆ GPU_batch_procedural_triangle_strips_get()

blender::gpu::Batch * GPU_batch_procedural_triangle_strips_get ( )

Batch with no attributes, suited for rendering procedural geometry. IMPORTANT: The returned batch is only valid for the current context.

Definition at line 525 of file gpu_batch.cc.

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

Referenced by blender::draw::command::procedural_batch_get(), and blender::draw::detail::PassBase< DrawCommandBufType >::procedural_batch_get().

◆ GPU_batch_procedural_triangles_get()

blender::gpu::Batch * GPU_batch_procedural_triangles_get ( )

Batch with no attributes, suited for rendering procedural geometry. IMPORTANT: The returned batch is only valid for the current context.

Definition at line 520 of file gpu_batch.cc.

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

Referenced by blender::draw::command::procedural_batch_get(), and blender::draw::detail::PassBase< DrawCommandBufType >::procedural_batch_get().

◆ GPU_batch_program_set_builtin()

void GPU_batch_program_set_builtin ( Batch * batch,
GPUBuiltinShader shader_id )

◆ GPU_batch_program_set_builtin_with_config()

void GPU_batch_program_set_builtin_with_config ( Batch * batch,
GPUBuiltinShader shader_id,
GPUShaderConfig sh_cfg )

◆ GPU_batch_program_set_imm_shader()

void GPU_batch_program_set_imm_shader ( Batch * batch)

Definition at line 505 of file gpu_batch.cc.

References batch, GPU_batch_set_shader(), and immGetShader().

◆ GPU_batch_set_shader()

void GPU_batch_set_shader ( Batch * batch,
blender::gpu::Shader * shader,
const shader::SpecializationConstants * constants_state )

◆ GPU_batch_vertbuf_add()

int GPU_batch_vertbuf_add ( Batch * batch,
VertBuf * vertex_buf,
bool own_vbo )

◆ GPU_batch_vertbuf_has()

bool GPU_batch_vertbuf_has ( const Batch * batch,
const VertBuf * vertex_buf )

Definition at line 174 of file gpu_batch.cc.

References batch, GPU_BATCH_VBO_MAX_LEN, and v.

◆ GPU_batch_zero()

void GPU_batch_zero ( Batch * batch)

Definition at line 34 of file gpu_batch.cc.

References ARRAY_SIZE, and batch.

Referenced by GPU_batch_calloc().

◆ polyline_draw_workaround()