Blender  V2.93
gpu_state.cc
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 #ifndef GPU_STANDALONE
22 # include "DNA_userdef_types.h"
23 # define PIXELSIZE (U.pixelsize)
24 #else
25 # define PIXELSIZE (1.0f)
26 #endif
27 
28 #include "BLI_math_vector.h"
29 #include "BLI_utildefines.h"
30 
31 #include "BKE_global.h"
32 
33 #include "GPU_state.h"
34 
35 #include "gpu_context_private.hh"
36 
37 #include "gpu_state_private.hh"
38 
39 using namespace blender::gpu;
40 
41 #define SET_STATE(_prefix, _state, _value) \
42  do { \
43  StateManager *stack = Context::get()->state_manager; \
44  auto &state_object = stack->_prefix##state; \
45  state_object._state = (_value); \
46  } while (0)
47 
48 #define SET_IMMUTABLE_STATE(_state, _value) SET_STATE(, _state, _value)
49 #define SET_MUTABLE_STATE(_state, _value) SET_STATE(mutable_, _state, _value)
50 
51 /* -------------------------------------------------------------------- */
56 {
58 }
59 
61 {
62  SET_IMMUTABLE_STATE(culling_test, culling);
63 }
64 
66 {
67  SET_IMMUTABLE_STATE(invert_facing, invert);
68 }
69 
71 {
72  SET_IMMUTABLE_STATE(provoking_vert, vert);
73 }
74 
76 {
77  SET_IMMUTABLE_STATE(depth_test, test);
78 }
79 
81 {
82  SET_IMMUTABLE_STATE(stencil_test, test);
83 }
84 
85 void GPU_line_smooth(bool enable)
86 {
87  SET_IMMUTABLE_STATE(line_smooth, enable);
88 }
89 
90 void GPU_polygon_smooth(bool enable)
91 {
92  SET_IMMUTABLE_STATE(polygon_smooth, enable);
93 }
94 
95 void GPU_logic_op_xor_set(bool enable)
96 {
97  SET_IMMUTABLE_STATE(logic_op_xor, enable);
98 }
99 
101 {
102  SET_IMMUTABLE_STATE(write_mask, mask);
103 }
104 
105 void GPU_color_mask(bool r, bool g, bool b, bool a)
106 {
108  auto &state = stack->state;
109  uint32_t write_mask = state.write_mask;
112  SET_FLAG_FROM_TEST(write_mask, b, (uint32_t)GPU_WRITE_BLUE);
114  state.write_mask = write_mask;
115 }
116 
117 void GPU_depth_mask(bool depth)
118 {
120  auto &state = stack->state;
121  uint32_t write_mask = state.write_mask;
122  SET_FLAG_FROM_TEST(write_mask, depth, (uint32_t)GPU_WRITE_DEPTH);
123  state.write_mask = write_mask;
124 }
125 
126 void GPU_shadow_offset(bool enable)
127 {
128  SET_IMMUTABLE_STATE(shadow_bias, enable);
129 }
130 
131 void GPU_clip_distances(int distances_enabled)
132 {
133  SET_IMMUTABLE_STATE(clip_distances, distances_enabled);
134 }
135 
136 void GPU_state_set(eGPUWriteMask write_mask,
138  eGPUFaceCullTest culling_test,
139  eGPUDepthTest depth_test,
140  eGPUStencilTest stencil_test,
141  eGPUStencilOp stencil_op,
142  eGPUProvokingVertex provoking_vert)
143 {
145  auto &state = stack->state;
146  state.write_mask = (uint32_t)write_mask;
147  state.blend = (uint32_t)blend;
148  state.culling_test = (uint32_t)culling_test;
149  state.depth_test = (uint32_t)depth_test;
150  state.stencil_test = (uint32_t)stencil_test;
151  state.stencil_op = (uint32_t)stencil_op;
152  state.provoking_vert = (uint32_t)provoking_vert;
153 }
154 
157 /* -------------------------------------------------------------------- */
161 void GPU_depth_range(float near, float far)
162 {
164  auto &state = stack->mutable_state;
165  copy_v2_fl2(state.depth_range, near, far);
166 }
167 
174 {
175  width = max_ff(1.0f, width * PIXELSIZE);
176  SET_MUTABLE_STATE(line_width, width);
177 }
178 
179 void GPU_point_size(float size)
180 {
182  auto &state = stack->mutable_state;
183  /* Keep the sign of point_size since it represents the enable state. */
184  state.point_size = size * ((state.point_size > 0.0) ? 1.0f : -1.0f);
185 }
186 
187 /* Programmable point size
188  * - shaders set their own point size when enabled
189  * - use GPU_point_size when disabled */
190 /* TODO remove and use program point size everywhere */
191 void GPU_program_point_size(bool enable)
192 {
194  auto &state = stack->mutable_state;
195  /* Set point size sign negative to disable. */
196  state.point_size = fabsf(state.point_size) * (enable ? 1 : -1);
197 }
198 
199 void GPU_scissor_test(bool enable)
200 {
202 }
203 
204 void GPU_scissor(int x, int y, int width, int height)
205 {
206  int scissor_rect[4] = {x, y, width, height};
207  Context::get()->active_fb->scissor_set(scissor_rect);
208 }
209 
210 void GPU_viewport(int x, int y, int width, int height)
211 {
212  int viewport_rect[4] = {x, y, width, height};
213  Context::get()->active_fb->viewport_set(viewport_rect);
214 }
215 
217 {
218  SET_MUTABLE_STATE(stencil_reference, (uint8_t)reference);
219 }
220 
222 {
223  SET_MUTABLE_STATE(stencil_write_mask, (uint8_t)write_mask);
224 }
225 
227 {
228  SET_MUTABLE_STATE(stencil_compare_mask, (uint8_t)compare_mask);
229 }
230 
233 /* -------------------------------------------------------------------- */
238 {
240  return (eGPUBlend)state.blend;
241 }
242 
244 {
246  return (eGPUWriteMask)state.write_mask;
247 }
248 
250 {
252  return state.stencil_write_mask;
253 }
254 
256 {
258  return (eGPUDepthTest)state.depth_test;
259 }
260 
262 {
264  return (eGPUStencilTest)state.stencil_test;
265 }
266 
267 /* NOTE: Already premultiplied by U.pixelsize. */
269 {
271  return state.line_width;
272 }
273 
274 void GPU_scissor_get(int coords[4])
275 {
276  Context::get()->active_fb->scissor_get(coords);
277 }
278 
279 void GPU_viewport_size_get_f(float coords[4])
280 {
281  int viewport[4];
282  Context::get()->active_fb->viewport_get(viewport);
283  for (int i = 0; i < 4; i++) {
284  coords[i] = viewport[i];
285  }
286 }
287 
288 void GPU_viewport_size_get_i(int coords[4])
289 {
290  Context::get()->active_fb->viewport_get(coords);
291 }
292 
294 {
296  return (state.write_mask & GPU_WRITE_DEPTH) != 0;
297 }
298 
300 {
301  /* TODO(fclem): this used to be a userdef option. */
302  return true;
303 }
304 
307 /* -------------------------------------------------------------------- */
311 void GPU_flush()
312 {
313  Context::get()->flush();
314 }
315 
317 {
318  Context::get()->finish();
319 }
320 
322 {
324 }
325 
328 /* -------------------------------------------------------------------- */
337 {
338  Context *ctx = Context::get();
339  if (!(ctx && ctx->state_manager)) {
340  return;
341  }
342  StateManager &state_manager = *(Context::get()->state_manager);
343  if (state_manager.use_bgl == false) {
344  /* Expected by many addons (see T80169, T81289).
345  * This will reset the blend function. */
347 
348  /* Equivalent of setting the depth func `glDepthFunc(GL_LEQUAL)`
349  * Needed since Python scripts may enable depth test.
350  * Without this block the depth test function is undefined. */
351  {
352  eGPUDepthTest depth_test_real = GPU_depth_test_get();
353  eGPUDepthTest depth_test_temp = GPU_DEPTH_LESS_EQUAL;
354  if (depth_test_real != depth_test_temp) {
355  GPU_depth_test(depth_test_temp);
356  state_manager.apply_state();
357  GPU_depth_test(depth_test_real);
358  }
359  }
360 
361  state_manager.apply_state();
362  state_manager.use_bgl = true;
363  }
364 }
365 
366 /* Just turn off the bgl safeguard system. Can be called even without GPU_bgl_start. */
368 {
369  Context *ctx = Context::get();
370  if (!(ctx && ctx->state_manager)) {
371  return;
372  }
373  StateManager &state_manager = *ctx->state_manager;
374  if (state_manager.use_bgl == true) {
375  state_manager.use_bgl = false;
376  /* Resync state tracking. */
377  state_manager.force_state();
378  }
379 }
380 
382 {
384 }
385 
388 /* -------------------------------------------------------------------- */
393 {
395 }
396 
399 /* -------------------------------------------------------------------- */
404 {
405  /* Set default state. */
413  state.logic_op_xor = false;
414  state.invert_facing = false;
415  state.shadow_bias = false;
416  state.clip_distances = 0;
417  state.polygon_smooth = false;
418  state.line_smooth = false;
419 
420  mutable_state.depth_range[0] = 0.0f;
421  mutable_state.depth_range[1] = 1.0f;
422  mutable_state.point_size = -1.0f; /* Negative is not using point size. */
423  mutable_state.line_width = 1.0f;
427 }
428 
MINLINE float max_ff(float a, float b)
MINLINE void copy_v2_fl2(float v[2], float x, float y)
unsigned int uint
Definition: BLI_sys_types.h:83
#define SET_FLAG_FROM_TEST(value, test, flag)
_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
eGPUBlend
Definition: GPU_state.h:54
@ GPU_BLEND_NONE
Definition: GPU_state.h:55
eGPUWriteMask
Definition: GPU_state.h:25
@ GPU_WRITE_RED
Definition: GPU_state.h:27
@ 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
eGPUProvokingVertex
Definition: GPU_state.h:108
@ GPU_VERTEX_LAST
Definition: GPU_state.h:109
eGPUFaceCullTest
Definition: GPU_state.h:102
@ GPU_CULL_NONE
Definition: GPU_state.h:103
eGPUBarrier
Definition: GPU_state.h:38
eGPUStencilOp
Definition: GPU_state.h:94
@ GPU_STENCIL_OP_NONE
Definition: GPU_state.h:95
eGPUDepthTest
Definition: GPU_state.h:77
@ GPU_DEPTH_LESS_EQUAL
Definition: GPU_state.h:81
@ GPU_DEPTH_NONE
Definition: GPU_state.h:78
eGPUStencilTest
Definition: GPU_state.h:87
@ GPU_STENCIL_NONE
Definition: GPU_state.h:88
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
virtual void finish(void)=0
static Context * get(void)
Definition: gpu_context.cc:88
virtual void flush(void)=0
void viewport_set(const int viewport[4])
void scissor_set(const int scissor[4])
void scissor_get(int r_scissor[4]) const
void viewport_get(int r_viewport[4]) const
virtual void issue_barrier(eGPUBarrier barrier_bits)=0
virtual void force_state(void)=0
virtual void apply_state(void)=0
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
void GPU_flush()
Definition: gpu_state.cc:311
void GPU_blend(eGPUBlend blend)
Definition: gpu_state.cc:55
void GPU_write_mask(eGPUWriteMask mask)
Definition: gpu_state.cc:100
void GPU_scissor_test(bool enable)
Definition: gpu_state.cc:199
void GPU_line_width(float width)
Definition: gpu_state.cc:173
eGPUBlend GPU_blend_get()
Definition: gpu_state.cc:237
void GPU_finish()
Definition: gpu_state.cc:316
void GPU_line_smooth(bool enable)
Definition: gpu_state.cc:85
void GPU_logic_op_xor_set(bool enable)
Definition: gpu_state.cc:95
void GPU_depth_mask(bool depth)
Definition: gpu_state.cc:117
eGPUDepthTest GPU_depth_test_get()
Definition: gpu_state.cc:255
void GPU_bgl_start()
Definition: gpu_state.cc:336
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
bool GPU_mipmap_enabled()
Definition: gpu_state.cc:299
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
eGPUWriteMask GPU_write_mask_get()
Definition: gpu_state.cc:243
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
float GPU_line_width_get()
Definition: gpu_state.cc:268
void GPU_stencil_compare_mask_set(uint compare_mask)
Definition: gpu_state.cc:226
eGPUStencilTest GPU_stencil_test_get()
Definition: gpu_state.cc:261
#define SET_MUTABLE_STATE(_state, _value)
Definition: gpu_state.cc:49
void GPU_front_facing(bool invert)
Definition: gpu_state.cc:65
void GPU_viewport(int x, int y, int width, int height)
Definition: gpu_state.cc:210
#define PIXELSIZE
Definition: gpu_state.cc:23
void GPU_point_size(float size)
Definition: gpu_state.cc:179
uint GPU_stencil_mask_get()
Definition: gpu_state.cc:249
void GPU_bgl_end()
Definition: gpu_state.cc:367
bool GPU_bgl_get()
Definition: gpu_state.cc:381
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
#define SET_IMMUTABLE_STATE(_state, _value)
Definition: gpu_state.cc:48
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_apply_state()
Definition: gpu_state.cc:321
bool GPU_depth_mask_get()
Definition: gpu_state.cc:293
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
#define fabsf(x)
static ulong state[N]
static unsigned a[3]
Definition: RandGen.cpp:92
unsigned int uint32_t
Definition: stdint.h:83
unsigned char uint8_t
Definition: stdint.h:81
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)