|
Blender V4.5
|
#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_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, eGPUBatchFlag owns_flag) |
| void | GPU_batch_init_ex (Batch *batch, GPUPrimType primitive_type, VertBuf *vertex_buf, IndexBuf *index_buf, eGPUBatchFlag owns_flag) |
| 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_instbuf_set (Batch *batch, VertBuf *vertex_buf, bool own_vbo) |
| void | GPU_batch_elembuf_set (Batch *batch, blender::gpu::IndexBuf *index_buf, bool own_ibo) |
| int | GPU_batch_instbuf_add (Batch *batch, VertBuf *vertex_buf, bool own_vbo) |
| 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) |
| void | GPU_batch_resource_id_buf_set (Batch *batch, GPUStorageBuf *resource_id_buf) |
Uniform setters | |
| void | GPU_batch_set_shader (Batch *batch, GPUShader *shader, const shader::SpecializationConstants *constants_state) |
| static uint16_t | bind_attribute_as_ssbo (const ShaderInterface *interface, GPUShader *shader, VertBuf *vbo) |
| void | GPU_batch_bind_as_resources (Batch *batch, GPUShader *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, GPUStorageBuf *indirect_buf, intptr_t offset) |
| void | GPU_batch_multi_draw_indirect (Batch *batch, GPUStorageBuf *indirect_buf, int count, intptr_t offset, intptr_t stride) |
Utilities | |
| void | GPU_batch_program_set_builtin_with_config (Batch *batch, eGPUBuiltinShader shader_id, eGPUShaderConfig sh_cfg) |
| void | GPU_batch_program_set_builtin (Batch *batch, eGPUBuiltinShader 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 () |
GPU geometry batch Contains VAOs + VBOs + Shader representing a drawable entity.
Definition in file gpu_batch.cc.
|
static |
Definition at line 234 of file gpu_batch.cc.
References BLI_assert, GPUVertAttr::comp_len, blender::gpu::VertBuf::format, GPU_shader_uniform_1i(), GPU_shader_uniform_2iv(), GPU_vertbuf_bind_as_ssbo(), GPU_vertformat_attr_name_get(), input, interface, GPUVertAttr::name_len, GPUVertAttr::offset, GPUVertAttr::size, and blender::gpu::VertBuf::vertex_len.
Referenced by GPU_batch_bind_as_resources().
| void GPU_batch_bind_as_resources | ( | Batch * | batch, |
| GPUShader * | shader, | ||
| const shader::SpecializationConstants * | constants ) |
Definition at line 287 of file gpu_batch.cc.
References batch, bind_attribute_as_ssbo(), BLI_assert_msg, GPU_BATCH_VBO_MAX_LEN, GPU_indexbuf_bind_as_ssbo(), GPU_shader_bind(), GPU_shader_uniform_1b(), GPU_shader_uniform_1i(), GPU_SSBO_INDEX_BUF_SLOT, GPU_vertbuf_bind_as_ssbo(), interface, UNUSED_VARS_NDEBUG, and v.
Referenced by polyline_draw_workaround().
| Batch * GPU_batch_calloc | ( | ) |
Definition at line 44 of file gpu_batch.cc.
References batch, blender::gpu::GPUBackend::batch_alloc(), blender::gpu::GPUBackend::get(), and GPU_batch_zero().
Referenced by DRW_batch_request(), and GPU_batch_create_ex().
| void GPU_batch_clear | ( | Batch * | batch | ) |
Definition at line 97 of file gpu_batch.cc.
References batch, GPU_BATCH_INST_VBO_MAX_LEN, GPU_BATCH_INVALID, GPU_BATCH_OWNS_INDEX, GPU_BATCH_OWNS_INST_VBO, GPU_BATCH_OWNS_INST_VBO_ANY, GPU_BATCH_OWNS_VBO, GPU_BATCH_OWNS_VBO_ANY, GPU_BATCH_VBO_MAX_LEN, GPU_indexbuf_discard(), GPU_VERTBUF_DISCARD_SAFE, and v.
Referenced by GPU_batch_copy(), and GPU_batch_discard().
| void GPU_batch_copy | ( | Batch * | batch_dst, |
| Batch * | batch_src ) |
Definition at line 85 of file gpu_batch.cc.
References GPU_batch_clear(), GPU_batch_init_ex(), GPU_BATCH_INVALID, GPU_BATCH_VBO_MAX_LEN, GPU_PRIM_POINTS, and v.
| Batch * GPU_batch_create_ex | ( | GPUPrimType | primitive_type, |
| blender::gpu::VertBuf * | vertex_buf, | ||
| blender::gpu::IndexBuf * | index_buf, | ||
| eGPUBatchFlag | owns_flag ) |
Allocate a #blender::gpu::Batch with a cleared state. The returned #blender::gpu::Batch needs to be passed to GPU_batch_init before being usable. Creates a #blender::gpu::Batch with explicit buffer ownership.
Definition at line 51 of file gpu_batch.cc.
References batch, GPU_batch_calloc(), and GPU_batch_init_ex().
Referenced by batch_screen_edges_get(), batch_sphere_wire(), blf_batch_draw_init(), blender::draw::calc_final_indices(), circle_draw_rgb(), blender::ed::greasepencil::image_render::draw_grease_pencil_stroke(), draw_line_bounds(), draw_line_loop(), draw_line_pairs(), blender::render::hydra::DrawTexture::DrawTexture(), blender::draw::drw_volume_selection_surface_cb(), blender::draw::drw_volume_wireframe_cb(), GPU_batch_preset_quad(), gpu_batch_sphere(), GPU_batch_tris_from_poly_2d_encoded(), GPU_batch_unit_cube(), GPU_batch_wire_from_poly_2d_encoded(), blender::gpu::tests::gpu_shader_lib_test(), gpu_viewport_batch_create(), immBeginBatch(), knifetool_draw(), blender::draw::lattice_batch_cache_create_overlay_batches(), blender::ed::space_node::nodelink_batch_init(), blender::ed::space_node::nodesocket_batch_init(), blender::draw::particle_batch_cache_ensure_procedural_indices(), blender::ed::vse::SeqQuadsBatch::SeqQuadsBatch(), blender::draw::overlay::ShapeCache::ShapeCache(), stitch_draw_vbo(), blender::gpu::tests::test_framebuffer_multi_viewport(), blender::gpu::tests::test_framebuffer_subpass_input(), ui_batch_roundbox_shadow_get(), ui_batch_roundbox_widget_get(), blender::gpu::tests::ShaderSpecializationConst::validate(), blender::gpu::tests::vertex_buffer_fetch_mode(), waveform_draw_one(), waveform_draw_rgb(), wm_gizmo_geometryinfo_draw(), and wm_xr_controller_model_batch_create().
| void GPU_batch_discard | ( | Batch * | batch | ) |
Definition at line 119 of file gpu_batch.cc.
References batch, and GPU_batch_clear().
| void GPU_batch_draw | ( | Batch * | batch | ) |
Definition at line 422 of file gpu_batch.cc.
References batch, BLI_assert, GPU_batch_draw_advanced(), GPU_shader_bind(), polyline_draw_workaround(), and blender::gpu::unwrap().
| void GPU_batch_draw_advanced | ( | Batch * | batch, |
| int | vertex_first, | ||
| int | vertex_count, | ||
| int | instance_first, | ||
| int | instance_count ) |
Definition at line 457 of file gpu_batch.cc.
References blender::gpu::Context::assert_framebuffer_shader_compatibility(), batch, BLI_assert, blender::gpu::Context::get(), and min_ii().
Referenced by GPU_batch_draw(), GPU_batch_draw_instance_range(), GPU_batch_draw_range(), and polyline_draw_workaround().
| 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 ) |
Return vertex range for this #blender::gpu::Batch when using primitive expansions.
Definition at line 358 of file gpu_batch.cc.
References BLI_assert_msg, GPU_PRIM_LINE_STRIP, and blender::gpu::indices_per_primitive().
Referenced by blender::draw::command::Draw::execute(), blender::draw::command::DrawMultiBuf::generate_commands(), blender::gpu::Immediate::polyline_draw_workaround(), and polyline_draw_workaround().
| void GPU_batch_draw_indirect | ( | Batch * | batch, |
| GPUStorageBuf * | indirect_buf, | ||
| intptr_t | offset ) |
Definition at line 488 of file gpu_batch.cc.
References blender::gpu::Context::assert_framebuffer_shader_compatibility(), batch, BLI_assert, and blender::gpu::Context::get().
| void GPU_batch_draw_instance_range | ( | Batch * | batch, |
| int | instance_first, | ||
| int | instance_count ) |
Definition at line 446 of file gpu_batch.cc.
References batch, BLI_assert, GPU_batch_draw_advanced(), GPU_shader_bind(), and blender::gpu::unwrap().
| 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 333 of file gpu_batch.cc.
| void GPU_batch_draw_range | ( | Batch * | batch, |
| int | vertex_first, | ||
| int | vertex_count ) |
Definition at line 434 of file gpu_batch.cc.
References batch, BLI_assert, GPU_batch_draw_advanced(), GPU_shader_bind(), polyline_draw_workaround(), and blender::gpu::unwrap().
| void GPU_batch_elembuf_set | ( | Batch * | batch, |
| blender::gpu::IndexBuf * | index_buf, | ||
| bool | own_ibo ) |
Definition at line 144 of file gpu_batch.cc.
References batch, BLI_assert, GPU_BATCH_DIRTY, GPU_BATCH_OWNS_INDEX, GPU_indexbuf_discard(), and SET_FLAG_FROM_TEST.
| void gpu_batch_exit | ( | ) |
Definition at line 564 of file gpu_batch.cc.
References gpu_batch_presets_exit().
Referenced by GPU_exit().
| void gpu_batch_init | ( | ) |
Definition at line 559 of file gpu_batch.cc.
References gpu_batch_presets_init().
Referenced by GPU_init().
| void GPU_batch_init_ex | ( | Batch * | batch, |
| GPUPrimType | primitive_type, | ||
| VertBuf * | vertex_buf, | ||
| IndexBuf * | index_buf, | ||
| eGPUBatchFlag | owns_flag ) |
Definition at line 61 of file gpu_batch.cc.
References batch, BLI_assert, GPU_BATCH_DIRTY, GPU_BATCH_INIT, GPU_BATCH_OWNS_INDEX, GPU_BATCH_OWNS_VBO, GPU_BATCH_VBO_MAX_LEN, and v.
Referenced by GPU_batch_copy(), and GPU_batch_create_ex().
| int GPU_batch_instbuf_add | ( | Batch * | batch, |
| VertBuf * | vertex_buf, | ||
| bool | own_vbo ) |
Definition at line 157 of file gpu_batch.cc.
References batch, BLI_assert, BLI_assert_msg, GPU_BATCH_DIRTY, GPU_BATCH_INST_VBO_MAX_LEN, GPU_BATCH_OWNS_INST_VBO, SET_FLAG_FROM_TEST, and v.
| void GPU_batch_instbuf_set | ( | Batch * | batch, |
| VertBuf * | vertex_buf, | ||
| bool | own_vbo ) |
Definition at line 131 of file gpu_batch.cc.
References batch, BLI_assert, GPU_BATCH_DIRTY, GPU_BATCH_OWNS_INST_VBO, GPU_vertbuf_discard(), and SET_FLAG_FROM_TEST.
| void GPU_batch_multi_draw_indirect | ( | Batch * | batch, |
| GPUStorageBuf * | indirect_buf, | ||
| int | count, | ||
| intptr_t | offset, | ||
| intptr_t | stride ) |
Definition at line 498 of file gpu_batch.cc.
References blender::gpu::Context::assert_framebuffer_shader_compatibility(), batch, BLI_assert, count, and blender::gpu::Context::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 538 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().
| 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 533 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().
| 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 548 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().
| 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 543 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().
| void GPU_batch_program_set_builtin | ( | Batch * | batch, |
| eGPUBuiltinShader | shader_id ) |
Definition at line 523 of file gpu_batch.cc.
References batch, GPU_batch_program_set_builtin_with_config(), and GPU_SHADER_CFG_DEFAULT.
| void GPU_batch_program_set_builtin_with_config | ( | Batch * | batch, |
| eGPUBuiltinShader | shader_id, | ||
| eGPUShaderConfig | sh_cfg ) |
Definition at line 515 of file gpu_batch.cc.
References batch, GPU_batch_set_shader(), and GPU_shader_get_builtin_shader_with_config().
Referenced by GPU_batch_program_set_builtin().
| void GPU_batch_program_set_imm_shader | ( | Batch * | batch | ) |
Definition at line 528 of file gpu_batch.cc.
References batch, GPU_batch_set_shader(), and immGetShader().
| void GPU_batch_resource_id_buf_set | ( | Batch * | batch, |
| GPUStorageBuf * | resource_id_buf ) |
Definition at line 212 of file gpu_batch.cc.
References batch, BLI_assert, and GPU_BATCH_DIRTY.
| void GPU_batch_set_shader | ( | Batch * | batch, |
| GPUShader * | shader, | ||
| const shader::SpecializationConstants * | constants_state ) |
Definition at line 226 of file gpu_batch.cc.
References batch, and GPU_shader_bind().
Referenced by GPU_batch_program_set_builtin_with_config(), GPU_batch_program_set_imm_shader(), and polyline_draw_workaround().
| int GPU_batch_vertbuf_add | ( | Batch * | batch, |
| VertBuf * | vertex_buf, | ||
| bool | own_vbo ) |
Definition at line 180 of file gpu_batch.cc.
References batch, BLI_assert, BLI_assert_msg, GPU_BATCH_DIRTY, GPU_BATCH_OWNS_VBO, GPU_BATCH_VBO_MAX_LEN, SET_FLAG_FROM_TEST, and v.
| bool GPU_batch_vertbuf_has | ( | const Batch * | batch, |
| const VertBuf * | vertex_buf ) |
Definition at line 202 of file gpu_batch.cc.
References batch, GPU_BATCH_VBO_MAX_LEN, and v.
| void GPU_batch_zero | ( | Batch * | batch | ) |
Definition at line 33 of file gpu_batch.cc.
References ARRAY_SIZE, and batch.
Referenced by GPU_batch_calloc().
|
static |
Definition at line 384 of file gpu_batch.cc.
References batch, BLI_assert, BLI_assert_msg, ELEM, GPUVertAttr::fetch_mode, blender::gpu::Context::get(), GPU_batch_bind_as_resources(), GPU_batch_draw_advanced(), GPU_batch_draw_expanded_parameter_get(), GPU_batch_set_shader(), GPU_FETCH_FLOAT, GPU_FETCH_INT_TO_FLOAT_UNIT, GPU_PRIM_LINE_LOOP, GPU_PRIM_LINE_STRIP, GPU_PRIM_LINES, GPU_PRIM_TRIS, GPU_shader_uniform_1b(), GPU_shader_uniform_3iv(), GPU_vertbuf_get_format(), GPU_vertformat_attr_id_get(), blender::gpu::Context::procedural_triangles_batch_get(), blender::IndexRange::size(), and blender::IndexRange::start().
Referenced by GPU_batch_draw(), and GPU_batch_draw_range().