diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-01-09 23:12:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-01-09 23:12:10 +0300 |
commit | f06f6eab0de15aeebab13074ef0b4173649779b4 (patch) | |
tree | 5d690cf77049b740cf2a17de8d337727043fb40f /source/blender/gpu/intern/gpu_select.c | |
parent | 8a924899a9e95e33ccdf1568a7b38d355bb91a38 (diff) |
Cleanup: style, gpu module
Diffstat (limited to 'source/blender/gpu/intern/gpu_select.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_select.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_select.c b/source/blender/gpu/intern/gpu_select.c index 44847dd5a48..d7b197756f9 100644 --- a/source/blender/gpu/intern/gpu_select.c +++ b/source/blender/gpu/intern/gpu_select.c @@ -69,6 +69,9 @@ typedef struct GPUQueryState { static GPUQueryState g_query_state = {0}; +/** + * initialize and provide buffer for results + */ void GPU_select_begin(unsigned int *buffer, unsigned int bufsize, rctf *input, char mode, int oldhits) { g_query_state.select_is_active = true; @@ -133,6 +136,13 @@ void GPU_select_begin(unsigned int *buffer, unsigned int bufsize, rctf *input, c } } +/** + * loads a new selection id and ends previous query, if any. In second pass of selection it also returns + * if id has been hit on the first pass already. + * Thus we can skip drawing un-hit objects. + * + * \warning We rely on the order of object rendering on passes to be the same for this to work. + */ bool GPU_select_load_id(unsigned int id) { /* if no selection mode active, ignore */ @@ -173,6 +183,11 @@ bool GPU_select_load_id(unsigned int id) return true; } +/** + * Cleanup and flush selection results to buffer. + * Return number of hits and hits in buffer. + * if \a dopass is true, we will do a second pass with occlusion queries to get the closest hit. + */ unsigned int GPU_select_end(void) { unsigned int hits = 0; @@ -233,8 +248,12 @@ unsigned int GPU_select_end(void) return hits; } +/** + * has user activated? + */ bool GPU_select_query_check_active(void) { return ((U.gpu_select_method == USER_SELECT_USE_OCCLUSION_QUERY) || - ((U.gpu_select_method == USER_SELECT_AUTO) && GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY))); + ((U.gpu_select_method == USER_SELECT_AUTO) && + GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY))); } |