|
Blender V5.0
|
#include <Python.h>#include "BLI_utildefines.h"#include "GPU_batch.hh"#include "GPU_state.hh"#include "../generic/py_capi_utils.hh"#include "../generic/python_compat.hh"#include "gpu_py.hh"#include "gpu_py_element.hh"#include "gpu_py_shader.hh"#include "gpu_py_vertex_buffer.hh"#include "gpu_py_batch.hh"Go to the source code of this file.
Functions | |
Utility Functions | |
| static bool | pygpu_batch_is_program_or_error (BPyGPUBatch *self) |
Public API | |
| PyObject * | BPyGPUBatch_CreatePyObject (blender::gpu::Batch *batch) |
GPUBatch Type | |
| static PyMethodDef | pygpu_batch__tp_methods [] |
| PyTypeObject | BPyGPUBatch_Type |
| static PyObject * | pygpu_batch__tp_new (PyTypeObject *, PyObject *args, PyObject *kwds) |
| PyDoc_STRVAR (pygpu_batch_vertbuf_add_doc, ".. method:: vertbuf_add(buf)\n" "\n" " Add another vertex buffer to the Batch.\n" " It is not possible to add more vertices to the batch using this method.\n" " Instead it can be used to add more attributes to the existing vertices.\n" " A good use case would be when you have a separate\n" " vertex buffer for vertex positions and vertex normals.\n" " Current a batch can have at most " STRINGIFY(GPU_BATCH_VBO_MAX_LEN) " vertex buffers.\n" "\n" " :arg buf: The vertex buffer that will be added to the batch.\n" " :type buf: :class:`gpu.types.GPUVertBuf`\n") | |
| static PyObject * | pygpu_batch_vertbuf_add (BPyGPUBatch *self, BPyGPUVertBuf *py_buf) |
| PyDoc_STRVAR (pygpu_batch_program_set_doc, ".. method:: program_set(program)\n" "\n" " Assign a shader to this batch that will be used for drawing when not overwritten later.\n" " Note: This method has to be called in the draw context that the batch will be drawn in.\n" " This function does not need to be called when you always\n" " set the shader when calling :meth:`gpu.types.GPUBatch.draw`.\n" "\n" " :arg program: The program/shader the batch will use in future draw calls.\n" " :type program: :class:`gpu.types.GPUShader`\n") | |
| static PyObject * | pygpu_batch_program_set (BPyGPUBatch *self, BPyGPUShader *py_shader) |
| static const char * | pygpu_shader_check_compatibility (blender::gpu::Batch *batch) |
| PyDoc_STRVAR (pygpu_batch_draw_doc, ".. method:: draw(shader=None)\n" "\n" " Run the drawing shader with the parameters assigned to the batch.\n" "\n" " :arg shader: Shader that performs the drawing operations.\n" " If ``None`` is passed, the last shader set to this batch will run.\n" " :type program: :class:`gpu.types.GPUShader`\n") | |
| static PyObject * | pygpu_batch_draw (BPyGPUBatch *self, PyObject *args) |
| PyDoc_STRVAR (pygpu_batch_draw_instanced_doc, ".. method:: draw_instanced(program, *, instance_start=0, instance_count=0)\n" "\n" " Draw multiple instances of the drawing program with the parameters assigned\n" " to the batch. In the vertex shader, ``gl_InstanceID`` will contain the instance\n" " number being drawn.\n" "\n" " :arg program: Program that performs the drawing operations.\n" " :type program: :class:`gpu.types.GPUShader`\n" " :arg instance_start: Number of the first instance to draw.\n" " :type instance_start: int\n" " :arg instance_count: Number of instances to draw. When not provided or set to 0\n" " the number of instances will be determined by the number of rows in the first\n" " vertex buffer.\n" " :type instance_count: int\n") | |
| static PyObject * | pygpu_batch_draw_instanced (BPyGPUBatch *self, PyObject *args, PyObject *kw) |
| PyDoc_STRVAR (pygpu_batch_draw_range_doc, ".. method:: draw_range(program, *, elem_start=0, elem_count=0)\n" "\n" " Run the drawing program with the parameters assigned to the batch. " "Only draw the ``elem_count`` elements of the index buffer starting at ``elem_start``.\n" "\n" " :arg program: Program that performs the drawing operations.\n" " :type program: :class:`gpu.types.GPUShader`\n" " :arg elem_start: First index to draw. When not provided or set to 0 drawing\n" " will start from the first element of the index buffer.\n" " :type elem_start: int\n" " :arg elem_count: Number of elements of the index buffer to draw. When not\n" " provided or set to 0 all elements from ``elem_start`` to the end of the\n" " index buffer will be drawn.\n" " :type elem_count: int\n") | |
| static PyObject * | pygpu_batch_draw_range (BPyGPUBatch *self, PyObject *args, PyObject *kw) |
| static PyObject * | pygpu_batch_program_use_begin (BPyGPUBatch *self) |
| static PyObject * | pygpu_batch_program_use_end (BPyGPUBatch *self) |
| static int | pygpu_batch__tp_traverse (BPyGPUBatch *self, visitproc visit, void *arg) |
| static int | pygpu_batch__tp_clear (BPyGPUBatch *self) |
| static int | pygpu_batch__tp_is_gc (BPyGPUBatch *self) |
| static void | pygpu_batch__tp_dealloc (BPyGPUBatch *self) |
| PyDoc_STRVAR (pygpu_batch__tp_doc, ".. class:: GPUBatch(type, buf, elem=None)\n" "\n" " Reusable container for drawable geometry.\n" "\n" " :arg type: The primitive type of geometry to be drawn.\n" " Possible values are ``POINTS``, ``LINES``, ``TRIS``, ``LINE_STRIP``, ``LINE_LOOP``, " "``TRI_STRIP``, ``TRI_FAN``, ``LINES_ADJ``, ``TRIS_ADJ`` and ``LINE_STRIP_ADJ``.\n" " :type type: str\n" " :arg buf: Vertex buffer containing all or some of the attributes required for drawing.\n" " :type buf: :class:`gpu.types.GPUVertBuf`\n" " :arg elem: An optional index buffer.\n" " :type elem: :class:`gpu.types.GPUIndexBuf`\n") | |
This file defines the off-screen functionalities of the 'gpu' module used for off-screen OpenGL rendering.
Definition in file gpu_py_batch.cc.
|
nodiscard |
Definition at line 659 of file gpu_py_batch.cc.
References batch, BPyGPUBatch_Type, and self.
Referenced by pygpu_batch__tp_new().
| PyDoc_STRVAR | ( | pygpu_batch__tp_doc | , |
| ".. class:: GPUBatch(type, buf, elem=None)\n" "\n" " Reusable container for drawable geometry.\n" "\n" " :arg type: The primitive type of geometry to be drawn.\n" " Possible values are ``POINTS`` | , | ||
| ``LINES`` | , | ||
| ``TRIS`` | , | ||
| ``LINE_STRIP`` | , | ||
| ``LINE_LOOP`` | , | ||
| " "``TRI_STRIP`` | , | ||
| ``TRI_FAN`` | , | ||
| ``LINES_ADJ`` | , | ||
| ``TRIS_ADJ`` and ``LINE_STRIP_ADJ``.\n" " :type type:str\n" " :arg buf:Vertex buffer containing all or some of the attributes required for drawing.\n" " :type buf::class:`gpu.types.GPUVertBuf`\n" " :arg elem:An optional index buffer.\n" " :type elem::class:`gpu.types.GPUIndexBuf`\n" | ) |
| PyDoc_STRVAR | ( | pygpu_batch_draw_doc | , |
| ".. method:: draw(shader=None)\n" "\n" " Run the drawing shader with the parameters assigned to the batch.\n" "\n" " :arg shader: Shader that performs the drawing operations.\n" " If ``None`` is | passed, | ||
| the last shader set to this batch will run.\n" " :type program::class:`gpu.types.GPUShader`\n" | ) |
| PyDoc_STRVAR | ( | pygpu_batch_draw_instanced_doc | , |
| ".. method:: draw_instanced(program, *, instance_start=0, instance_count=0)\n" "\n" " Draw multiple instances of the drawing program with the parameters assigned\n" " to the batch. In the vertex | shader, | ||
| ``gl_InstanceID`` will contain the instance\n" " number being drawn.\n" "\n" " :arg program:Program that performs the drawing operations.\n" " :type program::class:`gpu.types.GPUShader`\n" " :arg instance_start:Number of the first instance to draw.\n" " :type instance_start:int\n" " :arg instance_count:Number of instances to draw. When not provided or set to 0\n" " the number of instances will be determined by the number of rows in the first\n" " vertex buffer.\n" " :type instance_count:int\n" | ) |
| PyDoc_STRVAR | ( | pygpu_batch_draw_range_doc | , |
| ".. method:: draw_range(program, *, elem_start=0, elem_count=0)\n" "\n" " Run the drawing program with the parameters assigned to the batch. " "Only draw the ``elem_count`` elements of the index buffer starting at ``elem_start``.\n" "\n" " :arg program: Program that performs the drawing operations.\n" " :type program: :class:`gpu.types.GPUShader`\n" " :arg elem_start: First index to draw. When not provided or set to 0 drawing\n" " will start from the first element of the index buffer.\n" " :type elem_start: int\n" " :arg elem_count: Number of elements of the index buffer to draw. When not\n" " provided or set to 0 all elements from ``elem_start`` to the end of the\n" " index buffer will be drawn.\n" " :type elem_count: int\n" | ) |
| PyDoc_STRVAR | ( | pygpu_batch_program_set_doc | , |
| ".. method:: program_set(program)\n" "\n" " Assign a shader to this batch that will be used for drawing when not overwritten later.\n" " Note: This method has to be called in the draw context that the batch will be drawn in.\n" " This function does not need to be called when you always\n" " set the shader when calling :meth:`gpu.types.GPUBatch.draw`.\n" "\n" " :arg program: The program/shader the batch will use in future draw calls.\n" " :type program: :class:`gpu.types.GPUShader`\n" | ) |
| PyDoc_STRVAR | ( | pygpu_batch_vertbuf_add_doc | , |
| ".. method:: vertbuf_add(buf)\n" "\n" " Add another vertex buffer to the Batch.\n" " It is not possible to add more vertices to the batch using this method.\n" " Instead it can be used to add more attributes to the existing vertices.\n" " A good use case would be when you have a separate\n" " vertex buffer for vertex positions and vertex normals.\n" " Current a batch can have at most " STRINGIFY(GPU_BATCH_VBO_MAX_LEN) " vertex buffers.\n" "\n" " :arg buf: The vertex buffer that will be added to the batch.\n" " :type buf: :class:`gpu.types.GPUVertBuf`\n" | ) |
References GPU_BATCH_VBO_MAX_LEN.
|
static |
Definition at line 542 of file gpu_py_batch.cc.
References self.
Referenced by pygpu_batch__tp_dealloc().
|
static |
Definition at line 555 of file gpu_py_batch.cc.
References GPU_batch_discard(), pygpu_batch__tp_clear(), and self.
|
static |
Definition at line 548 of file gpu_py_batch.cc.
References self.
|
static |
Definition at line 51 of file gpu_py_batch.cc.
References batch, BLI_assert, BPYGPU_IS_INIT_OR_ERROR_OBJ, bpygpu_primtype_items, BPyGPUBatch_CreatePyObject(), BPyGPUIndexBuf_Type, BPyGPUVertBuf_Type, BPyGPUVertBuf::buf, BPyGPUIndexBuf::elem, GPU_batch_create, GPU_PRIM_LINE_LOOP, GPU_PRIM_NONE, GPU_PRIM_TRI_FAN, PY_ARG_PARSER_HEAD_COMPAT, PyC_ParseStringEnum(), ret, and PyC_StringEnum::value_found.
|
static |
Definition at line 536 of file gpu_py_batch.cc.
References self.
|
static |
Definition at line 294 of file gpu_py_batch.cc.
References BPyGPUShader_Type, ELEM, error(), GPU_batch_draw(), GPU_batch_set_shader(), GPU_line_smooth_get(), GPU_line_width_get(), GPU_PRIM_LINE_LOOP, GPU_PRIM_LINE_STRIP, GPU_PRIM_LINES, GPU_PRIM_POINTS, GPU_SHADER_3D_FLAT_COLOR, GPU_SHADER_3D_SMOOTH_COLOR, GPU_SHADER_3D_UNIFORM_COLOR, GPU_shader_get_builtin_shader(), BPyGPUShader::is_builtin, pygpu_batch_is_program_or_error(), pygpu_shader_check_compatibility(), self, and BPyGPUShader::shader.
|
static |
Definition at line 408 of file gpu_py_batch.cc.
References BPyGPUShader_Type, GPU_batch_draw_instance_range(), GPU_batch_set_shader(), PY_ARG_PARSER_HEAD_COMPAT, self, and BPyGPUShader::shader.
|
static |
Definition at line 453 of file gpu_py_batch.cc.
References BPyGPUShader_Type, GPU_batch_draw_range(), GPU_batch_set_shader(), PY_ARG_PARSER_HEAD_COMPAT, self, and BPyGPUShader::shader.
|
static |
Definition at line 36 of file gpu_py_batch.cc.
References self.
Referenced by pygpu_batch_draw(), pygpu_batch_program_use_begin(), and pygpu_batch_program_use_end().
|
static |
Definition at line 185 of file gpu_py_batch.cc.
References BPyGPUShader_Check, GPU_batch_set_shader(), i, Py_DECREF(), self, and BPyGPUShader::shader.
|
static |
Definition at line 481 of file gpu_py_batch.cc.
References GPU_shader_bind(), pygpu_batch_is_program_or_error(), and self.
|
static |
Definition at line 490 of file gpu_py_batch.cc.
References GPU_shader_unbind(), pygpu_batch_is_program_or_error(), and self.
|
static |
Definition at line 141 of file gpu_py_batch.cc.
References BPyGPUVertBuf_Check, BPyGPUVertBuf::buf, GPU_BATCH_VBO_MAX_LEN, GPU_batch_vertbuf_add(), GPU_vertbuf_get_vertex_len(), self, and STRINGIFY.
|
static |
Verify if the Shader is compatible with the batch and can be used for rendering. Derived from polyline_draw_workaround in gpu_immediate.cc.
Definition at line 232 of file gpu_py_batch.cc.
References ARRAY_SIZE, batch, bpygpu_shader_is_polyline(), GPUVertAttr::Type::comp_type(), ELEM, GPUVertAttr::Type::fetch_mode(), GPU_COMP_F32, GPU_COMP_U8, GPU_FETCH_FLOAT, GPU_vertformat_attr_name_get(), name, GPUVertAttr::offset, and GPUVertAttr::type.
Referenced by pygpu_batch_draw().
| PyTypeObject BPyGPUBatch_Type |
Definition at line 585 of file gpu_py_batch.cc.
Referenced by bpygpu_types_init(), and BPyGPUBatch_CreatePyObject().
|
static |
Definition at line 509 of file gpu_py_batch.cc.