Blender V5.3
gpu_select_pick.cc File Reference
#include <cfloat>
#include <cstdlib>
#include <cstring>
#include "GPU_debug.hh"
#include "GPU_framebuffer.hh"
#include "GPU_select.hh"
#include "GPU_state.hh"
#include "MEM_guardedalloc.h"
#include "BLI_listbase.hh"
#include "BLI_rect.hh"
#include "BLI_utildefines.hh"
#include "gpu_select_private.hh"
#include "BLI_strict_flags.hh"

Go to the source code of this file.

Classes

struct  blender::SubRectStride
struct  blender::DepthBufCache
struct  blender::DepthID
struct  blender::GPUPickState

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define ALLOC_DEPTHS   200
#define DEPTH_MAX   0xffffffff
#define EVAL_TEST()
#define EVAL_TEST()
#define EVAL_TEST(i_src, i_dst)

Functions

#DepthBufCache

Result of reading GPU_framebuffer_read_depth, use for both cache and non-cached storage.

static DepthBufCache * blender::depth_buf_malloc (uint rect_len)
static bool blender::depth_buf_rect_depth_any (const DepthBufCache *rect_depth, uint rect_len)
static bool blender::depth_buf_subrect_depth_any (const DepthBufCache *rect_depth, const SubRectStride *sub_rect)
static bool blender::depth_buf_rect_depth_any_filled (const DepthBufCache *rect_prev, const DepthBufCache *rect_curr, uint rect_len)
static bool blender::depth_buf_subrect_depth_any_filled (const DepthBufCache *rect_src, const DepthBufCache *rect_dst, const SubRectStride *sub_rect)
#DepthID

Internal structure for storing hits.

static int blender::depth_id_cmp (const void *v1, const void *v2)
static int blender::depth_cmp (const void *v1, const void *v2)
Caching

Support multiple begin/end's reusing depth buffers.

void blender::gpu_select_pick_cache_begin ()
void blender::gpu_select_pick_cache_end ()
bool blender::gpu_select_pick_is_cached ()
void blender::gpu_select_pick_cache_load_id ()

#SubRectStride

using blender::depth_t = uint
static void blender::rect_subregion_stride_calc (const rcti *src, const rcti *dst, SubRectStride *r_sub)
BLI_INLINE bool blender::depth_is_filled (const depth_t *prev, const depth_t *curr)

Main Selection Begin/End/Load API

static GPUPickState blender::g_pick_state {}
void blender::gpu_select_pick_begin (GPUSelectBuffer *buffer, const rcti *input, GPUSelectMode mode)
static void blender::gpu_select_load_id_pass_all (const DepthBufCache *rect_curr)
static void blender::gpu_select_load_id_pass_nearest (const DepthBufCache *rect_prev, const DepthBufCache *rect_curr)
bool blender::gpu_select_pick_load_id (uint id, bool end)
uint blender::gpu_select_pick_end ()

Detailed Description

Custom select code for picking small regions (not efficient for large regions). gpu_select_pick_* API.

Definition in file gpu_select_pick.cc.

Macro Definition Documentation

◆ ALLOC_DEPTHS

#define ALLOC_DEPTHS   200

◆ DEPTH_MAX

◆ EVAL_TEST [1/3]

#define EVAL_TEST ( )
Value:
if (depth_is_filled(prev, curr)) { \
*id_ptr = id; \
} \
((void)0)

◆ EVAL_TEST [2/3]

#define EVAL_TEST ( )
Value:
if (depth_best > *curr) { \
depth_best = *curr; \
} \
((void)0)

Referenced by blender::gpu_select_load_id_pass_all(), blender::gpu_select_load_id_pass_nearest(), and blender::gpu_select_pick_end().

◆ EVAL_TEST [3/3]

#define EVAL_TEST ( i_src,
i_dst )
Value:
{ \
const uint id = ps->nearest.rect_id[i_dst]; \
if (id != SELECT_ID_NONE) { \
const depth_t depth = rect_depth_final->buf[i_src]; \
if (depth_last == nullptr || depth_last->id != id) { \
DepthID *d = &depth_data[depth_data_len_first_pass++]; \
d->id = id; \
d->depth = depth; \
} \
else if (depth_last->depth > depth) { \
depth_last->depth = depth; \
} \
} \
} \
((void)0)
#define SELECT_ID_NONE