Blender  V3.3
gpu_py_state.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
12 #include <Python.h>
13 
14 #include "GPU_framebuffer.h"
15 #include "GPU_state.h"
16 
17 #include "../generic/py_capi_utils.h"
18 #include "../generic/python_utildefines.h"
19 
20 #include "gpu_py_framebuffer.h"
21 #include "gpu_py_state.h" /* own include */
22 
23 /* -------------------------------------------------------------------- */
27 static const struct PyC_StringEnumItems pygpu_state_blend_items[] = {
28  {GPU_BLEND_NONE, "NONE"},
29  {GPU_BLEND_ALPHA, "ALPHA"},
30  {GPU_BLEND_ALPHA_PREMULT, "ALPHA_PREMULT"},
31  {GPU_BLEND_ADDITIVE, "ADDITIVE"},
32  {GPU_BLEND_ADDITIVE_PREMULT, "ADDITIVE_PREMULT"},
33  {GPU_BLEND_MULTIPLY, "MULTIPLY"},
34  {GPU_BLEND_SUBTRACT, "SUBTRACT"},
35  {GPU_BLEND_INVERT, "INVERT"},
42  {0, NULL},
43 };
44 
45 static const struct PyC_StringEnumItems pygpu_state_depthtest_items[] = {
46  {GPU_DEPTH_NONE, "NONE"},
47  {GPU_DEPTH_ALWAYS, "ALWAYS"},
48  {GPU_DEPTH_LESS, "LESS"},
49  {GPU_DEPTH_LESS_EQUAL, "LESS_EQUAL"},
50  {GPU_DEPTH_EQUAL, "EQUAL"},
51  {GPU_DEPTH_GREATER, "GREATER"},
52  {GPU_DEPTH_GREATER_EQUAL, "GREATER_EQUAL"},
53  {0, NULL},
54 };
55 
56 static const struct PyC_StringEnumItems pygpu_state_faceculling_items[] = {
57  {GPU_CULL_NONE, "NONE"},
58  {GPU_CULL_FRONT, "FRONT"},
59  {GPU_CULL_BACK, "BACK"},
60  {0, NULL},
61 };
62 
65 /* -------------------------------------------------------------------- */
70  pygpu_state_blend_set_doc,
71  ".. function:: blend_set(mode)\n"
72  "\n"
73  " Defines the fixed pipeline blending equation.\n"
74  "\n"
75  " :param mode: The type of blend mode.\n"
76  " * ``NONE`` No blending.\n"
77  " * ``ALPHA`` The original color channels are interpolated according to the alpha "
78  "value.\n"
79  " * ``ALPHA_PREMULT`` The original color channels are interpolated according to the "
80  "alpha value with the new colors pre-multiplied by this value.\n"
81  " * ``ADDITIVE`` The original color channels are added by the corresponding ones.\n"
82  " * ``ADDITIVE_PREMULT`` The original color channels are added by the corresponding ones "
83  "that are pre-multiplied by the alpha value.\n"
84  " * ``MULTIPLY`` The original color channels are multiplied by the corresponding ones.\n"
85  " * ``SUBTRACT`` The original color channels are subtracted by the corresponding ones.\n"
86  " * ``INVERT`` The original color channels are replaced by its complementary color.\n"
87  //" * ``OIT``.\n"
88  //" * ``BACKGROUND`` .\n"
89  //" * ``CUSTOM`` .\n"
90  " :type mode: str\n");
91 static PyObject *pygpu_state_blend_set(PyObject *UNUSED(self), PyObject *value)
92 {
93  struct PyC_StringEnum pygpu_blend = {pygpu_state_blend_items};
94  if (!PyC_ParseStringEnum(value, &pygpu_blend)) {
95  return NULL;
96  }
97  GPU_blend(pygpu_blend.value_found);
98  Py_RETURN_NONE;
99 }
100 
101 PyDoc_STRVAR(pygpu_state_blend_get_doc,
102  ".. function:: blend_get()\n"
103  "\n"
104  " Current blending equation.\n"
105  "\n");
106 static PyObject *pygpu_state_blend_get(PyObject *UNUSED(self))
107 {
109  return PyUnicode_FromString(PyC_StringEnum_FindIDFromValue(pygpu_state_blend_items, blend));
110 }
111 
112 PyDoc_STRVAR(pygpu_state_clip_distances_set_doc,
113  ".. function:: clip_distances_set(distances_enabled)\n"
114  "\n"
115  " Sets the number of `gl_ClipDistance` planes used for clip geometry.\n"
116  "\n"
117  " :param distances_enabled: Number of clip distances enabled.\n"
118  " :type distances_enabled: int\n");
119 static PyObject *pygpu_state_clip_distances_set(PyObject *UNUSED(self), PyObject *value)
120 {
121  int distances_enabled = (int)PyLong_AsUnsignedLong(value);
122  if (distances_enabled == -1) {
123  return NULL;
124  }
125 
126  if (distances_enabled > 6) {
127  PyErr_SetString(PyExc_ValueError, "too many distances enabled, max is 6");
128  }
129 
130  GPU_clip_distances(distances_enabled);
131  Py_RETURN_NONE;
132 }
133 
134 PyDoc_STRVAR(pygpu_state_depth_test_set_doc,
135  ".. function:: depth_test_set(mode)\n"
136  "\n"
137  " Defines the depth_test equation.\n"
138  "\n"
139  " :param mode: The depth test equation name.\n"
140  " Possible values are `NONE`, `ALWAYS`, `LESS`, `LESS_EQUAL`, `EQUAL`, "
141  "`GREATER` and `GREATER_EQUAL`.\n"
142  " :type mode: str\n");
143 static PyObject *pygpu_state_depth_test_set(PyObject *UNUSED(self), PyObject *value)
144 {
145  struct PyC_StringEnum pygpu_depth_test = {pygpu_state_depthtest_items};
146  if (!PyC_ParseStringEnum(value, &pygpu_depth_test)) {
147  return NULL;
148  }
149  GPU_depth_test(pygpu_depth_test.value_found);
150  Py_RETURN_NONE;
151 }
152 
153 PyDoc_STRVAR(pygpu_state_depth_test_get_doc,
154  ".. function:: depth_test_get()\n"
155  "\n"
156  " Current depth_test equation.\n"
157  "\n");
158 static PyObject *pygpu_state_depth_test_get(PyObject *UNUSED(self))
159 {
161  return PyUnicode_FromString(PyC_StringEnum_FindIDFromValue(pygpu_state_depthtest_items, test));
162 }
163 
164 PyDoc_STRVAR(pygpu_state_depth_mask_set_doc,
165  ".. function:: depth_mask_set(value)\n"
166  "\n"
167  " Write to depth component.\n"
168  "\n"
169  " :param value: True for writing to the depth component.\n"
170  " :type near: bool\n");
171 static PyObject *pygpu_state_depth_mask_set(PyObject *UNUSED(self), PyObject *value)
172 {
173  bool write_to_depth;
174  if (!PyC_ParseBool(value, &write_to_depth)) {
175  return NULL;
176  }
177  GPU_depth_mask(write_to_depth);
178  Py_RETURN_NONE;
179 }
180 
181 PyDoc_STRVAR(pygpu_state_depth_mask_get_doc,
182  ".. function:: depth_mask_get()\n"
183  "\n"
184  " Writing status in the depth component.\n");
185 static PyObject *pygpu_state_depth_mask_get(PyObject *UNUSED(self))
186 {
187  return PyBool_FromLong(GPU_depth_mask_get());
188 }
189 
190 PyDoc_STRVAR(pygpu_state_viewport_set_doc,
191  ".. function:: viewport_set(x, y, xsize, ysize)\n"
192  "\n"
193  " Specifies the viewport of the active framebuffer.\n"
194  " Note: The viewport state is not saved upon framebuffer rebind.\n"
195  "\n"
196  " :param x, y: lower left corner of the viewport_set rectangle, in pixels.\n"
197  " :param width, height: width and height of the viewport_set.\n"
198  " :type x, y, xsize, ysize: int\n");
199 static PyObject *pygpu_state_viewport_set(PyObject *UNUSED(self), PyObject *args)
200 {
201  int x, y, xsize, ysize;
202  if (!PyArg_ParseTuple(args, "iiii:viewport_set", &x, &y, &xsize, &ysize)) {
203  return NULL;
204  }
205 
206  GPU_viewport(x, y, xsize, ysize);
207  Py_RETURN_NONE;
208 }
209 
210 PyDoc_STRVAR(pygpu_state_viewport_get_doc,
211  ".. function:: viewport_get()\n"
212  "\n"
213  " Viewport of the active framebuffer.\n");
214 static PyObject *pygpu_state_viewport_get(PyObject *UNUSED(self), PyObject *UNUSED(args))
215 {
216  int viewport[4];
217  GPU_viewport_size_get_i(viewport);
218 
219  PyObject *ret = PyTuple_New(4);
221  PyLong_FromLong(viewport[0]),
222  PyLong_FromLong(viewport[1]),
223  PyLong_FromLong(viewport[2]),
224  PyLong_FromLong(viewport[3]));
225  return ret;
226 }
227 
228 PyDoc_STRVAR(pygpu_state_line_width_set_doc,
229  ".. function:: line_width_set(width)\n"
230  "\n"
231  " Specify the width of rasterized lines.\n"
232  "\n"
233  " :param size: New width.\n"
234  " :type mode: float\n");
235 static PyObject *pygpu_state_line_width_set(PyObject *UNUSED(self), PyObject *value)
236 {
237  float width = (float)PyFloat_AsDouble(value);
238  if (PyErr_Occurred()) {
239  return NULL;
240  }
241 
243  Py_RETURN_NONE;
244 }
245 
246 PyDoc_STRVAR(pygpu_state_line_width_get_doc,
247  ".. function:: line_width_get()\n"
248  "\n"
249  " Current width of rasterized lines.\n");
250 static PyObject *pygpu_state_line_width_get(PyObject *UNUSED(self))
251 {
252  float width = GPU_line_width_get();
253  return PyFloat_FromDouble((double)width);
254 }
255 
256 PyDoc_STRVAR(pygpu_state_point_size_set_doc,
257  ".. function:: point_size_set(size)\n"
258  "\n"
259  " Specify the diameter of rasterized points.\n"
260  "\n"
261  " :param size: New diameter.\n"
262  " :type mode: float\n");
263 static PyObject *pygpu_state_point_size_set(PyObject *UNUSED(self), PyObject *value)
264 {
265  float size = (float)PyFloat_AsDouble(value);
266  if (PyErr_Occurred()) {
267  return NULL;
268  }
269 
271  Py_RETURN_NONE;
272 }
273 
274 PyDoc_STRVAR(pygpu_state_color_mask_set_doc,
275  ".. function:: color_mask_set(r, g, b, a)\n"
276  "\n"
277  " Enable or disable writing of frame buffer color components.\n"
278  "\n"
279  " :param r, g, b, a: components red, green, blue, and alpha.\n"
280  " :type r, g, b, a: bool\n");
281 static PyObject *pygpu_state_color_mask_set(PyObject *UNUSED(self), PyObject *args)
282 {
283  int r, g, b, a;
284  if (!PyArg_ParseTuple(args, "pppp:color_mask_set", &r, &g, &b, &a)) {
285  return NULL;
286  }
287 
288  GPU_color_mask((bool)r, (bool)g, (bool)b, (bool)a);
289  Py_RETURN_NONE;
290 }
291 
292 PyDoc_STRVAR(pygpu_state_face_culling_set_doc,
293  ".. function:: face_culling_set(culling)\n"
294  "\n"
295  " Specify whether none, front-facing or back-facing facets can be culled.\n"
296  "\n"
297  " :param mode: `NONE`, `FRONT` or `BACK`.\n"
298  " :type mode: str\n");
299 static PyObject *pygpu_state_face_culling_set(PyObject *UNUSED(self), PyObject *value)
300 {
301  struct PyC_StringEnum pygpu_faceculling = {pygpu_state_faceculling_items};
302  if (!PyC_ParseStringEnum(value, &pygpu_faceculling)) {
303  return NULL;
304  }
305 
306  GPU_face_culling(pygpu_faceculling.value_found);
307  Py_RETURN_NONE;
308 }
309 
310 PyDoc_STRVAR(pygpu_state_front_facing_set_doc,
311  ".. function:: front_facing_set(invert)\n"
312  "\n"
313  " Specifies the orientation of front-facing polygons.\n"
314  "\n"
315  " :param invert: True for clockwise polygons as front-facing.\n"
316  " :type mode: bool\n");
317 static PyObject *pygpu_state_front_facing_set(PyObject *UNUSED(self), PyObject *value)
318 {
319  bool invert;
320  if (!PyC_ParseBool(value, &invert)) {
321  return NULL;
322  }
323 
325  Py_RETURN_NONE;
326 }
327 
328 PyDoc_STRVAR(pygpu_state_program_point_size_set_doc,
329  ".. function:: program_point_size_set(enable)\n"
330  "\n"
331  " If enabled, the derived point size is taken from the (potentially clipped) "
332  "shader builtin gl_PointSize.\n"
333  "\n"
334  " :param enable: True for shader builtin gl_PointSize.\n"
335  " :type enable: bool\n");
336 static PyObject *pygpu_state_program_point_size_set(PyObject *UNUSED(self), PyObject *value)
337 {
338  bool enable;
339  if (!PyC_ParseBool(value, &enable)) {
340  return NULL;
341  }
342 
343  GPU_program_point_size(enable);
344  Py_RETURN_NONE;
345 }
346 
347 PyDoc_STRVAR(pygpu_state_framebuffer_active_get_doc,
348  ".. function:: framebuffer_active_get(enable)\n"
349  "\n"
350  " Return the active frame-buffer in context.\n");
351 static PyObject *pygpu_state_framebuffer_active_get(PyObject *UNUSED(self))
352 {
354  return BPyGPUFrameBuffer_CreatePyObject(fb, true);
355 }
356 
359 /* -------------------------------------------------------------------- */
363 static struct PyMethodDef pygpu_state__tp_methods[] = {
364  /* Manage Stack */
365  {"blend_set", (PyCFunction)pygpu_state_blend_set, METH_O, pygpu_state_blend_set_doc},
366  {"blend_get", (PyCFunction)pygpu_state_blend_get, METH_NOARGS, pygpu_state_blend_get_doc},
367  {"clip_distances_set",
368  (PyCFunction)pygpu_state_clip_distances_set,
369  METH_O,
370  pygpu_state_clip_distances_set_doc},
371  {"depth_test_set",
372  (PyCFunction)pygpu_state_depth_test_set,
373  METH_O,
374  pygpu_state_depth_test_set_doc},
375  {"depth_test_get",
376  (PyCFunction)pygpu_state_depth_test_get,
377  METH_NOARGS,
378  pygpu_state_depth_test_get_doc},
379  {"depth_mask_set",
380  (PyCFunction)pygpu_state_depth_mask_set,
381  METH_O,
382  pygpu_state_depth_mask_set_doc},
383  {"depth_mask_get",
384  (PyCFunction)pygpu_state_depth_mask_get,
385  METH_NOARGS,
386  pygpu_state_depth_mask_get_doc},
387  {"viewport_set",
388  (PyCFunction)pygpu_state_viewport_set,
389  METH_VARARGS,
390  pygpu_state_viewport_set_doc},
391  {"viewport_get",
392  (PyCFunction)pygpu_state_viewport_get,
393  METH_NOARGS,
394  pygpu_state_viewport_get_doc},
395  {"line_width_set",
396  (PyCFunction)pygpu_state_line_width_set,
397  METH_O,
398  pygpu_state_line_width_set_doc},
399  {"line_width_get",
400  (PyCFunction)pygpu_state_line_width_get,
401  METH_NOARGS,
402  pygpu_state_line_width_get_doc},
403  {"point_size_set",
404  (PyCFunction)pygpu_state_point_size_set,
405  METH_O,
406  pygpu_state_point_size_set_doc},
407  {"color_mask_set",
408  (PyCFunction)pygpu_state_color_mask_set,
409  METH_VARARGS,
410  pygpu_state_color_mask_set_doc},
411  {"face_culling_set",
412  (PyCFunction)pygpu_state_face_culling_set,
413  METH_O,
414  pygpu_state_face_culling_set_doc},
415  {"front_facing_set",
416  (PyCFunction)pygpu_state_front_facing_set,
417  METH_O,
418  pygpu_state_front_facing_set_doc},
419  {"program_point_size_set",
421  METH_O,
422  pygpu_state_program_point_size_set_doc},
423  {"active_framebuffer_get",
425  METH_NOARGS,
426  pygpu_state_framebuffer_active_get_doc},
427  {NULL, NULL, 0, NULL},
428 };
429 
430 PyDoc_STRVAR(pygpu_state__tp_doc, "This module provides access to the gpu state.");
431 static PyModuleDef pygpu_state_module_def = {
432  PyModuleDef_HEAD_INIT,
433  .m_name = "gpu.state",
434  .m_doc = pygpu_state__tp_doc,
435  .m_methods = pygpu_state__tp_methods,
436 };
437 
438 PyObject *bpygpu_state_init(void)
439 {
440  PyObject *submodule;
441 
442  submodule = PyModule_Create(&pygpu_state_module_def);
443 
444  return submodule;
445 }
446 
typedef float(TangentPoint)[2]
#define UNUSED(x)
struct GPUFrameBuffer GPUFrameBuffer
GPUFrameBuffer * GPU_framebuffer_active_get(void)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
void GPU_program_point_size(bool enable)
Definition: gpu_state.cc:172
void GPU_face_culling(eGPUFaceCullTest culling)
Definition: gpu_state.cc:44
eGPUBlend
Definition: GPU_state.h:59
@ GPU_BLEND_ADDITIVE_PREMULT
Definition: GPU_state.h:65
@ GPU_BLEND_INVERT
Definition: GPU_state.h:70
@ GPU_BLEND_MULTIPLY
Definition: GPU_state.h:66
@ GPU_BLEND_NONE
Definition: GPU_state.h:60
@ GPU_BLEND_ALPHA
Definition: GPU_state.h:62
@ GPU_BLEND_ADDITIVE
Definition: GPU_state.h:64
@ GPU_BLEND_SUBTRACT
Definition: GPU_state.h:67
@ GPU_BLEND_ALPHA_PREMULT
Definition: GPU_state.h:63
void GPU_blend(eGPUBlend blend)
Definition: gpu_state.cc:39
void GPU_line_width(float width)
Definition: gpu_state.cc:158
float GPU_line_width_get(void)
Definition: gpu_state.cc:248
void GPU_depth_mask(bool depth)
Definition: gpu_state.cc:107
@ GPU_CULL_FRONT
Definition: GPU_state.h:109
@ GPU_CULL_NONE
Definition: GPU_state.h:108
@ GPU_CULL_BACK
Definition: GPU_state.h:110
void GPU_color_mask(bool r, bool g, bool b, bool a)
Definition: gpu_state.cc:95
void GPU_viewport_size_get_i(int coords[4])
Definition: gpu_state.cc:268
eGPUBlend GPU_blend_get(void)
Definition: gpu_state.cc:218
void GPU_front_facing(bool invert)
Definition: gpu_state.cc:55
void GPU_viewport(int x, int y, int width, int height)
Definition: gpu_state.cc:191
void GPU_point_size(float size)
Definition: gpu_state.cc:164
bool GPU_depth_mask_get(void)
Definition: gpu_state.cc:273
eGPUDepthTest
Definition: GPU_state.h:82
@ GPU_DEPTH_GREATER
Definition: GPU_state.h:88
@ GPU_DEPTH_EQUAL
Definition: GPU_state.h:87
@ GPU_DEPTH_ALWAYS
Definition: GPU_state.h:84
@ GPU_DEPTH_GREATER_EQUAL
Definition: GPU_state.h:89
@ GPU_DEPTH_LESS
Definition: GPU_state.h:85
@ GPU_DEPTH_LESS_EQUAL
Definition: GPU_state.h:86
@ GPU_DEPTH_NONE
Definition: GPU_state.h:83
eGPUDepthTest GPU_depth_test_get(void)
Definition: gpu_state.cc:236
void GPU_depth_test(eGPUDepthTest test)
Definition: gpu_state.cc:65
void GPU_clip_distances(int distances_enabled)
Definition: gpu_state.cc:121
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
PyObject * BPyGPUFrameBuffer_CreatePyObject(GPUFrameBuffer *fb, bool shared_reference)
static PyObject * pygpu_state_depth_mask_set(PyObject *UNUSED(self), PyObject *value)
Definition: gpu_py_state.c:171
static const struct PyC_StringEnumItems pygpu_state_faceculling_items[]
Definition: gpu_py_state.c:56
static PyObject * pygpu_state_viewport_set(PyObject *UNUSED(self), PyObject *args)
Definition: gpu_py_state.c:199
static PyObject * pygpu_state_blend_set(PyObject *UNUSED(self), PyObject *value)
Definition: gpu_py_state.c:91
static const struct PyC_StringEnumItems pygpu_state_depthtest_items[]
Definition: gpu_py_state.c:45
static PyObject * pygpu_state_front_facing_set(PyObject *UNUSED(self), PyObject *value)
Definition: gpu_py_state.c:317
static PyObject * pygpu_state_blend_get(PyObject *UNUSED(self))
Definition: gpu_py_state.c:106
static PyObject * pygpu_state_depth_mask_get(PyObject *UNUSED(self))
Definition: gpu_py_state.c:185
static PyObject * pygpu_state_depth_test_set(PyObject *UNUSED(self), PyObject *value)
Definition: gpu_py_state.c:143
PyDoc_STRVAR(pygpu_state_blend_set_doc, ".. function:: blend_set(mode)\n" "\n" " Defines the fixed pipeline blending equation.\n" "\n" " :param mode: The type of blend mode.\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_point_size_set(PyObject *UNUSED(self), PyObject *value)
Definition: gpu_py_state.c:263
static PyObject * pygpu_state_face_culling_set(PyObject *UNUSED(self), PyObject *value)
Definition: gpu_py_state.c:299
static PyObject * pygpu_state_program_point_size_set(PyObject *UNUSED(self), PyObject *value)
Definition: gpu_py_state.c:336
static PyObject * pygpu_state_framebuffer_active_get(PyObject *UNUSED(self))
Definition: gpu_py_state.c:351
static PyObject * pygpu_state_line_width_get(PyObject *UNUSED(self))
Definition: gpu_py_state.c:250
static PyObject * pygpu_state_viewport_get(PyObject *UNUSED(self), PyObject *UNUSED(args))
Definition: gpu_py_state.c:214
static struct PyMethodDef pygpu_state__tp_methods[]
Definition: gpu_py_state.c:363
static PyObject * pygpu_state_clip_distances_set(PyObject *UNUSED(self), PyObject *value)
Definition: gpu_py_state.c:119
static PyObject * pygpu_state_line_width_set(PyObject *UNUSED(self), PyObject *value)
Definition: gpu_py_state.c:235
static PyObject * pygpu_state_color_mask_set(PyObject *UNUSED(self), PyObject *args)
Definition: gpu_py_state.c:281
static PyModuleDef pygpu_state_module_def
Definition: gpu_py_state.c:431
static PyObject * pygpu_state_depth_test_get(PyObject *UNUSED(self))
Definition: gpu_py_state.c:158
PyObject * bpygpu_state_init(void)
Definition: gpu_py_state.c:438
static const struct PyC_StringEnumItems pygpu_state_blend_items[]
Definition: gpu_py_state.c:27
BLI_INLINE float fb(float length, float L)
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
Definition: invert.h:8
static unsigned a[3]
Definition: RandGen.cpp:78
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken g("g", pxr::TfToken::Immortal)
int PyC_ParseStringEnum(PyObject *o, void *p)
const char * PyC_StringEnum_FindIDFromValue(const struct PyC_StringEnumItems *items, const int value)
int PyC_ParseBool(PyObject *o, void *p)
#define PyTuple_SET_ITEMS(op_arg,...)
return ret
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)