Blender V5.3
gl_framebuffer.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 "BLI_string.hh"
10
11#include "BKE_global.hh"
12
13#include "gl_backend.hh"
14#include "gl_debug.hh"
15#include "gl_state.hh"
16#include "gl_texture.hh"
17
18#include "gl_framebuffer.hh"
19
20namespace blender::gpu {
21
22/* -------------------------------------------------------------------- */
25
27{
28 /* Just-In-Time init. See #GLFrameBuffer::init(). */
29 immutable_ = false;
30 fbo_id_ = 0;
31}
32
34 const char *name, GLContext *ctx, GLenum target, GLuint fbo, int w, int h)
35 : FrameBuffer(name)
36{
37 context_ = ctx;
38 context_id_ = context_->context_id;
39 state_manager_ = static_cast<GLStateManager *>(ctx->state_manager);
40 immutable_ = true;
41 fbo_id_ = fbo;
42 gl_attachments_[0] = target;
44 /* Never update an internal frame-buffer. */
45 dirty_attachments_ = false;
46 width_ = w;
47 height_ = h;
48 srgb_ = false;
49
50 viewport_[0][0] = scissor_[0] = 0;
51 viewport_[0][1] = scissor_[1] = 0;
52 viewport_[0][2] = scissor_[2] = w;
53 viewport_[0][3] = scissor_[3] = h;
54
55 if (fbo_id_) {
56 debug::object_label(GL_FRAMEBUFFER, fbo_id_, name_);
57 }
58}
59
61{
62 if (context_ == nullptr) {
63 return;
64 }
65
66 if (!GLBackend::get()->is_valid_context_id(context_id_)) {
67 /* Context was freed. It can happen for GLTexture::framebuffer_. */
68 return;
69 }
70
71 /* Context might be partially freed. This happens when destroying the window frame-buffers. */
72 if (context_ == Context::get()) {
73 glDeleteFramebuffers(1, &fbo_id_);
74 }
75 else {
76 context_->fbo_free(fbo_id_);
77 }
78 /* Restore default frame-buffer if this frame-buffer was bound. */
79 if (context_->active_fb == this && context_->back_left != this) {
80 /* If this assert triggers it means the frame-buffer is being freed while in use by another
81 * context which, by the way, is TOTALLY UNSAFE! */
82 BLI_assert(context_ == Context::get());
84 }
85}
86
87void GLFrameBuffer::init()
88{
89 context_ = GLContext::get();
90 context_id_ = context_->context_id;
91 state_manager_ = static_cast<GLStateManager *>(context_->state_manager);
92 glGenFramebuffers(1, &fbo_id_);
93 /* Binding before setting the label is needed on some drivers.
94 * This is not an issue since we call this function only before binding. */
95 glBindFramebuffer(GL_FRAMEBUFFER, fbo_id_);
96
97 debug::object_label(GL_FRAMEBUFFER, fbo_id_, name_);
98}
99
101
102/* -------------------------------------------------------------------- */
105
106bool GLFrameBuffer::check(char err_out[256])
107{
108 this->bind(true);
109
110 GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
111
112#define FORMAT_STATUS(X) \
113 case X: { \
114 err = #X; \
115 break; \
116 }
117
118 const char *err;
119 switch (status) {
120 FORMAT_STATUS(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT);
121 FORMAT_STATUS(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
122 FORMAT_STATUS(GL_FRAMEBUFFER_UNSUPPORTED);
123 FORMAT_STATUS(GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER);
124 FORMAT_STATUS(GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER);
125 FORMAT_STATUS(GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE);
126 FORMAT_STATUS(GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS);
127 FORMAT_STATUS(GL_FRAMEBUFFER_UNDEFINED);
128 case GL_FRAMEBUFFER_COMPLETE:
129 return true;
130 default:
131 err = "unknown";
132 break;
133 }
134
135#undef FORMAT_STATUS
136
137 const char *format = "gpu::FrameBuffer: %s status %s\n";
138
139 if (err_out) {
140 BLI_snprintf(err_out, 256, format, this->name_, err);
141 }
142 else {
143 fprintf(stderr, format, this->name_, err);
144 }
145
146 return false;
147}
148
149void GLFrameBuffer::update_attachments()
150{
151 /* Default frame-buffers cannot have attachments. */
152 BLI_assert(immutable_ == false);
153
154 /* First color texture OR the depth texture if no color is attached.
155 * Used to determine frame-buffer color-space and dimensions. */
156 GPUAttachmentType first_attachment = GPU_FB_MAX_ATTACHMENT;
157 /* NOTE: Inverse iteration to get the first color texture. */
158 for (GPUAttachmentType type = GPU_FB_MAX_ATTACHMENT - 1; type >= 0; --type) {
159 GPUAttachment &attach = attachments_[type];
160 GLenum gl_attachment = to_gl(type);
161
162 if (type >= GPU_FB_COLOR_ATTACHMENT0) {
163 gl_attachments_[type - GPU_FB_COLOR_ATTACHMENT0] = (attach.tex) ? gl_attachment : GL_NONE;
164 first_attachment = (attach.tex) ? type : first_attachment;
165 }
166 else if (first_attachment == GPU_FB_MAX_ATTACHMENT) {
167 /* Only use depth texture to get information if there is no color attachment. */
168 first_attachment = (attach.tex) ? type : first_attachment;
169 }
170
171 if (attach.tex == nullptr) {
172 glFramebufferTexture(GL_FRAMEBUFFER, gl_attachment, 0, 0);
173 continue;
174 }
175 GLuint gl_tex = static_cast<GLTexture *>(attach.tex)->tex_id_;
176 if (attach.layer > -1 && GPU_texture_is_cube(attach.tex) && !GPU_texture_is_array(attach.tex))
177 {
178 /* Could be avoided if ARB_direct_state_access is required. In this case
179 * #glFramebufferTextureLayer would bind the correct face. */
180 GLenum gl_target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + attach.layer;
181 glFramebufferTexture2D(GL_FRAMEBUFFER, gl_attachment, gl_target, gl_tex, attach.mip);
182 }
183 else if (attach.layer > -1) {
184 glFramebufferTextureLayer(GL_FRAMEBUFFER, gl_attachment, gl_tex, attach.mip, attach.layer);
185 }
186 else {
187 /* The whole texture level is attached. The frame-buffer is potentially layered. */
188 glFramebufferTexture(GL_FRAMEBUFFER, gl_attachment, gl_tex, attach.mip);
189 }
190 /* We found one depth buffer type. Stop here, otherwise we would
191 * override it by setting GPU_FB_DEPTH_ATTACHMENT */
193 break;
194 }
195 }
196
198 /* Fill normally un-occupied slots to avoid rendering artifacts on some hardware. */
199 GLuint gl_tex = 0;
200 /* NOTE: Inverse iteration to get the first color texture. */
201 for (int i = ARRAY_SIZE(gl_attachments_) - 1; i >= 0; --i) {
203 GPUAttachment &attach = attachments_[type];
204 if (attach.tex != nullptr) {
205 gl_tex = static_cast<GLTexture *>(attach.tex)->tex_id_;
206 }
207 else if (gl_tex != 0) {
208 GLenum gl_attachment = to_gl(type);
209 gl_attachments_[i] = gl_attachment;
210 glFramebufferTexture(GL_FRAMEBUFFER, gl_attachment, gl_tex, 0);
211 }
212 }
213 }
214
215 if (first_attachment != GPU_FB_MAX_ATTACHMENT) {
216 GPUAttachment &attach = attachments_[first_attachment];
217 int size[3];
218 GPU_texture_get_mipmap_size(attach.tex, attach.mip, size);
219 this->size_set(size[0], size[1]);
220 srgb_ = (GPU_texture_format(attach.tex) == TextureFormat::SRGBA_8_8_8_8);
221 }
222 else {
223 /* Empty frame-buffer. */
224 glFramebufferParameteri(GL_FRAMEBUFFER, GL_FRAMEBUFFER_DEFAULT_WIDTH, width_);
225 glFramebufferParameteri(GL_FRAMEBUFFER, GL_FRAMEBUFFER_DEFAULT_HEIGHT, height_);
226 }
227
228 dirty_attachments_ = false;
229
230 glDrawBuffers(ARRAY_SIZE(gl_attachments_), gl_attachments_);
231
232 if (G.debug & G_DEBUG_GPU) {
233 BLI_assert(this->check(nullptr));
234 }
235}
236
238 Span<GPUAttachmentState> color_attachment_states)
239{
240 GPU_depth_mask(depth_attachment_state == GPU_ATTACHMENT_WRITE);
241
242 bool any_read = false;
243 for (auto attachment : color_attachment_states.index_range()) {
244 if (attachment == GPU_ATTACHMENT_READ) {
245 any_read = true;
246 break;
247 }
248 }
249
251 if (any_read) {
252 glFramebufferFetchBarrierEXT();
253 }
254 }
256 if (any_read) {
257 glTextureBarrier();
258 }
259
260 GLenum attachments[GPU_FB_MAX_COLOR_ATTACHMENT] = {GL_NONE};
261 for (int i : color_attachment_states.index_range()) {
263 gpu::Texture *attach_tex = this->attachments_[type].tex;
264 if (color_attachment_states[i] == GPU_ATTACHMENT_READ) {
265 tmp_detached_[type] = this->attachments_[type]; /* Bypass feedback loop check. */
267 }
268 else {
269 tmp_detached_[type] = GPU_ATTACHMENT_NONE;
270 }
271 bool attach_write = color_attachment_states[i] == GPU_ATTACHMENT_WRITE;
272 attachments[i] = (attach_tex && attach_write) ? to_gl(type) : GL_NONE;
273 }
274 /* We have to use `glDrawBuffers` instead of `glColorMaski` because the later is overwritten
275 * by the `GLStateManager`. */
276 /* WATCH(fclem): This modifies the frame-buffer state without setting `dirty_attachments_`. */
277 glDrawBuffers(ARRAY_SIZE(attachments), attachments);
278 }
279 else {
280 /* The only way to have correct visibility without extensions and ensure defined behavior, is
281 * to unbind the textures and update the frame-buffer. This is a slow operation but that's all
282 * we can do to emulate the sub-pass input. */
283 /* TODO(@fclem): Could avoid the frame-buffer reconfiguration by creating multiple
284 * frame-buffers internally. */
285 for (int i : color_attachment_states.index_range()) {
287
288 if (color_attachment_states[i] == GPU_ATTACHMENT_WRITE) {
289 if (tmp_detached_[type].tex != nullptr) {
290 /* Re-attach previous read attachments. */
291 this->attachment_set(type, tmp_detached_[type]);
292 tmp_detached_[type] = GPU_ATTACHMENT_NONE;
293 }
294 }
295 else if (color_attachment_states[i] == GPU_ATTACHMENT_READ) {
296 tmp_detached_[type] = this->attachments_[type];
297 tmp_detached_[type].tex->detach_from(this);
298 GPU_texture_bind_ex(tmp_detached_[type].tex, GPUSamplerState::default_sampler(), i);
299 }
300 }
301 if (dirty_attachments_) {
302 this->update_attachments();
303 }
304 }
305}
306
308{
309 BLI_assert(context_->active_fb == this);
310
311 /* TODO(fclem): Add support for other ops. */
313 if (tmp_detached_[type].tex != nullptr) {
314 /* #GPULoadStore is used to define the frame-buffer before it is used for rendering.
315 * Binding back unattached attachment makes its state undefined. This is described by the
316 * documentation and the user-land code should specify a sub-pass at the start of the drawing
317 * to explicitly set attachment state. */
319 /* NOOP. */
320 }
322 /* Reset default attachment state. */
323 for (int i : IndexRange(ARRAY_SIZE(tmp_detached_))) {
324 tmp_detached_[i] = GPU_ATTACHMENT_NONE;
325 }
326 glDrawBuffers(ARRAY_SIZE(gl_attachments_), gl_attachments_);
327 }
328 else {
329 tmp_detached_[type] = GPU_ATTACHMENT_NONE;
330 this->attachment_set(type, tmp_detached_[type]);
331 this->update_attachments();
332 }
333 }
335 }
336}
337
339{
340 if (dirty_state_ == false) {
341 return;
342 }
343
344 if (multi_viewport_ == false) {
345 glViewport(UNPACK4(viewport_[0]));
346 }
347 else {
348 /* Great API you have there! You have to convert to float values for setting int viewport
349 * values. **Audible Facepalm** */
350 float viewports_f[GPU_MAX_VIEWPORTS][4];
351 for (int i = 0; i < GPU_MAX_VIEWPORTS; i++) {
352 for (int j = 0; j < 4; j++) {
353 viewports_f[i][j] = viewport_[i][j];
354 }
355 }
356 glViewportArrayv(0, GPU_MAX_VIEWPORTS, viewports_f[0]);
357 }
358 glScissor(UNPACK4(scissor_));
359
360 if (scissor_test_) {
361 glEnable(GL_SCISSOR_TEST);
362 }
363 else {
364 glDisable(GL_SCISSOR_TEST);
365 }
366
367 dirty_state_ = false;
368}
369
371
372/* -------------------------------------------------------------------- */
375
376void GLFrameBuffer::bind(bool enabled_srgb)
377{
378 if (!immutable_ && fbo_id_ == 0) {
379 this->init();
380 }
381
382 if (context_ != GLContext::get()) {
383 BLI_assert_msg(0, "Trying to use the same frame-buffer in multiple context");
384 return;
385 }
386
387 if (context_->active_fb != this) {
388 glBindFramebuffer(GL_FRAMEBUFFER, fbo_id_);
389 /* Internal frame-buffers have only one color output and needs to be set every time. */
390 if (immutable_ && fbo_id_ == 0) {
391 glDrawBuffer(gl_attachments_[0]);
392 }
393 }
394
397 tmp_detached_[index] = GPU_ATTACHMENT_NONE;
398 }
399 }
400
401 if (dirty_attachments_) {
402 this->update_attachments();
403 this->viewport_reset();
404 this->scissor_reset();
405 }
406
407 if (context_->active_fb != this || enabled_srgb_ != enabled_srgb) {
408 enabled_srgb_ = enabled_srgb;
409 if (enabled_srgb && srgb_) {
410 glEnable(GL_FRAMEBUFFER_SRGB);
411 }
412 else {
413 glDisable(GL_FRAMEBUFFER_SRGB);
414 }
415 Shader::set_framebuffer_srgb_target(enabled_srgb && srgb_);
416 }
417
418 if (context_->active_fb != this) {
419 context_->active_fb = this;
420 state_manager_->active_fb = this;
421 dirty_state_ = true;
422 }
423}
424
426
427/* -------------------------------------------------------------------- */
430
432 const double4 clear_col,
433 float clear_depth,
434 uint clear_stencil)
435{
436 BLI_assert(GLContext::get() == context_);
437 BLI_assert(context_->active_fb == this);
438
439 /* Save and restore the state. */
440 GPUWriteMask write_mask = GPU_write_mask_get();
441 uint stencil_mask = GPU_stencil_mask_get();
442 GPUStencilTest stencil_test = GPU_stencil_test_get();
443
444 if (buffers & GPU_COLOR_BIT) {
445 if (immutable_) {
446 /* Immutable frame-buffers (default/window) have no texture attachments,
447 * clear via #glClearColor + #glClear (included in the mask below). */
448 GPU_color_mask(true, true, true, true);
449 glClearColor(
450 float(clear_col[0]), float(clear_col[1]), float(clear_col[2]), float(clear_col[3]));
451 }
452 else {
453 int type = GPU_FB_COLOR_ATTACHMENT0;
454 for (int i = 0; type < GPU_FB_MAX_ATTACHMENT; i++, type++) {
455 if (attachments_[type].tex != nullptr) {
456 this->clear_attachment(GPU_FB_COLOR_ATTACHMENT0 + i, clear_col);
457 }
458 }
459 }
460 }
461 if (buffers & GPU_DEPTH_BIT) {
462 GPU_depth_mask(true);
463 glClearDepth(clear_depth);
464 }
465 if (buffers & GPU_STENCIL_BIT) {
468 glClearStencil(clear_stencil);
469 }
470
471 context_->state_manager->apply_state();
472
473 /* Mutable frame-buffers clear color via per-attachment calls above,
474 * exclude color from the #glClear mask in that case. */
475 GPUFrameBufferBits glclear_buffers = immutable_ ? buffers :
477 GLbitfield mask = to_gl(glclear_buffers);
478 glClear(mask);
479
480 if (buffers & (GPU_COLOR_BIT | GPU_DEPTH_BIT)) {
481 GPU_write_mask(write_mask);
482 }
483 if (buffers & GPU_STENCIL_BIT) {
484 GPU_stencil_write_mask_set(stencil_mask);
485 GPU_stencil_test(stencil_test);
486 }
487}
488
490{
491 BLI_assert(GLContext::get() == context_);
492 BLI_assert(context_->active_fb == this);
493
494 /* Save and restore the state. */
495 GPUWriteMask write_mask = GPU_write_mask_get();
496
497 GPU_depth_mask(true);
498 GPU_color_mask(true, true, true, true);
499
500 context_->state_manager->apply_state();
501
503 glClearDepth(float(clear_value.x));
504 glClear(to_gl(GPU_DEPTH_BIT));
505 }
506 else {
507 int slot = type - GPU_FB_COLOR_ATTACHMENT0;
509 if (flag & GPU_FORMAT_FLOAT || flag & GPU_FORMAT_NORMALIZED_INTEGER) {
510 float4 data = float4(clear_value);
511 glClearBufferfv(GL_COLOR, slot, &data.x);
512 }
513 else if (flag & GPU_FORMAT_INTEGER && flag & GPU_FORMAT_SIGNED) {
514 int4 data = int4(clear_value);
515 glClearBufferiv(GL_COLOR, slot, &data.x);
516 }
517 else if (flag & GPU_FORMAT_INTEGER && !(flag & GPU_FORMAT_SIGNED)) {
518 uint4 data = uint4(clear_value);
519 glClearBufferuiv(GL_COLOR, slot, &data.x);
520 }
521 else {
522 BLI_assert_msg(0, "Unhandled data format");
523 }
524 }
525
526 GPU_write_mask(write_mask);
527}
528
530{
531 int type = GPU_FB_COLOR_ATTACHMENT0;
532 for (int i = 0; type < GPU_FB_MAX_ATTACHMENT; i++, type++) {
533 if (attachments_[type].tex != nullptr) {
534 this->clear_attachment(GPU_FB_COLOR_ATTACHMENT0 + i, clear_cols[i]);
535 }
536 }
537}
538
540 eGPUDataFormat data_format,
541 const int area[4],
542 int channel_len,
543 int slot,
544 void *r_data)
545{
546 GLenum format, type, mode;
547 mode = gl_attachments_[slot];
548 type = to_gl(data_format);
549
550 switch (plane) {
551 case GPU_DEPTH_BIT:
552 format = GL_DEPTH_COMPONENT;
554 this->attachments_[GPU_FB_DEPTH_ATTACHMENT].tex != nullptr ||
555 this->attachments_[GPU_FB_DEPTH_STENCIL_ATTACHMENT].tex != nullptr,
556 "GPUFramebuffer: Error: Trying to read depth without a depth buffer attached.");
557 break;
558 case GPU_COLOR_BIT:
560 mode != GL_NONE,
561 "GPUFramebuffer: Error: Trying to read a color slot without valid attachment.");
562 format = channel_len_to_gl(channel_len);
563 /* TODO: needed for selection buffers to work properly, this should be handled better. */
564 if (format == GL_RED && type == GL_UNSIGNED_INT) {
565 format = GL_RED_INTEGER;
566 }
567 break;
568 case GPU_STENCIL_BIT:
569 fprintf(stderr, "GPUFramebuffer: Error: Trying to read stencil bit. Unsupported.");
570 return;
571 default:
572 fprintf(stderr, "GPUFramebuffer: Error: Trying to read more than one frame-buffer plane.");
573 return;
574 }
575
576 glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo_id_);
577 glReadBuffer(mode);
578 glReadPixels(UNPACK4(area), format, type, r_data);
579}
580
582 GPUFrameBufferBits planes, int src_slot, FrameBuffer *dst_, int dst_slot, int x, int y)
583{
584 GLFrameBuffer *src = this;
585 GLFrameBuffer *dst = static_cast<GLFrameBuffer *>(dst_);
586
587 /* Frame-buffers must be up to date. This simplify this function. */
588 if (src->dirty_attachments_) {
589 src->bind(true);
590 }
591 if (dst->dirty_attachments_) {
592 dst->bind(true);
593 }
594
595 glBindFramebuffer(GL_READ_FRAMEBUFFER, src->fbo_id_);
596 glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dst->fbo_id_);
597
598 if (planes & GPU_COLOR_BIT) {
599 BLI_assert(src->immutable_ == false || src_slot == 0);
600 BLI_assert(dst->immutable_ == false || dst_slot == 0);
601 BLI_assert(src->gl_attachments_[src_slot] != GL_NONE);
602 BLI_assert(dst->gl_attachments_[dst_slot] != GL_NONE);
603 glReadBuffer(src->gl_attachments_[src_slot]);
604 glDrawBuffer(dst->gl_attachments_[dst_slot]);
605 }
606
607 context_->state_manager->apply_state();
608
609 int w = src->width_;
610 int h = src->height_;
611 GLbitfield mask = to_gl(planes);
612 glBlitFramebuffer(0, 0, w, h, x, y, x + w, y + h, mask, GL_NEAREST);
613
614 if (!dst->immutable_) {
615 /* Restore the draw buffers. */
616 glDrawBuffers(ARRAY_SIZE(dst->gl_attachments_), dst->gl_attachments_);
617 }
618 /* Ensure previous buffer is restored. */
619 context_->active_fb = dst;
620}
621
623
624} // namespace blender::gpu
#define GPU_ATTACHMENT_NONE
#define UNPACK4(a)
#define BLI_assert(a)
#define ELEM(...)
#define BLI_assert_msg(a, msg)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
constexpr IndexRange()=default
constexpr IndexRange index_range() const
Definition BLI_span.hh:405
static Context * get()
void size_set(int width, int height)
void set_color_attachment_bit(GPUAttachmentType type, bool value)
FrameBuffer(const char *name)
GPUAttachment attachments_[GPU_FB_MAX_ATTACHMENT]
int viewport_[GPU_MAX_VIEWPORTS][4]
void attachment_set(GPUAttachmentType type, const GPUAttachment &new_attachment)
static GLBackend * get()
Definition gl_backend.hh:86
static bool framebuffer_fetch_support
Definition gl_context.hh:61
static GLContext * get()
static bool unused_fb_slot_workaround
Definition gl_context.hh:80
static bool texture_barrier_support
Definition gl_context.hh:73
bool check(char err_out[256]) override
void attachment_set_loadstore_op(GPUAttachmentType type, GPULoadStore ls) override
void clear(GPUFrameBufferBits buffers, const double4 clear_col, float clear_depth, uint clear_stencil) override
void blit_to(GPUFrameBufferBits planes, int src_slot, FrameBuffer *dst, int dst_slot, int dst_offset_x, int dst_offset_y) override
void subpass_transition_impl(const GPUAttachmentState depth_attachment_state, Span< GPUAttachmentState > color_attachment_states) override
void clear_attachment(GPUAttachmentType type, const double4 clear_value) override
GLFrameBuffer(const char *name)
void bind(bool enabled_srgb) override
void read(GPUFrameBufferBits planes, eGPUDataFormat format, const int area[4], int channel_len, int slot, void *r_data) override
void clear_multi(Span< double4 > clear_cols) override
static void set_framebuffer_srgb_target(int use_srgb_to_linear)
GPUTextureFormatFlag format_flag_get() const
void detach_from(FrameBuffer *fb)
#define FORMAT_STATUS(X)
#define GPU_FB_MAX_COLOR_ATTACHMENT
int size(const AssetLibraryReference *library_reference)
void object_label(GLenum type, GLuint object, const char *name)
Definition gl_debug.cc:331
GLenum channel_len_to_gl(int channel_len)
GLenum to_gl(eGPUDataFormat format)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
gpu::TextureFormat GPU_texture_format(const gpu::Texture *texture)
VecBase< int32_t, 4 > int4
void GPU_framebuffer_restore()
GPUWriteMask GPU_write_mask_get()
Definition gpu_state.cc:217
unsigned int uint
Definition BKE_text.h:55
GPUStencilTest GPU_stencil_test_get()
Definition gpu_state.cc:235
VecBase< uint32_t, 4 > uint4
void GPU_depth_mask(bool depth)
Definition gpu_state.cc:107
Global G
Definition blender.cc:57
VecBase< float, 4 > float4
BMesh const char void * data
uint GPU_stencil_mask_get()
Definition gpu_state.cc:223
void GPU_color_mask(bool r, bool g, bool b, bool a)
Definition gpu_state.cc:95
bool GPU_texture_is_cube(const gpu::Texture *texture)
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
void GPU_stencil_test(GPUStencilTest test)
Definition gpu_state.cc:75
@ GPU_STENCIL_ALWAYS
Definition GPU_state.hh:143
void GPU_texture_bind_ex(gpu::Texture *texture, GPUSamplerState state, int unit)
bool GPU_texture_is_array(const gpu::Texture *texture)
void GPU_stencil_write_mask_set(uint write_mask)
Definition gpu_state.cc:195
VecBase< double, 4 > double4
void GPU_write_mask(GPUWriteMask mask)
Definition gpu_state.cc:90
void GPU_texture_get_mipmap_size(gpu::Texture *texture, int mip_level, int *r_size)
static constexpr GPUSamplerState default_sampler()