Blender V5.3
gl_state.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2020 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "BKE_global.hh"
10
11#include "BLI_math_base_c.hh"
12#include "BLI_math_bits.hh"
13
14#include "GPU_capabilities.hh"
15
16#include "gl_context.hh"
17#include "gl_framebuffer.hh"
18#include "gl_texture.hh"
19
20#include "gl_state.hh"
21
22namespace blender::gpu {
23
24/* -------------------------------------------------------------------- */
27
29{
30 /* Set other states that never change. */
31 glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
32 glEnable(GL_MULTISAMPLE);
33
34 glDisable(GL_DITHER);
35
36 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
37 glPixelStorei(GL_PACK_ALIGNMENT, 1);
38 glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
39
40 /* Takes precedence over #GL_PRIMITIVE_RESTART.
41 * Sets restart index correctly following the IBO type. */
42 glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
43
44 /* Limits. */
45 glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, line_width_range_);
46
47 /* Force update using default state. */
48 current_ = ~state;
49 current_mutable_ = ~mutable_state;
50 set_state(state);
51 set_mutable_state(mutable_state);
52}
53
55{
56 this->set_state(this->state);
57 this->set_mutable_state(this->mutable_state);
58 this->texture_bind_apply();
59 this->image_bind_apply();
60
61 /* This is needed by gpu_py_offscreen. */
63};
64
66{
67 /* Little exception for clip distances since they need to keep the old count correct. */
68 uint32_t clip_distances = current_.clip_distances;
69 current_ = ~this->state;
70 current_.clip_distances = clip_distances;
71 current_mutable_ = ~this->mutable_state;
72 this->set_state(this->state);
73 this->set_mutable_state(this->mutable_state);
74};
75
76void GLStateManager::set_state(const GPUState &state)
77{
78 GPUState changed = state ^ current_;
79
80 if (changed.blend != 0) {
81 set_blend(GPUBlend(state.blend));
82 }
83 if (changed.write_mask != 0) {
84 set_write_mask(GPUWriteMask(state.write_mask));
85 }
86 if (changed.depth_test != 0) {
87 set_depth_test(GPUDepthTest(state.depth_test));
88 }
89 if (changed.stencil_test != 0 || changed.stencil_op != 0) {
90 set_stencil_test(GPUStencilTest(state.stencil_test), GPUStencilOp(state.stencil_op));
91 set_stencil_mask(GPUStencilTest(state.stencil_test), mutable_state);
92 }
93 if (changed.clip_distances != 0) {
94 set_clip_distances(state.clip_distances, current_.clip_distances);
95 }
96 if (changed.culling_test != 0) {
97 set_backface_culling(GPUFaceCullTest(state.culling_test));
98 }
99
100 if (changed.invert_facing != 0) {
101 set_facing(state.invert_facing);
102 }
103 if (changed.provoking_vert != 0) {
104 set_provoking_vert(GPUProvokingVertex(state.provoking_vert));
105 }
106 if (changed.clip_control != 0) {
107 set_clip_control(state.clip_control);
108 }
109
110 /* TODO: remove. */
111 if (changed.polygon_smooth) {
112 if (state.polygon_smooth) {
113 glEnable(GL_POLYGON_SMOOTH);
114 }
115 else {
116 glDisable(GL_POLYGON_SMOOTH);
117 }
118 }
119 if (changed.line_smooth) {
120 if (state.line_smooth) {
121 glEnable(GL_LINE_SMOOTH);
122 }
123 else {
124 glDisable(GL_LINE_SMOOTH);
125 }
126 }
127
128 current_ = state;
129}
130
131void GLStateManager::set_mutable_state(const GPUStateMutable &state)
132{
133 GPUStateMutable changed = state ^ current_mutable_;
134
135 /* TODO: remove, should be uniform. */
136 if (float_as_uint(changed.point_size) != 0) {
137 if (state.point_size > 0.0f) {
138 glEnable(GL_PROGRAM_POINT_SIZE);
139 }
140 else {
141 glDisable(GL_PROGRAM_POINT_SIZE);
142 glPointSize(fabsf(state.point_size));
143 }
144 }
145
146 if (float_as_uint(changed.line_width) != 0) {
147 /* TODO: remove, should use wide line shader. */
148 glLineWidth(clamp_f(state.line_width, line_width_range_[0], line_width_range_[1]));
149 }
150
151 if (changed.stencil_compare_mask != 0 || changed.stencil_reference != 0 ||
152 changed.stencil_write_mask != 0)
153 {
154 set_stencil_mask(GPUStencilTest(current_.stencil_test), state);
155 }
156
157 current_mutable_ = state;
158}
159
161
162/* -------------------------------------------------------------------- */
165
166void GLStateManager::set_write_mask(const GPUWriteMask value)
167{
168 glDepthMask((value & GPU_WRITE_DEPTH) != 0);
169 glColorMask((value & GPU_WRITE_RED) != 0,
170 (value & GPU_WRITE_GREEN) != 0,
171 (value & GPU_WRITE_BLUE) != 0,
172 (value & GPU_WRITE_ALPHA) != 0);
173
174 if (value == GPU_WRITE_NONE) {
175 glEnable(GL_RASTERIZER_DISCARD);
176 }
177 else {
178 glDisable(GL_RASTERIZER_DISCARD);
179 }
180}
181
182void GLStateManager::set_depth_test(const GPUDepthTest value)
183{
184 GLenum func;
185 switch (value) {
186 case GPU_DEPTH_LESS:
187 func = GL_LESS;
188 break;
190 func = GL_LEQUAL;
191 break;
192 case GPU_DEPTH_EQUAL:
193 func = GL_EQUAL;
194 break;
196 func = GL_GREATER;
197 break;
199 func = GL_GEQUAL;
200 break;
201 case GPU_DEPTH_ALWAYS:
202 default:
203 func = GL_ALWAYS;
204 break;
205 }
206
207 if (value != GPU_DEPTH_NONE) {
208 glEnable(GL_DEPTH_TEST);
209 glDepthFunc(func);
210 }
211 else {
212 glDisable(GL_DEPTH_TEST);
213 }
214}
215
216void GLStateManager::set_stencil_test(const GPUStencilTest test, const GPUStencilOp operation)
217{
218 switch (operation) {
220 glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
221 break;
223 glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_INCR_WRAP);
224 glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_DECR_WRAP);
225 break;
227 glStencilOpSeparate(GL_BACK, GL_KEEP, GL_DECR_WRAP, GL_KEEP);
228 glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_INCR_WRAP, GL_KEEP);
229 break;
231 default:
232 glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
233 }
234
235 if (test != GPU_STENCIL_NONE) {
236 glEnable(GL_STENCIL_TEST);
237 }
238 else {
239 glDisable(GL_STENCIL_TEST);
240 }
241}
242
243void GLStateManager::set_stencil_mask(const GPUStencilTest test, const GPUStateMutable &state)
244{
245 GLenum func;
246 switch (test) {
248 func = GL_NOTEQUAL;
249 break;
251 func = GL_EQUAL;
252 break;
254 func = GL_ALWAYS;
255 break;
256 case GPU_STENCIL_NONE:
257 default:
258 glStencilMask(0x00);
259 glStencilFunc(GL_ALWAYS, 0x00, 0x00);
260 return;
261 }
262
263 glStencilMask(state.stencil_write_mask);
264 glStencilFunc(func, state.stencil_reference, state.stencil_compare_mask);
265}
266
267void GLStateManager::set_clip_distances(const int new_dist_len, const int old_dist_len)
268{
269 for (int i = 0; i < new_dist_len; i++) {
270 glEnable(GL_CLIP_DISTANCE0 + i);
271 }
272 for (int i = new_dist_len; i < old_dist_len; i++) {
273 glDisable(GL_CLIP_DISTANCE0 + i);
274 }
275}
276
277void GLStateManager::set_facing(const bool invert)
278{
279 glFrontFace((invert) ? GL_CW : GL_CCW);
280}
281
282void GLStateManager::set_backface_culling(const GPUFaceCullTest test)
283{
284 if (test != GPU_CULL_NONE) {
285 glEnable(GL_CULL_FACE);
286 glCullFace((test == GPU_CULL_FRONT) ? GL_FRONT : GL_BACK);
287 }
288 else {
289 glDisable(GL_CULL_FACE);
290 }
291}
292
293void GLStateManager::set_provoking_vert(const GPUProvokingVertex vert)
294{
295 GLenum value = (vert == GPU_VERTEX_FIRST) ? GL_FIRST_VERTEX_CONVENTION :
296 GL_LAST_VERTEX_CONVENTION;
297 glProvokingVertex(value);
298}
299
300void GLStateManager::set_clip_control(const bool enable)
301{
302 if (enable) {
303 /* Match Vulkan and Metal by default. */
304 glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
305 }
306 else {
307 glClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
308 }
309}
310
311void GLStateManager::set_blend(const GPUBlend value)
312{
320 GLenum src_rgb, src_alpha, dst_rgb, dst_alpha;
321 switch (value) {
322 default:
323 case GPU_BLEND_ALPHA: {
324 src_rgb = GL_SRC_ALPHA;
325 dst_rgb = GL_ONE_MINUS_SRC_ALPHA;
326 src_alpha = GL_ONE;
327 dst_alpha = GL_ONE_MINUS_SRC_ALPHA;
328 break;
329 }
331 src_rgb = GL_ONE;
332 dst_rgb = GL_ONE_MINUS_SRC_ALPHA;
333 src_alpha = GL_ONE;
334 dst_alpha = GL_ONE_MINUS_SRC_ALPHA;
335 break;
336 }
337 case GPU_BLEND_ADDITIVE: {
338 /* Do not let alpha accumulate but pre-multiply the source RGB by it. */
339 src_rgb = GL_SRC_ALPHA;
340 dst_rgb = GL_ONE;
341 src_alpha = GL_ZERO;
342 dst_alpha = GL_ONE;
343 break;
344 }
345 /* Factors are not use in min or max mode, but avoid uninitialized values. */;
346 case GPU_BLEND_MIN:
347 case GPU_BLEND_MAX:
350 /* Let alpha accumulate. */
351 src_rgb = GL_ONE;
352 dst_rgb = GL_ONE;
353 src_alpha = GL_ONE;
354 dst_alpha = GL_ONE;
355 break;
356 }
357 case GPU_BLEND_MULTIPLY: {
358 src_rgb = GL_DST_COLOR;
359 dst_rgb = GL_ZERO;
360 src_alpha = GL_DST_ALPHA;
361 dst_alpha = GL_ZERO;
362 break;
363 }
364 case GPU_BLEND_INVERT: {
365 src_rgb = GL_ONE_MINUS_DST_COLOR;
366 dst_rgb = GL_ZERO;
367 src_alpha = GL_ZERO;
368 dst_alpha = GL_ONE;
369 break;
370 }
371 case GPU_BLEND_OIT: {
372 src_rgb = GL_ONE;
373 dst_rgb = GL_ONE;
374 src_alpha = GL_ZERO;
375 dst_alpha = GL_ONE_MINUS_SRC_ALPHA;
376 break;
377 }
379 src_rgb = GL_ONE_MINUS_DST_ALPHA;
380 dst_rgb = GL_SRC_ALPHA;
381 src_alpha = GL_ZERO;
382 dst_alpha = GL_SRC_ALPHA;
383 break;
384 }
386 src_rgb = GL_ONE_MINUS_DST_ALPHA;
387 dst_rgb = GL_ONE;
388 src_alpha = GL_ONE_MINUS_DST_ALPHA;
389 dst_alpha = GL_ONE;
390 break;
391 }
392 case GPU_BLEND_CUSTOM: {
393 src_rgb = GL_ONE;
394 dst_rgb = GL_SRC1_COLOR;
395 src_alpha = GL_ONE;
396 dst_alpha = GL_SRC1_ALPHA;
397 break;
398 }
400 src_rgb = GL_ZERO;
401 dst_rgb = GL_ONE_MINUS_SRC_ALPHA;
402 src_alpha = GL_ZERO;
403 dst_alpha = GL_ONE_MINUS_SRC_ALPHA;
404 break;
405 }
407 src_rgb = GL_ONE;
408 dst_rgb = GL_SRC_ALPHA;
409 src_alpha = GL_ZERO;
410 dst_alpha = GL_SRC_ALPHA;
411 break;
412 }
413 }
414
415 if (value == GPU_BLEND_MIN) {
416 glBlendEquation(GL_MIN);
417 }
418 else if (value == GPU_BLEND_MAX) {
419 glBlendEquation(GL_MAX);
420 }
421 else if (value == GPU_BLEND_SUBTRACT) {
422 glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
423 }
424 else {
425 glBlendEquation(GL_FUNC_ADD);
426 }
427
428 /* Always set the blend function. This avoid a rendering error when blending is disabled but
429 * GPU_BLEND_CUSTOM was used just before and the frame-buffer is using more than 1 color target.
430 */
431 glBlendFuncSeparate(src_rgb, dst_rgb, src_alpha, dst_alpha);
432 if (value != GPU_BLEND_NONE) {
433 glEnable(GL_BLEND);
434 }
435 else {
436 glDisable(GL_BLEND);
437 }
438}
439
441
442/* -------------------------------------------------------------------- */
445
446void GLStateManager::texture_bind(Texture *tex_, GPUSamplerState sampler_state, int unit)
447{
449 GLTexture *tex = static_cast<GLTexture *>(tex_);
450 if (G.debug & G_DEBUG_GPU) {
451 tex->check_feedback_loop();
452 }
453 /* Eliminate redundant binds. */
454 if ((textures_[unit] == tex->tex_id_) &&
455 (samplers_[unit] == GLTexture::get_sampler(sampler_state)))
456 {
457 return;
458 }
459 targets_[unit] = tex->target_;
460 textures_[unit] = tex->tex_id_;
461 samplers_[unit] = GLTexture::get_sampler(sampler_state);
462 tex->is_bound_ = true;
463 dirty_texture_binds_ |= 1ULL << unit;
464}
465
467{
468 glActiveTexture(GL_TEXTURE0);
469 glBindTexture(tex->target_, tex->tex_id_);
470 /* Will reset the first texture that was originally bound to slot 0 back before drawing. */
471 dirty_texture_binds_ |= 1ULL;
472 /* NOTE: This might leave this texture attached to this target even after update.
473 * In practice it is not causing problems as we have incorrect binding detection
474 * at higher level. */
475}
476
478{
479 GLTexture *tex = static_cast<GLTexture *>(tex_);
480 if (!tex->is_bound_) {
481 return;
482 }
483
484 GLuint tex_id = tex->tex_id_;
485 for (int i = 0; i < ARRAY_SIZE(textures_); i++) {
486 if (textures_[i] == tex_id) {
487 textures_[i] = 0;
488 samplers_[i] = 0;
489 dirty_texture_binds_ |= 1ULL << i;
490 }
491 }
492 tex->is_bound_ = false;
493}
494
496{
497 for (int i = 0; i < ARRAY_SIZE(textures_); i++) {
498 if (textures_[i] != 0) {
499 textures_[i] = 0;
500 samplers_[i] = 0;
501 dirty_texture_binds_ |= 1ULL << i;
502 }
503 }
504 this->texture_bind_apply();
505}
506
507void GLStateManager::texture_bind_apply()
508{
509 if (dirty_texture_binds_ == 0) {
510 return;
511 }
512 uint64_t dirty_bind = dirty_texture_binds_;
513 dirty_texture_binds_ = 0;
514
515 int first = bitscan_forward_uint64(dirty_bind);
516 int last = 64 - bitscan_reverse_uint64(dirty_bind);
517 int count = last - first;
518
520 glBindTextures(first, count, textures_ + first);
521 glBindSamplers(first, count, samplers_ + first);
522 }
523 else {
524 for (int unit = first; unit < last; unit++) {
525 if ((dirty_bind >> unit) & 1UL) {
526 glActiveTexture(GL_TEXTURE0 + unit);
527 glBindTexture(targets_[unit], textures_[unit]);
528 glBindSampler(unit, samplers_[unit]);
529 }
530 }
531 }
532}
533
535{
536 uint64_t bound_slots = 0;
537 for (int i = 0; i < ARRAY_SIZE(textures_); i++) {
538 if (textures_[i] != 0) {
539 bound_slots |= 1ULL << i;
540 }
541 }
542 return bound_slots;
543}
544
546
547/* -------------------------------------------------------------------- */
550
552{
553 /* Minimum support is 8 image in the fragment shader. No image for other stages. */
554 BLI_assert(unit < 8);
555 GLTexture *tex = static_cast<GLTexture *>(tex_);
556 if (G.debug & G_DEBUG_GPU) {
557 tex->check_feedback_loop();
558 }
559 images_[unit] = tex->tex_id_;
560 formats_[unit] = to_gl_internal_format(tex->format_);
562 tex->is_bound_image_ = true;
563 dirty_image_binds_ |= 1ULL << unit;
564}
565
567{
568 GLTexture *tex = static_cast<GLTexture *>(tex_);
569 if (!tex->is_bound_image_) {
570 return;
571 }
572
573 GLuint tex_id = tex->tex_id_;
574 for (int i = 0; i < ARRAY_SIZE(images_); i++) {
575 if (images_[i] == tex_id) {
576 images_[i] = 0;
578 dirty_image_binds_ |= 1ULL << i;
579 }
580 }
581 tex->is_bound_image_ = false;
582}
583
585{
586 for (int i = 0; i < ARRAY_SIZE(images_); i++) {
587 if (images_[i] != 0) {
588 images_[i] = 0;
589 dirty_image_binds_ |= 1ULL << i;
590 }
591 }
593 this->image_bind_apply();
594}
595
596void GLStateManager::image_bind_apply()
597{
598 if (dirty_image_binds_ == 0) {
599 return;
600 }
601 uint32_t dirty_bind = dirty_image_binds_;
602 dirty_image_binds_ = 0;
603
604 int first = bitscan_forward_uint(dirty_bind);
605 int last = 32 - bitscan_reverse_uint(dirty_bind);
606 int count = last - first;
607
609 glBindImageTextures(first, count, images_ + first);
610 }
611 else {
612 for (int unit = first; unit < last; unit++) {
613 if ((dirty_bind >> unit) & 1UL) {
614 glBindImageTexture(unit, images_[unit], 0, GL_TRUE, 0, GL_READ_WRITE, formats_[unit]);
615 }
616 }
617 }
618}
619
621{
622 uint8_t bound_slots = 0;
623 for (int i = 0; i < ARRAY_SIZE(images_); i++) {
624 if (images_[i] != 0) {
625 bound_slots |= 1ULL << i;
626 }
627 }
628 return bound_slots;
629}
630
632
633/* -------------------------------------------------------------------- */
636
638{
639 glMemoryBarrier(to_gl(barrier_bits));
640}
641
643{
644 if (gl_sync_ != nullptr) {
645 glDeleteSync(gl_sync_);
646 gl_sync_ = nullptr;
647 }
648}
649
651{
652 /* If fence is already signaled, create a newly signaled fence primitive. */
653 if (gl_sync_) {
654 glDeleteSync(gl_sync_);
655 }
656
657 gl_sync_ = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
658 signalled_ = true;
659}
660
662{
663 /* Do not wait if fence does not yet exist. */
664 if (gl_sync_ == nullptr) {
665 return;
666 }
667 glWaitSync(gl_sync_, 0, GL_TIMEOUT_IGNORED);
668 signalled_ = false;
669}
670
671
672} // namespace blender::gpu
static bool multi_bind_support
Definition gl_context.hh:70
static bool multi_bind_image_support
Definition gl_context.hh:71
void signal() override
Definition gl_state.cc:650
void wait() override
Definition gl_state.cc:661
void texture_bind_temp(GLTexture *tex)
Definition gl_state.cc:466
GLFrameBuffer * active_fb
Definition gl_state.hh:31
void image_unbind(Texture *tex) override
Definition gl_state.cc:566
void image_bind(Texture *tex, int unit) override
Definition gl_state.cc:551
void apply_state() override
Definition gl_state.cc:54
void texture_unbind_all() override
Definition gl_state.cc:495
void issue_barrier(GPUBarrier barrier_bits) override
Definition gl_state.cc:637
void force_state() override
Definition gl_state.cc:65
void texture_bind(Texture *tex, GPUSamplerState sampler, int unit) override
Definition gl_state.cc:446
void image_unbind_all() override
Definition gl_state.cc:584
void texture_unbind(Texture *tex) override
Definition gl_state.cc:477
static GLuint get_sampler(const GPUSamplerState &sampler_state)
std::array< TextureWriteFormat, GPU_MAX_IMAGE > image_formats
TextureFormat format_get() const
float2x2 invert(float2x2 mat)
const int state
GLenum to_gl_internal_format(TextureFormat format)
GLenum to_gl(eGPUDataFormat format)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
@ GPU_CULL_FRONT
Definition GPU_state.hh:158
@ GPU_CULL_NONE
Definition GPU_state.hh:157
unsigned __int64 uint64_t
Definition BKE_text.h:91
@ GPU_STENCIL_OP_COUNT_DEPTH_FAIL
Definition GPU_state.hh:153
@ GPU_STENCIL_OP_COUNT_DEPTH_PASS
Definition GPU_state.hh:152
@ GPU_STENCIL_OP_NONE
Definition GPU_state.hh:149
@ GPU_STENCIL_OP_REPLACE
Definition GPU_state.hh:150
MINLINE unsigned int bitscan_forward_uint(unsigned int a)
MINLINE unsigned int float_as_uint(float f)
@ GPU_BLEND_MIN
Definition GPU_state.hh:102
@ GPU_BLEND_OVERLAY_MASK_FROM_ALPHA
Definition GPU_state.hh:122
@ GPU_BLEND_TRANSPARENCY
Definition GPU_state.hh:128
@ GPU_BLEND_NONE
Definition GPU_state.hh:88
@ GPU_BLEND_OIT
Definition GPU_state.hh:109
@ GPU_BLEND_MAX
Definition GPU_state.hh:104
@ GPU_BLEND_ALPHA_UNDER_PREMUL
Definition GPU_state.hh:117
@ GPU_BLEND_ADDITIVE_PREMULT
Definition GPU_state.hh:93
@ GPU_BLEND_ALPHA
Definition GPU_state.hh:90
@ GPU_BLEND_ADDITIVE
Definition GPU_state.hh:92
@ GPU_BLEND_BACKGROUND
Definition GPU_state.hh:111
@ GPU_BLEND_SUBTRACT
Definition GPU_state.hh:95
@ GPU_BLEND_ALPHA_PREMULT
Definition GPU_state.hh:91
@ GPU_BLEND_INVERT
Definition GPU_state.hh:100
@ GPU_BLEND_MULTIPLY
Definition GPU_state.hh:94
@ GPU_BLEND_CUSTOM
Definition GPU_state.hh:116
Global G
Definition blender.cc:57
unsigned int uint32_t
Definition BKE_text.h:81
@ GPU_DEPTH_NONE
Definition GPU_state.hh:132
@ GPU_DEPTH_LESS_EQUAL
Definition GPU_state.hh:135
@ GPU_DEPTH_ALWAYS
Definition GPU_state.hh:133
@ GPU_DEPTH_GREATER
Definition GPU_state.hh:137
@ GPU_DEPTH_LESS
Definition GPU_state.hh:134
@ GPU_DEPTH_GREATER_EQUAL
Definition GPU_state.hh:138
@ GPU_DEPTH_EQUAL
Definition GPU_state.hh:136
MINLINE unsigned int bitscan_reverse_uint(unsigned int a)
unsigned char uint8_t
Definition BKE_text.h:79
int GPU_max_textures()
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
MINLINE unsigned int bitscan_forward_uint64(unsigned long long a)
@ GPU_STENCIL_ALWAYS
Definition GPU_state.hh:143
@ GPU_STENCIL_EQUAL
Definition GPU_state.hh:144
@ GPU_STENCIL_NONE
Definition GPU_state.hh:142
@ GPU_STENCIL_NEQUAL
Definition GPU_state.hh:145
@ GPU_WRITE_NONE
Definition GPU_state.hh:20
@ GPU_WRITE_ALPHA
Definition GPU_state.hh:24
@ GPU_WRITE_RED
Definition GPU_state.hh:21
@ GPU_WRITE_BLUE
Definition GPU_state.hh:23
@ GPU_WRITE_GREEN
Definition GPU_state.hh:22
@ GPU_WRITE_DEPTH
Definition GPU_state.hh:25
GPUProvokingVertex
Definition GPU_state.hh:162
@ GPU_VERTEX_FIRST
Definition GPU_state.hh:164
MINLINE unsigned int bitscan_reverse_uint64(unsigned long long a)
MINLINE float clamp_f(float value, float min, float max)
void vert(const int vert_id, float4 &position)
#define fabsf