|
Blender V4.3
|
#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.h"#include "BLI_rect.h"#include "BLI_utildefines.h"#include "gpu_select_private.hh"#include "BLI_strict_flags.h"Go to the source code of this file.
Classes | |
| struct | SubRectStride |
| struct | DepthBufCache |
| struct | DepthID |
| struct | GPUPickState |
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 * | depth_buf_malloc (uint rect_len) |
| static bool | depth_buf_rect_depth_any (const DepthBufCache *rect_depth, uint rect_len) |
| static bool | depth_buf_subrect_depth_any (const DepthBufCache *rect_depth, const SubRectStride *sub_rect) |
| static bool | depth_buf_rect_depth_any_filled (const DepthBufCache *rect_prev, const DepthBufCache *rect_curr, uint rect_len) |
| static bool | 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 | depth_id_cmp (const void *v1, const void *v2) |
| static int | depth_cmp (const void *v1, const void *v2) |
Caching | |
Support multiple begin/end's reusing depth buffers. | |
| void | gpu_select_pick_cache_begin () |
| void | gpu_select_pick_cache_end () |
| bool | gpu_select_pick_is_cached () |
| void | gpu_select_pick_cache_load_id () |
#SubRectStride | |
| typedef uint | depth_t |
| static void | rect_subregion_stride_calc (const rcti *src, const rcti *dst, SubRectStride *r_sub) |
| BLI_INLINE bool | depth_is_filled (const depth_t *prev, const depth_t *curr) |
Main Selection Begin/End/Load API | |
| static GPUPickState | g_pick_state {} |
| void | gpu_select_pick_begin (GPUSelectBuffer *buffer, const rcti *input, eGPUSelectMode mode) |
| static void | gpu_select_load_id_pass_all (const DepthBufCache *rect_curr) |
| static void | gpu_select_load_id_pass_nearest (const DepthBufCache *rect_prev, const DepthBufCache *rect_curr) |
| bool | gpu_select_pick_load_id (uint id, bool end) |
| uint | gpu_select_pick_end () |
Custom select code for picking small regions (not efficient for large regions). gpu_select_pick_* API.
Definition in file gpu_select_pick.cc.
| #define ALLOC_DEPTHS 200 |
Definition at line 33 of file gpu_select_pick.cc.
Referenced by gpu_select_load_id_pass_all(), and gpu_select_pick_begin().
| #define DEPTH_MAX 0xffffffff |
Definition at line 36 of file gpu_select_pick.cc.
Referenced by depth_buf_rect_depth_any(), depth_buf_subrect_depth_any(), depth_is_filled(), gpu_select_load_id_pass_all(), and gpu_select_pick_begin().
| #define EVAL_TEST | ( | ) |
Referenced by gpu_select_load_id_pass_all(), gpu_select_load_id_pass_nearest(), and gpu_select_pick_end().
| #define EVAL_TEST | ( | ) |
| #define EVAL_TEST | ( | i_src, | |
| i_dst ) |
We may want to change back to float if uint isn't well supported.
Definition at line 55 of file gpu_select_pick.cc.
|
static |
Definition at line 106 of file gpu_select_pick.cc.
References DepthBufCache::id, MEM_mallocN, and SELECT_ID_NONE.
Referenced by gpu_select_pick_begin(), and gpu_select_pick_load_id().
|
static |
Definition at line 114 of file gpu_select_pick.cc.
References DepthBufCache::buf, and DEPTH_MAX.
Referenced by gpu_select_pick_load_id().
|
static |
Definition at line 141 of file gpu_select_pick.cc.
References DepthBufCache::buf, and depth_is_filled().
Referenced by gpu_select_pick_load_id().
|
static |
Definition at line 125 of file gpu_select_pick.cc.
References DepthBufCache::buf, DEPTH_MAX, SubRectStride::skip, SubRectStride::span, SubRectStride::span_len, and SubRectStride::start.
Referenced by gpu_select_pick_cache_load_id().
|
static |
Both buffers are the same size, just check if the sub-rect contains any differences.
Definition at line 162 of file gpu_select_pick.cc.
References DepthBufCache::buf, depth_is_filled(), SubRectStride::skip, SubRectStride::span, SubRectStride::span_len, and SubRectStride::start.
Referenced by gpu_select_pick_cache_load_id().
|
static |
Definition at line 208 of file gpu_select_pick.cc.
References DepthID::depth, and v2.
Referenced by gpu_select_pick_end().
|
static |
Definition at line 195 of file gpu_select_pick.cc.
References DepthID::id, and v2.
Referenced by gpu_select_pick_end().
| BLI_INLINE bool depth_is_filled | ( | const depth_t * | prev, |
| const depth_t * | curr ) |
Ignore depth clearing as a change, only check if its been changed and filled in (ignore clearing since XRAY does this).
Definition at line 85 of file gpu_select_pick.cc.
References DEPTH_MAX.
Referenced by depth_buf_rect_depth_any_filled(), and depth_buf_subrect_depth_any_filled().
|
static |
Given 2x depths, we know are different - update the depth information use for both cached/uncached depth buffers.
Definition at line 387 of file gpu_select_pick.cc.
References GPUPickState::all, ALLOC_DEPTHS, BLI_assert, DepthBufCache::buf, GPUPickState::cache, DepthID::depth, DEPTH_MAX, GPUPickState::dst, EVAL_TEST, g_pick_state, GPUPickState::hits, GPUPickState::hits_len, GPUPickState::hits_len_alloc, DepthBufCache::id, DepthID::id, GPUPickState::is_cached, MEM_reallocN, GPUPickState::rect_len, SubRectStride::skip, SubRectStride::span, SubRectStride::span_len, GPUPickState::src, SubRectStride::start, GPUPickState::sub_rect, and UNLIKELY.
Referenced by gpu_select_pick_cache_load_id(), and gpu_select_pick_load_id().
|
static |
Definition at line 433 of file gpu_select_pick.cc.
References BLI_assert, DepthBufCache::buf, GPUPickState::cache, GPUPickState::dst, EVAL_TEST, g_pick_state, DepthBufCache::id, GPUPickState::is_cached, GPUPickState::nearest, GPUPickState::rect_id, GPUPickState::rect_len, SELECT_ID_NONE, SubRectStride::skip, SubRectStride::span, SubRectStride::span_len, GPUPickState::src, SubRectStride::start, and GPUPickState::sub_rect.
Referenced by gpu_select_pick_cache_load_id(), and gpu_select_pick_load_id().
| void gpu_select_pick_begin | ( | GPUSelectBuffer * | buffer, |
| const rcti * | input, | ||
| eGPUSelectMode | mode ) |
Definition at line 296 of file gpu_select_pick.cc.
References GPUPickState::all, ALLOC_DEPTHS, BLI_assert, BLI_rcti_size_x(), BLI_rcti_size_y(), DepthBufCache::buf, GPUPickState::buffer, GPUPickState::cache, GPUPickState::clip_readpixels, GPUPickState::clip_rect, depth_buf_malloc(), DEPTH_MAX, GPUPickState::depth_test, GPUPickState::dst, g_pick_state, GPUPickState::gpu, GPU_clear_depth(), GPU_color_mask(), GPU_debug_group_begin(), GPU_DEPTH_LESS_EQUAL, GPU_depth_mask(), GPU_depth_test(), GPU_depth_test_get(), GPU_scissor_get(), GPU_SELECT_PICK_ALL, GPU_viewport(), GPU_viewport_size_get_f(), GPU_write_mask_get(), GPUPickState::hits, GPUPickState::hits_len, GPUPickState::hits_len_alloc, int, GPUPickState::is_cached, GPUPickState::is_init, MEM_mallocN, GPUPickState::mode, GPUPickState::nearest, GPUPickState::prev_id, printf, GPUPickState::rect_depth, GPUPickState::rect_depth_test, GPUPickState::rect_id, GPUPickState::rect_len, rect_subregion_stride_calc(), GPUPickState::scissor, GPUPickState::src, GPUPickState::sub_rect, UNPACK4, GPUPickState::use_cache, and GPUPickState::write_mask.
Referenced by gpu_select_begin_ex().
| void gpu_select_pick_cache_begin | ( | ) |
Definition at line 702 of file gpu_select_pick.cc.
References BLI_assert, g_pick_state, GPUPickState::is_cached, printf, and GPUPickState::use_cache.
Referenced by gpu_select_begin_ex().
| void gpu_select_pick_cache_end | ( | ) |
Definition at line 712 of file gpu_select_pick.cc.
References BLI_freelistN(), BLI_listbase_count(), GPUPickState::bufs, GPUPickState::cache, g_pick_state, GPUPickState::is_cached, printf, and GPUPickState::use_cache.
Referenced by GPU_select_cache_end().
| void gpu_select_pick_cache_load_id | ( | ) |
Definition at line 728 of file gpu_select_pick.cc.
References BLI_assert, GPUPickState::bufs, GPUPickState::cache, depth_buf_subrect_depth_any(), depth_buf_subrect_depth_any_filled(), g_pick_state, gpu_select_load_id_pass_all(), gpu_select_load_id_pass_nearest(), GPU_SELECT_PICK_ALL, GPUPickState::is_cached, LISTBASE_FOREACH, GPUPickState::mode, printf, and GPUPickState::sub_rect.
Referenced by GPU_select_cache_load_id().
| uint gpu_select_pick_end | ( | ) |
Definition at line 538 of file gpu_select_pick.cc.
References GPUPickState::all, blender::Vector< T, InlineBufferCapacity, Allocator >::append_unchecked(), BLI_addtail(), GPUPickState::buffer, GPUPickState::bufs, GPUPickState::cache, DepthID::depth, depth_cmp(), depth_id_cmp(), GPUPickState::depth_test, GPUPickState::dst, EVAL_TEST, g_pick_state, GPUPickState::gpu, GPU_debug_group_end(), GPU_depth_test(), GPU_SELECT_PICK_ALL, gpu_select_pick_load_id(), GPU_viewport(), GPU_write_mask(), GPUPickState::hits, GPUPickState::hits_len, GPUPickState::hits_len_alloc, DepthID::id, GPUSelectResult::id, GPUPickState::is_cached, GPUPickState::is_init, ListBase::last, MEM_freeN(), MEM_mallocN, MEM_SAFE_FREE, GPUPickState::mode, GPUPickState::nearest, GPUPickState::prev_id, printf, GPUPickState::rect_depth, GPUPickState::rect_depth_test, GPUPickState::rect_id, GPUPickState::rect_len, blender::Vector< T, InlineBufferCapacity, Allocator >::reserve(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), SubRectStride::skip, SubRectStride::span, SubRectStride::span_len, GPUPickState::src, SubRectStride::start, GPUSelectBuffer::storage, GPUPickState::sub_rect, UNPACK4, GPUPickState::use_cache, GPUPickState::viewport, and GPUPickState::write_mask.
Referenced by GPU_select_end().
| bool gpu_select_pick_is_cached | ( | ) |
Definition at line 723 of file gpu_select_pick.cc.
References g_pick_state, and GPUPickState::is_cached.
Referenced by GPU_select_is_cached().
| bool gpu_select_pick_load_id | ( | uint | id, |
| bool | end ) |
Definition at line 478 of file gpu_select_pick.cc.
References BLI_addtail(), DepthBufCache::buf, GPUPickState::bufs, GPUPickState::cache, GPUPickState::clip_readpixels, depth_buf_malloc(), depth_buf_rect_depth_any(), depth_buf_rect_depth_any_filled(), fb(), g_pick_state, GPUPickState::gpu, GPU_clear_depth(), GPU_DATA_UINT, GPU_depth_mask(), GPU_depth_mask_get(), GPU_framebuffer_active_get(), GPU_framebuffer_read_depth(), gpu_select_load_id_pass_all(), gpu_select_load_id_pass_nearest(), GPU_SELECT_PICK_ALL, DepthBufCache::id, GPUPickState::is_init, GPUPickState::mode, GPUPickState::prev_id, GPUPickState::rect_depth, GPUPickState::rect_depth_test, GPUPickState::rect_len, GPUPickState::src, UNPACK4, and GPUPickState::use_cache.
Referenced by GPU_select_load_id(), and gpu_select_pick_end().
|
static |
Calculate values needed for looping over a sub-region (smaller buffer within a larger buffer).
'src' must be bigger than 'dst'.
Definition at line 62 of file gpu_select_pick.cc.
References BLI_assert, BLI_rcti_size_x(), BLI_rcti_size_y(), SubRectStride::skip, SubRectStride::span, SubRectStride::span_len, SubRectStride::start, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by gpu_select_pick_begin().
|
static |
Definition at line 294 of file gpu_select_pick.cc.
Referenced by gpu_select_load_id_pass_all(), gpu_select_load_id_pass_nearest(), gpu_select_pick_begin(), gpu_select_pick_cache_begin(), gpu_select_pick_cache_end(), gpu_select_pick_cache_load_id(), gpu_select_pick_end(), gpu_select_pick_is_cached(), and gpu_select_pick_load_id().