Blender  V2.93
GPU_state.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #pragma once
22 
23 #include "BLI_utildefines.h"
24 
25 typedef enum eGPUWriteMask {
27  GPU_WRITE_RED = (1 << 0),
28  GPU_WRITE_GREEN = (1 << 1),
29  GPU_WRITE_BLUE = (1 << 2),
30  GPU_WRITE_ALPHA = (1 << 3),
31  GPU_WRITE_DEPTH = (1 << 4),
32  GPU_WRITE_STENCIL = (1 << 5),
35 
37 
38 typedef enum eGPUBarrier {
43 
45 
46 
54 typedef enum eGPUBlend {
76 
77 typedef enum eGPUDepthTest {
79  GPU_DEPTH_ALWAYS, /* Used to draw to the depth buffer without really testing. */
81  GPU_DEPTH_LESS_EQUAL, /* Default. */
86 
87 typedef enum eGPUStencilTest {
93 
94 typedef enum eGPUStencilOp {
101 
102 typedef enum eGPUFaceCullTest {
103  GPU_CULL_NONE = 0, /* Culling disabled. */
107 
108 typedef enum eGPUProvokingVertex {
109  GPU_VERTEX_LAST = 0, /* Default. */
110  GPU_VERTEX_FIRST = 1, /* Follow Blender loop order. */
112 
113 #ifdef __cplusplus
114 extern "C" {
115 #endif
116 
118 void GPU_face_culling(eGPUFaceCullTest culling);
119 void GPU_depth_test(eGPUDepthTest test);
122 void GPU_front_facing(bool invert);
123 void GPU_depth_range(float near, float far);
124 void GPU_scissor_test(bool enable);
125 void GPU_line_smooth(bool enable);
126 void GPU_line_width(float width);
127 void GPU_logic_op_xor_set(bool enable);
128 void GPU_point_size(float size);
129 void GPU_polygon_smooth(bool enable);
130 void GPU_program_point_size(bool enable);
131 void GPU_scissor(int x, int y, int width, int height);
132 void GPU_scissor_get(int coords[4]);
133 void GPU_viewport(int x, int y, int width, int height);
134 void GPU_viewport_size_get_f(float coords[4]);
135 void GPU_viewport_size_get_i(int coords[4]);
137 void GPU_color_mask(bool r, bool g, bool b, bool a);
138 void GPU_depth_mask(bool depth);
139 bool GPU_depth_mask_get(void);
140 void GPU_shadow_offset(bool enable);
141 void GPU_clip_distances(int distances_enabled);
142 bool GPU_mipmap_enabled(void);
143 void GPU_state_set(eGPUWriteMask write_mask,
145  eGPUFaceCullTest culling_test,
146  eGPUDepthTest depth_test,
147  eGPUStencilTest stencil_test,
148  eGPUStencilOp stencil_op,
149  eGPUProvokingVertex provoking_vert);
150 
151 void GPU_stencil_reference_set(uint reference);
152 void GPU_stencil_write_mask_set(uint write_mask);
153 void GPU_stencil_compare_mask_set(uint compare_mask);
154 
160 float GPU_line_width_get(void);
161 
162 void GPU_flush(void);
163 void GPU_finish(void);
164 void GPU_apply_state(void);
165 
166 void GPU_bgl_start(void);
167 void GPU_bgl_end(void);
168 bool GPU_bgl_get(void);
169 
170 void GPU_memory_barrier(eGPUBarrier barrier);
171 
172 #ifdef __cplusplus
173 }
174 #endif
unsigned int uint
Definition: BLI_sys_types.h:83
#define ENUM_OPERATORS(_type, _max)
_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 GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_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
void GPU_memory_barrier(eGPUBarrier barrier)
Definition: gpu_state.cc:392
void GPU_program_point_size(bool enable)
Definition: gpu_state.cc:191
void GPU_face_culling(eGPUFaceCullTest culling)
Definition: gpu_state.cc:60
eGPUBlend
Definition: GPU_state.h:54
@ GPU_BLEND_ADDITIVE_PREMULT
Definition: GPU_state.h:60
@ GPU_BLEND_INVERT
Definition: GPU_state.h:65
@ GPU_BLEND_OIT
Definition: GPU_state.h:68
@ GPU_BLEND_MULTIPLY
Definition: GPU_state.h:61
@ GPU_BLEND_NONE
Definition: GPU_state.h:55
@ GPU_BLEND_ALPHA
Definition: GPU_state.h:57
@ GPU_BLEND_CUSTOM
Definition: GPU_state.h:73
@ GPU_BLEND_ADDITIVE
Definition: GPU_state.h:59
@ GPU_BLEND_SUBTRACT
Definition: GPU_state.h:62
@ GPU_BLEND_ALPHA_UNDER_PREMUL
Definition: GPU_state.h:74
@ GPU_BLEND_BACKGROUND
Definition: GPU_state.h:70
@ GPU_BLEND_ALPHA_PREMULT
Definition: GPU_state.h:58
void GPU_blend(eGPUBlend blend)
Definition: gpu_state.cc:55
void GPU_bgl_end(void)
Definition: gpu_state.cc:367
void GPU_write_mask(eGPUWriteMask mask)
Definition: gpu_state.cc:100
void GPU_scissor_test(bool enable)
Definition: gpu_state.cc:199
void GPU_bgl_start(void)
Definition: gpu_state.cc:336
void GPU_line_width(float width)
Definition: gpu_state.cc:173
void GPU_apply_state(void)
Definition: gpu_state.cc:321
eGPUWriteMask
Definition: GPU_state.h:25
@ GPU_WRITE_RED
Definition: GPU_state.h:27
@ GPU_WRITE_STENCIL
Definition: GPU_state.h:32
@ GPU_WRITE_NONE
Definition: GPU_state.h:26
@ GPU_WRITE_GREEN
Definition: GPU_state.h:28
@ GPU_WRITE_BLUE
Definition: GPU_state.h:29
@ GPU_WRITE_DEPTH
Definition: GPU_state.h:31
@ GPU_WRITE_COLOR
Definition: GPU_state.h:33
@ GPU_WRITE_ALPHA
Definition: GPU_state.h:30
float GPU_line_width_get(void)
Definition: gpu_state.cc:268
void GPU_line_smooth(bool enable)
Definition: gpu_state.cc:85
eGPUProvokingVertex
Definition: GPU_state.h:108
@ GPU_VERTEX_LAST
Definition: GPU_state.h:109
@ GPU_VERTEX_FIRST
Definition: GPU_state.h:110
void GPU_logic_op_xor_set(bool enable)
Definition: gpu_state.cc:95
uint GPU_stencil_mask_get(void)
Definition: gpu_state.cc:249
void GPU_depth_mask(bool depth)
Definition: gpu_state.cc:117
void GPU_stencil_test(eGPUStencilTest test)
Definition: gpu_state.cc:80
void GPU_stencil_write_mask_set(uint write_mask)
Definition: gpu_state.cc:221
void GPU_flush(void)
Definition: gpu_state.cc:311
bool GPU_bgl_get(void)
Definition: gpu_state.cc:381
eGPUFaceCullTest
Definition: GPU_state.h:102
@ GPU_CULL_FRONT
Definition: GPU_state.h:104
@ GPU_CULL_NONE
Definition: GPU_state.h:103
@ GPU_CULL_BACK
Definition: GPU_state.h:105
void GPU_finish(void)
Definition: gpu_state.cc:316
void GPU_color_mask(bool r, bool g, bool b, bool a)
Definition: gpu_state.cc:105
void GPU_depth_range(float near, float far)
Definition: gpu_state.cc:161
void GPU_viewport_size_get_i(int coords[4])
Definition: gpu_state.cc:288
void GPU_stencil_reference_set(uint reference)
Definition: gpu_state.cc:216
void GPU_scissor(int x, int y, int width, int height)
Definition: gpu_state.cc:204
eGPUBlend GPU_blend_get(void)
Definition: gpu_state.cc:237
eGPUBarrier
Definition: GPU_state.h:38
@ GPU_BARRIER_TEXTURE_FETCH
Definition: GPU_state.h:41
@ GPU_BARRIER_NONE
Definition: GPU_state.h:39
@ GPU_BARRIER_SHADER_IMAGE_ACCESS
Definition: GPU_state.h:40
eGPUStencilOp
Definition: GPU_state.h:94
@ GPU_STENCIL_OP_COUNT_DEPTH_FAIL
Definition: GPU_state.h:99
@ GPU_STENCIL_OP_COUNT_DEPTH_PASS
Definition: GPU_state.h:98
@ GPU_STENCIL_OP_REPLACE
Definition: GPU_state.h:96
@ GPU_STENCIL_OP_NONE
Definition: GPU_state.h:95
void GPU_stencil_compare_mask_set(uint compare_mask)
Definition: gpu_state.cc:226
void GPU_front_facing(bool invert)
Definition: gpu_state.cc:65
eGPUWriteMask GPU_write_mask_get(void)
Definition: gpu_state.cc:243
void GPU_viewport(int x, int y, int width, int height)
Definition: gpu_state.cc:210
eGPUStencilTest GPU_stencil_test_get(void)
Definition: gpu_state.cc:261
void GPU_point_size(float size)
Definition: gpu_state.cc:179
bool GPU_depth_mask_get(void)
Definition: gpu_state.cc:293
eGPUDepthTest
Definition: GPU_state.h:77
@ GPU_DEPTH_GREATER
Definition: GPU_state.h:83
@ GPU_DEPTH_EQUAL
Definition: GPU_state.h:82
@ GPU_DEPTH_ALWAYS
Definition: GPU_state.h:79
@ GPU_DEPTH_GREATER_EQUAL
Definition: GPU_state.h:84
@ GPU_DEPTH_LESS
Definition: GPU_state.h:80
@ GPU_DEPTH_LESS_EQUAL
Definition: GPU_state.h:81
@ GPU_DEPTH_NONE
Definition: GPU_state.h:78
eGPUDepthTest GPU_depth_test_get(void)
Definition: gpu_state.cc:255
bool GPU_mipmap_enabled(void)
Definition: gpu_state.cc:299
void GPU_state_set(eGPUWriteMask write_mask, eGPUBlend blend, eGPUFaceCullTest culling_test, eGPUDepthTest depth_test, eGPUStencilTest stencil_test, eGPUStencilOp stencil_op, eGPUProvokingVertex provoking_vert)
Definition: gpu_state.cc:136
eGPUStencilTest
Definition: GPU_state.h:87
@ GPU_STENCIL_EQUAL
Definition: GPU_state.h:90
@ GPU_STENCIL_NEQUAL
Definition: GPU_state.h:91
@ GPU_STENCIL_ALWAYS
Definition: GPU_state.h:89
@ GPU_STENCIL_NONE
Definition: GPU_state.h:88
void GPU_depth_test(eGPUDepthTest test)
Definition: gpu_state.cc:75
void GPU_viewport_size_get_f(float coords[4])
Definition: gpu_state.cc:279
void GPU_scissor_get(int coords[4])
Definition: gpu_state.cc:274
void GPU_clip_distances(int distances_enabled)
Definition: gpu_state.cc:131
void GPU_provoking_vertex(eGPUProvokingVertex vert)
Definition: gpu_state.cc:70
void GPU_polygon_smooth(bool enable)
Definition: gpu_state.cc:90
void GPU_shadow_offset(bool enable)
Definition: gpu_state.cc:126
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
static unsigned a[3]
Definition: RandGen.cpp:92
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
Definition: svm_invert.h:19
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)