Files
test/source/blender/draw/engines/select/select_private.hh
Germano Cavalcante ffaf3e30ef DRW: Simplify Selection Engine
The selection engine has some complex tricks that improve performance.
These are:
- Only draws objects whose bounding box intersects the selection
threshold;
- If the viewport or objects are not "dirty", it does not clean the
texture IDs and only adds objects that have not yet been drawn;
- Only updates the depth buffer if a new object is drawn;
- Skip drawing if no object is found;

These tricks were initially implemented so that this engine could be
used for snapping.

But this initial idea has changed and now the engine is only used to
select Vertices, Edges or Faces.

Due to this limited use, these tricks bring no real benefit.
In fact, it's even worse with the Retopology Overlay, as it forces the
Depth buffer to be redrawn.

This commit removes these tricks and only keeps those that indicate
whether the drawing needs to be updated.

Pull Request: https://projects.blender.org/blender/blender/pulls/113308
2023-10-09 11:06:53 -03:00

66 lines
1.5 KiB
C++

/* SPDX-FileCopyrightText: 2019 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup draw_engine
*/
#pragma once
#define USE_CAGE_OCCLUSION
#include "DRW_render.h"
/* GPUViewport.storage
* Is freed every time the viewport engine changes. */
struct SELECTID_StorageList {
struct SELECTID_PrivateData *g_data;
};
struct SELECTID_PassList {
DRWPass *depth_only_pass;
DRWPass *select_id_face_pass;
DRWPass *select_id_edge_pass;
DRWPass *select_id_vert_pass;
};
struct SELECTID_Data {
void *engine_type;
DRWViewportEmptyList *fbl;
DRWViewportEmptyList *txl;
SELECTID_PassList *psl;
SELECTID_StorageList *stl;
};
struct SELECTID_Shaders {
/* Depth Pre Pass */
GPUShader *select_id_flat;
GPUShader *select_id_uniform;
};
struct SELECTID_PrivateData {
DRWShadingGroup *shgrp_depth_only;
DRWShadingGroup *shgrp_occlude;
DRWShadingGroup *shgrp_face_unif;
DRWShadingGroup *shgrp_face_flat;
DRWShadingGroup *shgrp_edge;
DRWShadingGroup *shgrp_vert;
DRWView *view_faces;
DRWView *view_edges;
DRWView *view_verts;
}; /* Transient data */
/* `select_draw_utils.cc` */
short select_id_get_object_select_mode(Scene *scene, Object *ob);
void select_id_draw_object(void *vedata,
View3D *v3d,
Object *ob,
short select_mode,
uint initial_offset,
uint *r_vert_offset,
uint *r_edge_offset,
uint *r_face_offset);