Blender V4.3
GPU_select.hh File Reference
#include "BLI_span.hh"
#include "BLI_sys_types.h"
#include "BLI_vector.hh"

Go to the source code of this file.

Classes

struct  GPUSelectResult
 
struct  GPUSelectBuffer
 

Typedefs

using GPUSelectStorage = blender::Vector<GPUSelectResult, 2500>
 

Enumerations

enum  eGPUSelectMode {
  GPU_SELECT_ALL = 1 , GPU_SELECT_NEAREST_FIRST_PASS = 2 , GPU_SELECT_NEAREST_SECOND_PASS = 3 , GPU_SELECT_PICK_ALL = 4 ,
  GPU_SELECT_PICK_NEAREST = 5
}
 

Functions

void GPU_select_begin (GPUSelectBuffer *buffer, const rcti *input, eGPUSelectMode mode, int oldhits)
 
void GPU_select_begin_next (GPUSelectBuffer *buffer, const rcti *input, eGPUSelectMode mode, int oldhits)
 
bool GPU_select_load_id (unsigned int id)
 
void GPU_select_finalize ()
 
unsigned int GPU_select_end ()
 
bool GPU_select_is_cached ()
 
void GPU_select_cache_begin ()
 
void GPU_select_cache_load_id ()
 
void GPU_select_cache_end ()
 
const GPUSelectResultGPU_select_buffer_near (const blender::Span< GPUSelectResult > hit_results)
 
uint GPU_select_buffer_remove_by_id (blender::MutableSpan< GPUSelectResult > hit_results, uint select_id)
 
void GPU_select_buffer_stride_realign (const rcti *src, const rcti *dst, uint *r_buf)
 

Typedef Documentation

◆ GPUSelectStorage

Definition at line 44 of file GPU_select.hh.

Enumeration Type Documentation

◆ eGPUSelectMode

Flags for mode of operation.

Enumerator
GPU_SELECT_ALL 
GPU_SELECT_NEAREST_FIRST_PASS 
GPU_SELECT_NEAREST_SECOND_PASS 
GPU_SELECT_PICK_ALL 
GPU_SELECT_PICK_NEAREST 

Definition at line 18 of file GPU_select.hh.

Function Documentation

◆ GPU_select_begin()

void GPU_select_begin ( GPUSelectBuffer * buffer,
const rcti * input,
eGPUSelectMode mode,
int oldhits )

Initialize and provide buffer for results.

Definition at line 142 of file gpu_select.cc.

References gpu_select_begin_ex().

Referenced by gizmo_find_intersected_3d_intern().

◆ GPU_select_begin_next()

void GPU_select_begin_next ( GPUSelectBuffer * buffer,
const rcti * input,
eGPUSelectMode mode,
int oldhits )

Initialize and provide buffer for results. Uses the new Select-Next engine if enabled.

Definition at line 134 of file gpu_select.cc.

References gpu_select_begin_ex().

Referenced by drw_select_loop_pass(), and view3d_opengl_select_ex().

◆ GPU_select_buffer_near()

const GPUSelectResult * GPU_select_buffer_near ( const blender::Span< GPUSelectResult > hit_results)

Helper function, nothing special but avoids doing inline since hits aren't sorted by depth and purpose of 4x buffer indices isn't so clear.

Note that comparing depth as uint is fine.

Definition at line 245 of file gpu_select.cc.

References BLI_assert.

Referenced by gizmo_find_intersected_3d_intern().

◆ GPU_select_buffer_remove_by_id()

uint GPU_select_buffer_remove_by_id ( blender::MutableSpan< GPUSelectResult > hit_results,
uint select_id )

Definition at line 259 of file gpu_select.cc.

Referenced by view3d_opengl_select_with_id_filter().

◆ GPU_select_buffer_stride_realign()

void GPU_select_buffer_stride_realign ( const rcti * src,
const rcti * dst,
uint * r_buf )

Part of the solution copied from rect_subregion_stride_calc.

Definition at line 278 of file gpu_select.cc.

References BLI_assert, BLI_rcti_size_x(), BLI_rcti_size_y(), rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.

Referenced by DRW_select_buffer_read().

◆ GPU_select_cache_begin()

void GPU_select_cache_begin ( )

◆ GPU_select_cache_end()

◆ GPU_select_cache_load_id()

void GPU_select_cache_load_id ( )

◆ GPU_select_end()

unsigned int GPU_select_end ( )

Cleanup and flush selection results to buffer. Return number of hits and hits in buffer. if dopass is true, we will do a second pass with occlusion queries to get the closest hit.

Definition at line 170 of file gpu_select.cc.

References ALGO_GL_QUERY, ALGO_SELECT_NEXT, GPUSelectState::algorithm, g_select_state, gpu_select_next_end(), gpu_select_pick_end(), gpu_select_query_end(), and GPUSelectState::select_is_active.

Referenced by drw_select_loop_pass(), gizmo_find_intersected_3d_intern(), and view3d_opengl_select_ex().

◆ GPU_select_finalize()

void GPU_select_finalize ( )

◆ GPU_select_is_cached()

bool GPU_select_is_cached ( )

◆ GPU_select_load_id()

bool GPU_select_load_id ( unsigned int id)

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.

Definition at line 147 of file gpu_select.cc.

References ALGO_GL_QUERY, ALGO_SELECT_NEXT, GPUSelectState::algorithm, BLI_assert_unreachable, g_select_state, gpu_select_pick_load_id(), gpu_select_query_load_id(), and GPUSelectState::select_is_active.

Referenced by draw_call_indirect(), draw_call_single_do(), draw_select_buffer(), ed_gizmo_draw_preset_geometry(), gizmo_arrow_draw_select(), gizmo_button2d_draw_select(), gizmo_cage2d_draw_intern(), gizmo_cage3d_draw_intern(), gizmo_dial_draw_select(), gizmo_move_draw_select(), gizmo_primitive_draw_select(), and pygpu_select_load_id().