32 #define ALLOC_DEPTHS 200
35 #define DEPTH_MAX 0xffffffff
115 for (
uint i = 0; i < rect_len; i++, curr++) {
129 for (; curr < curr_end; curr++, curr++) {
134 curr += sub_rect->
skip;
144 return memcmp(rect_depth_a->buf, rect_depth_b->buf, rect_len *
sizeof(
depth_t)) != 0;
148 for (
uint i = 0; i < rect_len; i++, curr++,
prev++) {
169 for (; curr < curr_end;
prev++, curr++) {
175 curr += sub_rect->
skip;
196 if (d1->
id < d2->id) {
199 if (d1->
id > d2->id) {
209 if (d1->
depth < d2->depth) {
212 if (d1->
depth > d2->depth) {
296 const uint buffer_len,
303 printf(
"%s: mode=%d, use_cache=%d, is_cache=%d\n",
357 for (
uint i = 0; i < rect_len; i++) {
374 ps->
all.hits_len = 0;
391 const uint id = rect_curr->
id;
395 #define EVAL_TEST() \
396 if (depth_best > *curr) { \
397 depth_best = *curr; \
405 for (
uint i = 0; i < rect_len; i++, curr++) {
414 for (; curr < curr_end; curr++) {
430 d->depth = depth_best;
437 const uint id = rect_curr->
id;
445 #define EVAL_TEST() \
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;
543 printf(
"%s\n", __func__);
577 uint depth_data_len = 0;
580 depth_data = ps->
all.hits;
581 depth_data_len = ps->
all.hits_len;
584 ps->
all.hits_len = 0;
585 ps->
all.hits_len_alloc = 0;
591 uint depth_data_len_first_pass = 0;
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 == NULL || 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 ==
NULL || 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) {
659 if (depth_data_len > maxhits) {
666 for (
uint i = 0; i < depth_data_len; i++) {
668 printf(
" hit: %u: depth %u\n", depth_data[i].
id, depth_data[i].depth);
709 printf(
"%s\n", __func__);
736 printf(
"%s (building depth from cache)\n", __func__);
739 if (rect_depth->next !=
NULL) {
#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)
Strict compiler flags for areas of code we want to ensure don't do conversions without us knowing abo...
void GPU_debug_group_end(void)
void GPU_debug_group_begin(const char *name)
struct GPUFrameBuffer GPUFrameBuffer
GPUFrameBuffer * GPU_framebuffer_active_get(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 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 v1
void GPU_write_mask(eGPUWriteMask mask)
void GPU_depth_mask(bool depth)
void GPU_color_mask(bool r, bool g, bool b, bool a)
eGPUWriteMask GPU_write_mask_get(void)
void GPU_viewport(int x, int y, int width, int height)
bool GPU_depth_mask_get(void)
eGPUDepthTest GPU_depth_test_get(void)
void GPU_depth_test(eGPUDepthTest test)
void GPU_viewport_size_get_f(float coords[4])
void GPU_scissor_get(int coords[4])
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
SyclQueue void void * src
void GPU_clear_depth(float depth)
void GPU_framebuffer_read_depth(GPUFrameBuffer *gpu_fb, int x, int y, int w, int h, eGPUDataFormat format, void *data)
bool gpu_select_pick_load_id(uint id, bool end)
void gpu_select_pick_begin(GPUSelectResult *buffer, const uint buffer_len, const rcti *input, eGPUSelectMode mode)
static bool depth_buf_subrect_depth_any(const DepthBufCache *rect_depth, const SubRectStride *sub_rect)
struct GPUPickState GPUPickState
static int depth_cmp(const void *v1, const void *v2)
struct SubRectStride SubRectStride
BLI_INLINE bool depth_is_filled(const depth_t *prev, const depth_t *curr)
bool gpu_select_pick_is_cached(void)
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)
void gpu_select_pick_cache_end(void)
static int depth_id_cmp(const void *v1, const void *v2)
uint gpu_select_pick_end(void)
static DepthBufCache * depth_buf_malloc(uint rect_len)
static GPUPickState g_pick_state
struct DepthBufCache DepthBufCache
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_cache_begin(void)
static bool depth_buf_rect_depth_any(const DepthBufCache *rect_depth, uint rect_len)
void gpu_select_pick_cache_load_id(void)
BLI_INLINE float fb(float length, float L)
ccl_global float * buffer
ccl_global KernelShaderEvalInput * input
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
SymEdge< T > * prev(const SymEdge< T > *se)
struct DepthBufCache * next
struct DepthBufCache * prev
struct GPUPickState::@670::@672 all
struct GPUPickState::@668 dst
DepthBufCache * rect_depth
struct GPUPickState::@670::@673 nearest
struct GPUPickState::@668 src
struct GPUPickState::@667 gpu
struct GPUPickState::@669 cache
DepthBufCache * rect_depth_test