Blender V5.0
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/* -------------------------------------------------------------------- */
29
31 {GPU_BLEND_NONE, "NONE"},
32 {GPU_BLEND_ALPHA, "ALPHA"},
33 {GPU_BLEND_ALPHA_PREMULT, "ALPHA_PREMULT"},
34 {GPU_BLEND_ADDITIVE, "ADDITIVE"},
35 {GPU_BLEND_ADDITIVE_PREMULT, "ADDITIVE_PREMULT"},
36 {GPU_BLEND_MULTIPLY, "MULTIPLY"},
37 {GPU_BLEND_SUBTRACT, "SUBTRACT"},
38 {GPU_BLEND_INVERT, "INVERT"},
45 {0, nullptr},
46};
47
49 {GPU_DEPTH_NONE, "NONE"},
50 {GPU_DEPTH_ALWAYS, "ALWAYS"},
51 {GPU_DEPTH_LESS, "LESS"},
52 {GPU_DEPTH_LESS_EQUAL, "LESS_EQUAL"},
53 {GPU_DEPTH_EQUAL, "EQUAL"},
54 {GPU_DEPTH_GREATER, "GREATER"},
55 {GPU_DEPTH_GREATER_EQUAL, "GREATER_EQUAL"},
56 {0, nullptr},
57};
58
60 {GPU_CULL_NONE, "NONE"},
61 {GPU_CULL_FRONT, "FRONT"},
62 {GPU_CULL_BACK, "BACK"},
63 {0, nullptr},
64};
65
67
68/* -------------------------------------------------------------------- */
71
73 /* Wrap. */
74 pygpu_state_blend_set_doc,
75 ".. function:: blend_set(mode)\n"
76 "\n"
77 " Defines the fixed pipeline blending equation.\n"
78 "\n"
79 " :arg mode: The type of blend mode.\n"
80 "\n"
81 " * ``NONE`` No blending.\n"
82 " * ``ALPHA`` The original color channels are interpolated according to the alpha "
83 "value.\n"
84 " * ``ALPHA_PREMULT`` The original color channels are interpolated according to the "
85 "alpha value with the new colors pre-multiplied by this value.\n"
86 " * ``ADDITIVE`` The original color channels are added by the corresponding ones.\n"
87 " * ``ADDITIVE_PREMULT`` The original color channels are added by the corresponding ones "
88 "that are pre-multiplied by the alpha value.\n"
89 " * ``MULTIPLY`` The original color channels are multiplied by the corresponding ones.\n"
90 " * ``SUBTRACT`` The original color channels are subtracted by the corresponding ones.\n"
91 " * ``INVERT`` The original color channels are replaced by its complementary color.\n"
92 //" * ``OIT``.\n"
93 //" * ``BACKGROUND`` .\n"
94 //" * ``CUSTOM`` .\n"
95 " :type mode: str\n");
96static PyObject *pygpu_state_blend_set(PyObject * /*self*/, PyObject *value)
97{
99
101 if (!PyC_ParseStringEnum(value, &pygpu_blend)) {
102 return nullptr;
103 }
104 GPU_blend(GPUBlend(pygpu_blend.value_found));
105 Py_RETURN_NONE;
106}
107
109 /* Wrap. */
110 pygpu_state_blend_get_doc,
111 ".. function:: blend_get()\n"
112 "\n"
113 " Current blending equation.\n"
114 "\n");
115static PyObject *pygpu_state_blend_get(PyObject * /*self*/)
116{
118
120 return PyUnicode_FromString(PyC_StringEnum_FindIDFromValue(pygpu_state_blend_items, blend));
121}
122
124 /* Wrap. */
125 pygpu_state_clip_distances_set_doc,
126 ".. function:: clip_distances_set(distances_enabled)\n"
127 "\n"
128 " Sets the number of ``gl_ClipDistance`` planes used for clip geometry.\n"
129 "\n"
130 " :arg distances_enabled: Number of clip distances enabled.\n"
131 " :type distances_enabled: int\n");
132static PyObject *pygpu_state_clip_distances_set(PyObject * /*self*/, PyObject *value)
133{
135
136 int distances_enabled = int(PyLong_AsUnsignedLong(value));
137 if (distances_enabled == -1) {
138 return nullptr;
139 }
140
141 if (distances_enabled > 6) {
142 PyErr_SetString(PyExc_ValueError, "too many distances enabled, max is 6");
143 }
144
145 GPU_clip_distances(distances_enabled);
146 Py_RETURN_NONE;
147}
148
150 /* Wrap. */
151 pygpu_state_depth_test_set_doc,
152 ".. function:: depth_test_set(mode)\n"
153 "\n"
154 " Defines the depth_test equation.\n"
155 "\n"
156 " :arg mode: The depth test equation name.\n"
157 " Possible values are ``NONE``, ``ALWAYS``, ``LESS``, ``LESS_EQUAL``, ``EQUAL``, "
158 "``GREATER`` and ``GREATER_EQUAL``.\n"
159 " :type mode: str\n");
160static PyObject *pygpu_state_depth_test_set(PyObject * /*self*/, PyObject *value)
161{
163
164 PyC_StringEnum pygpu_depth_test = {pygpu_state_depthtest_items};
165 if (!PyC_ParseStringEnum(value, &pygpu_depth_test)) {
166 return nullptr;
167 }
168 GPU_depth_test(GPUDepthTest(pygpu_depth_test.value_found));
169 Py_RETURN_NONE;
170}
171
173 /* Wrap. */
174 pygpu_state_depth_test_get_doc,
175 ".. function:: depth_test_get()\n"
176 "\n"
177 " Current depth_test equation.\n"
178 "\n");
179static PyObject *pygpu_state_depth_test_get(PyObject * /*self*/)
180{
182
184 return PyUnicode_FromString(PyC_StringEnum_FindIDFromValue(pygpu_state_depthtest_items, test));
185}
186
188 /* Wrap. */
189 pygpu_state_depth_mask_set_doc,
190 ".. function:: depth_mask_set(value)\n"
191 "\n"
192 " Write to depth component.\n"
193 "\n"
194 " :arg value: True for writing to the depth component.\n"
195 " :type near: bool\n");
196static PyObject *pygpu_state_depth_mask_set(PyObject * /*self*/, PyObject *value)
197{
199
200 bool write_to_depth;
201 if (!PyC_ParseBool(value, &write_to_depth)) {
202 return nullptr;
203 }
204 GPU_depth_mask(write_to_depth);
205 Py_RETURN_NONE;
206}
207
209 /* Wrap. */
210 pygpu_state_depth_mask_get_doc,
211 ".. function:: depth_mask_get()\n"
212 "\n"
213 " Writing status in the depth component.\n");
214static PyObject *pygpu_state_depth_mask_get(PyObject * /*self*/)
215{
217
218 return PyBool_FromLong(GPU_depth_mask_get());
219}
220
222 /* Wrap. */
223 pygpu_state_viewport_set_doc,
224 ".. function:: viewport_set(x, y, xsize, ysize)\n"
225 "\n"
226 " Specifies the viewport of the active framebuffer.\n"
227 " Note: The viewport state is not saved upon framebuffer rebind.\n"
228 "\n"
229 " :arg x, y: lower left corner of the viewport_set rectangle, in pixels.\n"
230 " :type x, y: int\n"
231 " :arg xsize, ysize: width and height of the viewport_set.\n"
232 " :type xsize, ysize: int\n");
233static PyObject *pygpu_state_viewport_set(PyObject * /*self*/, PyObject *args)
234{
236
237 int x, y, xsize, ysize;
238 if (!PyArg_ParseTuple(args, "iiii:viewport_set", &x, &y, &xsize, &ysize)) {
239 return nullptr;
240 }
241
242 GPU_viewport(x, y, xsize, ysize);
243 Py_RETURN_NONE;
244}
245
247 /* Wrap. */
248 pygpu_state_viewport_get_doc,
249 ".. function:: viewport_get()\n"
250 "\n"
251 " Viewport of the active framebuffer.\n");
252static PyObject *pygpu_state_viewport_get(PyObject * /*self*/, PyObject * /*args*/)
253{
255
256 int viewport[4];
257 GPU_viewport_size_get_i(viewport);
258
259 PyObject *ret = PyTuple_New(4);
261 PyLong_FromLong(viewport[0]),
262 PyLong_FromLong(viewport[1]),
263 PyLong_FromLong(viewport[2]),
264 PyLong_FromLong(viewport[3]));
265 return ret;
266}
267
269 /* Wrap. */
270 pygpu_state_scissor_set_doc,
271 ".. function:: scissor_set(x, y, xsize, ysize)\n"
272 "\n"
273 " Specifies the scissor area of the active framebuffer.\n"
274 " Note: The scissor state is not saved upon framebuffer rebind.\n"
275 "\n"
276 " :arg x, y: lower left corner of the scissor rectangle, in pixels.\n"
277 " :type x, y: int\n"
278 " :arg xsize, ysize: width and height of the scissor rectangle.\n"
279 " :type xsize, ysize: int\n");
280static PyObject *pygpu_state_scissor_set(PyObject * /*self*/, PyObject *args)
281{
283
284 int x, y, xsize, ysize;
285 if (!PyArg_ParseTuple(args, "iiii:scissor_set", &x, &y, &xsize, &ysize)) {
286 return nullptr;
287 }
288
289 GPU_scissor(x, y, xsize, ysize);
290 Py_RETURN_NONE;
291}
292
294 /* Wrap. */
295 pygpu_state_scissor_get_doc,
296 ".. function:: scissor_get()\n"
297 "\n"
298 " Retrieve the scissors of the active framebuffer.\n"
299 " Note: Only valid between 'scissor_set' and a framebuffer rebind.\n"
300 "\n"
301 " :return: The scissor of the active framebuffer as a tuple\n"
302 " (x, y, xsize, ysize).\n"
303 " x, y: lower left corner of the scissor rectangle, in pixels.\n"
304 " xsize, ysize: width and height of the scissor rectangle.\n"
305 " :rtype: tuple[int, int, int, int]\n");
306static PyObject *pygpu_state_scissor_get(PyObject * /*self*/, PyObject * /*args*/)
307{
309
310 int scissor[4];
311 GPU_scissor_get(scissor);
312
313 PyObject *ret = PyTuple_New(4);
315 PyLong_FromLong(scissor[0]),
316 PyLong_FromLong(scissor[1]),
317 PyLong_FromLong(scissor[2]),
318 PyLong_FromLong(scissor[3]));
319 return ret;
320}
321
323 /* Wrap. */
324 pygpu_state_scissor_test_set_doc,
325 ".. function:: scissor_test_set(enable)\n"
326 "\n"
327 " Enable/disable scissor testing on the active framebuffer.\n"
328 "\n"
329 " :arg enable:\n"
330 " True - enable scissor testing.\n"
331 " False - disable scissor testing.\n"
332 " :type enable: bool\n");
333static PyObject *pygpu_state_scissor_test_set(PyObject * /*self*/, PyObject *value)
334{
336
337 bool enabled;
338 if (!PyC_ParseBool(value, &enabled)) {
339 return nullptr;
340 }
341
343 Py_RETURN_NONE;
344}
345
347 /* Wrap. */
348 pygpu_state_line_width_set_doc,
349 ".. function:: line_width_set(width)\n"
350 "\n"
351 " Specify the width of rasterized lines.\n"
352 "\n"
353 " :arg size: New width.\n"
354 " :type mode: float\n");
355static PyObject *pygpu_state_line_width_set(PyObject * /*self*/, PyObject *value)
356{
358
359 float width = float(PyFloat_AsDouble(value));
360 if (PyErr_Occurred()) {
361 return nullptr;
362 }
363
364 GPU_line_width(width);
365 Py_RETURN_NONE;
366}
367
369 /* Wrap. */
370 pygpu_state_line_width_get_doc,
371 ".. function:: line_width_get()\n"
372 "\n"
373 " Current width of rasterized lines.\n");
374static PyObject *pygpu_state_line_width_get(PyObject * /*self*/)
375{
377
378 float width = GPU_line_width_get();
379 return PyFloat_FromDouble(double(width));
380}
381
383 /* Wrap. */
384 pygpu_state_point_size_set_doc,
385 ".. function:: point_size_set(size)\n"
386 "\n"
387 " Specify the diameter of rasterized points.\n"
388 "\n"
389 " :arg size: New diameter.\n"
390 " :type mode: float\n");
391static PyObject *pygpu_state_point_size_set(PyObject * /*self*/, PyObject *value)
392{
394
395 float size = float(PyFloat_AsDouble(value));
396 if (PyErr_Occurred()) {
397 return nullptr;
398 }
399
401 Py_RETURN_NONE;
402}
403
405 /* Wrap. */
406 pygpu_state_color_mask_set_doc,
407 ".. function:: color_mask_set(r, g, b, a)\n"
408 "\n"
409 " Enable or disable writing of frame buffer color components.\n"
410 "\n"
411 " :arg r, g, b, a: components red, green, blue, and alpha.\n"
412 " :type r, g, b, a: bool\n");
413static PyObject *pygpu_state_color_mask_set(PyObject * /*self*/, PyObject *args)
414{
416
417 int r, g, b, a;
418 if (!PyArg_ParseTuple(args, "pppp:color_mask_set", &r, &g, &b, &a)) {
419 return nullptr;
420 }
421
422 GPU_color_mask(bool(r), bool(g), bool(b), bool(a));
423 Py_RETURN_NONE;
424}
425
427 /* Wrap. */
428 pygpu_state_face_culling_set_doc,
429 ".. function:: face_culling_set(culling)\n"
430 "\n"
431 " Specify whether none, front-facing or back-facing facets can be culled.\n"
432 "\n"
433 " :arg mode: ``NONE``, ``FRONT`` or ``BACK``.\n"
434 " :type mode: str\n");
435static PyObject *pygpu_state_face_culling_set(PyObject * /*self*/, PyObject *value)
436{
438
439 PyC_StringEnum pygpu_faceculling = {pygpu_state_faceculling_items};
440 if (!PyC_ParseStringEnum(value, &pygpu_faceculling)) {
441 return nullptr;
442 }
443
444 GPU_face_culling(GPUFaceCullTest(pygpu_faceculling.value_found));
445 Py_RETURN_NONE;
446}
447
449 /* Wrap. */
450 pygpu_state_front_facing_set_doc,
451 ".. function:: front_facing_set(invert)\n"
452 "\n"
453 " Specifies the orientation of front-facing polygons.\n"
454 "\n"
455 " :arg invert: True for clockwise polygons as front-facing.\n"
456 " :type mode: bool\n");
457static PyObject *pygpu_state_front_facing_set(PyObject * /*self*/, PyObject *value)
458{
460
461 bool invert;
462 if (!PyC_ParseBool(value, &invert)) {
463 return nullptr;
464 }
465
467 Py_RETURN_NONE;
468}
469
471 /* Wrap. */
472 pygpu_state_program_point_size_set_doc,
473 ".. function:: program_point_size_set(enable)\n"
474 "\n"
475 " If enabled, the derived point size is taken from the (potentially clipped) "
476 "shader builtin gl_PointSize.\n"
477 "\n"
478 " :arg enable: True for shader builtin gl_PointSize.\n"
479 " :type enable: bool\n");
480static PyObject *pygpu_state_program_point_size_set(PyObject * /*self*/, PyObject *value)
481{
483
484 bool enable;
485 if (!PyC_ParseBool(value, &enable)) {
486 return nullptr;
487 }
488
490 Py_RETURN_NONE;
491}
492
494 /* Wrap. */
495 pygpu_state_active_framebuffer_get_doc,
496 ".. function:: active_framebuffer_get(enable)\n"
497 "\n"
498 " Return the active frame-buffer in context.\n");
506
508
509/* -------------------------------------------------------------------- */
512
513#ifdef __GNUC__
514# ifdef __clang__
515# pragma clang diagnostic push
516# pragma clang diagnostic ignored "-Wcast-function-type"
517# else
518# pragma GCC diagnostic push
519# pragma GCC diagnostic ignored "-Wcast-function-type"
520# endif
521#endif
522
523static PyMethodDef pygpu_state__tp_methods[] = {
524 /* Manage Stack */
525 {"blend_set", (PyCFunction)pygpu_state_blend_set, METH_O, pygpu_state_blend_set_doc},
526 {"blend_get", (PyCFunction)pygpu_state_blend_get, METH_NOARGS, pygpu_state_blend_get_doc},
527 {"clip_distances_set",
529 METH_O,
530 pygpu_state_clip_distances_set_doc},
531 {"depth_test_set",
532 (PyCFunction)pygpu_state_depth_test_set,
533 METH_O,
534 pygpu_state_depth_test_set_doc},
535 {"depth_test_get",
536 (PyCFunction)pygpu_state_depth_test_get,
537 METH_NOARGS,
538 pygpu_state_depth_test_get_doc},
539 {"depth_mask_set",
540 (PyCFunction)pygpu_state_depth_mask_set,
541 METH_O,
542 pygpu_state_depth_mask_set_doc},
543 {"depth_mask_get",
544 (PyCFunction)pygpu_state_depth_mask_get,
545 METH_NOARGS,
546 pygpu_state_depth_mask_get_doc},
547 {"viewport_set",
548 (PyCFunction)pygpu_state_viewport_set,
549 METH_VARARGS,
550 pygpu_state_viewport_set_doc},
551 {"viewport_get",
552 (PyCFunction)pygpu_state_viewport_get,
553 METH_NOARGS,
554 pygpu_state_viewport_get_doc},
555 {"scissor_set",
556 (PyCFunction)pygpu_state_scissor_set,
557 METH_VARARGS,
558 pygpu_state_scissor_set_doc},
559 {"scissor_get",
560 (PyCFunction)pygpu_state_scissor_get,
561 METH_NOARGS,
562 pygpu_state_scissor_get_doc},
563 {"scissor_test_set",
564 (PyCFunction)pygpu_state_scissor_test_set,
565 METH_O,
566 pygpu_state_scissor_test_set_doc},
567 {"line_width_set",
568 (PyCFunction)pygpu_state_line_width_set,
569 METH_O,
570 pygpu_state_line_width_set_doc},
571 {"line_width_get",
572 (PyCFunction)pygpu_state_line_width_get,
573 METH_NOARGS,
574 pygpu_state_line_width_get_doc},
575 {"point_size_set",
576 (PyCFunction)pygpu_state_point_size_set,
577 METH_O,
578 pygpu_state_point_size_set_doc},
579 {"color_mask_set",
580 (PyCFunction)pygpu_state_color_mask_set,
581 METH_VARARGS,
582 pygpu_state_color_mask_set_doc},
583 {"face_culling_set",
584 (PyCFunction)pygpu_state_face_culling_set,
585 METH_O,
586 pygpu_state_face_culling_set_doc},
587 {"front_facing_set",
588 (PyCFunction)pygpu_state_front_facing_set,
589 METH_O,
590 pygpu_state_front_facing_set_doc},
591 {"program_point_size_set",
593 METH_O,
594 pygpu_state_program_point_size_set_doc},
595 {"active_framebuffer_get",
597 METH_NOARGS,
598 pygpu_state_active_framebuffer_get_doc},
599 {nullptr, nullptr, 0, nullptr},
600};
601
602#ifdef __GNUC__
603# ifdef __clang__
604# pragma clang diagnostic pop
605# else
606# pragma GCC diagnostic pop
607# endif
608#endif
609
611 /* Wrap. */
612 pygpu_state__tp_doc,
613 "This module provides access to the gpu state.");
614static PyModuleDef pygpu_state_module_def = {
615 /*m_base*/ PyModuleDef_HEAD_INIT,
616 /*m_name*/ "gpu.state",
617 /*m_doc*/ pygpu_state__tp_doc,
618 /*m_size*/ 0,
619 /*m_methods*/ pygpu_state__tp_methods,
620 /*m_slots*/ nullptr,
621 /*m_traverse*/ nullptr,
622 /*m_clear*/ nullptr,
623 /*m_free*/ nullptr,
624};
625
627{
628 PyObject *submodule;
629
630 submodule = PyModule_Create(&pygpu_state_module_def);
631
632 return submodule;
633}
634
blender::gpu::FrameBuffer * GPU_framebuffer_active_get()
void GPU_program_point_size(bool enable)
Definition gpu_state.cc:180
void GPU_scissor_test(bool enable)
Definition gpu_state.cc:188
GPUDepthTest
Definition GPU_state.hh:110
@ GPU_DEPTH_GREATER
Definition GPU_state.hh:116
@ GPU_DEPTH_EQUAL
Definition GPU_state.hh:115
@ GPU_DEPTH_ALWAYS
Definition GPU_state.hh:112
@ GPU_DEPTH_GREATER_EQUAL
Definition GPU_state.hh:117
@ GPU_DEPTH_LESS
Definition GPU_state.hh:113
@ GPU_DEPTH_LESS_EQUAL
Definition GPU_state.hh:114
@ GPU_DEPTH_NONE
Definition GPU_state.hh:111
void GPU_line_width(float width)
Definition gpu_state.cc:166
GPUBlend GPU_blend_get()
Definition gpu_state.cc:226
GPUBlend
Definition GPU_state.hh:84
@ GPU_BLEND_ADDITIVE_PREMULT
Definition GPU_state.hh:90
@ GPU_BLEND_INVERT
Definition GPU_state.hh:95
@ GPU_BLEND_MULTIPLY
Definition GPU_state.hh:91
@ GPU_BLEND_NONE
Definition GPU_state.hh:85
@ GPU_BLEND_ALPHA
Definition GPU_state.hh:87
@ GPU_BLEND_ADDITIVE
Definition GPU_state.hh:89
@ GPU_BLEND_SUBTRACT
Definition GPU_state.hh:92
@ GPU_BLEND_ALPHA_PREMULT
Definition GPU_state.hh:88
void GPU_depth_mask(bool depth)
Definition gpu_state.cc:110
void GPU_face_culling(GPUFaceCullTest culling)
Definition gpu_state.cc:47
void GPU_blend(GPUBlend blend)
Definition gpu_state.cc:42
void GPU_depth_test(GPUDepthTest test)
Definition gpu_state.cc:68
void GPU_color_mask(bool r, bool g, bool b, bool a)
Definition gpu_state.cc:98
void GPU_viewport_size_get_i(int coords[4])
Definition gpu_state.cc:282
void GPU_scissor(int x, int y, int width, int height)
Definition gpu_state.cc:193
GPUDepthTest GPU_depth_test_get()
Definition gpu_state.cc:244
float GPU_line_width_get()
Definition gpu_state.cc:256
void GPU_front_facing(bool invert)
Definition gpu_state.cc:58
void GPU_viewport(int x, int y, int width, int height)
Definition gpu_state.cc:199
void GPU_point_size(float size)
Definition gpu_state.cc:172
GPUFaceCullTest
Definition GPU_state.hh:135
@ GPU_CULL_FRONT
Definition GPU_state.hh:137
@ GPU_CULL_NONE
Definition GPU_state.hh:136
@ GPU_CULL_BACK
Definition GPU_state.hh:138
bool GPU_depth_mask_get()
Definition gpu_state.cc:287
void GPU_scissor_get(int coords[4])
Definition gpu_state.cc:268
void GPU_clip_distances(int distances_enabled)
Definition gpu_state.cc:124
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
nullptr float
#define BPYGPU_IS_INIT_OR_ERROR_OBJ
Definition gpu_py.hh:20
PyObject * BPyGPUFrameBuffer_CreatePyObject(blender::gpu::FrameBuffer *fb, bool shared_reference)
static PyObject * pygpu_state_scissor_set(PyObject *, PyObject *args)
static PyObject * pygpu_state_blend_get(PyObject *)
static PyObject * pygpu_state_viewport_set(PyObject *, PyObject *args)
static PyMethodDef pygpu_state__tp_methods[]
static PyObject * pygpu_state_program_point_size_set(PyObject *, PyObject *value)
PyDoc_STRVAR(pygpu_state_blend_set_doc, ".. function:: blend_set(mode)\n" "\n" " Defines the fixed pipeline blending equation.\n" "\n" " :arg mode: The type of blend mode.\n" "\n" " * ``NONE`` No blending.\n" " * ``ALPHA`` The original color channels are interpolated according to the alpha " "value.\n" " * ``ALPHA_PREMULT`` The original color channels are interpolated according to the " "alpha value with the new colors pre-multiplied by this value.\n" " * ``ADDITIVE`` The original color channels are added by the corresponding ones.\n" " * ``ADDITIVE_PREMULT`` The original color channels are added by the corresponding ones " "that are pre-multiplied by the alpha value.\n" " * ``MULTIPLY`` The original color channels are multiplied by the corresponding ones.\n" " * ``SUBTRACT`` The original color channels are subtracted by the corresponding ones.\n" " * ``INVERT`` The original color channels are replaced by its complementary color.\n" " :type mode: str\n")
static PyObject * pygpu_state_viewport_get(PyObject *, PyObject *)
static PyObject * pygpu_state_scissor_test_set(PyObject *, PyObject *value)
static PyObject * pygpu_state_line_width_set(PyObject *, PyObject *value)
static PyObject * pygpu_state_front_facing_set(PyObject *, PyObject *value)
static PyObject * pygpu_state_point_size_set(PyObject *, PyObject *value)
static PyObject * pygpu_state_active_framebuffer_get(PyObject *)
PyObject * bpygpu_state_init()
static PyObject * pygpu_state_depth_mask_get(PyObject *)
static PyObject * pygpu_state_face_culling_set(PyObject *, PyObject *value)
static PyObject * pygpu_state_clip_distances_set(PyObject *, PyObject *value)
static PyObject * pygpu_state_blend_set(PyObject *, PyObject *value)
static const PyC_StringEnumItems pygpu_state_depthtest_items[]
static PyObject * pygpu_state_depth_test_set(PyObject *, PyObject *value)
static PyObject * pygpu_state_line_width_get(PyObject *)
static PyObject * pygpu_state_depth_test_get(PyObject *)
static PyObject * pygpu_state_depth_mask_set(PyObject *, PyObject *value)
static PyObject * pygpu_state_color_mask_set(PyObject *, PyObject *args)
static const PyC_StringEnumItems pygpu_state_faceculling_items[]
static PyObject * pygpu_state_scissor_get(PyObject *, PyObject *)
static PyModuleDef pygpu_state_module_def
static const PyC_StringEnumItems pygpu_state_blend_items[]
BLI_INLINE float fb(float length, float L)
bool enabled
CCL_NAMESPACE_BEGIN ccl_device float invert(const float color, const float factor)
Definition invert.h:11
int PyC_ParseStringEnum(PyObject *o, void *p)
const char * PyC_StringEnum_FindIDFromValue(const PyC_StringEnumItems *items, const int value)
int PyC_ParseBool(PyObject *o, void *p)
header-only utilities
#define PyTuple_SET_ITEMS(op_arg,...)
return ret
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)