Blender V5.3
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_c.hh"
15#include "BLI_rect.hh"
16
17#include "BKE_colortools.hh"
18
19#include "DNA_color_types.h"
21
22#include "DNA_vec_types.h"
23
24#include "GPU_capabilities.hh"
25#include "GPU_framebuffer.hh"
26#include "GPU_immediate.hh"
27#include "GPU_matrix.hh"
28#include "GPU_state.hh"
29#include "GPU_texture.hh"
30#include "GPU_viewport.hh"
31
32#include "DRW_engine.hh"
33
34#include "MEM_guardedalloc.h"
35
36namespace blender {
37
38/* Struct storing a viewport specific gpu::Batch.
39 * The end-goal is to have a single batch shared across viewport and use a model matrix to place
40 * the batch. Due to OCIO and Image/UV editor we are not able to use an model matrix yet. */
42 gpu::Batch *batch = nullptr;
43 struct {
44 rctf rect_pos = {};
45 rctf rect_uv = {};
47};
48
49static struct {
51 struct {
53 } attr_id;
54} g_viewport = {{0}};
55
58 int flag = 0;
59
60 /* Set the active view (for stereoscopic viewport rendering). */
61 int active_view = 0;
62
63 /* Viewport Resources. */
64 DRWData *draw_data = nullptr;
81
82 /* Color management. */
85 bool use_hdr_display = false;
87 float dither = 0.0f;
88 /* TODO(@fclem): the UV-image display use the viewport but do not set any view transform for the
89 * moment. The end goal would be to let the GPUViewport do the color management. */
90 bool do_color_management = false;
92};
93
94enum {
95 DO_UPDATE = (1 << 0),
97};
98
100{
101 viewport->flag |= DO_UPDATE;
102}
103
105{
106 bool ret = (viewport->flag & DO_UPDATE);
107 viewport->flag &= ~DO_UPDATE;
108 return ret;
109}
110
112{
113 GPUViewport *viewport = MEM_new<GPUViewport>("GPUViewport");
114 viewport->do_color_management = false;
115 viewport->size[0] = viewport->size[1] = -1;
116 viewport->active_view = 0;
117 return viewport;
118}
119
121{
122 GPUViewport *viewport = GPU_viewport_create();
123 viewport->flag = GPU_VIEWPORT_STEREO;
124 return viewport;
125}
126
128{
129 return &viewport->draw_data;
130}
131
133{
134 int *size = viewport->size;
135 float const empty_pixel[4] = {0.0f, 0.0f, 0.0f, 0.0f};
137
138 if (viewport->color_render_tx[0] == nullptr) {
139
140 /* NOTE: dtxl_color texture requires write support as it may be written to by the viewport
141 * compositor. */
142 viewport->color_render_tx[0] = GPU_texture_create_2d("dtxl_color",
143 UNPACK2(size),
144 1,
145 gpu::TextureFormat::SFLOAT_16_16_16_16,
147 nullptr);
149 "dtxl_color_overlay", UNPACK2(size), 1, gpu::TextureFormat::SRGBA_8_8_8_8, usage, nullptr);
150
151 GPU_texture_clear(viewport->color_render_tx[0], GPU_DATA_FLOAT, empty_pixel);
152 GPU_texture_clear(viewport->color_overlay_tx[0], GPU_DATA_FLOAT, empty_pixel);
153 }
154
155 if ((viewport->flag & GPU_VIEWPORT_STEREO) != 0 && viewport->color_render_tx[1] == nullptr) {
156 viewport->color_render_tx[1] = GPU_texture_create_2d("dtxl_color_stereo",
157 UNPACK2(size),
158 1,
159 gpu::TextureFormat::SFLOAT_16_16_16_16,
161 nullptr);
162 viewport->color_overlay_tx[1] = GPU_texture_create_2d("dtxl_color_overlay_stereo",
163 UNPACK2(size),
164 1,
165 gpu::TextureFormat::SRGBA_8_8_8_8,
166 usage,
167 nullptr);
168
169 GPU_texture_clear(viewport->color_render_tx[1], GPU_DATA_FLOAT, empty_pixel);
170 GPU_texture_clear(viewport->color_overlay_tx[1], GPU_DATA_FLOAT, empty_pixel);
171 }
172
173 /* Can be shared with #GPUOffscreen. */
174 if (viewport->depth_tx == nullptr) {
175 /* Depth texture can be read back by gizmos #view3d_depths_create. */
176 /* Swizzle flag is needed by Workbench Volumes to read the stencil view. */
177 viewport->depth_tx = GPU_texture_create_2d("dtxl_depth",
178 UNPACK2(size),
179 1,
180 gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8,
183 nullptr);
184 const float depth_clear = 0.0f;
185 GPU_texture_clear(viewport->depth_tx, GPU_DATA_FLOAT, &depth_clear);
186 }
187
188 if (!viewport->depth_tx || !viewport->color_render_tx[0] || !viewport->color_overlay_tx[0]) {
189 GPU_viewport_free(viewport);
190 }
191}
192
194{
198
199 for (int i = 0; i < 2; i++) {
202 }
203
205}
206
207void GPU_viewport_bind(GPUViewport *viewport, int view, const rcti *rect)
208{
210 /* add one pixel because of scissor test */
211 rect_size[0] = BLI_rcti_size_x(rect) + 1;
212 rect_size[1] = BLI_rcti_size_y(rect) + 1;
213
215
216 if (viewport->size != rect_size) {
217 copy_v2_v2_int(viewport->size, rect_size);
220 }
221
222 viewport->active_view = view;
223}
224
225void GPU_viewport_bind_from_offscreen(GPUViewport *viewport, GPUOffScreen *ofs, bool is_xr_surface)
226{
227 gpu::Texture *color, *depth;
229 viewport->size[0] = GPU_offscreen_width(ofs);
230 viewport->size[1] = GPU_offscreen_height(ofs);
231
233
234 /* XR surfaces will already check for texture size changes and free if necessary (see
235 * #wm_xr_session_surface_offscreen_ensure()), so don't free here as it has a significant
236 * performance impact (leads to texture re-creation in #gpu_viewport_textures_create() every VR
237 * drawing iteration). */
238 if (!is_xr_surface) {
240 }
241
242 /* This is the only texture we can share. */
243 viewport->depth_tx = depth;
244
246}
247
249 const ColorManagedViewSettings *view_settings,
250 const ColorManagedDisplaySettings *display_settings,
251 float dither)
252{
260 if (view_settings->curve_mapping) {
261 if (viewport->view_settings.curve_mapping) {
262 if (view_settings->curve_mapping->changed_timestamp !=
264 {
266 }
267 }
268 }
269
270 if (viewport->orig_curve_mapping != view_settings->curve_mapping) {
271 viewport->orig_curve_mapping = view_settings->curve_mapping;
273 }
274 /* Don't copy the curve mapping already. */
276 /* Only copy curve-mapping if needed. Avoid unneeded OCIO cache miss. */
277 if (view_settings->curve_mapping && viewport->view_settings.curve_mapping == nullptr) {
280 }
281
282 BKE_color_managed_display_settings_copy(&viewport->display_settings, display_settings);
283 viewport->dither = dither;
284 viewport->do_color_management = true;
286 &viewport->display_settings, viewport->view_settings.view_transform);
287}
288
290{
291 viewport->do_color_management = false;
292}
293
295{
297 /* Early Exit: the other display modes need access to the full screen and cannot be
298 * done from a single viewport. See `wm_stereo.cc`. */
299 return;
300 }
301 /* The composite framebuffer object needs to be created in the window context. */
303 &viewport->stereo_comp_fb,
304 {
305 GPU_ATTACHMENT_NONE,
306 /* We need the sRGB attachment to be first for GL_FRAMEBUFFER_SRGB to be turned on.
307 * Note that this is the opposite of what the texture binding is. */
308 GPU_ATTACHMENT_TEXTURE(viewport->color_overlay_tx[0]),
309 GPU_ATTACHMENT_TEXTURE(viewport->color_render_tx[0]),
310 });
311
312 GPUVertFormat *vert_format = immVertexFormat();
313 uint pos = GPU_vertformat_attr_add(vert_format, "pos", gpu::VertAttrType::SFLOAT_32_32);
314 uint tex_coord = GPU_vertformat_attr_add(
315 vert_format, "texCoord", gpu::VertAttrType::SFLOAT_32_32);
322 int settings = stereo_format->display_mode;
323 if (settings == S3D_DISPLAY_ANAGLYPH) {
324 switch (stereo_format->anaglyph_type) {
326 GPU_color_mask(false, true, true, true);
327 break;
329 GPU_color_mask(true, false, true, true);
330 break;
332 GPU_color_mask(false, false, true, true);
333 break;
334 }
335 }
336 else if (settings == S3D_DISPLAY_INTERLACE) {
337 settings |= stereo_format->interlace_type << 3;
338 SET_FLAG_FROM_TEST(settings, stereo_format->flag & S3D_INTERLACE_SWAP, 1 << 6);
339 }
340 immUniform1i("stereoDisplaySettings", settings);
341
342 GPU_texture_bind(viewport->color_render_tx[1], 0);
343 GPU_texture_bind(viewport->color_overlay_tx[1], 1);
344
346
347 immAttr2f(tex_coord, 0.0f, 0.0f);
348 immVertex2f(pos, -1.0f, -1.0f);
349 immAttr2f(tex_coord, 1.0f, 0.0f);
350 immVertex2f(pos, 1.0f, -1.0f);
351 immAttr2f(tex_coord, 0.0f, 1.0f);
352 immVertex2f(pos, -1.0f, 1.0f);
353 immAttr2f(tex_coord, 1.0f, 1.0f);
354 immVertex2f(pos, 1.0f, 1.0f);
355
356 immEnd();
357
360
364
365 if (settings == S3D_DISPLAY_ANAGLYPH) {
366 GPU_color_mask(true, true, true, true);
367 }
368
370}
371/* -------------------------------------------------------------------- */
374
376{
377 if (g_viewport.format.attr_len == 0) {
378 GPUVertFormat *format = &g_viewport.format;
380 format, "pos", gpu::VertAttrType::SFLOAT_32_32);
381 g_viewport.attr_id.tex_coord = GPU_vertformat_attr_add(
382 format, "texCoord", gpu::VertAttrType::SFLOAT_32_32);
383 }
384 return g_viewport.format;
385}
386
387static gpu::Batch *gpu_viewport_batch_create(const rctf *rect_pos, const rctf *rect_uv)
388{
389 gpu::VertBuf *vbo = GPU_vertbuf_create_with_format(gpu_viewport_batch_format());
390 const uint vbo_len = 4;
391 GPU_vertbuf_data_alloc(*vbo, vbo_len);
392
393 GPUVertBufRaw pos_step, tex_coord_step;
394 GPU_vertbuf_attr_get_raw_data(vbo, g_viewport.attr_id.pos, &pos_step);
395 GPU_vertbuf_attr_get_raw_data(vbo, g_viewport.attr_id.tex_coord, &tex_coord_step);
396
398 static_cast<float *>(GPU_vertbuf_raw_step(&pos_step)), rect_pos->xmin, rect_pos->ymin);
400 static_cast<float *>(GPU_vertbuf_raw_step(&tex_coord_step)), rect_uv->xmin, rect_uv->ymin);
402 static_cast<float *>(GPU_vertbuf_raw_step(&pos_step)), rect_pos->xmax, rect_pos->ymin);
404 static_cast<float *>(GPU_vertbuf_raw_step(&tex_coord_step)), rect_uv->xmax, rect_uv->ymin);
406 static_cast<float *>(GPU_vertbuf_raw_step(&pos_step)), rect_pos->xmin, rect_pos->ymax);
408 static_cast<float *>(GPU_vertbuf_raw_step(&tex_coord_step)), rect_uv->xmin, rect_uv->ymax);
410 static_cast<float *>(GPU_vertbuf_raw_step(&pos_step)), rect_pos->xmax, rect_pos->ymax);
412 static_cast<float *>(GPU_vertbuf_raw_step(&tex_coord_step)), rect_uv->xmax, rect_uv->ymax);
413
415}
416
417static gpu::Batch *gpu_viewport_batch_get(GPUViewport *viewport,
418 const rctf *rect_pos,
419 const rctf *rect_uv)
420{
421 const float compare_limit = 0.0001f;
422 const bool parameters_changed =
424 &viewport->batch.last_used_parameters.rect_pos, rect_pos, compare_limit) ||
425 !BLI_rctf_compare(&viewport->batch.last_used_parameters.rect_uv, rect_uv, compare_limit));
426
427 if (viewport->batch.batch && parameters_changed) {
428 GPU_batch_discard(viewport->batch.batch);
429 viewport->batch.batch = nullptr;
430 }
431
432 if (!viewport->batch.batch) {
433 viewport->batch.batch = gpu_viewport_batch_create(rect_pos, rect_uv);
434 viewport->batch.last_used_parameters.rect_pos = *rect_pos;
435 viewport->batch.last_used_parameters.rect_uv = *rect_uv;
436 }
437 return viewport->batch.batch;
438}
439
441{
442 if (viewport->batch.batch) {
443 GPU_batch_discard(viewport->batch.batch);
444 viewport->batch.batch = nullptr;
445 }
446}
447
449
451 int view,
452 const rctf *rect_pos,
453 const rctf *rect_uv,
454 bool display_colorspace,
455 bool do_overlay_merge)
456{
457 gpu::Texture *color = viewport->color_render_tx[view];
458 gpu::Texture *color_overlay = viewport->color_overlay_tx[view];
459
460 bool use_ocio = false;
461
462 if (viewport->do_color_management && display_colorspace) {
463 /* During the binding process the last used VertexFormat is tested and can assert as it is not
464 * valid. By calling the `immVertexFormat` the last used VertexFormat is reset and the assert
465 * does not happen. This solves a chicken and egg problem when using GPUBatches. GPUBatches
466 * contain the correct vertex format, but can only bind after the shader is bound.
467 *
468 * Image/UV editor still uses imm, after that has been changed we could move this fix to the
469 * OCIO. */
472 &viewport->display_settings,
473 nullptr,
474 viewport->dither,
475 false,
476 do_overlay_merge);
477 }
478
479 gpu::Batch *batch = gpu_viewport_batch_get(viewport, rect_pos, rect_uv);
480 if (use_ocio) {
482 }
483 else {
485 GPU_batch_uniform_1i(batch, "overlay", do_overlay_merge);
486 GPU_batch_uniform_1i(batch, "display_transform", display_colorspace);
487 GPU_batch_uniform_1i(batch, "use_hdr_display", viewport->use_hdr_display);
488 }
489
491 GPU_texture_bind(color_overlay, 1);
492 GPU_batch_draw(batch);
494 GPU_texture_unbind(color_overlay);
495
496 if (use_ocio) {
498 }
499}
500
502 int view,
503 const rcti *rect,
504 bool display_colorspace,
505 bool do_overlay_merge)
506{
507 gpu::Texture *color = viewport->color_render_tx[view];
508
509 if (color == nullptr) {
510 return;
511 }
512
513 const float w = float(GPU_texture_width(color));
514 const float h = float(GPU_texture_height(color));
515
516 /* We allow rects with min/max swapped, but we also need correctly assigned coordinates. */
517 rcti sanitized_rect = *rect;
518 BLI_rcti_sanitize(&sanitized_rect);
519
520 BLI_assert(w == BLI_rcti_size_x(&sanitized_rect) + 1);
521 BLI_assert(h == BLI_rcti_size_y(&sanitized_rect) + 1);
522
523 /* wmOrtho for the screen has this same offset */
524 const float halfx = GLA_PIXEL_OFS / w;
525 const float halfy = GLA_PIXEL_OFS / h;
526
527 rctf pos_rect{};
528 pos_rect.xmin = sanitized_rect.xmin;
529 pos_rect.ymin = sanitized_rect.ymin;
530 pos_rect.xmax = sanitized_rect.xmin + w;
531 pos_rect.ymax = sanitized_rect.ymin + h;
532
533 rctf uv_rect{};
534 uv_rect.xmin = halfx;
535 uv_rect.ymin = halfy;
536 uv_rect.xmax = halfx + 1.0f;
537 uv_rect.ymax = halfy + 1.0f;
538
539 /* Mirror the UV rect in case axis-swapped drawing is requested (by passing a rect with min and
540 * max values swapped). */
541 if (BLI_rcti_size_x(rect) < 0) {
542 std::swap(uv_rect.xmin, uv_rect.xmax);
543 }
544 if (BLI_rcti_size_y(rect) < 0) {
545 std::swap(uv_rect.ymin, uv_rect.ymax);
546 }
547
549 viewport, view, &pos_rect, &uv_rect, display_colorspace, do_overlay_merge);
550}
551
552void GPU_viewport_draw_to_screen(GPUViewport *viewport, int view, const rcti *rect)
553{
554 GPU_viewport_draw_to_screen_ex(viewport, view, rect, true, true);
555}
556
558 GPUOffScreen *ofs,
559 bool display_colorspace,
560 bool do_overlay_merge)
561{
562 const int view = 0;
563
564 if (viewport->color_render_tx[view] == nullptr) {
565 return;
566 }
567
569 GPU_offscreen_bind(ofs, false);
570
571 rctf pos_rect{};
572 pos_rect.xmin = -1.0f;
573 pos_rect.ymin = -1.0f;
574 pos_rect.xmax = 1.0f;
575 pos_rect.ymax = 1.0f;
576
577 rctf uv_rect{};
578 uv_rect.xmin = 0.0f;
579 uv_rect.ymin = 0.0f;
580 uv_rect.xmax = 1.0f;
581 uv_rect.ymax = 1.0f;
582
584 viewport, view, &pos_rect, &uv_rect, display_colorspace, do_overlay_merge);
585
586 /* This one is from the offscreen. Don't free it with the viewport. */
587 viewport->depth_tx = nullptr;
588}
589
595
597{
598 return viewport->active_view;
599}
600
602{
603 return (viewport->flag & GPU_VIEWPORT_STEREO) != 0;
604}
605
607{
608 return viewport->color_render_tx[view];
609}
610
612{
613 return viewport->color_overlay_tx[view];
614}
615
617{
618 return viewport->depth_tx;
619}
620
622{
624 &viewport->render_fb,
625 {
626 GPU_ATTACHMENT_TEXTURE(viewport->depth_tx),
627 GPU_ATTACHMENT_TEXTURE(viewport->color_render_tx[viewport->active_view]),
628 });
629 return viewport->render_fb;
630}
631
633{
635 &viewport->overlay_fb,
636 {
637 GPU_ATTACHMENT_TEXTURE(viewport->depth_tx),
638 GPU_ATTACHMENT_TEXTURE(viewport->color_overlay_tx[viewport->active_view]),
639 });
640 return viewport->overlay_fb;
641}
642
644{
645 if (viewport->draw_data) {
647 }
648
650
652 gpu_viewport_batch_free(viewport);
653
654 MEM_delete(viewport);
655}
656
657} // namespace blender
#define GPU_batch_uniform_1i(batch, name, x)
Definition GPU_batch.hh:265
#define GPU_FRAMEBUFFER_FREE_SAFE(fb)
#define GPU_framebuffer_ensure_config(_fb,...)
#define GPU_TEXTURE_FREE_SAFE(texture)
#define GLA_PIXEL_OFS
Read Blender memory allocation and freeing.
#define UNPACK2(a)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define ELEM(...)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
BMesh Iterators.
void DRW_gpu_context_enable()
void GPU_viewport_stereo_composite(GPUViewport *viewport, Stereo3dFormat *stereo_format)
void GPU_framebuffer_bind(gpu::FrameBuffer *fb)
void GPU_viewport_draw_to_screen_ex(GPUViewport *viewport, int view, const rcti *rect, bool display_colorspace, bool do_overlay_merge)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
gpu::Texture * GPU_viewport_color_texture(GPUViewport *viewport, int view)
static struct blender::@173001173141073324343215237207056221242135144335 g_viewport
CurveMapping * BKE_curvemapping_copy(const CurveMapping *cumap)
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
void GPU_viewport_colorspace_set(GPUViewport *viewport, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, float dither)
gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, gpu::VertBuf *vertex_buf, gpu::IndexBuf *index_buf, GPUBatchFlag owns_flag)
Definition gpu_batch.cc:53
void immEnd()
void GPU_framebuffer_restore()
bool IMB_colormanagement_display_is_hdr(const ColorManagedDisplaySettings *display_settings, const char *view_name)
unsigned int uint
Definition BKE_text.h:55
void IMB_colormanagement_finish_glsl_draw()
BLI_INLINE float fb(float length, float L)
void GPU_matrix_identity_set()
void GPU_viewport_tag_update(GPUViewport *viewport)
GPUVertFormat * immVertexFormat()
void BKE_color_managed_view_settings_copy_keep_curve_mapping(ColorManagedViewSettings *new_settings, const ColorManagedViewSettings *settings)
@ S3D_DISPLAY_INTERLACE
void immBegin(GPUPrimType, uint vertex_len)
void GPU_viewport_bind_from_offscreen(GPUViewport *viewport, GPUOffScreen *ofs, bool is_xr_surface)
gpu::FrameBuffer * GPU_viewport_framebuffer_render_get(GPUViewport *viewport)
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, ColorManagedDisplaySpace display_space=DISPLAY_SPACE_DRAW, float opacity=1.0f)
@ GPU_PRIM_TRI_STRIP
void GPU_batch_discard(gpu::Batch *batch)
void GPU_matrix_identity_projection_set()
int GPU_offscreen_width(const GPUOffScreen *offscreen)
void immAttr2f(uint attr_id, float x, float y)
GPU_INLINE void * GPU_vertbuf_raw_step(GPUVertBufRaw *a)
static const GPUVertFormat & gpu_viewport_batch_format()
void immUnbindProgram()
void BLI_rcti_sanitize(struct rcti *rect)
Definition rct.cc:460
gpu::Texture * GPU_viewport_overlay_texture(GPUViewport *viewport, int view)
void DRW_viewport_data_free(DRWData *drw_data)
DRWData ** GPU_viewport_data_get(GPUViewport *viewport)
void GPU_viewport_unbind(GPUViewport *viewport)
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void DRW_gpu_context_disable()
static gpu::Batch * gpu_viewport_batch_create(const rctf *rect_pos, const rctf *rect_uv)
void GPU_viewport_colorspace_clear(GPUViewport *viewport)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.hh:207
VecBase< int32_t, 2 > int2
@ GPU_DEPTH_NONE
Definition GPU_state.hh:132
int GPU_offscreen_height(const GPUOffScreen *offscreen)
void immVertex2f(uint attr_id, float x, float y)
void BKE_color_managed_display_settings_copy(ColorManagedDisplaySettings *new_settings, const ColorManagedDisplaySettings *settings)
@ GPU_TEXTURE_USAGE_FORMAT_VIEW
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_SHADER_WRITE
@ GPU_TEXTURE_USAGE_HOST_READ
@ GPU_TEXTURE_USAGE_ATTACHMENT
bool BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, float limit)
void GPU_offscreen_viewport_data_get(GPUOffScreen *offscreen, gpu::FrameBuffer **r_fb, gpu::Texture **r_color, gpu::Texture **r_depth)
@ GPU_SHADER_2D_IMAGE_OVERLAYS_MERGE
@ GPU_SHADER_2D_IMAGE_OVERLAYS_STEREO_MERGE
static gpu::Batch * gpu_viewport_batch_get(GPUViewport *viewport, const rctf *rect_pos, const rctf *rect_uv)
void GPU_color_mask(bool r, bool g, bool b, bool a)
Definition gpu_state.cc:95
int GPU_texture_width(const gpu::Texture *texture)
void GPU_batch_program_set_imm_shader(gpu::Batch *batch)
void GPU_batch_draw(gpu::Batch *batch)
@ GPU_BATCH_OWNS_VBO
Definition GPU_batch.hh:44
MINLINE void copy_v2_fl2(float v[2], float x, float y)
void GPU_offscreen_bind(GPUOffScreen *offscreen, bool save)
void GPU_viewport_bind(GPUViewport *viewport, int view, const rcti *rect)
void GPU_vertbuf_attr_get_raw_data(gpu::VertBuf *, uint a_idx, GPUVertBufRaw *access)
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.hh:203
void GPU_batch_program_set_builtin(gpu::Batch *batch, GPUBuiltinShader shader_id)
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)
gpu::FrameBuffer * GPU_viewport_framebuffer_overlay_get(GPUViewport *viewport)
void GPU_viewport_free(GPUViewport *viewport)
gpu::Texture * GPU_viewport_depth_texture(GPUViewport *viewport)
void GPU_matrix_pop_projection()
static void gpu_viewport_batch_free(GPUViewport *viewport)
void GPU_texture_clear(gpu::Texture *texture, eGPUDataFormat data_format, const void *data)
void GPU_texture_bind(gpu::Texture *texture, int unit)
int GPU_texture_height(const gpu::Texture *texture)
void GPU_vertbuf_data_alloc(gpu::VertBuf &verts, uint v_len)
@ S3D_ANAGLYPH_YELLOWBLUE
@ S3D_ANAGLYPH_GREENMAGENTA
@ GPU_VIEWPORT_STEREO
void GPU_viewport_draw_to_screen(GPUViewport *viewport, int view, const rcti *rect)
void GPU_texture_unbind(gpu::Texture *texture)
void BKE_color_managed_view_settings_free(ColorManagedViewSettings *settings)
bool GPU_viewport_is_stereo_get(GPUViewport *viewport)
static void gpu_viewport_textures_free(GPUViewport *viewport)
void immUniform1i(const char *name, int x)
GPUViewport * GPU_viewport_stereo_create()
void GPU_matrix_pop()
void GPU_matrix_push_projection()
void GPU_depth_test(GPUDepthTest test)
Definition gpu_state.cc:70
int GPU_viewport_active_view_get(GPUViewport *viewport)
gpu::Texture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
bool GPU_viewport_do_update(GPUViewport *viewport)
void GPU_matrix_push()
GPUViewport * GPU_viewport_create()
void GPU_viewport_unbind_from_offscreen(GPUViewport *viewport, GPUOffScreen *ofs, bool display_colorspace, bool do_overlay_merge)
static void gpu_viewport_textures_create(GPUViewport *viewport)
ccl_device_inline int rect_size(const int4 rect)
Definition rect.h:56
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
struct CurveMapping * curve_mapping
struct blender::GPUViewportBatch::@032165141313147065042054252172166113232122301022 last_used_parameters
ColorManagedDisplaySettings display_settings
gpu::FrameBuffer * overlay_fb
GPUViewportBatch batch
gpu::FrameBuffer * stereo_comp_fb
gpu::Texture * color_render_tx[2]
CurveMapping * orig_curve_mapping
gpu::FrameBuffer * render_fb
ColorManagedViewSettings view_settings
gpu::Texture * color_overlay_tx[2]
gpu::Texture * depth_tx
eStereo3dAnaglyphType anaglyph_type
eStereoDisplayMode display_mode
eStereo3dInterlaceType interlace_type
struct blender::@173001173141073324343215237207056221242135144335::@165201342376101213023223344052306163034031243201 attr_id