Blender V4.5
gpu_viewport.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2006 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#include <cstring>
12
13#include "BLI_math_vector.h"
15#include "BLI_rect.h"
16
17#include "BKE_colortools.hh"
18
20
21#include "DNA_vec_types.h"
22
23#include "GPU_capabilities.hh"
24#include "GPU_framebuffer.hh"
25#include "GPU_immediate.hh"
26#include "GPU_matrix.hh"
27#include "GPU_state.hh"
28#include "GPU_texture.hh"
29#include "GPU_viewport.hh"
30
31#include "DRW_engine.hh"
32
33#include "MEM_guardedalloc.h"
34
35/* Struct storing a viewport specific blender::gpu::Batch.
36 * The end-goal is to have a single batch shared across viewport and use a model matrix to place
37 * the batch. Due to OCIO and Image/UV editor we are not able to use an model matrix yet. */
39 blender::gpu::Batch *batch;
40 struct {
44};
45
46static struct {
48 struct {
51} g_viewport = {{0}};
52
55 int flag;
56
57 /* Set the active view (for stereoscopic viewport rendering). */
59
60 /* Viewport Resources. */
63 GPUTexture *color_render_tx[2];
64 GPUTexture *color_overlay_tx[2];
66 GPUTexture *depth_tx;
68 GPUFrameBuffer *stereo_comp_fb;
74 GPUFrameBuffer *render_fb;
75 GPUFrameBuffer *overlay_fb;
76
77 /* Color management. */
81 float dither;
82 /* TODO(@fclem): the UV-image display use the viewport but do not set any view transform for the
83 * moment. The end goal would be to let the GPUViewport do the color management. */
86};
87
88enum {
89 DO_UPDATE = (1 << 0),
91};
92
94{
95 viewport->flag |= DO_UPDATE;
96}
97
99{
100 bool ret = (viewport->flag & DO_UPDATE);
101 viewport->flag &= ~DO_UPDATE;
102 return ret;
103}
104
106{
107 GPUViewport *viewport = MEM_callocN<GPUViewport>("GPUViewport");
108 viewport->do_color_management = false;
109 viewport->size[0] = viewport->size[1] = -1;
110 viewport->active_view = 0;
111 return viewport;
112}
113
115{
116 GPUViewport *viewport = GPU_viewport_create();
117 viewport->flag = GPU_VIEWPORT_STEREO;
118 return viewport;
119}
120
122{
123 return &viewport->draw_data;
124}
125
127{
128 int *size = viewport->size;
129 float const empty_pixel[4] = {0.0f, 0.0f, 0.0f, 0.0f};
131
132 if (viewport->color_render_tx[0] == nullptr) {
133
134 /* NOTE: dtxl_color texture requires write support as it may be written to by the viewport
135 * compositor. */
136 viewport->color_render_tx[0] = GPU_texture_create_2d("dtxl_color",
137 UNPACK2(size),
138 1,
141 nullptr);
143 "dtxl_color_overlay", UNPACK2(size), 1, GPU_SRGB8_A8, usage, nullptr);
144
145 GPU_texture_clear(viewport->color_render_tx[0], GPU_DATA_FLOAT, empty_pixel);
146 GPU_texture_clear(viewport->color_overlay_tx[0], GPU_DATA_FLOAT, empty_pixel);
147 }
148
149 if ((viewport->flag & GPU_VIEWPORT_STEREO) != 0 && viewport->color_render_tx[1] == nullptr) {
150 viewport->color_render_tx[1] = GPU_texture_create_2d("dtxl_color_stereo",
151 UNPACK2(size),
152 1,
155 nullptr);
157 "dtxl_color_overlay_stereo", UNPACK2(size), 1, GPU_SRGB8_A8, usage, nullptr);
158
159 GPU_texture_clear(viewport->color_render_tx[1], GPU_DATA_FLOAT, empty_pixel);
160 GPU_texture_clear(viewport->color_overlay_tx[1], GPU_DATA_FLOAT, empty_pixel);
161 }
162
163 /* Can be shared with #GPUOffscreen. */
164 if (viewport->depth_tx == nullptr) {
165 /* Depth texture can be read back by gizmos #view3d_depths_create. */
166 /* Swizzle flag is needed by Workbench Volumes to read the stencil view. */
167 viewport->depth_tx = GPU_texture_create_2d("dtxl_depth",
168 UNPACK2(size),
169 1,
173 nullptr);
174 const int depth_clear = 0;
175 GPU_texture_clear(viewport->depth_tx, GPU_DATA_UINT_24_8, &depth_clear);
176 }
177
178 if (!viewport->depth_tx || !viewport->color_render_tx[0] || !viewport->color_overlay_tx[0]) {
179 GPU_viewport_free(viewport);
180 }
181}
182
184{
188
189 for (int i = 0; i < 2; i++) {
192 }
193
195}
196
197void GPU_viewport_bind(GPUViewport *viewport, int view, const rcti *rect)
198{
200 /* add one pixel because of scissor test */
201 rect_size[0] = BLI_rcti_size_x(rect) + 1;
202 rect_size[1] = BLI_rcti_size_y(rect) + 1;
203
205
206 if (viewport->size != rect_size) {
207 copy_v2_v2_int(viewport->size, rect_size);
210 }
211
212 viewport->active_view = view;
213}
214
215void GPU_viewport_bind_from_offscreen(GPUViewport *viewport, GPUOffScreen *ofs, bool is_xr_surface)
216{
217 GPUTexture *color, *depth;
218 GPUFrameBuffer *fb;
219 viewport->size[0] = GPU_offscreen_width(ofs);
220 viewport->size[1] = GPU_offscreen_height(ofs);
221
222 GPU_offscreen_viewport_data_get(ofs, &fb, &color, &depth);
223
224 /* XR surfaces will already check for texture size changes and free if necessary (see
225 * #wm_xr_session_surface_offscreen_ensure()), so don't free here as it has a significant
226 * performance impact (leads to texture re-creation in #gpu_viewport_textures_create() every VR
227 * drawing iteration). */
228 if (!is_xr_surface) {
230 }
231
232 /* This is the only texture we can share. */
233 viewport->depth_tx = depth;
234
236}
237
239 const ColorManagedViewSettings *view_settings,
240 const ColorManagedDisplaySettings *display_settings,
241 float dither)
242{
250 if (view_settings->curve_mapping) {
251 if (viewport->view_settings.curve_mapping) {
252 if (view_settings->curve_mapping->changed_timestamp !=
254 {
256 }
257 }
258 }
259
260 if (viewport->orig_curve_mapping != view_settings->curve_mapping) {
261 viewport->orig_curve_mapping = view_settings->curve_mapping;
263 }
264 /* Don't copy the curve mapping already. */
266 /* Only copy curve-mapping if needed. Avoid unneeded OCIO cache miss. */
267 if (view_settings->curve_mapping && viewport->view_settings.curve_mapping == nullptr) {
270 }
271
272 BKE_color_managed_display_settings_copy(&viewport->display_settings, display_settings);
273 viewport->dither = dither;
274 viewport->do_color_management = true;
275}
276
278{
280 /* Early Exit: the other display modes need access to the full screen and cannot be
281 * done from a single viewport. See `wm_stereo.cc`. */
282 return;
283 }
284 /* The composite framebuffer object needs to be created in the window context. */
286 &viewport->stereo_comp_fb,
287 {
288 GPU_ATTACHMENT_NONE,
289 /* We need the sRGB attachment to be first for GL_FRAMEBUFFER_SRGB to be turned on.
290 * Note that this is the opposite of what the texture binding is. */
291 GPU_ATTACHMENT_TEXTURE(viewport->color_overlay_tx[0]),
292 GPU_ATTACHMENT_TEXTURE(viewport->color_render_tx[0]),
293 });
294
295 GPUVertFormat *vert_format = immVertexFormat();
303 int settings = stereo_format->display_mode;
304 if (settings == S3D_DISPLAY_ANAGLYPH) {
305 switch (stereo_format->anaglyph_type) {
307 GPU_color_mask(false, true, true, true);
308 break;
310 GPU_color_mask(true, false, true, true);
311 break;
313 GPU_color_mask(false, false, true, true);
314 break;
315 }
316 }
317 else if (settings == S3D_DISPLAY_INTERLACE) {
318 settings |= stereo_format->interlace_type << 3;
319 SET_FLAG_FROM_TEST(settings, stereo_format->flag & S3D_INTERLACE_SWAP, 1 << 6);
320 }
321 immUniform1i("stereoDisplaySettings", settings);
322
323 GPU_texture_bind(viewport->color_render_tx[1], 0);
324 GPU_texture_bind(viewport->color_overlay_tx[1], 1);
325
327
328 immVertex2f(pos, -1.0f, -1.0f);
329 immVertex2f(pos, 1.0f, -1.0f);
330 immVertex2f(pos, -1.0f, 1.0f);
331 immVertex2f(pos, 1.0f, 1.0f);
332
333 immEnd();
334
337
341
342 if (settings == S3D_DISPLAY_ANAGLYPH) {
343 GPU_color_mask(true, true, true, true);
344 }
345
347}
348/* -------------------------------------------------------------------- */
351
353{
354 if (g_viewport.format.attr_len == 0) {
358 g_viewport.attr_id.tex_coord = GPU_vertformat_attr_add(
359 format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
360 }
361 return g_viewport.format;
362}
363
364static blender::gpu::Batch *gpu_viewport_batch_create(const rctf *rect_pos, const rctf *rect_uv)
365{
367 const uint vbo_len = 4;
368 GPU_vertbuf_data_alloc(*vbo, vbo_len);
369
370 GPUVertBufRaw pos_step, tex_coord_step;
371 GPU_vertbuf_attr_get_raw_data(vbo, g_viewport.attr_id.pos, &pos_step);
372 GPU_vertbuf_attr_get_raw_data(vbo, g_viewport.attr_id.tex_coord, &tex_coord_step);
373
375 static_cast<float *>(GPU_vertbuf_raw_step(&pos_step)), rect_pos->xmin, rect_pos->ymin);
377 static_cast<float *>(GPU_vertbuf_raw_step(&tex_coord_step)), rect_uv->xmin, rect_uv->ymin);
379 static_cast<float *>(GPU_vertbuf_raw_step(&pos_step)), rect_pos->xmax, rect_pos->ymin);
381 static_cast<float *>(GPU_vertbuf_raw_step(&tex_coord_step)), rect_uv->xmax, rect_uv->ymin);
383 static_cast<float *>(GPU_vertbuf_raw_step(&pos_step)), rect_pos->xmin, rect_pos->ymax);
385 static_cast<float *>(GPU_vertbuf_raw_step(&tex_coord_step)), rect_uv->xmin, rect_uv->ymax);
387 static_cast<float *>(GPU_vertbuf_raw_step(&pos_step)), rect_pos->xmax, rect_pos->ymax);
389 static_cast<float *>(GPU_vertbuf_raw_step(&tex_coord_step)), rect_uv->xmax, rect_uv->ymax);
390
392}
393
394static blender::gpu::Batch *gpu_viewport_batch_get(GPUViewport *viewport,
395 const rctf *rect_pos,
396 const rctf *rect_uv)
397{
398 const float compare_limit = 0.0001f;
399 const bool parameters_changed =
401 &viewport->batch.last_used_parameters.rect_pos, rect_pos, compare_limit) ||
402 !BLI_rctf_compare(&viewport->batch.last_used_parameters.rect_uv, rect_uv, compare_limit));
403
404 if (viewport->batch.batch && parameters_changed) {
405 GPU_batch_discard(viewport->batch.batch);
406 viewport->batch.batch = nullptr;
407 }
408
409 if (!viewport->batch.batch) {
410 viewport->batch.batch = gpu_viewport_batch_create(rect_pos, rect_uv);
411 viewport->batch.last_used_parameters.rect_pos = *rect_pos;
412 viewport->batch.last_used_parameters.rect_uv = *rect_uv;
413 }
414 return viewport->batch.batch;
415}
416
418{
419 if (viewport->batch.batch) {
420 GPU_batch_discard(viewport->batch.batch);
421 viewport->batch.batch = nullptr;
422 }
423}
424
426
428 int view,
429 const rctf *rect_pos,
430 const rctf *rect_uv,
431 bool display_colorspace,
432 bool do_overlay_merge)
433{
434 GPUTexture *color = viewport->color_render_tx[view];
435 GPUTexture *color_overlay = viewport->color_overlay_tx[view];
436
437 bool use_ocio = false;
438 bool use_hdr = GPU_hdr_support() &&
439 ((viewport->view_settings.flag & COLORMANAGE_VIEW_USE_HDR) != 0);
440
441 if (viewport->do_color_management && display_colorspace) {
442 /* During the binding process the last used VertexFormat is tested and can assert as it is not
443 * valid. By calling the `immVertexFormat` the last used VertexFormat is reset and the assert
444 * does not happen. This solves a chicken and egg problem when using GPUBatches. GPUBatches
445 * contain the correct vertex format, but can only bind after the shader is bound.
446 *
447 * Image/UV editor still uses imm, after that has been changed we could move this fix to the
448 * OCIO. */
451 &viewport->display_settings,
452 nullptr,
453 viewport->dither,
454 false,
455 do_overlay_merge);
456 }
457
458 blender::gpu::Batch *batch = gpu_viewport_batch_get(viewport, rect_pos, rect_uv);
459 if (use_ocio) {
461 }
462 else {
464 GPU_batch_uniform_1i(batch, "overlay", do_overlay_merge);
465 GPU_batch_uniform_1i(batch, "display_transform", display_colorspace);
466 GPU_batch_uniform_1i(batch, "use_hdr", use_hdr);
467 }
468
469 GPU_texture_bind(color, 0);
470 GPU_texture_bind(color_overlay, 1);
472 GPU_texture_unbind(color);
473 GPU_texture_unbind(color_overlay);
474
475 if (use_ocio) {
477 }
478}
479
481 int view,
482 const rcti *rect,
483 bool display_colorspace,
484 bool do_overlay_merge)
485{
486 GPUTexture *color = viewport->color_render_tx[view];
487
488 if (color == nullptr) {
489 return;
490 }
491
492 const float w = float(GPU_texture_width(color));
493 const float h = float(GPU_texture_height(color));
494
495 /* We allow rects with min/max swapped, but we also need correctly assigned coordinates. */
496 rcti sanitized_rect = *rect;
497 BLI_rcti_sanitize(&sanitized_rect);
498
499 BLI_assert(w == BLI_rcti_size_x(&sanitized_rect) + 1);
500 BLI_assert(h == BLI_rcti_size_y(&sanitized_rect) + 1);
501
502 /* wmOrtho for the screen has this same offset */
503 const float halfx = GLA_PIXEL_OFS / w;
504 const float halfy = GLA_PIXEL_OFS / h;
505
506 rctf pos_rect{};
507 pos_rect.xmin = sanitized_rect.xmin;
508 pos_rect.ymin = sanitized_rect.ymin;
509 pos_rect.xmax = sanitized_rect.xmin + w;
510 pos_rect.ymax = sanitized_rect.ymin + h;
511
512 rctf uv_rect{};
513 uv_rect.xmin = halfx;
514 uv_rect.ymin = halfy;
515 uv_rect.xmax = halfx + 1.0f;
516 uv_rect.ymax = halfy + 1.0f;
517
518 /* Mirror the UV rect in case axis-swapped drawing is requested (by passing a rect with min and
519 * max values swapped). */
520 if (BLI_rcti_size_x(rect) < 0) {
521 std::swap(uv_rect.xmin, uv_rect.xmax);
522 }
523 if (BLI_rcti_size_y(rect) < 0) {
524 std::swap(uv_rect.ymin, uv_rect.ymax);
525 }
526
528 viewport, view, &pos_rect, &uv_rect, display_colorspace, do_overlay_merge);
529}
530
531void GPU_viewport_draw_to_screen(GPUViewport *viewport, int view, const rcti *rect)
532{
533 GPU_viewport_draw_to_screen_ex(viewport, view, rect, true, true);
534}
535
537 GPUOffScreen *ofs,
538 bool display_colorspace,
539 bool do_overlay_merge)
540{
541 const int view = 0;
542
543 if (viewport->color_render_tx[view] == nullptr) {
544 return;
545 }
546
548 GPU_offscreen_bind(ofs, false);
549
550 rctf pos_rect{};
551 pos_rect.xmin = -1.0f;
552 pos_rect.ymin = -1.0f;
553 pos_rect.xmax = 1.0f;
554 pos_rect.ymax = 1.0f;
555
556 rctf uv_rect{};
557 uv_rect.xmin = 0.0f;
558 uv_rect.ymin = 0.0f;
559 uv_rect.xmax = 1.0f;
560 uv_rect.ymax = 1.0f;
561
563 viewport, view, &pos_rect, &uv_rect, display_colorspace, do_overlay_merge);
564
565 /* This one is from the offscreen. Don't free it with the viewport. */
566 viewport->depth_tx = nullptr;
567}
568
574
576{
577 return viewport->active_view;
578}
579
581{
582 return (viewport->flag & GPU_VIEWPORT_STEREO) != 0;
583}
584
585GPUTexture *GPU_viewport_color_texture(GPUViewport *viewport, int view)
586{
587 return viewport->color_render_tx[view];
588}
589
591{
592 return viewport->color_overlay_tx[view];
593}
594
596{
597 return viewport->depth_tx;
598}
599
601{
603 &viewport->render_fb,
604 {
605 GPU_ATTACHMENT_TEXTURE(viewport->depth_tx),
606 GPU_ATTACHMENT_TEXTURE(viewport->color_render_tx[viewport->active_view]),
607 });
608 return viewport->render_fb;
609}
610
612{
614 &viewport->overlay_fb,
615 {
616 GPU_ATTACHMENT_TEXTURE(viewport->depth_tx),
617 GPU_ATTACHMENT_TEXTURE(viewport->color_overlay_tx[viewport->active_view]),
618 });
619 return viewport->overlay_fb;
620}
621
623{
624 if (viewport->draw_data) {
626 }
627
629
631 gpu_viewport_batch_free(viewport);
632
633 MEM_freeN(viewport);
634}
void BKE_color_managed_display_settings_copy(ColorManagedDisplaySettings *new_settings, const ColorManagedDisplaySettings *settings)
void BKE_color_managed_view_settings_free(ColorManagedViewSettings *settings)
CurveMapping * BKE_curvemapping_copy(const CurveMapping *cumap)
void BKE_color_managed_view_settings_copy_keep_curve_mapping(ColorManagedViewSettings *new_settings, const ColorManagedViewSettings *settings)
#define BLI_assert(a)
Definition BLI_assert.h:46
MINLINE void copy_v2_fl2(float v[2], float x, float y)
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.h:198
void BLI_rcti_sanitize(struct rcti *rect)
Definition rct.cc:446
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.h:194
bool BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, float limit)
unsigned int uint
#define UNPACK2(a)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define ELEM(...)
@ COLORMANAGE_VIEW_USE_HDR
@ S3D_ANAGLYPH_REDCYAN
@ S3D_ANAGLYPH_YELLOWBLUE
@ S3D_ANAGLYPH_GREENMAGENTA
@ S3D_INTERLACE_SWAP
@ S3D_DISPLAY_ANAGLYPH
@ S3D_DISPLAY_INTERLACE
void DRW_gpu_context_disable()
void DRW_gpu_context_enable()
void DRW_viewport_data_free(DRWData *drw_data)
static AppView * view
blender::gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, blender::gpu::VertBuf *vertex_buf, blender::gpu::IndexBuf *index_buf, eGPUBatchFlag owns_flag)
Definition gpu_batch.cc:51
void GPU_batch_discard(blender::gpu::Batch *batch)
void GPU_batch_program_set_imm_shader(blender::gpu::Batch *batch)
void GPU_batch_program_set_builtin(blender::gpu::Batch *batch, eGPUBuiltinShader shader_id)
void GPU_batch_draw(blender::gpu::Batch *batch)
@ GPU_BATCH_OWNS_VBO
Definition GPU_batch.hh:41
#define GPU_batch_uniform_1i(batch, name, x)
Definition GPU_batch.hh:299
bool GPU_hdr_support()
#define GPU_FRAMEBUFFER_FREE_SAFE(fb)
int GPU_offscreen_width(const GPUOffScreen *offscreen)
void GPU_offscreen_bind(GPUOffScreen *offscreen, bool save)
void GPU_offscreen_viewport_data_get(GPUOffScreen *offscreen, GPUFrameBuffer **r_fb, GPUTexture **r_color, GPUTexture **r_depth)
void GPU_framebuffer_restore()
int GPU_offscreen_height(const GPUOffScreen *offscreen)
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
#define GPU_framebuffer_ensure_config(_fb,...)
void immEnd()
void immUnbindProgram()
void immVertex2f(uint attr_id, float x, float y)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
void immUniform1i(const char *name, int x)
GPUVertFormat * immVertexFormat()
void immBegin(GPUPrimType, uint vertex_len)
void GPU_matrix_identity_projection_set()
void GPU_matrix_identity_set()
void GPU_matrix_push()
void GPU_matrix_push_projection()
void GPU_matrix_pop_projection()
void GPU_matrix_pop()
@ GPU_PRIM_TRI_STRIP
@ GPU_SHADER_2D_IMAGE_OVERLAYS_STEREO_MERGE
@ GPU_SHADER_2D_IMAGE_OVERLAYS_MERGE
void GPU_color_mask(bool r, bool g, bool b, bool a)
Definition gpu_state.cc:98
@ GPU_DEPTH_NONE
Definition GPU_state.hh:111
void GPU_depth_test(eGPUDepthTest test)
Definition gpu_state.cc:68
int GPU_texture_height(const GPUTexture *texture)
void GPU_texture_bind(GPUTexture *texture, int unit)
GPUTexture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
int GPU_texture_width(const GPUTexture *texture)
void GPU_texture_clear(GPUTexture *texture, eGPUDataFormat data_format, const void *data)
void GPU_texture_unbind(GPUTexture *texture)
@ GPU_DATA_UINT_24_8
@ GPU_DATA_FLOAT
eGPUTextureUsage
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_SHADER_WRITE
@ GPU_TEXTURE_USAGE_HOST_READ
@ GPU_TEXTURE_USAGE_ATTACHMENT
@ GPU_TEXTURE_USAGE_FORMAT_VIEW
#define GPU_TEXTURE_FREE_SAFE(texture)
@ GPU_SRGB8_A8
@ GPU_DEPTH24_STENCIL8
@ GPU_RGBA16F
void GPU_vertbuf_attr_get_raw_data(blender::gpu::VertBuf *, uint a_idx, GPUVertBufRaw *access)
GPU_INLINE void * GPU_vertbuf_raw_step(GPUVertBufRaw *a)
#define GPU_vertbuf_create_with_format(format)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, blender::StringRef name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
#define GLA_PIXEL_OFS
void IMB_colormanagement_finish_glsl_draw()
bool IMB_colormanagement_setup_glsl_draw_from_space(const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, const ColorSpace *from_colorspace, float dither, bool predivide, bool do_overlay_merge)
Read Guarded memory(de)allocation.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
uint pos
struct @242053044010324116347033273112253060004051364061::@373043131300025057314200265134167265161140142363 attr_id
struct @242053044010324116347033273112253060004051364061::@051143074301336237271216303350234260141112266062 batch
void GPU_viewport_bind(GPUViewport *viewport, int view, const rcti *rect)
GPUTexture * GPU_viewport_color_texture(GPUViewport *viewport, int view)
void GPU_viewport_unbind(GPUViewport *)
static const GPUVertFormat & gpu_viewport_batch_format()
void GPU_viewport_unbind_from_offscreen(GPUViewport *viewport, GPUOffScreen *ofs, bool display_colorspace, bool do_overlay_merge)
void GPU_viewport_draw_to_screen(GPUViewport *viewport, int view, const rcti *rect)
void GPU_viewport_draw_to_screen_ex(GPUViewport *viewport, int view, const rcti *rect, bool display_colorspace, bool do_overlay_merge)
GPUViewport * GPU_viewport_create()
GPUViewport * GPU_viewport_stereo_create()
static blender::gpu::Batch * gpu_viewport_batch_create(const rctf *rect_pos, const rctf *rect_uv)
static struct @205365341300264070236363157302166140270074174361 g_viewport
static void gpu_viewport_draw_colormanaged(GPUViewport *viewport, int view, const rctf *rect_pos, const rctf *rect_uv, bool display_colorspace, bool do_overlay_merge)
void GPU_viewport_bind_from_offscreen(GPUViewport *viewport, GPUOffScreen *ofs, bool is_xr_surface)
static void gpu_viewport_textures_create(GPUViewport *viewport)
bool GPU_viewport_is_stereo_get(GPUViewport *viewport)
bool GPU_viewport_do_update(GPUViewport *viewport)
static blender::gpu::Batch * gpu_viewport_batch_get(GPUViewport *viewport, const rctf *rect_pos, const rctf *rect_uv)
uint tex_coord
int GPU_viewport_active_view_get(GPUViewport *viewport)
static void gpu_viewport_textures_free(GPUViewport *viewport)
void GPU_viewport_free(GPUViewport *viewport)
GPUTexture * GPU_viewport_depth_texture(GPUViewport *viewport)
void GPU_viewport_colorspace_set(GPUViewport *viewport, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, float dither)
void GPU_viewport_stereo_composite(GPUViewport *viewport, Stereo3dFormat *stereo_format)
static void gpu_viewport_batch_free(GPUViewport *viewport)
void GPU_viewport_tag_update(GPUViewport *viewport)
GPUFrameBuffer * GPU_viewport_framebuffer_overlay_get(GPUViewport *viewport)
GPUTexture * GPU_viewport_overlay_texture(GPUViewport *viewport, int view)
GPUFrameBuffer * GPU_viewport_framebuffer_render_get(GPUViewport *viewport)
DRWData ** GPU_viewport_data_get(GPUViewport *viewport)
@ GPU_VIEWPORT_STEREO
@ DO_UPDATE
BLI_INLINE float fb(float length, float L)
format
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
VecBase< int32_t, 2 > int2
return ret
ccl_device_inline int rect_size(const int4 rect)
Definition rect.h:56
struct CurveMapping * curve_mapping
blender::gpu::Batch * batch
struct GPUViewportBatch::@352030103322200053217325036066152160214055240116 last_used_parameters
GPUTexture * depth_tx
GPUFrameBuffer * overlay_fb
blender::int2 size
ColorManagedViewSettings view_settings
ColorManagedDisplaySettings display_settings
GPUTexture * color_overlay_tx[2]
GPUTexture * color_render_tx[2]
GPUViewportBatch batch
DRWData * draw_data
GPUFrameBuffer * stereo_comp_fb
CurveMapping * orig_curve_mapping
bool do_color_management
GPUFrameBuffer * render_fb
float xmax
float xmin
float ymax
float ymin
int ymin
int xmin
i
Definition text_draw.cc:230