Blender V5.0
glutil.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdio>
10#include <cstring>
11
12#include "DNA_userdef_types.h"
13#include "DNA_vec_types.h"
14
15#include "BLI_utildefines.h"
16
17#include "BIF_glutil.hh"
18
20#include "IMB_imbuf_types.hh"
21
22#include "GPU_context.hh"
23#include "GPU_immediate.hh"
24#include "GPU_texture.hh"
25
26/* ******************************************** */
27
29{
30 GPUVertFormat *vert_format = immVertexFormat();
32 vert_format, "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
34 vert_format, "texCoord", blender::gpu::VertAttrType::SFLOAT_32_32);
35}
36
38{
41
43
44 /* Shader will be unbind by immUnbindProgram in a `immDrawPixelsTex` function. */
46 state.do_shader_unbind = true;
47
48 return state;
49}
50
52 const float x,
53 const float y,
54 const int img_w,
55 const int img_h,
56 const blender::gpu::TextureFormat gpu_format,
57 const bool use_filter,
58 const void *rect,
59 const float scaleX,
60 const float scaleY,
61 const float xzoom,
62 const float yzoom,
63 const float color[4])
64{
65 static const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
66 const float draw_width = img_w * scaleX * xzoom;
67 const float draw_height = img_h * scaleY * yzoom;
68 /* Down-scaling with regular bi-linear interpolation (i.e. #GL_LINEAR) doesn't give good
69 * filtering results. Mipmaps can be used to get better results (i.e. #GL_LINEAR_MIPMAP_LINEAR),
70 * so always use mipmaps when filtering. */
71 const bool use_mipmap = use_filter && ((draw_width < img_w) || (draw_height < img_h));
72 const int mip_len = use_mipmap ? 9999 : 1;
73
75 "immDrawPixels", img_w, img_h, mip_len, gpu_format, GPU_TEXTURE_USAGE_SHADER_READ, nullptr);
76
77 const bool use_float_data = ELEM(gpu_format,
78 blender::gpu::TextureFormat::SFLOAT_16_16_16_16,
79 blender::gpu::TextureFormat::SFLOAT_16_16_16,
80 blender::gpu::TextureFormat::SFLOAT_16);
81 eGPUDataFormat gpu_data_format = (use_float_data) ? GPU_DATA_FLOAT : GPU_DATA_UBYTE;
82 GPU_texture_update(tex, gpu_data_format, rect);
83
84 GPU_texture_filter_mode(tex, use_filter);
85 if (use_mipmap) {
87 GPU_texture_mipmap_mode(tex, true, true);
88 }
90
91 GPU_texture_bind(tex, 0);
92
93 /* optional */
94 /* NOTE: Shader could be null for GLSL OCIO drawing, it is fine, since
95 * it does not need color.
96 */
97 if (state->shader != nullptr && GPU_shader_get_uniform(state->shader, "color") != -1) {
98 immUniformColor4fv((color) ? color : white);
99 }
100
101 uint pos = state->pos, texco = state->texco;
102
104 immAttr2f(texco, 0.0f, 0.0f);
105 immVertex2f(pos, x, y);
106
107 immAttr2f(texco, 1.0f, 0.0f);
108 immVertex2f(pos, x + draw_width, y);
109
110 immAttr2f(texco, 1.0f, 1.0f);
111 immVertex2f(pos, x + draw_width, y + draw_height);
112
113 immAttr2f(texco, 0.0f, 1.0f);
114 immVertex2f(pos, x, y + draw_height);
115 immEnd();
116
117 if (state->do_shader_unbind) {
119 }
120
122 GPU_texture_free(tex);
123}
124
126 float x,
127 float y,
128 int img_w,
129 int img_h,
131 bool use_filter,
132 const void *rect,
133 float scaleX,
134 float scaleY,
135 float clip_min_x,
136 float clip_min_y,
137 float clip_max_x,
138 float clip_max_y,
139 float xzoom,
140 float yzoom,
141 const float color[4])
142{
143 int subpart_x, subpart_y, tex_w = 256, tex_h = 256;
145 /* NOTE: These backend will keep all temporary texture memory within a command
146 * submission in-flight, so using a partial tile size does not provide any tangible memory
147 * reduction, but does incur additional API overhead and significant cache inefficiency on
148 * specific platforms.
149 *
150 * The Metal API also provides smart resource paging such that the application can
151 * still efficiently swap memory, even if system is low in physical memory. */
152 tex_w = img_w;
153 tex_h = img_h;
154 }
155 int seamless, offset_x, offset_y, nsubparts_x, nsubparts_y;
156 int components;
157 const bool use_clipping = ((clip_min_x < clip_max_x) && (clip_min_y < clip_max_y));
158 const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
159
160 if (ELEM(gpu_format,
161 blender::gpu::TextureFormat::UNORM_8_8_8_8,
162 blender::gpu::TextureFormat::SFLOAT_16_16_16_16))
163 {
164 components = 4;
165 }
166 else if (ELEM(gpu_format, blender::gpu::TextureFormat::SFLOAT_16_16_16)) {
167 components = 3;
168 }
169 else if (ELEM(gpu_format,
170 blender::gpu::TextureFormat::UNORM_8,
171 blender::gpu::TextureFormat::SFLOAT_16))
172 {
173 components = 1;
174 }
175 else {
176 BLI_assert_msg(0, "Incompatible format passed to immDrawPixels");
177 return;
178 }
179
180 const bool use_float_data = ELEM(gpu_format,
181 blender::gpu::TextureFormat::SFLOAT_16_16_16_16,
182 blender::gpu::TextureFormat::SFLOAT_16_16_16,
183 blender::gpu::TextureFormat::SFLOAT_16);
184 eGPUDataFormat gpu_data = (use_float_data) ? GPU_DATA_FLOAT : GPU_DATA_UBYTE;
185 size_t stride = components * ((use_float_data) ? sizeof(float) : sizeof(uchar));
186
188 "immDrawPixels", tex_w, tex_h, 1, gpu_format, GPU_TEXTURE_USAGE_SHADER_READ, nullptr);
189
190 GPU_texture_filter_mode(tex, use_filter);
192
193 GPU_texture_bind(tex, 0);
194
195 /* setup seamless 2=on, 0=off */
196 seamless = ((tex_w < img_w || tex_h < img_h) && tex_w > 2 && tex_h > 2) ? 2 : 0;
197
198 offset_x = tex_w - seamless;
199 offset_y = tex_h - seamless;
200
201 nsubparts_x = (img_w + (offset_x - 1)) / (offset_x);
202 nsubparts_y = (img_h + (offset_y - 1)) / (offset_y);
203
204 /* optional */
205 /* NOTE: Shader could be null for GLSL OCIO drawing, it is fine, since
206 * it does not need color.
207 */
208 if (state->shader != nullptr && GPU_shader_get_uniform(state->shader, "color") != -1) {
209 immUniformColor4fv((color) ? color : white);
210 }
211
213
214 for (subpart_y = 0; subpart_y < nsubparts_y; subpart_y++) {
215 for (subpart_x = 0; subpart_x < nsubparts_x; subpart_x++) {
216 int remainder_x = img_w - subpart_x * offset_x;
217 int remainder_y = img_h - subpart_y * offset_y;
218 int subpart_w = (remainder_x < tex_w) ? remainder_x : tex_w;
219 int subpart_h = (remainder_y < tex_h) ? remainder_y : tex_h;
220 int offset_left = (seamless && subpart_x != 0) ? 1 : 0;
221 int offset_bot = (seamless && subpart_y != 0) ? 1 : 0;
222 int offset_right = (seamless && remainder_x > tex_w) ? 1 : 0;
223 int offset_top = (seamless && remainder_y > tex_h) ? 1 : 0;
224 float rast_x = x + subpart_x * offset_x * xzoom;
225 float rast_y = y + subpart_y * offset_y * yzoom;
226 /* check if we already got these because we always get 2 more when doing seamless */
227 if (subpart_w <= seamless || subpart_h <= seamless) {
228 continue;
229 }
230
231 int right = subpart_w - offset_right;
232 int top = subpart_h - offset_top;
233 int bottom = 0 + offset_bot;
234 int left = 0 + offset_left;
235
236 if (use_clipping) {
237 if (rast_x + right * xzoom * scaleX < clip_min_x ||
238 rast_y + top * yzoom * scaleY < clip_min_y)
239 {
240 continue;
241 }
242 if (rast_x + left * xzoom > clip_max_x || rast_y + bottom * yzoom > clip_max_y) {
243 continue;
244 }
245 }
246
247 {
248 int src_y = subpart_y * offset_y;
249 int src_x = subpart_x * offset_x;
250
251#define DATA(_y, _x) (static_cast<const char *>(rect) + stride * (size_t(_y) * img_w + (_x)))
252 {
253 const void *data = DATA(src_y, src_x);
254 GPU_texture_update_sub(tex, gpu_data, data, 0, 0, 0, subpart_w, subpart_h, 0);
255 }
256 /* Add an extra border of pixels so linear interpolation looks ok
257 * at edges of full image. */
258 if (subpart_w < tex_w) {
259 const void *data = DATA(src_y, src_x + subpart_w - 1);
260 const int offset[2] = {subpart_w, 0};
261 const int extent[2] = {1, subpart_h};
262 GPU_texture_update_sub(tex, gpu_data, data, UNPACK2(offset), 0, UNPACK2(extent), 0);
263 }
264 if (subpart_h < tex_h) {
265 const void *data = DATA(src_y + subpart_h - 1, src_x);
266 const int offset[2] = {0, subpart_h};
267 const int extent[2] = {subpart_w, 1};
268 GPU_texture_update_sub(tex, gpu_data, data, UNPACK2(offset), 0, UNPACK2(extent), 0);
269 }
270
271 if (subpart_w < tex_w && subpart_h < tex_h) {
272 const void *data = DATA(src_y + subpart_h - 1, src_x + subpart_w - 1);
273 const int offset[2] = {subpart_w, subpart_h};
274 const int extent[2] = {1, 1};
275 GPU_texture_update_sub(tex, gpu_data, data, UNPACK2(offset), 0, UNPACK2(extent), 0);
276 }
277#undef DATA
278 }
279
280 uint pos = state->pos, texco = state->texco;
281
283 immAttr2f(texco, left / float(tex_w), bottom / float(tex_h));
284 immVertex2f(pos, rast_x + offset_left * xzoom, rast_y + offset_bot * yzoom);
285
286 immAttr2f(texco, right / float(tex_w), bottom / float(tex_h));
287 immVertex2f(pos, rast_x + right * xzoom * scaleX, rast_y + offset_bot * yzoom);
288
289 immAttr2f(texco, right / float(tex_w), top / float(tex_h));
290 immVertex2f(pos, rast_x + right * xzoom * scaleX, rast_y + top * yzoom * scaleY);
291
292 immAttr2f(texco, left / float(tex_w), top / float(tex_h));
293 immVertex2f(pos, rast_x + offset_left * xzoom, rast_y + top * yzoom * scaleY);
294 immEnd();
295 }
296 }
297
298 if (state->do_shader_unbind) {
299 immUnbindProgram();
300 }
301
303 GPU_texture_free(tex);
304
305 /* Restore default. */
307}
308
310 float x,
311 float y,
312 int img_w,
313 int img_h,
315 bool use_filter,
316 const void *rect,
317 float scaleX,
318 float scaleY,
319 float xzoom,
320 float yzoom,
321 const float color[4])
322{
324 x,
325 y,
326 img_w,
327 img_h,
328 gpu_format,
329 use_filter,
330 rect,
331 scaleX,
332 scaleY,
333 0.0f,
334 0.0f,
335 0.0f,
336 0.0f,
337 xzoom,
338 yzoom,
339 color);
340}
341
343 float x,
344 float y,
345 int img_w,
346 int img_h,
348 bool use_filter,
349 const void *rect,
350 float xzoom,
351 float yzoom,
352 const float color[4])
353{
355 x,
356 y,
357 img_w,
358 img_h,
359 gpu_format,
360 use_filter,
361 rect,
362 1.0f,
363 1.0f,
364 0.0f,
365 0.0f,
366 0.0f,
367 0.0f,
368 xzoom,
369 yzoom,
370 color);
371}
372
374 float x,
375 float y,
376 int img_w,
377 int img_h,
379 bool use_filter,
380 const void *rect,
381 float clip_min_x,
382 float clip_min_y,
383 float clip_max_x,
384 float clip_max_y,
385 float xzoom,
386 float yzoom,
387 const float color[4])
388{
390 x,
391 y,
392 img_w,
393 img_h,
394 gpu_format,
395 use_filter,
396 rect,
397 1.0f,
398 1.0f,
399 clip_min_x,
400 clip_min_y,
401 clip_max_x,
402 clip_max_y,
403 xzoom,
404 yzoom,
405 color);
406}
407
408/* **** Color management helper functions for GLSL display/transform ***** */
409
411 float x,
412 float y,
413 bool use_filter,
414 const ColorManagedViewSettings *view_settings,
415 const ColorManagedDisplaySettings *display_settings,
416 float clip_min_x,
417 float clip_min_y,
418 float clip_max_x,
419 float clip_max_y,
420 float zoom_x,
421 float zoom_y)
422{
423 using namespace blender::gpu;
424
425 bool force_fallback = false;
426 bool need_fallback = true;
427
428 /* Early out */
429 if (ibuf->byte_buffer.data == nullptr && ibuf->float_buffer.data == nullptr) {
430 return;
431 }
432
433 /* Single channel images could not be transformed using GLSL yet */
434 force_fallback |= ibuf->channels == 1;
435
436 /* If user decided not to use GLSL, fallback to glaDrawPixelsAuto */
437 force_fallback |= (ED_draw_imbuf_method(ibuf) != IMAGE_DRAW_METHOD_GLSL);
438
439 /* Try to draw buffer using GLSL display transform */
440 if (force_fallback == false) {
441 int ok;
442
443 IMMDrawPixelsTexState state = {nullptr};
444 /* We want GLSL state to be fully handled by OCIO. */
445 state.do_shader_unbind = false;
447
448 if (ibuf->float_buffer.data) {
449 if (ibuf->float_buffer.colorspace) {
451 display_settings,
453 ibuf->dither,
454 true,
455 false);
456 }
457 else {
459 view_settings, display_settings, ibuf->dither, true);
460 }
461 }
462 else {
464 display_settings,
466 ibuf->dither,
467 false,
468 false);
469 }
470
471 if (ok) {
472 if (ibuf->float_buffer.data) {
474
475 if (ibuf->channels == 3) {
476 format = TextureFormat::SFLOAT_16_16_16;
477 }
478 else if (ibuf->channels == 4) {
479 format = TextureFormat::SFLOAT_16_16_16_16;
480 }
481 else {
482 BLI_assert_msg(0, "Incompatible number of channels for GLSL display");
483 }
484
487 x,
488 y,
489 ibuf->x,
490 ibuf->y,
491 format,
492 use_filter,
493 ibuf->float_buffer.data,
494 clip_min_x,
495 clip_min_y,
496 clip_max_x,
497 clip_max_y,
498 zoom_x,
499 zoom_y,
500 nullptr);
501 }
502 }
503 else if (ibuf->byte_buffer.data) {
504 /* ibuf->rect is always RGBA */
506 x,
507 y,
508 ibuf->x,
509 ibuf->y,
510 blender::gpu::TextureFormat::UNORM_8_8_8_8,
511 use_filter,
512 ibuf->byte_buffer.data,
513 clip_min_x,
514 clip_min_y,
515 clip_max_x,
516 clip_max_y,
517 zoom_x,
518 zoom_y,
519 nullptr);
520 }
521
523
524 need_fallback = false;
525 }
526 }
527
528 /* In case GLSL failed or not usable, fallback to glaDrawPixelsAuto */
529 if (need_fallback) {
530 uchar *display_buffer;
531 void *cache_handle;
532
533 display_buffer = IMB_display_buffer_acquire(
534 ibuf, view_settings, display_settings, &cache_handle);
535
536 if (display_buffer) {
539 x,
540 y,
541 ibuf->x,
542 ibuf->y,
543 blender::gpu::TextureFormat::UNORM_8_8_8_8,
544 use_filter,
545 display_buffer,
546 clip_min_x,
547 clip_min_y,
548 clip_max_x,
549 clip_max_y,
550 zoom_x,
551 zoom_y,
552 nullptr);
553 }
554
555 IMB_display_buffer_release(cache_handle);
556 }
557}
558
560 float x,
561 float y,
562 bool use_filter,
563 const ColorManagedViewSettings *view_settings,
564 const ColorManagedDisplaySettings *display_settings,
565 float zoom_x,
566 float zoom_y)
567{
569 x,
570 y,
571 use_filter,
572 view_settings,
573 display_settings,
574 0.0f,
575 0.0f,
576 0.0f,
577 0.0f,
578 zoom_x,
579 zoom_y);
580}
581
583 ImBuf *ibuf,
584 float x,
585 float y,
586 bool use_filter,
587 float clip_min_x,
588 float clip_min_y,
589 float clip_max_x,
590 float clip_max_y,
591 float zoom_x,
592 float zoom_y)
593{
594 ColorManagedViewSettings *view_settings;
595 ColorManagedDisplaySettings *display_settings;
596
597 IMB_colormanagement_display_settings_from_ctx(C, &view_settings, &display_settings);
598
600 x,
601 y,
602 use_filter,
603 view_settings,
604 display_settings,
605 clip_min_x,
606 clip_min_y,
607 clip_max_x,
608 clip_max_y,
609 zoom_x,
610 zoom_y);
611}
612
614 const bContext *C, ImBuf *ibuf, float x, float y, bool use_filter, float zoom_x, float zoom_y)
615{
616 ED_draw_imbuf_ctx_clipping(C, ibuf, x, y, use_filter, 0.0f, 0.0f, 0.0f, 0.0f, zoom_x, zoom_y);
617}
618
620{
621 if (U.image_draw_method == IMAGE_DRAW_METHOD_AUTO) {
622 /* Use faster GLSL when CPU to GPU transfer is unlikely to be a bottleneck,
623 * otherwise do color management on CPU side. */
624 const size_t threshold = sizeof(float[4]) * 2048 * 2048;
625 const size_t data_size = (ibuf->float_buffer.data) ? sizeof(float) : sizeof(uchar);
626 const size_t size = size_t(ibuf->x) * size_t(ibuf->y) * size_t(ibuf->channels) * data_size;
627
629 }
630 return U.image_draw_method;
631}
632
633void immDrawBorderCorners(uint pos, const rcti *border, float zoomx, float zoomy)
634{
635 float delta_x = 4.0f * UI_SCALE_FAC / zoomx;
636 float delta_y = 4.0f * UI_SCALE_FAC / zoomy;
637
638 delta_x = min_ff(delta_x, border->xmax - border->xmin);
639 delta_y = min_ff(delta_y, border->ymax - border->ymin);
640
641 /* left bottom corner */
643 immVertex2f(pos, border->xmin, border->ymin + delta_y);
644 immVertex2f(pos, border->xmin, border->ymin);
645 immVertex2f(pos, border->xmin + delta_x, border->ymin);
646 immEnd();
647
648 /* left top corner */
650 immVertex2f(pos, border->xmin, border->ymax - delta_y);
651 immVertex2f(pos, border->xmin, border->ymax);
652 immVertex2f(pos, border->xmin + delta_x, border->ymax);
653 immEnd();
654
655 /* right bottom corner */
657 immVertex2f(pos, border->xmax - delta_x, border->ymin);
658 immVertex2f(pos, border->xmax, border->ymin);
659 immVertex2f(pos, border->xmax, border->ymin + delta_y);
660 immEnd();
661
662 /* right top corner */
664 immVertex2f(pos, border->xmax - delta_x, border->ymax);
665 immVertex2f(pos, border->xmax, border->ymax);
666 immVertex2f(pos, border->xmax, border->ymax - delta_y);
667 immEnd();
668}
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
MINLINE float min_ff(float a, float b)
unsigned char uchar
unsigned int uint
#define UNPACK2(a)
#define ELEM(...)
#define UI_SCALE_FAC
@ IMAGE_DRAW_METHOD_AUTO
@ IMAGE_DRAW_METHOD_GLSL
@ IMAGE_DRAW_METHOD_2DTEXTURE
GPUBackendType GPU_backend_get_type()
void immEnd()
void immUnbindProgram()
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void immVertex2f(uint attr_id, float x, float y)
GPUVertFormat * immVertexFormat()
void immUniformColor4fv(const float rgba[4])
void immAttr2f(uint attr_id, float x, float y)
void immBegin(GPUPrimType, uint vertex_len)
@ GPU_PRIM_TRI_FAN
@ GPU_PRIM_LINE_STRIP
int GPU_shader_get_uniform(blender::gpu::Shader *shader, const char *name)
blender::gpu::Shader * GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
GPUBuiltinShader
@ GPU_SHADER_3D_IMAGE_COLOR
void GPU_texture_update_sub(blender::gpu::Texture *texture, eGPUDataFormat data_format, const void *pixels, int offset_x, int offset_y, int offset_z, int width, int height, int depth)
void GPU_texture_update_mipmap_chain(blender::gpu::Texture *texture)
void GPU_texture_unbind(blender::gpu::Texture *texture)
eGPUDataFormat
@ GPU_DATA_UBYTE
@ GPU_DATA_FLOAT
void GPU_texture_extend_mode(blender::gpu::Texture *texture, GPUSamplerExtendMode extend_mode)
void GPU_texture_mipmap_mode(blender::gpu::Texture *texture, bool use_mipmap, bool use_filter)
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_SAMPLER_EXTEND_MODE_EXTEND
blender::gpu::Texture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_filter_mode(blender::gpu::Texture *texture, bool use_filter)
void GPU_unpack_row_length_set(uint len)
void GPU_texture_bind(blender::gpu::Texture *texture, int unit)
void GPU_texture_free(blender::gpu::Texture *texture)
void GPU_texture_update(blender::gpu::Texture *texture, eGPUDataFormat data_format, const void *data)
uint GPU_vertformat_attr_add(GPUVertFormat *format, blender::StringRef name, blender::gpu::VertAttrType type)
unsigned char * IMB_display_buffer_acquire(ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, void **cache_handle)
bool IMB_colormanagement_setup_glsl_draw(const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, float dither, bool predivide)
void IMB_display_buffer_release(void *cache_handle)
void IMB_colormanagement_display_settings_from_ctx(const bContext *C, ColorManagedViewSettings **r_view_settings, ColorManagedDisplaySettings **r_display_settings)
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)
#define C
Definition RandGen.cpp:29
#define U
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
nullptr float
void ED_draw_imbuf_ctx(const bContext *C, ImBuf *ibuf, float x, float y, bool use_filter, float zoom_x, float zoom_y)
Definition glutil.cc:613
void ED_draw_imbuf_clipping(ImBuf *ibuf, float x, float y, bool use_filter, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float zoom_x, float zoom_y)
Definition glutil.cc:410
void ED_draw_imbuf(ImBuf *ibuf, float x, float y, bool use_filter, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, float zoom_x, float zoom_y)
Definition glutil.cc:559
void immDrawBorderCorners(uint pos, const rcti *border, float zoomx, float zoomy)
Definition glutil.cc:633
void ED_draw_imbuf_ctx_clipping(const bContext *C, ImBuf *ibuf, float x, float y, bool use_filter, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float zoom_x, float zoom_y)
Definition glutil.cc:582
void immDrawPixelsTexTiled_scaling(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float scaleX, float scaleY, float xzoom, float yzoom, const float color[4])
Definition glutil.cc:309
void immDrawPixelsTexScaledFullSize(const IMMDrawPixelsTexState *state, const float x, const float y, const int img_w, const int img_h, const blender::gpu::TextureFormat gpu_format, const bool use_filter, const void *rect, const float scaleX, const float scaleY, const float xzoom, const float yzoom, const float color[4])
Definition glutil.cc:51
void immDrawPixelsTexTiled(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float xzoom, float yzoom, const float color[4])
Definition glutil.cc:342
void immDrawPixelsTexTiled_clipping(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float xzoom, float yzoom, const float color[4])
Definition glutil.cc:373
#define DATA(_y, _x)
void immDrawPixelsTexTiled_scaling_clipping(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float scaleX, float scaleY, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float xzoom, float yzoom, const float color[4])
Definition glutil.cc:125
int ED_draw_imbuf_method(const ImBuf *ibuf)
Definition glutil.cc:619
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
Definition glutil.cc:37
static void immDrawPixelsTexSetupAttributes(IMMDrawPixelsTexState *state)
Definition glutil.cc:28
uint pos
uint top
format
static ulong state[N]
static int left
const ColorSpace * colorspace
const ColorSpace * colorspace
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
int ymin
int ymax
int xmin
int xmax