33#define ALLOC_DEPTHS 200
36#define DEPTH_MAX 0xffffffff
87 return (*prev != *curr) && (*curr !=
DEPTH_MAX);
117 for (
uint i = 0; i < rect_len; i++, curr++) {
131 for (; curr < curr_end; curr++, curr++) {
136 curr += sub_rect->
skip;
146 return memcmp(rect_depth_a->buf, rect_depth_b->buf, rect_len *
sizeof(
depth_t)) != 0;
150 for (
uint i = 0; i < rect_len; i++, curr++, prev++) {
171 for (; curr < curr_end; prev++, curr++) {
176 prev += sub_rect->
skip;
177 curr += sub_rect->
skip;
198 if (d1->
id < d2->id) {
201 if (d1->
id > d2->id) {
211 if (d1->
depth < d2->depth) {
214 if (d1->
depth > d2->depth) {
301 printf(
"%s: mode=%d, use_cache=%d, is_cache=%d\n",
354 for (
uint i = 0; i < rect_len; i++) {
390 const uint id = rect_curr->
id;
395 if (depth_best > *curr) { \
396 depth_best = *curr; \
404 for (
uint i = 0; i < rect_len; i++, curr++) {
413 for (; curr < curr_end; curr++) {
430 d->
depth = depth_best;
437 const uint id = rect_curr->
id;
446 if (depth_is_filled(prev, curr)) { \
456 for (
uint i = 0; i < rect_len; i++, curr++, prev++, id_ptr++) {
466 for (; curr < curr_end; prev++, curr++, id_ptr++) {
495 bool do_pass =
false;
576 uint depth_data_len = 0;
590 uint depth_data_len_first_pass = 0;
591 depth_data =
static_cast<DepthID *
>(
598#define EVAL_TEST(i_src, i_dst) \
600 const uint id = ps->nearest.rect_id[i_dst]; \
601 if (id != SELECT_ID_NONE) { \
602 const depth_t depth = rect_depth_final->buf[i_src]; \
603 if (depth_last == nullptr || depth_last->id != id) { \
604 DepthID *d = &depth_data[depth_data_len_first_pass++]; \
608 else if (depth_last->depth > depth) { \
609 depth_last->depth = depth; \
627 for (; i_src < i_src_end; i_src++, i_dst++) {
643 for (
uint i = 0; i < depth_data_len_first_pass; i++) {
644 if (depth_last ==
nullptr || depth_last->
id != depth_data[i].
id) {
645 depth_last = &depth_data[depth_data_len++];
646 *depth_last = depth_data[i];
648 else if (depth_last->
depth > depth_data[i].
depth) {
663 for (
uint i = 0; i < depth_data_len; i++) {
665 printf(
" hit: %u: depth %u\n", depth_data[i].
id, depth_data[i].depth);
668 hit_result.
id = depth_data[i].
id;
669 hit_result.depth = depth_data[i].
depth;
733 printf(
"%s (building depth from cache)\n", __func__);
736 if (rect_depth->next !=
nullptr) {
#define LISTBASE_FOREACH(type, var, list)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
void GPU_debug_group_end()
void GPU_debug_group_begin(const char *name)
GPUFrameBuffer * GPU_framebuffer_active_get()
void GPU_framebuffer_read_depth(GPUFrameBuffer *framebuffer, int x, int y, int width, int height, eGPUDataFormat data_format, void *r_data)
void GPU_clear_depth(float depth)
void GPU_write_mask(eGPUWriteMask mask)
void GPU_depth_mask(bool depth)
eGPUDepthTest GPU_depth_test_get()
void GPU_color_mask(bool r, bool g, bool b, bool a)
eGPUWriteMask GPU_write_mask_get()
void GPU_viewport(int x, int y, int width, int height)
void GPU_depth_test(eGPUDepthTest test)
void GPU_viewport_size_get_f(float coords[4])
bool GPU_depth_mask_get()
void GPU_scissor_get(int coords[4])
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
void append_unchecked(const T &value)
void reserve(const int64_t min_capacity)
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
bool gpu_select_pick_load_id(uint id, bool end)
static DepthBufCache * depth_buf_malloc(uint rect_len)
static bool depth_buf_subrect_depth_any(const DepthBufCache *rect_depth, const SubRectStride *sub_rect)
static int depth_cmp(const void *v1, const void *v2)
uint gpu_select_pick_end()
void gpu_select_pick_cache_begin()
BLI_INLINE bool depth_is_filled(const depth_t *prev, const depth_t *curr)
static bool depth_buf_subrect_depth_any_filled(const DepthBufCache *rect_src, const DepthBufCache *rect_dst, const SubRectStride *sub_rect)
static void rect_subregion_stride_calc(const rcti *src, const rcti *dst, SubRectStride *r_sub)
bool gpu_select_pick_is_cached()
static int depth_id_cmp(const void *v1, const void *v2)
void gpu_select_pick_cache_load_id()
static GPUPickState g_pick_state
static void gpu_select_load_id_pass_all(const DepthBufCache *rect_curr)
static bool depth_buf_rect_depth_any_filled(const DepthBufCache *rect_prev, const DepthBufCache *rect_curr, uint rect_len)
static void gpu_select_load_id_pass_nearest(const DepthBufCache *rect_prev, const DepthBufCache *rect_curr)
void gpu_select_pick_begin(GPUSelectBuffer *buffer, const rcti *input, eGPUSelectMode mode)
void gpu_select_pick_cache_end()
static bool depth_buf_rect_depth_any(const DepthBufCache *rect_depth, uint rect_len)
BLI_INLINE float fb(float length, float L)
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
DepthBufCache * rect_depth
struct GPUPickState::@634 cache
struct GPUPickState::@635::@637 all
struct GPUPickState::@632 gpu
DepthBufCache * rect_depth_test
struct GPUPickState::@633 src
struct GPUPickState::@633 dst
struct GPUPickState::@635::@638 nearest