Blender  V2.93
draw_select_buffer.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright 2019, Blender Foundation.
17  */
18 
25 #include "MEM_guardedalloc.h"
26 
27 #include "BLI_array_utils.h"
28 #include "BLI_bitmap.h"
29 #include "BLI_bitmap_draw_2d.h"
30 #include "BLI_rect.h"
31 
32 #include "DNA_screen_types.h"
33 
34 #include "GPU_select.h"
35 
36 #include "DEG_depsgraph.h"
37 #include "DEG_depsgraph_query.h"
38 
39 #include "DRW_engine.h"
40 #include "DRW_select_buffer.h"
41 
42 #include "draw_manager.h"
43 
44 #include "../engines/select/select_engine.h"
45 
46 /* -------------------------------------------------------------------- */
50 /* Main function to read a block of pixels from the select frame buffer. */
52  struct ARegion *region,
53  struct View3D *v3d,
54  const rcti *rect,
55  uint *r_buf_len)
56 {
57  uint *r_buf = NULL;
58  uint buf_len = 0;
59 
60  /* Clamp rect. */
61  rcti r = {
62  .xmin = 0,
63  .xmax = region->winx,
64  .ymin = 0,
65  .ymax = region->winy,
66  };
67 
68  /* Make sure that the rect is within the bounds of the viewport.
69  * Some GPUs have problems reading pixels off limits. */
70  rcti rect_clamp = *rect;
71  if (BLI_rcti_isect(&r, &rect_clamp, &rect_clamp)) {
72  struct SELECTID_Context *select_ctx = DRW_select_engine_context_get();
73 
75  /* Update the drawing. */
76  DRW_draw_select_id(depsgraph, region, v3d, rect);
77 
78  if (select_ctx->index_drawn_len > 1) {
81 
82  /* Read the UI32 pixels. */
83  buf_len = BLI_rcti_size_x(rect) * BLI_rcti_size_y(rect);
84  r_buf = MEM_mallocN(buf_len * sizeof(*r_buf), __func__);
85 
87  GPU_framebuffer_bind(select_id_fb);
88  GPU_framebuffer_read_color(select_id_fb,
89  rect_clamp.xmin,
90  rect_clamp.ymin,
91  BLI_rcti_size_x(&rect_clamp),
92  BLI_rcti_size_y(&rect_clamp),
93  1,
94  0,
96  r_buf);
97 
98  if (!BLI_rcti_compare(rect, &rect_clamp)) {
99  /* The rect has been clamped so you need to realign the buffer and fill in the blanks */
100  GPU_select_buffer_stride_realign(rect, &rect_clamp, r_buf);
101  }
102  }
103 
106  }
107 
108  if (r_buf_len) {
109  *r_buf_len = buf_len;
110  }
111 
112  return r_buf;
113 }
114 
117 /* -------------------------------------------------------------------- */
130  struct ARegion *region,
131  struct View3D *v3d,
132  const rcti *rect,
133  uint *r_bitmap_len)
134 {
135  struct SELECTID_Context *select_ctx = DRW_select_engine_context_get();
136 
137  rcti rect_px = *rect;
138  rect_px.xmax += 1;
139  rect_px.ymax += 1;
140 
141  uint buf_len;
142  uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect_px, &buf_len);
143  if (buf == NULL) {
144  return NULL;
145  }
146 
147  BLI_assert(select_ctx->index_drawn_len > 0);
148  const uint bitmap_len = select_ctx->index_drawn_len - 1;
149 
150  BLI_bitmap *bitmap_buf = BLI_BITMAP_NEW(bitmap_len, __func__);
151  const uint *buf_iter = buf;
152  while (buf_len--) {
153  const uint index = *buf_iter - 1;
154  if (index < bitmap_len) {
155  BLI_BITMAP_ENABLE(bitmap_buf, index);
156  }
157  buf_iter++;
158  }
159  MEM_freeN((void *)buf);
160 
161  if (r_bitmap_len) {
162  *r_bitmap_len = bitmap_len;
163  }
164 
165  return bitmap_buf;
166 }
167 
175  struct ARegion *region,
176  struct View3D *v3d,
177  const int center[2],
178  const int radius,
179  uint *r_bitmap_len)
180 {
181  struct SELECTID_Context *select_ctx = DRW_select_engine_context_get();
182 
183  const rcti rect = {
184  .xmin = center[0] - radius,
185  .xmax = center[0] + radius + 1,
186  .ymin = center[1] - radius,
187  .ymax = center[1] + radius + 1,
188  };
189 
190  const uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect, NULL);
191 
192  if (buf == NULL) {
193  return NULL;
194  }
195 
196  BLI_assert(select_ctx->index_drawn_len > 0);
197  const uint bitmap_len = select_ctx->index_drawn_len - 1;
198 
199  BLI_bitmap *bitmap_buf = BLI_BITMAP_NEW(bitmap_len, __func__);
200  const uint *buf_iter = buf;
201  const int radius_sq = radius * radius;
202  for (int yc = -radius; yc <= radius; yc++) {
203  for (int xc = -radius; xc <= radius; xc++, buf_iter++) {
204  if (xc * xc + yc * yc < radius_sq) {
205  /* Intentionally wrap to max value if this is zero. */
206  const uint index = *buf_iter - 1;
207  if (index < bitmap_len) {
208  BLI_BITMAP_ENABLE(bitmap_buf, index);
209  }
210  }
211  }
212  }
213  MEM_freeN((void *)buf);
214 
215  if (r_bitmap_len) {
216  *r_bitmap_len = bitmap_len;
217  }
218 
219  return bitmap_buf;
220 }
221 
222 struct PolyMaskData {
224  int width;
225 };
226 
227 static void drw_select_mask_px_cb(int x, int x_end, int y, void *user_data)
228 {
229  struct PolyMaskData *data = user_data;
230  BLI_bitmap *px = data->px;
231  int i = (y * data->width) + x;
232  do {
233  BLI_BITMAP_ENABLE(px, i);
234  i++;
235  } while (++x != x_end);
236 }
237 
245  struct ARegion *region,
246  struct View3D *v3d,
247  const int poly[][2],
248  const int poly_len,
249  const rcti *rect,
250  uint *r_bitmap_len)
251 {
252  struct SELECTID_Context *select_ctx = DRW_select_engine_context_get();
253 
254  rcti rect_px = *rect;
255  rect_px.xmax += 1;
256  rect_px.ymax += 1;
257 
258  uint buf_len;
259  uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect_px, &buf_len);
260  if (buf == NULL) {
261  return NULL;
262  }
263 
264  BLI_bitmap *buf_mask = BLI_BITMAP_NEW(buf_len, __func__);
265 
266  struct PolyMaskData poly_mask_data;
267  poly_mask_data.px = buf_mask;
268  poly_mask_data.width = (rect->xmax - rect->xmin) + 1;
269 
271  rect_px.ymin,
272  rect_px.xmax,
273  rect_px.ymax,
274  poly,
275  poly_len,
277  &poly_mask_data);
278 
279  BLI_assert(select_ctx->index_drawn_len > 0);
280  const uint bitmap_len = select_ctx->index_drawn_len - 1;
281 
282  BLI_bitmap *bitmap_buf = BLI_BITMAP_NEW(bitmap_len, __func__);
283  const uint *buf_iter = buf;
284  int i = 0;
285  while (buf_len--) {
286  const uint index = *buf_iter - 1;
287  if (index < bitmap_len && BLI_BITMAP_TEST(buf_mask, i)) {
288  BLI_BITMAP_ENABLE(bitmap_buf, index);
289  }
290  buf_iter++;
291  i++;
292  }
293  MEM_freeN((void *)buf);
294  MEM_freeN(buf_mask);
295 
296  if (r_bitmap_len) {
297  *r_bitmap_len = bitmap_len;
298  }
299 
300  return bitmap_buf;
301 }
302 
305 /* -------------------------------------------------------------------- */
316  struct ARegion *region,
317  struct View3D *v3d,
318  const int center[2])
319 {
320  uint ret = 0;
321 
322  const rcti rect = {
323  .xmin = center[0],
324  .xmax = center[0] + 1,
325  .ymin = center[1],
326  .ymax = center[1] + 1,
327  };
328 
329  uint buf_len;
330  uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect, &buf_len);
331  if (buf) {
332  BLI_assert(0 != buf_len);
333  ret = buf[0];
334  MEM_freeN(buf);
335  }
336 
337  return ret;
338 }
339 
341  const void *val_ptr;
345 };
346 
347 static bool select_buffer_test_fn(const void *__restrict value, void *__restrict userdata)
348 {
349  struct SelectReadData *data = userdata;
350  uint hit_id = *(uint *)value;
351  if (hit_id && hit_id >= data->id_min && hit_id < data->id_max) {
352  /* Start at 1 to confirm. */
353  data->val_ptr = value;
354  data->r_index = (hit_id - data->id_min) + 1;
355  return true;
356  }
357  return false;
358 }
359 
366  struct ARegion *region,
367  struct View3D *v3d,
368  const int center[2],
369  const uint id_min,
370  const uint id_max,
371  uint *dist)
372 {
373  /* Create region around center (typically the mouse cursor).
374  * This must be square and have an odd width. */
375 
376  rcti rect;
377  BLI_rcti_init_pt_radius(&rect, center, *dist);
378  rect.xmax += 1;
379  rect.ymax += 1;
380 
381  int width = BLI_rcti_size_x(&rect);
382  int height = width;
383 
384  /* Read from selection framebuffer. */
385 
386  uint buf_len;
387  const uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect, &buf_len);
388 
389  if (buf == NULL) {
390  return 0;
391  }
392 
393  const int shape[2] = {height, width};
394  const int center_yx[2] = {(height - 1) / 2, (width - 1) / 2};
395  struct SelectReadData data = {NULL, id_min, id_max, 0};
396  BLI_array_iter_spiral_square(buf, shape, center_yx, select_buffer_test_fn, &data);
397 
398  if (data.val_ptr) {
399  size_t offset = ((size_t)data.val_ptr - (size_t)buf) / sizeof(*buf);
400  int hit_x = offset % width;
401  int hit_y = offset / width;
402  *dist = (uint)(abs(hit_y - center_yx[0]) + abs(hit_x - center_yx[1]));
403  }
404 
405  MEM_freeN((void *)buf);
406  return data.r_index;
407 }
408 
411 /* -------------------------------------------------------------------- */
416  uint *r_elem,
417  uint *r_base_index,
418  char *r_elem_type)
419 {
420  struct SELECTID_Context *select_ctx = DRW_select_engine_context_get();
421 
422  char elem_type = 0;
423  uint elem_id = 0;
424  uint base_index = 0;
425 
426  for (; base_index < select_ctx->objects_drawn_len; base_index++) {
427  struct ObjectOffsets *base_ofs = &select_ctx->index_offsets[base_index];
428 
429  if (base_ofs->face > sel_id) {
430  elem_id = sel_id - base_ofs->face_start;
431  elem_type = SCE_SELECT_FACE;
432  break;
433  }
434  if (base_ofs->edge > sel_id) {
435  elem_id = sel_id - base_ofs->edge_start;
436  elem_type = SCE_SELECT_EDGE;
437  break;
438  }
439  if (base_ofs->vert > sel_id) {
440  elem_id = sel_id - base_ofs->vert_start;
441  elem_type = SCE_SELECT_VERTEX;
442  break;
443  }
444  }
445 
446  if (base_index == select_ctx->objects_drawn_len) {
447  return false;
448  }
449 
450  *r_elem = elem_id;
451 
452  if (r_base_index) {
453  Object *obj_orig = DEG_get_original_object(select_ctx->objects_drawn[base_index]);
454  *r_base_index = obj_orig->runtime.select_id;
455  }
456 
457  if (r_elem_type) {
458  *r_elem_type = elem_type;
459  }
460 
461  return true;
462 }
463 
465  Object *object,
466  char elem_type)
467 {
468  struct SELECTID_Context *select_ctx = DRW_select_engine_context_get();
469 
470  Object *ob_eval = DEG_get_evaluated_object(depsgraph, object);
471 
473  &ob_eval->id, &draw_engine_select_type);
474 
475  if (!sel_data || !sel_data->is_drawn) {
476  return 0;
477  }
478 
479  struct ObjectOffsets *base_ofs = &select_ctx->index_offsets[sel_data->drawn_index];
480 
481  if (elem_type == SCE_SELECT_VERTEX) {
482  return base_ofs->vert_start;
483  }
484  if (elem_type == SCE_SELECT_EDGE) {
485  return base_ofs->edge_start;
486  }
487  if (elem_type == SCE_SELECT_FACE) {
488  return base_ofs->face_start;
489  }
490  BLI_assert(0);
491  return 0;
492 }
493 
496 /* -------------------------------------------------------------------- */
500 void DRW_select_buffer_context_create(Base **bases, const uint bases_len, short select_mode)
501 {
502  struct SELECTID_Context *select_ctx = DRW_select_engine_context_get();
503 
504  select_ctx->objects = MEM_reallocN(select_ctx->objects,
505  sizeof(*select_ctx->objects) * bases_len);
506 
507  select_ctx->index_offsets = MEM_reallocN(select_ctx->index_offsets,
508  sizeof(*select_ctx->index_offsets) * bases_len);
509 
510  select_ctx->objects_drawn = MEM_reallocN(select_ctx->objects_drawn,
511  sizeof(*select_ctx->objects_drawn) * bases_len);
512 
513  for (uint base_index = 0; base_index < bases_len; base_index++) {
514  Object *obj = bases[base_index]->object;
515  select_ctx->objects[base_index] = obj;
516 
517  /* Weak but necessary for `DRW_select_buffer_elem_get`. */
518  obj->runtime.select_id = base_index;
519  }
520 
521  select_ctx->objects_len = bases_len;
522  select_ctx->select_mode = select_mode;
523  memset(select_ctx->persmat, 0, sizeof(select_ctx->persmat));
524 }
Generic array manipulation API.
#define BLI_array_iter_spiral_square(arr, arr_shape, center, test_fn, user_data)
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define BLI_BITMAP_TEST(_bitmap, _index)
Definition: BLI_bitmap.h:63
#define BLI_BITMAP_ENABLE(_bitmap, _index)
Definition: BLI_bitmap.h:78
#define BLI_BITMAP_NEW(_tot, _alloc_string)
Definition: BLI_bitmap.h:50
unsigned int BLI_bitmap
Definition: BLI_bitmap.h:32
void BLI_bitmap_draw_2d_poly_v2i_n(const int xmin, const int ymin, const int xmax, const int ymax, const int verts[][2], const int verts_len, void(*callback)(int x, int x_end, int y, void *), void *user_data)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:157
bool BLI_rcti_compare(const struct rcti *rect_a, const struct rcti *rect_b)
void BLI_rcti_init_pt_radius(struct rcti *rect, const int xy[2], int size)
Definition: rct.c:508
bool BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition: BLI_rect.h:153
unsigned int uint
Definition: BLI_sys_types.h:83
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
struct Object * DEG_get_original_object(struct Object *object)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
#define SCE_SELECT_FACE
#define SCE_SELECT_VERTEX
#define SCE_SELECT_EDGE
void DRW_opengl_context_enable(void)
void DRW_draw_select_id(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const struct rcti *rect)
void DRW_opengl_context_disable(void)
NSNotificationCenter * center
struct GPUFrameBuffer GPUFrameBuffer
void GPU_framebuffer_restore(void)
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
_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 const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_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 width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_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
void GPU_select_buffer_stride_realign(const struct rcti *src, const struct rcti *dst, uint *r_buf)
int GPU_texture_height(const GPUTexture *tex)
Definition: gpu_texture.cc:532
int GPU_texture_width(const GPUTexture *tex)
Definition: gpu_texture.cc:527
@ GPU_DATA_UINT
Definition: GPU_texture.h:174
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
const Depsgraph * depsgraph
void * user_data
DrawData * DRW_drawdata_get(ID *id, DrawEngineType *engine_type)
Definition: draw_manager.c:883
void DRW_select_buffer_context_create(Base **bases, const uint bases_len, short select_mode)
bool DRW_select_buffer_elem_get(const uint sel_id, uint *r_elem, uint *r_base_index, char *r_elem_type)
static bool select_buffer_test_fn(const void *__restrict value, void *__restrict userdata)
uint * DRW_select_buffer_bitmap_from_rect(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const rcti *rect, uint *r_bitmap_len)
uint * DRW_select_buffer_read(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const rcti *rect, uint *r_buf_len)
uint DRW_select_buffer_context_offset_for_object_elem(Depsgraph *depsgraph, Object *object, char elem_type)
uint * DRW_select_buffer_bitmap_from_poly(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const int poly[][2], const int poly_len, const rcti *rect, uint *r_bitmap_len)
uint * DRW_select_buffer_bitmap_from_circle(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const int center[2], const int radius, uint *r_bitmap_len)
uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const int center[2], const uint id_min, const uint id_max, uint *dist)
uint DRW_select_buffer_sample_point(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const int center[2])
static void drw_select_mask_px_cb(int x, int x_end, int y, void *user_data)
void GPU_framebuffer_read_color(GPUFrameBuffer *gpu_fb, int x, int y, int w, int h, int channels, int slot, eGPUDataFormat format, void *data)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
return ret
DrawEngineType draw_engine_select_type
struct SELECTID_Context * DRW_select_engine_context_get(void)
GPUFrameBuffer * DRW_engine_select_framebuffer_get(void)
GPUTexture * DRW_engine_select_texture_get(void)
struct Object * object
Object_Runtime runtime
BLI_bitmap * px
struct Object ** objects_drawn
struct ObjectOffsets * index_offsets
struct Object ** objects
const void * val_ptr
int ymin
Definition: DNA_vec_types.h:80
int ymax
Definition: DNA_vec_types.h:80
int xmin
Definition: DNA_vec_types.h:79
int xmax
Definition: DNA_vec_types.h:79
__forceinline const avxi abs(const avxi &a)
Definition: util_avxi.h:186