Blender  V3.3
glutil.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
8 #include <stdio.h>
9 #include <string.h>
10 
11 #include "DNA_userdef_types.h"
12 #include "DNA_vec_types.h"
13 
14 #include "BLI_math.h"
15 #include "BLI_utildefines.h"
16 
17 #include "BKE_context.h"
18 
19 #include "BIF_glutil.h"
20 
21 #include "IMB_colormanagement.h"
22 #include "IMB_imbuf_types.h"
23 
24 #include "GPU_immediate.h"
25 #include "GPU_matrix.h"
26 #include "GPU_texture.h"
27 
28 #ifdef __APPLE__
29 # include "GPU_state.h"
30 #endif
31 
32 #include "UI_interface.h"
33 
34 /* ******************************************** */
35 
37 {
38  GPUVertFormat *vert_format = immVertexFormat();
39  state->pos = GPU_vertformat_attr_add(vert_format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
41  vert_format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
42 }
43 
45 {
48 
49  state.shader = GPU_shader_get_builtin_shader(builtin);
50 
51  /* Shader will be unbind by immUnbindProgram in a `immDrawPixelsTex` function. */
52  immBindBuiltinProgram(builtin);
53  immUniform1i("image", 0);
54  state.do_shader_unbind = true;
55 
56  return state;
57 }
58 
60  const float x,
61  const float y,
62  const int img_w,
63  const int img_h,
64  const eGPUTextureFormat gpu_format,
65  const bool use_filter,
66  const void *rect,
67  const float scaleX,
68  const float scaleY,
69  const float xzoom,
70  const float yzoom,
71  const float color[4])
72 {
73  static const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
74  const float draw_width = img_w * scaleX * xzoom;
75  const float draw_height = img_h * scaleY * yzoom;
76  /* Down-scaling with regular bi-linear interpolation (i.e. #GL_LINEAR) doesn't give good
77  * filtering results. Mipmaps can be used to get better results (i.e. #GL_LINEAR_MIPMAP_LINEAR),
78  * so always use mipmaps when filtering. */
79  const bool use_mipmap = use_filter && ((draw_width < img_w) || (draw_height < img_h));
80  const int mip_len = use_mipmap ? 9999 : 1;
81 
83  "immDrawPixels", img_w, img_h, mip_len, gpu_format, NULL);
84 
85  const bool use_float_data = ELEM(gpu_format, GPU_RGBA16F, GPU_RGB16F, GPU_R16F);
86  eGPUDataFormat gpu_data_format = (use_float_data) ? GPU_DATA_FLOAT : GPU_DATA_UBYTE;
87  GPU_texture_update(tex, gpu_data_format, rect);
88 
89  GPU_texture_filter_mode(tex, use_filter);
90  if (use_mipmap) {
92  GPU_texture_mipmap_mode(tex, true, true);
93  }
94  GPU_texture_wrap_mode(tex, false, true);
95 
97 
98  /* optional */
99  /* NOTE: Shader could be null for GLSL OCIO drawing, it is fine, since
100  * it does not need color.
101  */
102  if (state->shader != NULL && GPU_shader_get_uniform(state->shader, "color") != -1) {
103  immUniformColor4fv((color) ? color : white);
104  }
105 
106  uint pos = state->pos, texco = state->texco;
107 
109  immAttr2f(texco, 0.0f, 0.0f);
110  immVertex2f(pos, x, y);
111 
112  immAttr2f(texco, 1.0f, 0.0f);
113  immVertex2f(pos, x + draw_width, y);
114 
115  immAttr2f(texco, 1.0f, 1.0f);
116  immVertex2f(pos, x + draw_width, y + draw_height);
117 
118  immAttr2f(texco, 0.0f, 1.0f);
119  immVertex2f(pos, x, y + draw_height);
120  immEnd();
121 
122  if (state->do_shader_unbind) {
124  }
125 
128 }
129 
131  float x,
132  float y,
133  int img_w,
134  int img_h,
135  eGPUTextureFormat gpu_format,
136  bool use_filter,
137  void *rect,
138  float scaleX,
139  float scaleY,
140  float clip_min_x,
141  float clip_min_y,
142  float clip_max_x,
143  float clip_max_y,
144  float xzoom,
145  float yzoom,
146  const float color[4])
147 {
148  int subpart_x, subpart_y, tex_w = 256, tex_h = 256;
149  int seamless, offset_x, offset_y, nsubparts_x, nsubparts_y;
150  int components;
151  const bool use_clipping = ((clip_min_x < clip_max_x) && (clip_min_y < clip_max_y));
152  const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
153 
154  if (ELEM(gpu_format, GPU_RGBA8, GPU_RGBA16F)) {
155  components = 4;
156  }
157  else if (ELEM(gpu_format, GPU_RGB16F)) {
158  components = 3;
159  }
160  else if (ELEM(gpu_format, GPU_R8, GPU_R16F)) {
161  components = 1;
162  }
163  else {
164  BLI_assert_msg(0, "Incompatible format passed to immDrawPixels");
165  return;
166  }
167 
168  const bool use_float_data = ELEM(gpu_format, GPU_RGBA16F, GPU_RGB16F, GPU_R16F);
169  eGPUDataFormat gpu_data = (use_float_data) ? GPU_DATA_FLOAT : GPU_DATA_UBYTE;
170  size_t stride = components * ((use_float_data) ? sizeof(float) : sizeof(uchar));
171 
172  GPUTexture *tex = GPU_texture_create_2d("immDrawPixels", tex_w, tex_h, 1, gpu_format, NULL);
173 
174  GPU_texture_filter_mode(tex, use_filter);
175  GPU_texture_wrap_mode(tex, false, true);
176 
177  GPU_texture_bind(tex, 0);
178 
179  /* setup seamless 2=on, 0=off */
180  seamless = ((tex_w < img_w || tex_h < img_h) && tex_w > 2 && tex_h > 2) ? 2 : 0;
181 
182  offset_x = tex_w - seamless;
183  offset_y = tex_h - seamless;
184 
185  nsubparts_x = (img_w + (offset_x - 1)) / (offset_x);
186  nsubparts_y = (img_h + (offset_y - 1)) / (offset_y);
187 
188  /* optional */
189  /* NOTE: Shader could be null for GLSL OCIO drawing, it is fine, since
190  * it does not need color.
191  */
192  if (state->shader != NULL && GPU_shader_get_uniform(state->shader, "color") != -1) {
193  immUniformColor4fv((color) ? color : white);
194  }
195 
197 
198  for (subpart_y = 0; subpart_y < nsubparts_y; subpart_y++) {
199  for (subpart_x = 0; subpart_x < nsubparts_x; subpart_x++) {
200  int remainder_x = img_w - subpart_x * offset_x;
201  int remainder_y = img_h - subpart_y * offset_y;
202  int subpart_w = (remainder_x < tex_w) ? remainder_x : tex_w;
203  int subpart_h = (remainder_y < tex_h) ? remainder_y : tex_h;
204  int offset_left = (seamless && subpart_x != 0) ? 1 : 0;
205  int offset_bot = (seamless && subpart_y != 0) ? 1 : 0;
206  int offset_right = (seamless && remainder_x > tex_w) ? 1 : 0;
207  int offset_top = (seamless && remainder_y > tex_h) ? 1 : 0;
208  float rast_x = x + subpart_x * offset_x * xzoom;
209  float rast_y = y + subpart_y * offset_y * yzoom;
210  /* check if we already got these because we always get 2 more when doing seamless */
211  if (subpart_w <= seamless || subpart_h <= seamless) {
212  continue;
213  }
214 
215  int right = subpart_w - offset_right;
216  int top = subpart_h - offset_top;
217  int bottom = 0 + offset_bot;
218  int left = 0 + offset_left;
219 
220  if (use_clipping) {
221  if (rast_x + right * xzoom * scaleX < clip_min_x ||
222  rast_y + top * yzoom * scaleY < clip_min_y) {
223  continue;
224  }
225  if (rast_x + left * xzoom > clip_max_x || rast_y + bottom * yzoom > clip_max_y) {
226  continue;
227  }
228  }
229 
230  {
231  int src_y = subpart_y * offset_y;
232  int src_x = subpart_x * offset_x;
233 
234 #define DATA(_y, _x) ((char *)rect + stride * ((size_t)(_y)*img_w + (_x)))
235  {
236  void *data = DATA(src_y, src_x);
237  GPU_texture_update_sub(tex, gpu_data, data, 0, 0, 0, subpart_w, subpart_h, 0);
238  }
239  /* Add an extra border of pixels so linear interpolation looks ok
240  * at edges of full image. */
241  if (subpart_w < tex_w) {
242  void *data = DATA(src_y, src_x + subpart_w - 1);
243  const int offset[2] = {subpart_w, 0};
244  const int extent[2] = {1, subpart_h};
245  GPU_texture_update_sub(tex, gpu_data, data, UNPACK2(offset), 0, UNPACK2(extent), 0);
246  }
247  if (subpart_h < tex_h) {
248  void *data = DATA(src_y + subpart_h - 1, src_x);
249  const int offset[2] = {0, subpart_h};
250  const int extent[2] = {subpart_w, 1};
251  GPU_texture_update_sub(tex, gpu_data, data, UNPACK2(offset), 0, UNPACK2(extent), 0);
252  }
253 
254  if (subpart_w < tex_w && subpart_h < tex_h) {
255  void *data = DATA(src_y + subpart_h - 1, src_x + subpart_w - 1);
256  const int offset[2] = {subpart_w, subpart_h};
257  const int extent[2] = {1, 1};
258  GPU_texture_update_sub(tex, gpu_data, data, UNPACK2(offset), 0, UNPACK2(extent), 0);
259  }
260 #undef DATA
261  }
262 
263  uint pos = state->pos, texco = state->texco;
264 
266  immAttr2f(texco, left / (float)tex_w, bottom / (float)tex_h);
267  immVertex2f(pos, rast_x + offset_left * xzoom, rast_y + offset_bot * yzoom);
268 
269  immAttr2f(texco, right / (float)tex_w, bottom / (float)tex_h);
270  immVertex2f(pos, rast_x + right * xzoom * scaleX, rast_y + offset_bot * yzoom);
271 
272  immAttr2f(texco, right / (float)tex_w, top / (float)tex_h);
273  immVertex2f(pos, rast_x + right * xzoom * scaleX, rast_y + top * yzoom * scaleY);
274 
275  immAttr2f(texco, left / (float)tex_w, top / (float)tex_h);
276  immVertex2f(pos, rast_x + offset_left * xzoom, rast_y + top * yzoom * scaleY);
277  immEnd();
278 
279  /* NOTE: Weirdly enough this is only required on macOS. Without this there is some sort of
280  * bleeding of data is happening from tiles which are drawn later on.
281  * This doesn't seem to be too slow,
282  * but still would be nice to have fast and nice solution. */
283 #ifdef __APPLE__
284  GPU_flush();
285 #endif
286  }
287  }
288 
289  if (state->do_shader_unbind) {
291  }
292 
295 
296  /* Restore default. */
298 }
299 
301  float x,
302  float y,
303  int img_w,
304  int img_h,
305  eGPUTextureFormat gpu_format,
306  bool use_filter,
307  void *rect,
308  float scaleX,
309  float scaleY,
310  float xzoom,
311  float yzoom,
312  const float color[4])
313 {
315  x,
316  y,
317  img_w,
318  img_h,
319  gpu_format,
320  use_filter,
321  rect,
322  scaleX,
323  scaleY,
324  0.0f,
325  0.0f,
326  0.0f,
327  0.0f,
328  xzoom,
329  yzoom,
330  color);
331 }
332 
334  float x,
335  float y,
336  int img_w,
337  int img_h,
338  eGPUTextureFormat gpu_format,
339  bool use_filter,
340  void *rect,
341  float xzoom,
342  float yzoom,
343  const float color[4])
344 {
346  x,
347  y,
348  img_w,
349  img_h,
350  gpu_format,
351  use_filter,
352  rect,
353  1.0f,
354  1.0f,
355  0.0f,
356  0.0f,
357  0.0f,
358  0.0f,
359  xzoom,
360  yzoom,
361  color);
362 }
363 
365  float x,
366  float y,
367  int img_w,
368  int img_h,
369  eGPUTextureFormat gpu_format,
370  bool use_filter,
371  void *rect,
372  float clip_min_x,
373  float clip_min_y,
374  float clip_max_x,
375  float clip_max_y,
376  float xzoom,
377  float yzoom,
378  const float color[4])
379 {
381  x,
382  y,
383  img_w,
384  img_h,
385  gpu_format,
386  use_filter,
387  rect,
388  1.0f,
389  1.0f,
390  clip_min_x,
391  clip_min_y,
392  clip_max_x,
393  clip_max_y,
394  xzoom,
395  yzoom,
396  color);
397 }
398 
399 /* **** Color management helper functions for GLSL display/transform ***** */
400 
402  float x,
403  float y,
404  bool use_filter,
405  ColorManagedViewSettings *view_settings,
406  ColorManagedDisplaySettings *display_settings,
407  float clip_min_x,
408  float clip_min_y,
409  float clip_max_x,
410  float clip_max_y,
411  float zoom_x,
412  float zoom_y)
413 {
414  bool force_fallback = false;
415  bool need_fallback = true;
416 
417  /* Early out */
418  if (ibuf->rect == NULL && ibuf->rect_float == NULL) {
419  return;
420  }
421 
422  /* Single channel images could not be transformed using GLSL yet */
423  force_fallback |= ibuf->channels == 1;
424 
425  /* If user decided not to use GLSL, fallback to glaDrawPixelsAuto */
426  force_fallback |= (ED_draw_imbuf_method(ibuf) != IMAGE_DRAW_METHOD_GLSL);
427 
428  /* Try to draw buffer using GLSL display transform */
429  if (force_fallback == false) {
430  int ok;
431 
433  /* We want GLSL state to be fully handled by OCIO. */
434  state.do_shader_unbind = false;
436 
437  if (ibuf->rect_float) {
438  if (ibuf->float_colorspace) {
440  view_settings, display_settings, ibuf->float_colorspace, ibuf->dither, true, false);
441  }
442  else {
444  view_settings, display_settings, ibuf->dither, true);
445  }
446  }
447  else {
449  view_settings, display_settings, ibuf->rect_colorspace, ibuf->dither, false, false);
450  }
451 
452  if (ok) {
453  if (ibuf->rect_float) {
455 
456  if (ibuf->channels == 3) {
457  format = GPU_RGB16F;
458  }
459  else if (ibuf->channels == 4) {
461  }
462  else {
463  BLI_assert_msg(0, "Incompatible number of channels for GLSL display");
464  }
465 
466  if (format != 0) {
468  x,
469  y,
470  ibuf->x,
471  ibuf->y,
472  format,
473  use_filter,
474  ibuf->rect_float,
475  clip_min_x,
476  clip_min_y,
477  clip_max_x,
478  clip_max_y,
479  zoom_x,
480  zoom_y,
481  NULL);
482  }
483  }
484  else if (ibuf->rect) {
485  /* ibuf->rect is always RGBA */
487  x,
488  y,
489  ibuf->x,
490  ibuf->y,
491  GPU_RGBA8,
492  use_filter,
493  ibuf->rect,
494  clip_min_x,
495  clip_min_y,
496  clip_max_x,
497  clip_max_y,
498  zoom_x,
499  zoom_y,
500  NULL);
501  }
502 
504 
505  need_fallback = false;
506  }
507  }
508 
509  /* In case GLSL failed or not usable, fallback to glaDrawPixelsAuto */
510  if (need_fallback) {
511  uchar *display_buffer;
512  void *cache_handle;
513 
514  display_buffer = IMB_display_buffer_acquire(
515  ibuf, view_settings, display_settings, &cache_handle);
516 
517  if (display_buffer) {
520  x,
521  y,
522  ibuf->x,
523  ibuf->y,
524  GPU_RGBA8,
525  use_filter,
526  display_buffer,
527  clip_min_x,
528  clip_min_y,
529  clip_max_x,
530  clip_max_y,
531  zoom_x,
532  zoom_y,
533  NULL);
534  }
535 
536  IMB_display_buffer_release(cache_handle);
537  }
538 }
539 
540 void ED_draw_imbuf(ImBuf *ibuf,
541  float x,
542  float y,
543  bool use_filter,
544  ColorManagedViewSettings *view_settings,
545  ColorManagedDisplaySettings *display_settings,
546  float zoom_x,
547  float zoom_y)
548 {
550  x,
551  y,
552  use_filter,
553  view_settings,
554  display_settings,
555  0.0f,
556  0.0f,
557  0.0f,
558  0.0f,
559  zoom_x,
560  zoom_y);
561 }
562 
564  ImBuf *ibuf,
565  float x,
566  float y,
567  bool use_filter,
568  float clip_min_x,
569  float clip_min_y,
570  float clip_max_x,
571  float clip_max_y,
572  float zoom_x,
573  float zoom_y)
574 {
575  ColorManagedViewSettings *view_settings;
576  ColorManagedDisplaySettings *display_settings;
577 
578  IMB_colormanagement_display_settings_from_ctx(C, &view_settings, &display_settings);
579 
581  x,
582  y,
583  use_filter,
584  view_settings,
585  display_settings,
586  clip_min_x,
587  clip_min_y,
588  clip_max_x,
589  clip_max_y,
590  zoom_x,
591  zoom_y);
592 }
593 
595  const bContext *C, ImBuf *ibuf, float x, float y, bool use_filter, float zoom_x, float zoom_y)
596 {
597  ED_draw_imbuf_ctx_clipping(C, ibuf, x, y, use_filter, 0.0f, 0.0f, 0.0f, 0.0f, zoom_x, zoom_y);
598 }
599 
601 {
602  if (U.image_draw_method == IMAGE_DRAW_METHOD_AUTO) {
603  /* Use faster GLSL when CPU to GPU transfer is unlikely to be a bottleneck,
604  * otherwise do color management on CPU side. */
605  const size_t threshold = sizeof(float[4]) * 2048 * 2048;
606  const size_t data_size = (ibuf->rect_float) ? sizeof(float) : sizeof(uchar);
607  const size_t size = ibuf->x * ibuf->y * ibuf->channels * data_size;
608 
610  }
611  return U.image_draw_method;
612 }
613 
614 void immDrawBorderCorners(uint pos, const rcti *border, float zoomx, float zoomy)
615 {
616  float delta_x = 4.0f * UI_DPI_FAC / zoomx;
617  float delta_y = 4.0f * UI_DPI_FAC / zoomy;
618 
619  delta_x = min_ff(delta_x, border->xmax - border->xmin);
620  delta_y = min_ff(delta_y, border->ymax - border->ymin);
621 
622  /* left bottom corner */
624  immVertex2f(pos, border->xmin, border->ymin + delta_y);
625  immVertex2f(pos, border->xmin, border->ymin);
626  immVertex2f(pos, border->xmin + delta_x, border->ymin);
627  immEnd();
628 
629  /* left top corner */
631  immVertex2f(pos, border->xmin, border->ymax - delta_y);
632  immVertex2f(pos, border->xmin, border->ymax);
633  immVertex2f(pos, border->xmin + delta_x, border->ymax);
634  immEnd();
635 
636  /* right bottom corner */
638  immVertex2f(pos, border->xmax - delta_x, border->ymin);
639  immVertex2f(pos, border->xmax, border->ymin);
640  immVertex2f(pos, border->xmax, border->ymin + delta_y);
641  immEnd();
642 
643  /* right top corner */
645  immVertex2f(pos, border->xmax - delta_x, border->ymax);
646  immVertex2f(pos, border->xmax, border->ymax);
647  immVertex2f(pos, border->xmax, border->ymax - delta_y);
648  immEnd();
649 }
#define BLI_assert_msg(a, msg)
Definition: BLI_assert.h:53
MINLINE float min_ff(float a, float b)
unsigned char uchar
Definition: BLI_sys_types.h:70
unsigned int uint
Definition: BLI_sys_types.h:67
#define UNPACK2(a)
#define ELEM(...)
@ IMAGE_DRAW_METHOD_AUTO
@ IMAGE_DRAW_METHOD_GLSL
@ IMAGE_DRAW_METHOD_2DTEXTURE
void immUnbindProgram(void)
void immVertex2f(uint attr_id, float x, float y)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
void immUniform1i(const char *name, int x)
void immUniformColor4fv(const float rgba[4])
GPUVertFormat * immVertexFormat(void)
void immAttr2f(uint attr_id, float x, float y)
void immBegin(GPUPrimType, uint vertex_len)
void immEnd(void)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble right
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble top
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei stride
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble bottom
@ GPU_PRIM_TRI_FAN
Definition: GPU_primitive.h:25
@ GPU_PRIM_LINE_STRIP
Definition: GPU_primitive.h:22
int GPU_shader_get_uniform(GPUShader *shader, const char *name)
Definition: gpu_shader.cc:559
GPUShader * GPU_shader_get_builtin_shader(eGPUBuiltinShader shader)
@ GPU_SHADER_2D_IMAGE_COLOR
Definition: GPU_shader.h:217
void GPU_flush(void)
Definition: gpu_state.cc:291
void GPU_texture_update_sub(GPUTexture *tex, eGPUDataFormat data_format, const void *pixels, int offset_x, int offset_y, int offset_z, int width, int height, int depth)
Definition: gpu_texture.cc:417
void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat, bool use_clamp)
Definition: gpu_texture.cc:546
struct GPUTexture GPUTexture
Definition: GPU_texture.h:17
void GPU_texture_mipmap_mode(GPUTexture *tex, bool use_mipmap, bool use_filter)
Definition: gpu_texture.cc:527
eGPUDataFormat
Definition: GPU_texture.h:170
@ GPU_DATA_UBYTE
Definition: GPU_texture.h:174
@ GPU_DATA_FLOAT
Definition: GPU_texture.h:171
void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const void *data)
Definition: gpu_texture.cc:444
void GPU_texture_free(GPUTexture *tex)
Definition: gpu_texture.cc:564
void GPU_texture_filter_mode(GPUTexture *tex, bool use_filter)
Definition: gpu_texture.cc:518
void GPU_texture_unbind(GPUTexture *tex)
Definition: gpu_texture.cc:472
GPUTexture * GPU_texture_create_2d(const char *name, int w, int h, int mip_len, eGPUTextureFormat format, const float *data)
Definition: gpu_texture.cc:291
eGPUTextureFormat
Definition: GPU_texture.h:83
@ GPU_R16F
Definition: GPU_texture.h:113
@ GPU_R8
Definition: GPU_texture.h:107
@ GPU_RGB16F
Definition: GPU_texture.h:127
@ GPU_RGBA8
Definition: GPU_texture.h:87
void GPU_unpack_row_length_set(uint len)
Definition: gpu_texture.cc:449
void GPU_texture_bind(GPUTexture *tex, int unit)
Definition: gpu_texture.cc:466
void GPU_texture_generate_mipmap(GPUTexture *tex)
Definition: gpu_texture.cc:498
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
void IMB_colormanagement_display_settings_from_ctx(const struct bContext *C, struct ColorManagedViewSettings **r_view_settings, struct ColorManagedDisplaySettings **r_display_settings)
void IMB_display_buffer_release(void *cache_handle)
bool IMB_colormanagement_setup_glsl_draw(const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings, float dither, bool predivide)
unsigned char * IMB_display_buffer_acquire(struct ImBuf *ibuf, const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings, void **cache_handle)
void IMB_colormanagement_finish_glsl_draw(void)
bool IMB_colormanagement_setup_glsl_draw_from_space(const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings, struct ColorSpace *colorspace, float dither, bool predivide, bool do_overlay_merge)
Contains defines and structs used throughout the imbuf module.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
#define C
Definition: RandGen.cpp:25
#define UI_DPI_FAC
Definition: UI_interface.h:305
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
unsigned int U
Definition: btGjkEpa3.h:78
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img GPU_RGBA16F
void immDrawPixelsTexTiled_clipping(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, 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.c:364
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.c:594
int ED_draw_imbuf_method(ImBuf *ibuf)
Definition: glutil.c:600
void ED_draw_imbuf_clipping(ImBuf *ibuf, float x, float y, bool use_filter, ColorManagedViewSettings *view_settings, 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.c:401
void immDrawBorderCorners(uint pos, const rcti *border, float zoomx, float zoomy)
Definition: glutil.c:614
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.c:563
void immDrawPixelsTexTiled_scaling_clipping(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, 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.c:130
#define DATA(_y, _x)
void immDrawPixelsTexTiled(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, void *rect, float xzoom, float yzoom, const float color[4])
Definition: glutil.c:333
void ED_draw_imbuf(ImBuf *ibuf, float x, float y, bool use_filter, ColorManagedViewSettings *view_settings, ColorManagedDisplaySettings *display_settings, float zoom_x, float zoom_y)
Definition: glutil.c:540
void immDrawPixelsTexScaledFullSize(const IMMDrawPixelsTexState *state, const float x, const float y, const int img_w, const int img_h, const eGPUTextureFormat 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.c:59
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
Definition: glutil.c:44
void immDrawPixelsTexTiled_scaling(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, void *rect, float scaleX, float scaleY, float xzoom, float yzoom, const float color[4])
Definition: glutil.c:300
static void immDrawPixelsTexSetupAttributes(IMMDrawPixelsTexState *state)
Definition: glutil.c:36
uint pos
IconTextureDrawCall border
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
const int state
format
Definition: logImageCore.h:38
static int left
int channels
struct ColorSpace * rect_colorspace
float dither
unsigned int * rect
float * rect_float
struct ColorSpace * float_colorspace