Blender V5.3
gpu_py_state.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
13
14#include <Python.h>
15
16#include "GPU_framebuffer.hh"
17#include "GPU_state.hh"
18
21
22#include "gpu_py.hh"
23#include "gpu_py_framebuffer.hh"
24#include "gpu_py_state.hh" /* own include */
25
26/* Docstring Literal types. */
27#define PYDOC_BLEND_LITERAL \
28 "Literal['NONE', 'ALPHA', 'ALPHA_PREMULT', 'ADDITIVE', " \
29 "'ADDITIVE_PREMULT', 'MULTIPLY', 'SUBTRACT', 'INVERT']"
30#define PYDOC_DEPTHTEST_LITERAL \
31 "Literal['NONE', 'ALWAYS', 'LESS', 'LESS_EQUAL', 'EQUAL', 'GREATER', 'GREATER_EQUAL']"
32
33namespace blender {
34
35/* -------------------------------------------------------------------- */
38
40 {GPU_BLEND_NONE, "NONE"},
41 {GPU_BLEND_ALPHA, "ALPHA"},
42 {GPU_BLEND_ALPHA_PREMULT, "ALPHA_PREMULT"},
43 {GPU_BLEND_ADDITIVE, "ADDITIVE"},
44 {GPU_BLEND_ADDITIVE_PREMULT, "ADDITIVE_PREMULT"},
45 {GPU_BLEND_MULTIPLY, "MULTIPLY"},
46 {GPU_BLEND_SUBTRACT, "SUBTRACT"},
47 {GPU_BLEND_INVERT, "INVERT"},
54 {0, nullptr},
55};
56
58 {GPU_DEPTH_NONE, "NONE"},
59 {GPU_DEPTH_ALWAYS, "ALWAYS"},
60 {GPU_DEPTH_LESS, "LESS"},
61 {GPU_DEPTH_LESS_EQUAL, "LESS_EQUAL"},
62 {GPU_DEPTH_EQUAL, "EQUAL"},
63 {GPU_DEPTH_GREATER, "GREATER"},
64 {GPU_DEPTH_GREATER_EQUAL, "GREATER_EQUAL"},
65 {0, nullptr},
66};
67
69 {GPU_CULL_NONE, "NONE"},
70 {GPU_CULL_FRONT, "FRONT"},
71 {GPU_CULL_BACK, "BACK"},
72 {0, nullptr},
73};
74
76
77/* -------------------------------------------------------------------- */
80
82 /* Wrap. */
83 pygpu_state_blend_set_doc,
84 ".. function:: blend_set(mode)\n"
85 "\n"
86 " Defines the fixed pipeline blending equation.\n"
87 "\n"
88 " :param mode: The type of blend mode.\n"
89 "\n"
90 " * ``NONE`` No blending.\n"
91 " * ``ALPHA`` The original color channels are interpolated according to the alpha "
92 "value.\n"
93 " * ``ALPHA_PREMULT`` The original color channels are interpolated according to the "
94 "alpha value with the new colors pre-multiplied by this value.\n"
95 " * ``ADDITIVE`` The original color channels are added by the corresponding ones.\n"
96 " * ``ADDITIVE_PREMULT`` The original color channels are added by the corresponding ones "
97 "that are pre-multiplied by the alpha value.\n"
98 " * ``MULTIPLY`` The original color channels are multiplied by the corresponding ones.\n"
99 " * ``SUBTRACT`` The original color channels are subtracted by the corresponding ones.\n"
100 " * ``INVERT`` The original color channels are replaced by its complementary color.\n"
101 //" * ``OIT``.\n"
102 //" * ``BACKGROUND`` .\n"
103 //" * ``CUSTOM`` .\n"
104 " :type mode: " PYDOC_BLEND_LITERAL "\n");
105static PyObject *pygpu_state_blend_set(PyObject * /*self*/, PyObject *value)
106{
108
110 if (!PyC_ParseStringEnum(value, &pygpu_blend)) {
111 return nullptr;
112 }
113 GPU_blend(GPUBlend(pygpu_blend.value_found));
114 Py_RETURN_NONE;
115}
116
118 /* Wrap. */
119 pygpu_state_blend_get_doc,
120 ".. function:: blend_get()\n"
121 "\n"
122 " Current blending equation.\n"
123 "\n"
124 " :return: The current blend mode.\n"
125 " :rtype: str\n");
126static PyObject *pygpu_state_blend_get(PyObject * /*self*/)
127{
129
130 GPUBlend blend = GPU_blend_get();
131 return PyUnicode_FromString(PyC_StringEnum_FindIDFromValue(pygpu_state_blend_items, blend));
132}
133
135 /* Wrap. */
136 pygpu_state_clip_distances_set_doc,
137 ".. function:: clip_distances_set(distances_enabled)\n"
138 "\n"
139 " Sets the number of ``gl_ClipDistance`` planes used for clip geometry.\n"
140 "\n"
141 " :param distances_enabled: Number of clip distances enabled.\n"
142 " :type distances_enabled: int\n");
143static PyObject *pygpu_state_clip_distances_set(PyObject * /*self*/, PyObject *value)
144{
146
147 int distances_enabled = int(PyLong_AsUnsignedLong(value));
148 if (distances_enabled == -1) {
149 return nullptr;
150 }
151
152 if (distances_enabled > 6) {
153 PyErr_SetString(PyExc_ValueError, "too many distances enabled, max is 6");
154 }
155
156 GPU_clip_distances(distances_enabled);
157 Py_RETURN_NONE;
158}
159
161 /* Wrap. */
162 pygpu_state_depth_test_set_doc,
163 ".. function:: depth_test_set(mode)\n"
164 "\n"
165 " Defines the depth_test equation.\n"
166 "\n"
167 " :param mode: The depth test equation name.\n"
168 " :type mode: " PYDOC_DEPTHTEST_LITERAL "\n");
169static PyObject *pygpu_state_depth_test_set(PyObject * /*self*/, PyObject *value)
170{
172
173 PyC_StringEnum pygpu_depth_test = {pygpu_state_depthtest_items};
174 if (!PyC_ParseStringEnum(value, &pygpu_depth_test)) {
175 return nullptr;
176 }
177 GPU_depth_test(GPUDepthTest(pygpu_depth_test.value_found));
178 Py_RETURN_NONE;
179}
180
182 /* Wrap. */
183 pygpu_state_depth_test_get_doc,
184 ".. function:: depth_test_get()\n"
185 "\n"
186 " Current depth_test equation.\n"
187 "\n"
188 " :return: The current depth test mode.\n"
189 " :rtype: str\n");
190static PyObject *pygpu_state_depth_test_get(PyObject * /*self*/)
191{
193
195 return PyUnicode_FromString(PyC_StringEnum_FindIDFromValue(pygpu_state_depthtest_items, test));
196}
197
199 /* Wrap. */
200 pygpu_state_depth_mask_set_doc,
201 ".. function:: depth_mask_set(value)\n"
202 "\n"
203 " Write to depth component.\n"
204 "\n"
205 " :param value: True for writing to the depth component.\n"
206 " :type value: bool\n");
207static PyObject *pygpu_state_depth_mask_set(PyObject * /*self*/, PyObject *value)
208{
210
211 bool write_to_depth;
212 if (!PyC_ParseBool(value, &write_to_depth)) {
213 return nullptr;
214 }
215 GPU_depth_mask(write_to_depth);
216 Py_RETURN_NONE;
217}
218
220 /* Wrap. */
221 pygpu_state_depth_mask_get_doc,
222 ".. function:: depth_mask_get()\n"
223 "\n"
224 " Writing status in the depth component.\n"
225 "\n"
226 " :return: True if writing to the depth component is enabled.\n"
227 " :rtype: bool\n");
228static PyObject *pygpu_state_depth_mask_get(PyObject * /*self*/)
229{
231
232 return PyBool_FromLong(GPU_depth_mask_get());
233}
234
236 /* Wrap. */
237 pygpu_state_viewport_set_doc,
238 ".. function:: viewport_set(x, y, xsize, ysize)\n"
239 "\n"
240 " Specifies the viewport of the active framebuffer.\n"
241 " Note: The viewport state is not saved upon framebuffer rebind.\n"
242 "\n"
243 " :param x: Lower left corner x coordinate, in pixels.\n"
244 " :type x: int\n"
245 " :param y: Lower left corner y coordinate, in pixels.\n"
246 " :type y: int\n"
247 " :param xsize: Width of the viewport.\n"
248 " :type xsize: int\n"
249 " :param ysize: Height of the viewport.\n"
250 " :type ysize: int\n");
251static PyObject *pygpu_state_viewport_set(PyObject * /*self*/, PyObject *args)
252{
254
255 int x, y, xsize, ysize;
256 if (!PyArg_ParseTuple(args,
257 "i" /* `x` */
258 "i" /* `y` */
259 "i" /* `xsize` */
260 "i" /* `ysize` */
261 ":viewport_set",
262 &x,
263 &y,
264 &xsize,
265 &ysize))
266 {
267 return nullptr;
268 }
269
270 GPU_viewport(x, y, xsize, ysize);
271 Py_RETURN_NONE;
272}
273
275 /* Wrap. */
276 pygpu_state_viewport_get_doc,
277 ".. function:: viewport_get()\n"
278 "\n"
279 " Viewport of the active framebuffer.\n"
280 "\n"
281 " :return: The viewport as a tuple (x, y, xsize, ysize).\n"
282 " :rtype: tuple[int, int, int, int]\n");
283static PyObject *pygpu_state_viewport_get(PyObject * /*self*/, PyObject * /*args*/)
284{
286
287 int viewport[4];
288 GPU_viewport_size_get_i(viewport);
289
290 PyObject *ret = PyTuple_New(4);
292 PyLong_FromLong(viewport[0]),
293 PyLong_FromLong(viewport[1]),
294 PyLong_FromLong(viewport[2]),
295 PyLong_FromLong(viewport[3]));
296 return ret;
297}
298
300 /* Wrap. */
301 pygpu_state_scissor_set_doc,
302 ".. function:: scissor_set(x, y, xsize, ysize)\n"
303 "\n"
304 " Specifies the scissor area of the active framebuffer.\n"
305 " Note: The scissor state is not saved upon framebuffer rebind.\n"
306 "\n"
307 " :param x: Lower left corner x coordinate, in pixels.\n"
308 " :type x: int\n"
309 " :param y: Lower left corner y coordinate, in pixels.\n"
310 " :type y: int\n"
311 " :param xsize: Width of the scissor rectangle.\n"
312 " :type xsize: int\n"
313 " :param ysize: Height of the scissor rectangle.\n"
314 " :type ysize: int\n");
315static PyObject *pygpu_state_scissor_set(PyObject * /*self*/, PyObject *args)
316{
318
319 int x, y, xsize, ysize;
320 if (!PyArg_ParseTuple(args,
321 "i" /* `x` */
322 "i" /* `y` */
323 "i" /* `xsize` */
324 "i" /* `ysize` */
325 ":scissor_set",
326 &x,
327 &y,
328 &xsize,
329 &ysize))
330 {
331 return nullptr;
332 }
333
334 GPU_scissor(x, y, xsize, ysize);
335 Py_RETURN_NONE;
336}
337
339 /* Wrap. */
340 pygpu_state_scissor_get_doc,
341 ".. function:: scissor_get()\n"
342 "\n"
343 " Retrieve the scissors of the active framebuffer.\n"
344 " Note: Only valid between 'scissor_set' and a framebuffer rebind.\n"
345 "\n"
346 " :return: The scissor of the active framebuffer as a tuple\n"
347 " (x, y, xsize, ysize).\n"
348 " x, y: lower left corner of the scissor rectangle, in pixels.\n"
349 " xsize, ysize: width and height of the scissor rectangle.\n"
350 " :rtype: tuple[int, int, int, int]\n");
351static PyObject *pygpu_state_scissor_get(PyObject * /*self*/, PyObject * /*args*/)
352{
354
355 int scissor[4];
356 GPU_scissor_get(scissor);
357
358 PyObject *ret = PyTuple_New(4);
360 PyLong_FromLong(scissor[0]),
361 PyLong_FromLong(scissor[1]),
362 PyLong_FromLong(scissor[2]),
363 PyLong_FromLong(scissor[3]));
364 return ret;
365}
366
368 /* Wrap. */
369 pygpu_state_scissor_test_set_doc,
370 ".. function:: scissor_test_set(enable)\n"
371 "\n"
372 " Enable/disable scissor testing on the active framebuffer.\n"
373 "\n"
374 " :param enable:\n"
375 " True - enable scissor testing.\n"
376 " False - disable scissor testing.\n"
377 " :type enable: bool\n");
378static PyObject *pygpu_state_scissor_test_set(PyObject * /*self*/, PyObject *value)
379{
381
382 bool enabled;
383 if (!PyC_ParseBool(value, &enabled)) {
384 return nullptr;
385 }
386
387 GPU_scissor_test(enabled);
388 Py_RETURN_NONE;
389}
390
392 /* Wrap. */
393 pygpu_state_line_width_set_doc,
394 ".. function:: line_width_set(width)\n"
395 "\n"
396 " Specify the width of rasterized lines.\n"
397 "\n"
398 " :param width: New width.\n"
399 " :type width: float\n");
400static PyObject *pygpu_state_line_width_set(PyObject * /*self*/, PyObject *value)
401{
403
404 float width = float(PyFloat_AsDouble(value));
405 if (PyErr_Occurred()) {
406 return nullptr;
407 }
408
409 GPU_line_width(width);
410 Py_RETURN_NONE;
411}
412
414 /* Wrap. */
415 pygpu_state_line_width_get_doc,
416 ".. function:: line_width_get()\n"
417 "\n"
418 " Current width of rasterized lines.\n"
419 "\n"
420 " :return: The current line width.\n"
421 " :rtype: float\n");
422static PyObject *pygpu_state_line_width_get(PyObject * /*self*/)
423{
425
426 float width = GPU_line_width_get();
427 return PyFloat_FromDouble(double(width));
428}
429
431 /* Wrap. */
432 pygpu_state_point_size_set_doc,
433 ".. function:: point_size_set(size)\n"
434 "\n"
435 " Specify the diameter of rasterized points.\n"
436 "\n"
437 " When ``program_point_size_set(False)`` is set, this sets the ``size``\n"
438 " uniform of point shaders. Any value set by ``uniform_float(\"size\", ...)``\n"
439 " on a point shader will be overwritten by this function. Use\n"
440 " ``program_point_size_set(True)`` to disable this override and control\n"
441 " point size via ``gl_PointSize`` in the vertex shader.\n"
442 "\n"
443 " :param size: New diameter.\n"
444 " :type size: float\n");
445static PyObject *pygpu_state_point_size_set(PyObject * /*self*/, PyObject *value)
446{
448
449 float size = float(PyFloat_AsDouble(value));
450 if (PyErr_Occurred()) {
451 return nullptr;
452 }
453
454 GPU_point_size(size);
455 Py_RETURN_NONE;
456}
457
459 /* Wrap. */
460 pygpu_state_color_mask_set_doc,
461 ".. function:: color_mask_set(r, g, b, a)\n"
462 "\n"
463 " Enable or disable writing of frame buffer color components.\n"
464 "\n"
465 " :param r: Red component.\n"
466 " :type r: bool\n"
467 " :param g: Green component.\n"
468 " :type g: bool\n"
469 " :param b: Blue component.\n"
470 " :type b: bool\n"
471 " :param a: Alpha component.\n"
472 " :type a: bool\n");
473static PyObject *pygpu_state_color_mask_set(PyObject * /*self*/, PyObject *args)
474{
476
477 int r, g, b, a;
478 if (!PyArg_ParseTuple(args,
479 "p" /* `r` */
480 "p" /* `g` */
481 "p" /* `b` */
482 "p" /* `a` */
483 ":color_mask_set",
484 &r,
485 &g,
486 &b,
487 &a))
488 {
489 return nullptr;
490 }
491
492 GPU_color_mask(bool(r), bool(g), bool(b), bool(a));
493 Py_RETURN_NONE;
494}
495
497 /* Wrap. */
498 pygpu_state_face_culling_set_doc,
499 ".. function:: face_culling_set(culling)\n"
500 "\n"
501 " Specify whether none, front-facing or back-facing facets can be culled.\n"
502 "\n"
503 " :param culling: The face culling mode.\n"
504 " :type culling: Literal['NONE', 'FRONT', 'BACK']\n");
505static PyObject *pygpu_state_face_culling_set(PyObject * /*self*/, PyObject *value)
506{
508
509 PyC_StringEnum pygpu_faceculling = {pygpu_state_faceculling_items};
510 if (!PyC_ParseStringEnum(value, &pygpu_faceculling)) {
511 return nullptr;
512 }
513
514 GPU_face_culling(GPUFaceCullTest(pygpu_faceculling.value_found));
515 Py_RETURN_NONE;
516}
517
519 /* Wrap. */
520 pygpu_state_front_facing_set_doc,
521 ".. function:: front_facing_set(invert)\n"
522 "\n"
523 " Specifies the orientation of front-facing polygons.\n"
524 "\n"
525 " :param invert: True for clockwise polygons as front-facing.\n"
526 " :type invert: bool\n");
527static PyObject *pygpu_state_front_facing_set(PyObject * /*self*/, PyObject *value)
528{
530
531 bool invert;
532 if (!PyC_ParseBool(value, &invert)) {
533 return nullptr;
534 }
535
537 Py_RETURN_NONE;
538}
539
541 /* Wrap. */
542 pygpu_state_program_point_size_set_doc,
543 ".. function:: program_point_size_set(enable)\n"
544 "\n"
545 " When enabled (True), point size is taken from the shader builtin\n"
546 " ``gl_PointSize``. When disabled (False), the global state value can\n"
547 " be applied to the shader ``size`` uniform, overwriting any user-set\n"
548 " value.\n"
549 "\n"
550 " :param enable: True to use shader ``gl_PointSize``, False for global state.\n"
551 " :type enable: bool\n");
552static PyObject *pygpu_state_program_point_size_set(PyObject * /*self*/, PyObject *value)
553{
555
556 bool enable;
557 if (!PyC_ParseBool(value, &enable)) {
558 return nullptr;
559 }
560
562 Py_RETURN_NONE;
563}
564
566 /* Wrap. */
567 pygpu_state_active_framebuffer_get_doc,
568 ".. function:: active_framebuffer_get()\n"
569 "\n"
570 " Return the active frame-buffer in context.\n"
571 "\n"
572 " :return: The active framebuffer.\n"
573 " :rtype: :class:`gpu.types.GPUFrameBuffer`\n");
581
583
584/* -------------------------------------------------------------------- */
587
588#ifdef __GNUC__
589# ifdef __clang__
590# pragma clang diagnostic push
591# pragma clang diagnostic ignored "-Wcast-function-type"
592# else
593# pragma GCC diagnostic push
594# pragma GCC diagnostic ignored "-Wcast-function-type"
595# endif
596#endif
597
598static PyMethodDef pygpu_state__tp_methods[] = {
599 /* Manage Stack */
600 {"blend_set",
601 static_cast<PyCFunction>(pygpu_state_blend_set),
602 METH_O,
603 pygpu_state_blend_set_doc},
604 {"blend_get",
605 reinterpret_cast<PyCFunction>(pygpu_state_blend_get),
606 METH_NOARGS,
607 pygpu_state_blend_get_doc},
608 {"clip_distances_set",
609 static_cast<PyCFunction>(pygpu_state_clip_distances_set),
610 METH_O,
611 pygpu_state_clip_distances_set_doc},
612 {"depth_test_set",
613 static_cast<PyCFunction>(pygpu_state_depth_test_set),
614 METH_O,
615 pygpu_state_depth_test_set_doc},
616 {"depth_test_get",
617 reinterpret_cast<PyCFunction>(pygpu_state_depth_test_get),
618 METH_NOARGS,
619 pygpu_state_depth_test_get_doc},
620 {"depth_mask_set",
621 static_cast<PyCFunction>(pygpu_state_depth_mask_set),
622 METH_O,
623 pygpu_state_depth_mask_set_doc},
624 {"depth_mask_get",
625 reinterpret_cast<PyCFunction>(pygpu_state_depth_mask_get),
626 METH_NOARGS,
627 pygpu_state_depth_mask_get_doc},
628 {"viewport_set",
629 static_cast<PyCFunction>(pygpu_state_viewport_set),
630 METH_VARARGS,
631 pygpu_state_viewport_set_doc},
632 {"viewport_get",
633 static_cast<PyCFunction>(pygpu_state_viewport_get),
634 METH_NOARGS,
635 pygpu_state_viewport_get_doc},
636 {"scissor_set",
637 static_cast<PyCFunction>(pygpu_state_scissor_set),
638 METH_VARARGS,
639 pygpu_state_scissor_set_doc},
640 {"scissor_get",
641 static_cast<PyCFunction>(pygpu_state_scissor_get),
642 METH_NOARGS,
643 pygpu_state_scissor_get_doc},
644 {"scissor_test_set",
645 static_cast<PyCFunction>(pygpu_state_scissor_test_set),
646 METH_O,
647 pygpu_state_scissor_test_set_doc},
648 {"line_width_set",
649 static_cast<PyCFunction>(pygpu_state_line_width_set),
650 METH_O,
651 pygpu_state_line_width_set_doc},
652 {"line_width_get",
653 reinterpret_cast<PyCFunction>(pygpu_state_line_width_get),
654 METH_NOARGS,
655 pygpu_state_line_width_get_doc},
656 {"point_size_set",
657 static_cast<PyCFunction>(pygpu_state_point_size_set),
658 METH_O,
659 pygpu_state_point_size_set_doc},
660 {"color_mask_set",
661 static_cast<PyCFunction>(pygpu_state_color_mask_set),
662 METH_VARARGS,
663 pygpu_state_color_mask_set_doc},
664 {"face_culling_set",
665 static_cast<PyCFunction>(pygpu_state_face_culling_set),
666 METH_O,
667 pygpu_state_face_culling_set_doc},
668 {"front_facing_set",
669 static_cast<PyCFunction>(pygpu_state_front_facing_set),
670 METH_O,
671 pygpu_state_front_facing_set_doc},
672 {"program_point_size_set",
673 static_cast<PyCFunction>(pygpu_state_program_point_size_set),
674 METH_O,
675 pygpu_state_program_point_size_set_doc},
676 {"active_framebuffer_get",
677 reinterpret_cast<PyCFunction>(pygpu_state_active_framebuffer_get),
678 METH_NOARGS,
679 pygpu_state_active_framebuffer_get_doc},
680 {nullptr, nullptr, 0, nullptr},
681};
682
683#ifdef __GNUC__
684# ifdef __clang__
685# pragma clang diagnostic pop
686# else
687# pragma GCC diagnostic pop
688# endif
689#endif
690
692 /* Wrap. */
693 pygpu_state__tp_doc,
694 "This module provides access to the gpu state.");
695static PyModuleDef pygpu_state_module_def = {
696 /*m_base*/ PyModuleDef_HEAD_INIT,
697 /*m_name*/ "gpu.state",
698 /*m_doc*/ pygpu_state__tp_doc,
699 /*m_size*/ 0,
700 /*m_methods*/ pygpu_state__tp_methods,
701 /*m_slots*/ nullptr,
702 /*m_traverse*/ nullptr,
703 /*m_clear*/ nullptr,
704 /*m_free*/ nullptr,
705};
706
708{
709 PyObject *submodule;
710
711 submodule = PyModule_Create(&pygpu_state_module_def);
712
713 return submodule;
714}
715
717
718} // namespace blender
#define BPYGPU_IS_INIT_OR_ERROR_OBJ
Definition gpu_py.hh:45
#define PYDOC_BLEND_LITERAL
#define PYDOC_DEPTHTEST_LITERAL
float2x2 invert(float2x2 mat)
BMesh Iterators.
void GPU_scissor_test(bool enable)
Definition gpu_state.cc:173
@ GPU_CULL_FRONT
Definition GPU_state.hh:158
@ GPU_CULL_NONE
Definition GPU_state.hh:157
@ GPU_CULL_BACK
Definition GPU_state.hh:159
gpu::FrameBuffer * GPU_framebuffer_active_get()
static const PyC_StringEnumItems pygpu_state_blend_items[]
static PyObject * pygpu_state_depth_mask_get(PyObject *)
int PyC_ParseBool(PyObject *o, void *p)
void GPU_clip_distances(int distances_enabled)
Definition gpu_state.cc:116
PyObject * bpygpu_state_init()
GPUDepthTest GPU_depth_test_get()
Definition gpu_state.cc:229
BLI_INLINE float fb(float length, float L)
PyDoc_STRVAR(bpy_bm_new_doc, ".. function:: new(*, use_operators=True)\n" "\n" " :param use_operators: Support calling operators in :mod:`bmesh.ops` (uses some " "extra memory per vert/edge/face).\n" " :type use_operators: bool\n" " :return: Return a new, empty BMesh.\n" " :rtype: :class:`bmesh.types.BMesh`\n")
void GPU_point_size(float size)
Definition gpu_state.cc:157
static PyModuleDef pygpu_state_module_def
void GPU_depth_mask(bool depth)
Definition gpu_state.cc:107
static PyObject * pygpu_state_blend_set(PyObject *, PyObject *value)
static PyObject * pygpu_state_active_framebuffer_get(PyObject *)
static PyObject * pygpu_state_viewport_set(PyObject *, PyObject *args)
static PyObject * pygpu_state_color_mask_set(PyObject *, PyObject *args)
PyObject * BPyGPUFrameBuffer_CreatePyObject(gpu::FrameBuffer *fb, bool shared_reference)
static PyObject * pygpu_state_depth_test_set(PyObject *, PyObject *value)
void GPU_line_width(float width)
Definition gpu_state.cc:151
@ GPU_BLEND_NONE
Definition GPU_state.hh:88
@ GPU_BLEND_ADDITIVE_PREMULT
Definition GPU_state.hh:93
@ GPU_BLEND_ALPHA
Definition GPU_state.hh:90
@ GPU_BLEND_ADDITIVE
Definition GPU_state.hh:92
@ GPU_BLEND_SUBTRACT
Definition GPU_state.hh:95
@ GPU_BLEND_ALPHA_PREMULT
Definition GPU_state.hh:91
@ GPU_BLEND_INVERT
Definition GPU_state.hh:100
@ GPU_BLEND_MULTIPLY
Definition GPU_state.hh:94
float GPU_line_width_get()
Definition gpu_state.cc:241
static PyObject * pygpu_state_depth_test_get(PyObject *)
static PyObject * pygpu_state_point_size_set(PyObject *, PyObject *value)
static PyObject * pygpu_state_scissor_test_set(PyObject *, PyObject *value)
static PyObject * pygpu_state_line_width_get(PyObject *)
@ GPU_DEPTH_NONE
Definition GPU_state.hh:132
@ GPU_DEPTH_LESS_EQUAL
Definition GPU_state.hh:135
@ GPU_DEPTH_ALWAYS
Definition GPU_state.hh:133
@ GPU_DEPTH_GREATER
Definition GPU_state.hh:137
@ GPU_DEPTH_LESS
Definition GPU_state.hh:134
@ GPU_DEPTH_GREATER_EQUAL
Definition GPU_state.hh:138
@ GPU_DEPTH_EQUAL
Definition GPU_state.hh:136
static PyObject * pygpu_state_line_width_set(PyObject *, PyObject *value)
static PyObject * pygpu_state_clip_distances_set(PyObject *, PyObject *value)
void GPU_scissor_get(int coords[4])
Definition gpu_state.cc:253
bool GPU_depth_mask_get()
Definition gpu_state.cc:272
void GPU_color_mask(bool r, bool g, bool b, bool a)
Definition gpu_state.cc:95
void GPU_program_point_size(bool enable)
Definition gpu_state.cc:165
const char * PyC_StringEnum_FindIDFromValue(const PyC_StringEnumItems *items, const int value)
static PyObject * pygpu_state_face_culling_set(PyObject *, PyObject *value)
void GPU_scissor(int x, int y, int width, int height)
Definition gpu_state.cc:178
static PyObject * pygpu_state_blend_get(PyObject *)
GPUBlend GPU_blend_get()
Definition gpu_state.cc:211
static PyObject * pygpu_state_viewport_get(PyObject *, PyObject *)
static PyObject * pygpu_state_depth_mask_set(PyObject *, PyObject *value)
static PyObject * pygpu_state_scissor_get(PyObject *, PyObject *)
void GPU_viewport(int x, int y, int width, int height)
Definition gpu_state.cc:184
static const PyC_StringEnumItems pygpu_state_depthtest_items[]
void GPU_viewport_size_get_i(int coords[4])
Definition gpu_state.cc:267
void GPU_face_culling(GPUFaceCullTest culling)
Definition gpu_state.cc:49
static PyObject * pygpu_state_front_facing_set(PyObject *, PyObject *value)
static PyObject * pygpu_state_program_point_size_set(PyObject *, PyObject *value)
void GPU_front_facing(bool invert)
Definition gpu_state.cc:60
void GPU_blend(GPUBlend blend)
Definition gpu_state.cc:44
static PyObject * pygpu_state_scissor_set(PyObject *, PyObject *args)
int PyC_ParseStringEnum(PyObject *o, void *p)
static PyMethodDef pygpu_state__tp_methods[]
void GPU_depth_test(GPUDepthTest test)
Definition gpu_state.cc:70
static const PyC_StringEnumItems pygpu_state_faceculling_items[]
header-only utilities
#define PyTuple_SET_ITEMS(op_arg,...)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float