49 #define ALLOC_DEPTHS 200
52 #define DEPTH_MAX 0xffffffff
99 return (*prev != *curr) && (*curr !=
DEPTH_MAX);
126 for (
uint i = 0; i < rect_len; i++, curr++) {
140 for (; curr < curr_end; curr++, curr++) {
145 curr += sub_rect->
skip;
155 return memcmp(rect_depth_a->buf, rect_depth_b->buf, rect_len *
sizeof(
depth_t)) != 0;
159 for (
uint i = 0; i < rect_len; i++, curr++,
prev++) {
180 for (; curr < curr_end;
prev++, curr++) {
186 curr += sub_rect->
skip;
205 if (d1->
id < d2->id) {
208 if (d1->
id > d2->id) {
218 if (d1->
depth < d2->depth) {
221 if (d1->
depth > d2->depth) {
301 printf(
"%s: mode=%d, use_cache=%d, is_cache=%d\n", __func__, mode, ps->
use_cache, ps->
is_cached);
351 for (
uint i = 0; i < rect_len; i++) {
368 ps->
all.hits_len = 0;
385 const uint id = rect_curr->
id;
389 #define EVAL_TEST() \
390 if (depth_best > *curr) { \
391 depth_best = *curr; \
399 for (
uint i = 0; i < rect_len; i++, curr++) {
408 for (; curr < curr_end; curr++) {
424 d->
depth = depth_best;
431 const uint id = rect_curr->
id;
439 #define EVAL_TEST() \
440 if (depth_is_filled(prev, curr)) { \
450 for (
uint i = 0; i < rect_len; i++, curr++, prev++, id_ptr++) {
460 for (; curr < curr_end; prev++, curr++, id_ptr++) {
489 bool do_pass =
false;
537 printf(
"%s\n", __func__);
571 uint depth_data_len = 0;
574 depth_data = ps->
all.hits;
575 depth_data_len = ps->
all.hits_len;
578 ps->
all.hits_len = 0;
579 ps->
all.hits_len_alloc = 0;
585 uint depth_data_len_first_pass = 0;
592 #define EVAL_TEST(i_src, i_dst) \
594 const uint id = ps->nearest.rect_id[i_dst]; \
595 if (id != SELECT_ID_NONE) { \
596 const depth_t depth = rect_depth_final->buf[i_src]; \
597 if (depth_last == NULL || depth_last->id != id) { \
598 DepthID *d = &depth_data[depth_data_len_first_pass++]; \
602 else if (depth_last->depth > depth) { \
603 depth_last->depth = depth; \
621 for (; i_src < i_src_end; i_src++, i_dst++) {
637 for (
uint i = 0; i < depth_data_len_first_pass; i++) {
638 if (depth_last ==
NULL || depth_last->
id != depth_data[i].
id) {
639 depth_last = &depth_data[depth_data_len++];
640 *depth_last = depth_data[i];
642 else if (depth_last->
depth > depth_data[i].
depth) {
653 if (depth_data_len > maxhits) {
660 for (
uint i = 0; i < depth_data_len; i++) {
662 printf(
" hit: %u: depth %u\n", depth_data[i].
id, depth_data[i].depth);
704 printf(
"%s\n", __func__);
732 printf(
"%s (building depth from cache)\n", __func__);
735 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
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)
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_begin(uint(*buffer)[4], uint bufsize, const rcti *input, char mode)
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)
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
struct DepthBufCache * next
struct DepthBufCache * prev
struct GPUPickState::@630 src
DepthBufCache * rect_depth
struct GPUPickState::@630 dst
struct GPUPickState::@629 gl
DepthBufCache * rect_depth_test
struct GPUPickState::@632::@635 nearest
struct GPUPickState::@632::@634 all
struct GPUPickState::@631 cache