Blender V4.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
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/* -------------------------------------------------------------------- */
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
68/* -------------------------------------------------------------------- */
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(eGPUBlend(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(eGPUDepthTest(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
342 GPU_scissor_test(enabled);
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
400 GPU_point_size(size);
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
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");
499static PyObject *pygpu_state_active_framebuffer_get(PyObject * /*self*/)
500{
502
503 GPUFrameBuffer *fb = GPU_framebuffer_active_get();
505}
506
509/* -------------------------------------------------------------------- */
513#if (defined(__GNUC__) && !defined(__clang__))
514# pragma GCC diagnostic push
515# pragma GCC diagnostic ignored "-Wcast-function-type"
516#endif
517
518static PyMethodDef pygpu_state__tp_methods[] = {
519 /* Manage Stack */
520 {"blend_set", (PyCFunction)pygpu_state_blend_set, METH_O, pygpu_state_blend_set_doc},
521 {"blend_get", (PyCFunction)pygpu_state_blend_get, METH_NOARGS, pygpu_state_blend_get_doc},
522 {"clip_distances_set",
524 METH_O,
525 pygpu_state_clip_distances_set_doc},
526 {"depth_test_set",
527 (PyCFunction)pygpu_state_depth_test_set,
528 METH_O,
529 pygpu_state_depth_test_set_doc},
530 {"depth_test_get",
531 (PyCFunction)pygpu_state_depth_test_get,
532 METH_NOARGS,
533 pygpu_state_depth_test_get_doc},
534 {"depth_mask_set",
535 (PyCFunction)pygpu_state_depth_mask_set,
536 METH_O,
537 pygpu_state_depth_mask_set_doc},
538 {"depth_mask_get",
539 (PyCFunction)pygpu_state_depth_mask_get,
540 METH_NOARGS,
541 pygpu_state_depth_mask_get_doc},
542 {"viewport_set",
543 (PyCFunction)pygpu_state_viewport_set,
544 METH_VARARGS,
545 pygpu_state_viewport_set_doc},
546 {"viewport_get",
547 (PyCFunction)pygpu_state_viewport_get,
548 METH_NOARGS,
549 pygpu_state_viewport_get_doc},
550 {"scissor_set",
551 (PyCFunction)pygpu_state_scissor_set,
552 METH_VARARGS,
553 pygpu_state_scissor_set_doc},
554 {"scissor_get",
555 (PyCFunction)pygpu_state_scissor_get,
556 METH_NOARGS,
557 pygpu_state_scissor_get_doc},
558 {"scissor_test_set",
559 (PyCFunction)pygpu_state_scissor_test_set,
560 METH_O,
561 pygpu_state_scissor_test_set_doc},
562 {"line_width_set",
563 (PyCFunction)pygpu_state_line_width_set,
564 METH_O,
565 pygpu_state_line_width_set_doc},
566 {"line_width_get",
567 (PyCFunction)pygpu_state_line_width_get,
568 METH_NOARGS,
569 pygpu_state_line_width_get_doc},
570 {"point_size_set",
571 (PyCFunction)pygpu_state_point_size_set,
572 METH_O,
573 pygpu_state_point_size_set_doc},
574 {"color_mask_set",
575 (PyCFunction)pygpu_state_color_mask_set,
576 METH_VARARGS,
577 pygpu_state_color_mask_set_doc},
578 {"face_culling_set",
579 (PyCFunction)pygpu_state_face_culling_set,
580 METH_O,
581 pygpu_state_face_culling_set_doc},
582 {"front_facing_set",
583 (PyCFunction)pygpu_state_front_facing_set,
584 METH_O,
585 pygpu_state_front_facing_set_doc},
586 {"program_point_size_set",
588 METH_O,
589 pygpu_state_program_point_size_set_doc},
590 {"active_framebuffer_get",
592 METH_NOARGS,
593 pygpu_state_active_framebuffer_get_doc},
594 {nullptr, nullptr, 0, nullptr},
595};
596
597#if (defined(__GNUC__) && !defined(__clang__))
598# pragma GCC diagnostic pop
599#endif
600
602 /* Wrap. */
603 pygpu_state__tp_doc,
604 "This module provides access to the gpu state.");
605static PyModuleDef pygpu_state_module_def = {
606 /*m_base*/ PyModuleDef_HEAD_INIT,
607 /*m_name*/ "gpu.state",
608 /*m_doc*/ pygpu_state__tp_doc,
609 /*m_size*/ 0,
610 /*m_methods*/ pygpu_state__tp_methods,
611 /*m_slots*/ nullptr,
612 /*m_traverse*/ nullptr,
613 /*m_clear*/ nullptr,
614 /*m_free*/ nullptr,
615};
616
618{
619 PyObject *submodule;
620
621 submodule = PyModule_Create(&pygpu_state_module_def);
622
623 return submodule;
624}
625
GPUFrameBuffer * GPU_framebuffer_active_get()
void GPU_program_point_size(bool enable)
Definition gpu_state.cc:175
void GPU_face_culling(eGPUFaceCullTest culling)
Definition gpu_state.cc:47
eGPUBlend
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_blend(eGPUBlend blend)
Definition gpu_state.cc:42
void GPU_scissor_test(bool enable)
Definition gpu_state.cc:183
void GPU_line_width(float width)
Definition gpu_state.cc:161
eGPUBlend GPU_blend_get()
Definition gpu_state.cc:221
void GPU_depth_mask(bool depth)
Definition gpu_state.cc:110
eGPUDepthTest GPU_depth_test_get()
Definition gpu_state.cc:239
eGPUFaceCullTest
Definition GPU_state.hh:132
@ GPU_CULL_FRONT
Definition GPU_state.hh:134
@ GPU_CULL_NONE
Definition GPU_state.hh:133
@ GPU_CULL_BACK
Definition GPU_state.hh:135
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:271
void GPU_scissor(int x, int y, int width, int height)
Definition gpu_state.cc:188
float GPU_line_width_get()
Definition gpu_state.cc:251
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:194
void GPU_point_size(float size)
Definition gpu_state.cc:167
eGPUDepthTest
Definition GPU_state.hh:107
@ GPU_DEPTH_GREATER
Definition GPU_state.hh:113
@ GPU_DEPTH_EQUAL
Definition GPU_state.hh:112
@ GPU_DEPTH_ALWAYS
Definition GPU_state.hh:109
@ GPU_DEPTH_GREATER_EQUAL
Definition GPU_state.hh:114
@ GPU_DEPTH_LESS
Definition GPU_state.hh:110
@ GPU_DEPTH_LESS_EQUAL
Definition GPU_state.hh:111
@ GPU_DEPTH_NONE
Definition GPU_state.hh:108
void GPU_depth_test(eGPUDepthTest test)
Definition gpu_state.cc:68
bool GPU_depth_mask_get()
Definition gpu_state.cc:276
void GPU_scissor_get(int coords[4])
Definition gpu_state.cc:257
void GPU_clip_distances(int distances_enabled)
Definition gpu_state.cc:124
local_group_size(16, 16) .push_constant(Type b
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
#define BPYGPU_IS_INIT_OR_ERROR_OBJ
Definition gpu_py.hh:18
PyObject * BPyGPUFrameBuffer_CreatePyObject(GPUFrameBuffer *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(float color, float factor)
Definition invert.h:9
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