Blender V4.5
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.h"
12#include "BLI_math_bits.h"
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 if (!this->use_bgl) {
57 this->set_state(this->state);
58 this->set_mutable_state(this->mutable_state);
59 this->texture_bind_apply();
60 this->image_bind_apply();
61 }
62 /* This is needed by gpu_py_offscreen. */
63 active_fb->apply_state();
64};
65
67{
68 /* Little exception for clip distances since they need to keep the old count correct. */
69 uint32_t clip_distances = current_.clip_distances;
70 current_ = ~this->state;
71 current_.clip_distances = clip_distances;
72 current_mutable_ = ~this->mutable_state;
73 this->set_state(this->state);
74 this->set_mutable_state(this->mutable_state);
75};
76
77void GLStateManager::set_state(const GPUState &state)
78{
79 GPUState changed = state ^ current_;
80
81 if (changed.blend != 0) {
82 set_blend((eGPUBlend)state.blend);
83 }
84 if (changed.write_mask != 0) {
85 set_write_mask((eGPUWriteMask)state.write_mask);
86 }
87 if (changed.depth_test != 0) {
88 set_depth_test((eGPUDepthTest)state.depth_test);
89 }
90 if (changed.stencil_test != 0 || changed.stencil_op != 0) {
91 set_stencil_test((eGPUStencilTest)state.stencil_test, (eGPUStencilOp)state.stencil_op);
92 set_stencil_mask((eGPUStencilTest)state.stencil_test, mutable_state);
93 }
94 if (changed.clip_distances != 0) {
95 set_clip_distances(state.clip_distances, current_.clip_distances);
96 }
97 if (changed.culling_test != 0) {
98 set_backface_culling((eGPUFaceCullTest)state.culling_test);
99 }
100 if (changed.logic_op_xor != 0) {
101 set_logic_op(state.logic_op_xor);
102 }
103 if (changed.invert_facing != 0) {
104 set_facing(state.invert_facing);
105 }
106 if (changed.provoking_vert != 0) {
107 set_provoking_vert((eGPUProvokingVertex)state.provoking_vert);
108 }
109 if (changed.shadow_bias != 0) {
110 set_shadow_bias(state.shadow_bias);
111 }
112 if (changed.clip_control != 0) {
113 set_clip_control(state.clip_control);
114 }
115
116 /* TODO: remove. */
117 if (changed.polygon_smooth) {
118 if (state.polygon_smooth) {
119 glEnable(GL_POLYGON_SMOOTH);
120 }
121 else {
122 glDisable(GL_POLYGON_SMOOTH);
123 }
124 }
125 if (changed.line_smooth) {
126 if (state.line_smooth) {
127 glEnable(GL_LINE_SMOOTH);
128 }
129 else {
130 glDisable(GL_LINE_SMOOTH);
131 }
132 }
133
134 current_ = state;
135}
136
137void GLStateManager::set_mutable_state(const GPUStateMutable &state)
138{
139 GPUStateMutable changed = state ^ current_mutable_;
140
141 /* TODO: remove, should be uniform. */
142 if (float_as_uint(changed.point_size) != 0) {
143 if (state.point_size > 0.0f) {
144 glEnable(GL_PROGRAM_POINT_SIZE);
145 }
146 else {
147 glDisable(GL_PROGRAM_POINT_SIZE);
148 glPointSize(fabsf(state.point_size));
149 }
150 }
151
152 if (float_as_uint(changed.line_width) != 0) {
153 /* TODO: remove, should use wide line shader. */
154 glLineWidth(clamp_f(state.line_width, line_width_range_[0], line_width_range_[1]));
155 }
156
157 if (float_as_uint(changed.depth_range[0]) != 0 || float_as_uint(changed.depth_range[1]) != 0) {
158 /* TODO: remove, should modify the projection matrix instead. */
159 glDepthRange(UNPACK2(state.depth_range));
160 }
161
162 if (changed.stencil_compare_mask != 0 || changed.stencil_reference != 0 ||
163 changed.stencil_write_mask != 0)
164 {
165 set_stencil_mask((eGPUStencilTest)current_.stencil_test, state);
166 }
167
168 current_mutable_ = state;
169}
170
172
173/* -------------------------------------------------------------------- */
176
177void GLStateManager::set_write_mask(const eGPUWriteMask value)
178{
179 glDepthMask((value & GPU_WRITE_DEPTH) != 0);
180 glColorMask((value & GPU_WRITE_RED) != 0,
181 (value & GPU_WRITE_GREEN) != 0,
182 (value & GPU_WRITE_BLUE) != 0,
183 (value & GPU_WRITE_ALPHA) != 0);
184
185 if (value == GPU_WRITE_NONE) {
186 glEnable(GL_RASTERIZER_DISCARD);
187 }
188 else {
189 glDisable(GL_RASTERIZER_DISCARD);
190 }
191}
192
193void GLStateManager::set_depth_test(const eGPUDepthTest value)
194{
195 GLenum func;
196 switch (value) {
197 case GPU_DEPTH_LESS:
198 func = GL_LESS;
199 break;
201 func = GL_LEQUAL;
202 break;
203 case GPU_DEPTH_EQUAL:
204 func = GL_EQUAL;
205 break;
207 func = GL_GREATER;
208 break;
210 func = GL_GEQUAL;
211 break;
212 case GPU_DEPTH_ALWAYS:
213 default:
214 func = GL_ALWAYS;
215 break;
216 }
217
218 if (value != GPU_DEPTH_NONE) {
219 glEnable(GL_DEPTH_TEST);
220 glDepthFunc(func);
221 }
222 else {
223 glDisable(GL_DEPTH_TEST);
224 }
225}
226
227void GLStateManager::set_stencil_test(const eGPUStencilTest test, const eGPUStencilOp operation)
228{
229 switch (operation) {
231 glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
232 break;
234 glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_INCR_WRAP);
235 glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_DECR_WRAP);
236 break;
238 glStencilOpSeparate(GL_BACK, GL_KEEP, GL_DECR_WRAP, GL_KEEP);
239 glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_INCR_WRAP, GL_KEEP);
240 break;
242 default:
243 glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
244 }
245
246 if (test != GPU_STENCIL_NONE) {
247 glEnable(GL_STENCIL_TEST);
248 }
249 else {
250 glDisable(GL_STENCIL_TEST);
251 }
252}
253
254void GLStateManager::set_stencil_mask(const eGPUStencilTest test, const GPUStateMutable &state)
255{
256 GLenum func;
257 switch (test) {
259 func = GL_NOTEQUAL;
260 break;
262 func = GL_EQUAL;
263 break;
265 func = GL_ALWAYS;
266 break;
267 case GPU_STENCIL_NONE:
268 default:
269 glStencilMask(0x00);
270 glStencilFunc(GL_ALWAYS, 0x00, 0x00);
271 return;
272 }
273
274 glStencilMask(state.stencil_write_mask);
275 glStencilFunc(func, state.stencil_reference, state.stencil_compare_mask);
276}
277
278void GLStateManager::set_clip_distances(const int new_dist_len, const int old_dist_len)
279{
280 for (int i = 0; i < new_dist_len; i++) {
281 glEnable(GL_CLIP_DISTANCE0 + i);
282 }
283 for (int i = new_dist_len; i < old_dist_len; i++) {
284 glDisable(GL_CLIP_DISTANCE0 + i);
285 }
286}
287
288void GLStateManager::set_logic_op(const bool enable)
289{
290 if (enable) {
291 glEnable(GL_COLOR_LOGIC_OP);
292 glLogicOp(GL_XOR);
293 }
294 else {
295 glDisable(GL_COLOR_LOGIC_OP);
296 }
297}
298
299void GLStateManager::set_facing(const bool invert)
300{
301 glFrontFace((invert) ? GL_CW : GL_CCW);
302}
303
304void GLStateManager::set_backface_culling(const eGPUFaceCullTest test)
305{
306 if (test != GPU_CULL_NONE) {
307 glEnable(GL_CULL_FACE);
308 glCullFace((test == GPU_CULL_FRONT) ? GL_FRONT : GL_BACK);
309 }
310 else {
311 glDisable(GL_CULL_FACE);
312 }
313}
314
315void GLStateManager::set_provoking_vert(const eGPUProvokingVertex vert)
316{
317 GLenum value = (vert == GPU_VERTEX_FIRST) ? GL_FIRST_VERTEX_CONVENTION :
318 GL_LAST_VERTEX_CONVENTION;
319 glProvokingVertex(value);
320}
321
322void GLStateManager::set_shadow_bias(const bool enable)
323{
324 if (enable) {
325 glEnable(GL_POLYGON_OFFSET_FILL);
326 glEnable(GL_POLYGON_OFFSET_LINE);
327 /* 2.0 Seems to be the lowest possible slope bias that works in every case. */
328 glPolygonOffset(2.0f, 1.0f);
329 }
330 else {
331 glDisable(GL_POLYGON_OFFSET_FILL);
332 glDisable(GL_POLYGON_OFFSET_LINE);
333 }
334}
335
336void GLStateManager::set_clip_control(const bool enable)
337{
339 if (enable) {
340 /* Match Vulkan and Metal by default. */
341 glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
342 }
343 else {
344 glClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
345 }
346 }
347}
348
349void GLStateManager::set_blend(const eGPUBlend value)
350{
358 GLenum src_rgb, src_alpha, dst_rgb, dst_alpha;
359 switch (value) {
360 default:
361 case GPU_BLEND_ALPHA: {
362 src_rgb = GL_SRC_ALPHA;
363 dst_rgb = GL_ONE_MINUS_SRC_ALPHA;
364 src_alpha = GL_ONE;
365 dst_alpha = GL_ONE_MINUS_SRC_ALPHA;
366 break;
367 }
369 src_rgb = GL_ONE;
370 dst_rgb = GL_ONE_MINUS_SRC_ALPHA;
371 src_alpha = GL_ONE;
372 dst_alpha = GL_ONE_MINUS_SRC_ALPHA;
373 break;
374 }
375 case GPU_BLEND_ADDITIVE: {
376 /* Do not let alpha accumulate but pre-multiply the source RGB by it. */
377 src_rgb = GL_SRC_ALPHA;
378 dst_rgb = GL_ONE;
379 src_alpha = GL_ZERO;
380 dst_alpha = GL_ONE;
381 break;
382 }
385 /* Let alpha accumulate. */
386 src_rgb = GL_ONE;
387 dst_rgb = GL_ONE;
388 src_alpha = GL_ONE;
389 dst_alpha = GL_ONE;
390 break;
391 }
392 case GPU_BLEND_MULTIPLY: {
393 src_rgb = GL_DST_COLOR;
394 dst_rgb = GL_ZERO;
395 src_alpha = GL_DST_ALPHA;
396 dst_alpha = GL_ZERO;
397 break;
398 }
399 case GPU_BLEND_INVERT: {
400 src_rgb = GL_ONE_MINUS_DST_COLOR;
401 dst_rgb = GL_ZERO;
402 src_alpha = GL_ZERO;
403 dst_alpha = GL_ONE;
404 break;
405 }
406 case GPU_BLEND_OIT: {
407 src_rgb = GL_ONE;
408 dst_rgb = GL_ONE;
409 src_alpha = GL_ZERO;
410 dst_alpha = GL_ONE_MINUS_SRC_ALPHA;
411 break;
412 }
414 src_rgb = GL_ONE_MINUS_DST_ALPHA;
415 dst_rgb = GL_SRC_ALPHA;
416 src_alpha = GL_ZERO;
417 dst_alpha = GL_SRC_ALPHA;
418 break;
419 }
421 src_rgb = GL_ONE_MINUS_DST_ALPHA;
422 dst_rgb = GL_ONE;
423 src_alpha = GL_ONE_MINUS_DST_ALPHA;
424 dst_alpha = GL_ONE;
425 break;
426 }
427 case GPU_BLEND_CUSTOM: {
428 src_rgb = GL_ONE;
429 dst_rgb = GL_SRC1_COLOR;
430 src_alpha = GL_ONE;
431 dst_alpha = GL_SRC1_ALPHA;
432 break;
433 }
435 src_rgb = GL_ZERO;
436 dst_rgb = GL_ONE_MINUS_SRC_ALPHA;
437 src_alpha = GL_ZERO;
438 dst_alpha = GL_ONE_MINUS_SRC_ALPHA;
439 break;
440 }
441 }
442
443 if (value == GPU_BLEND_SUBTRACT) {
444 glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
445 }
446 else {
447 glBlendEquation(GL_FUNC_ADD);
448 }
449
450 /* Always set the blend function. This avoid a rendering error when blending is disabled but
451 * GPU_BLEND_CUSTOM was used just before and the frame-buffer is using more than 1 color target.
452 */
453 glBlendFuncSeparate(src_rgb, dst_rgb, src_alpha, dst_alpha);
454 if (value != GPU_BLEND_NONE) {
455 glEnable(GL_BLEND);
456 }
457 else {
458 glDisable(GL_BLEND);
459 }
460}
461
463
464/* -------------------------------------------------------------------- */
467
468void GLStateManager::texture_bind(Texture *tex_, GPUSamplerState sampler_state, int unit)
469{
471 GLTexture *tex = static_cast<GLTexture *>(tex_);
472 if (G.debug & G_DEBUG_GPU) {
473 tex->check_feedback_loop();
474 }
475 /* Eliminate redundant binds. */
476 if ((textures_[unit] == tex->tex_id_) &&
477 (samplers_[unit] == GLTexture::get_sampler(sampler_state)))
478 {
479 return;
480 }
481 targets_[unit] = tex->target_;
482 textures_[unit] = tex->tex_id_;
483 samplers_[unit] = GLTexture::get_sampler(sampler_state);
484 tex->is_bound_ = true;
485 dirty_texture_binds_ |= 1ULL << unit;
486}
487
489{
490 glActiveTexture(GL_TEXTURE0);
491 glBindTexture(tex->target_, tex->tex_id_);
492 /* Will reset the first texture that was originally bound to slot 0 back before drawing. */
493 dirty_texture_binds_ |= 1ULL;
494 /* NOTE: This might leave this texture attached to this target even after update.
495 * In practice it is not causing problems as we have incorrect binding detection
496 * at higher level. */
497}
498
500{
501 GLTexture *tex = static_cast<GLTexture *>(tex_);
502 if (!tex->is_bound_) {
503 return;
504 }
505
506 GLuint tex_id = tex->tex_id_;
507 for (int i = 0; i < ARRAY_SIZE(textures_); i++) {
508 if (textures_[i] == tex_id) {
509 textures_[i] = 0;
510 samplers_[i] = 0;
511 dirty_texture_binds_ |= 1ULL << i;
512 }
513 }
514 tex->is_bound_ = false;
515}
516
518{
519 for (int i = 0; i < ARRAY_SIZE(textures_); i++) {
520 if (textures_[i] != 0) {
521 textures_[i] = 0;
522 samplers_[i] = 0;
523 dirty_texture_binds_ |= 1ULL << i;
524 }
525 }
526 this->texture_bind_apply();
527}
528
529void GLStateManager::texture_bind_apply()
530{
531 if (dirty_texture_binds_ == 0) {
532 return;
533 }
534 uint64_t dirty_bind = dirty_texture_binds_;
535 dirty_texture_binds_ = 0;
536
537 int first = bitscan_forward_uint64(dirty_bind);
538 int last = 64 - bitscan_reverse_uint64(dirty_bind);
539 int count = last - first;
540
542 glBindTextures(first, count, textures_ + first);
543 glBindSamplers(first, count, samplers_ + first);
544 }
545 else {
546 for (int unit = first; unit < last; unit++) {
547 if ((dirty_bind >> unit) & 1UL) {
548 glActiveTexture(GL_TEXTURE0 + unit);
549 glBindTexture(targets_[unit], textures_[unit]);
550 glBindSampler(unit, samplers_[unit]);
551 }
552 }
553 }
554}
555
557{
558 glPixelStorei(GL_UNPACK_ROW_LENGTH, len);
559}
560
562{
563 uint64_t bound_slots = 0;
564 for (int i = 0; i < ARRAY_SIZE(textures_); i++) {
565 if (textures_[i] != 0) {
566 bound_slots |= 1ULL << i;
567 }
568 }
569 return bound_slots;
570}
571
573
574/* -------------------------------------------------------------------- */
577
579{
580 /* Minimum support is 8 image in the fragment shader. No image for other stages. */
581 BLI_assert(unit < 8);
582 GLTexture *tex = static_cast<GLTexture *>(tex_);
583 if (G.debug & G_DEBUG_GPU) {
584 tex->check_feedback_loop();
585 }
586 images_[unit] = tex->tex_id_;
587 formats_[unit] = to_gl_internal_format(tex->format_);
588 tex->is_bound_image_ = true;
589 dirty_image_binds_ |= 1ULL << unit;
590}
591
593{
594 GLTexture *tex = static_cast<GLTexture *>(tex_);
595 if (!tex->is_bound_image_) {
596 return;
597 }
598
599 GLuint tex_id = tex->tex_id_;
600 for (int i = 0; i < ARRAY_SIZE(images_); i++) {
601 if (images_[i] == tex_id) {
602 images_[i] = 0;
603 dirty_image_binds_ |= 1ULL << i;
604 }
605 }
606 tex->is_bound_image_ = false;
607}
608
610{
611 for (int i = 0; i < ARRAY_SIZE(images_); i++) {
612 if (images_[i] != 0) {
613 images_[i] = 0;
614 dirty_image_binds_ |= 1ULL << i;
615 }
616 }
617 this->image_bind_apply();
618}
619
620void GLStateManager::image_bind_apply()
621{
622 if (dirty_image_binds_ == 0) {
623 return;
624 }
625 uint32_t dirty_bind = dirty_image_binds_;
626 dirty_image_binds_ = 0;
627
628 int first = bitscan_forward_uint(dirty_bind);
629 int last = 32 - bitscan_reverse_uint(dirty_bind);
630 int count = last - first;
631
633 glBindImageTextures(first, count, images_ + first);
634 }
635 else {
636 for (int unit = first; unit < last; unit++) {
637 if ((dirty_bind >> unit) & 1UL) {
638 glBindImageTexture(unit, images_[unit], 0, GL_TRUE, 0, GL_READ_WRITE, formats_[unit]);
639 }
640 }
641 }
642}
643
645{
646 uint8_t bound_slots = 0;
647 for (int i = 0; i < ARRAY_SIZE(images_); i++) {
648 if (images_[i] != 0) {
649 bound_slots |= 1ULL << i;
650 }
651 }
652 return bound_slots;
653}
654
656
657/* -------------------------------------------------------------------- */
660
662{
663 glMemoryBarrier(to_gl(barrier_bits));
664}
665
667{
668 if (gl_sync_ != nullptr) {
669 glDeleteSync(gl_sync_);
670 gl_sync_ = nullptr;
671 }
672}
673
675{
676 /* If fence is already signaled, create a newly signaled fence primitive. */
677 if (gl_sync_) {
678 glDeleteSync(gl_sync_);
679 }
680
681 gl_sync_ = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
682 signalled_ = true;
683}
684
686{
687 /* Do not wait if fence does not yet exist. */
688 if (gl_sync_ == nullptr) {
689 return;
690 }
691 glWaitSync(gl_sync_, 0, GL_TIMEOUT_IGNORED);
692 signalled_ = false;
693}
694
695
696} // namespace blender::gpu
@ G_DEBUG_GPU
#define BLI_assert(a)
Definition BLI_assert.h:46
MINLINE float clamp_f(float value, float min, float max)
MINLINE unsigned int bitscan_forward_uint(unsigned int a)
MINLINE unsigned int float_as_uint(float f)
MINLINE unsigned int bitscan_reverse_uint(unsigned int a)
MINLINE unsigned int bitscan_forward_uint64(unsigned long long a)
MINLINE unsigned int bitscan_reverse_uint64(unsigned long long a)
unsigned int uint
#define UNPACK2(a)
#define ARRAY_SIZE(arr)
int GPU_max_textures()
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_OIT
Definition GPU_state.hh:98
@ 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_CUSTOM
Definition GPU_state.hh:103
@ GPU_BLEND_ADDITIVE
Definition GPU_state.hh:89
@ GPU_BLEND_SUBTRACT
Definition GPU_state.hh:92
@ GPU_BLEND_ALPHA_UNDER_PREMUL
Definition GPU_state.hh:104
@ GPU_BLEND_BACKGROUND
Definition GPU_state.hh:100
@ GPU_BLEND_ALPHA_PREMULT
Definition GPU_state.hh:88
@ GPU_BLEND_OVERLAY_MASK_FROM_ALPHA
Definition GPU_state.hh:107
eGPUWriteMask
Definition GPU_state.hh:16
@ GPU_WRITE_RED
Definition GPU_state.hh:18
@ GPU_WRITE_NONE
Definition GPU_state.hh:17
@ GPU_WRITE_GREEN
Definition GPU_state.hh:19
@ GPU_WRITE_BLUE
Definition GPU_state.hh:20
@ GPU_WRITE_DEPTH
Definition GPU_state.hh:22
@ GPU_WRITE_ALPHA
Definition GPU_state.hh:21
eGPUProvokingVertex
Definition GPU_state.hh:141
@ GPU_VERTEX_FIRST
Definition GPU_state.hh:143
eGPUFaceCullTest
Definition GPU_state.hh:135
@ GPU_CULL_FRONT
Definition GPU_state.hh:137
@ GPU_CULL_NONE
Definition GPU_state.hh:136
eGPUBarrier
Definition GPU_state.hh:29
eGPUStencilOp
Definition GPU_state.hh:127
@ GPU_STENCIL_OP_COUNT_DEPTH_FAIL
Definition GPU_state.hh:132
@ GPU_STENCIL_OP_COUNT_DEPTH_PASS
Definition GPU_state.hh:131
@ GPU_STENCIL_OP_REPLACE
Definition GPU_state.hh:129
@ GPU_STENCIL_OP_NONE
Definition GPU_state.hh:128
eGPUDepthTest
Definition GPU_state.hh:110
@ GPU_DEPTH_GREATER
Definition GPU_state.hh:116
@ GPU_DEPTH_EQUAL
Definition GPU_state.hh:115
@ GPU_DEPTH_ALWAYS
Definition GPU_state.hh:112
@ GPU_DEPTH_GREATER_EQUAL
Definition GPU_state.hh:117
@ GPU_DEPTH_LESS
Definition GPU_state.hh:113
@ GPU_DEPTH_LESS_EQUAL
Definition GPU_state.hh:114
@ GPU_DEPTH_NONE
Definition GPU_state.hh:111
eGPUStencilTest
Definition GPU_state.hh:120
@ GPU_STENCIL_EQUAL
Definition GPU_state.hh:123
@ GPU_STENCIL_NEQUAL
Definition GPU_state.hh:124
@ GPU_STENCIL_ALWAYS
Definition GPU_state.hh:122
@ GPU_STENCIL_NONE
Definition GPU_state.hh:121
unsigned long long int uint64_t
static bool multi_bind_support
Definition gl_context.hh:58
static bool clip_control_support
Definition gl_context.hh:51
static bool multi_bind_image_support
Definition gl_context.hh:59
void signal() override
Definition gl_state.cc:674
void wait() override
Definition gl_state.cc:685
void texture_bind_temp(GLTexture *tex)
Definition gl_state.cc:488
GLFrameBuffer * active_fb
Definition gl_state.hh:32
void image_unbind(Texture *tex) override
Definition gl_state.cc:592
void image_bind(Texture *tex, int unit) override
Definition gl_state.cc:578
void apply_state() override
Definition gl_state.cc:54
void texture_unpack_row_length_set(uint len) override
Definition gl_state.cc:556
void issue_barrier(eGPUBarrier barrier_bits) override
Definition gl_state.cc:661
void texture_unbind_all() override
Definition gl_state.cc:517
void force_state() override
Definition gl_state.cc:66
void texture_bind(Texture *tex, GPUSamplerState sampler, int unit) override
Definition gl_state.cc:468
void image_unbind_all() override
Definition gl_state.cc:609
void texture_unbind(Texture *tex) override
Definition gl_state.cc:499
static GLuint get_sampler(const GPUSamplerState &sampler_state)
#define fabsf(x)
#define this
int count
CCL_NAMESPACE_BEGIN ccl_device float invert(const float color, const float factor)
Definition invert.h:11
static ulong state[N]
#define G(x, y, z)
GLenum to_gl_internal_format(eGPUTextureFormat format)
static GLenum to_gl(const GPUAttachmentType type)
i
Definition text_draw.cc:230
uint len