Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2019-12-02 03:40:58 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-12-02 15:15:52 +0300
commit9516921c05bd9fee5c94942eb8e38f47ba7e4351 (patch)
treeda007fc17bc6a02f849dae2e8f76f5ab304fe4dc /source/blender/draw/intern/draw_manager_exec.c
parent1f6c3699a836d485ed37f443cd0fcd19e978dbb6 (diff)
Overlay Engine: Refactor & Cleanup
This is the unification of all overlays into one overlay engine as described in T65347. I went over all the code making it more future proof with less hacks and removing old / not relevent parts. Goals / Acheivements: - Remove internal shader usage (only drw shaders) - Remove viewportSize and viewportSizeInv and put them in gloabl ubo - Fixed some drawing issues: Missing probe option and Missing Alt+B clipping of some shader - Remove old (legacy) shaders dependancy (not using view UBO). - Less shader variation (less compilation time at first load and less patching needed for vulkan) - removed some geom shaders when I could - Remove static e_data (except shaders storage where it is OK) - Clear the way to fix some anoying limitations (dithered transparency, background image compositing etc...) - Wireframe drawing now uses the same batching capabilities as workbench & eevee (indirect drawing). - Reduced complexity, removed ~3000 Lines of code in draw (also removed a lot of unused shader in GPU). - Post AA to avoid complexity and cost of MSAA. Remaining issues: - ~~Armature edits, overlay toggles, (... others?) are not refreshing viewport after AA is complete~~ - FXAA is not the best for wires, maybe investigate SMAA - Maybe do something more temporally stable for AA. - ~~Paint overlays are not working with AA.~~ - ~~infront objects are difficult to select.~~ - ~~the infront wires sometimes goes through they solid counterpart (missing clear maybe?) (toggle overlays on-off when using infront+wireframe overlay in solid shading)~~ Note: I made some decision to change slightly the appearance of some objects to simplify their drawing. Namely the empty arrows end (which is now hollow/wire) and distance points of the cameras/spots being done by lines. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D6296
Diffstat (limited to 'source/blender/draw/intern/draw_manager_exec.c')
-rw-r--r--source/blender/draw/intern/draw_manager_exec.c52
1 files changed, 44 insertions, 8 deletions
diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c
index fa7c44c1b1f..02667ad9d4a 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -321,6 +321,38 @@ void drw_state_set(DRWState state)
}
}
+ /* In Front objects selection */
+ {
+ int test;
+ if ((test = CHANGED_TO(DRW_STATE_IN_FRONT_SELECT))) {
+ if (test == 1) {
+ /* XXX `GPU_depth_range` is not a perfect solution
+ * since very distant geometries can still be occluded.
+ * Also the depth test precision of these geometries is impaired.
+ * However, it solves the selection for the vast majority of cases. */
+ GPU_depth_range(0.0f, 0.01f);
+ }
+ else {
+ GPU_depth_range(0.0f, 1.0f);
+ }
+ }
+ }
+
+ /* Logic Ops */
+ {
+ int test;
+ if ((test = CHANGED_TO(DRW_STATE_LOGIC_INVERT))) {
+ if (test == 1) {
+ glLogicOp(GL_INVERT);
+ glEnable(GL_COLOR_LOGIC_OP);
+ }
+ else {
+ glLogicOp(GL_COPY);
+ glDisable(GL_COLOR_LOGIC_OP);
+ }
+ }
+ }
+
/* Clip Planes */
{
int test;
@@ -990,10 +1022,10 @@ BLI_INLINE void draw_select_buffer(DRWShadingGroup *shgroup,
GPUBatch *batch,
const DRWResourceHandle *handle)
{
- const bool is_instancing = (batch->inst != NULL);
+ const bool is_instancing = (batch->inst[0] != NULL);
int start = 0;
int count = 1;
- int tot = is_instancing ? batch->inst->vertex_len : batch->verts[0]->vertex_len;
+ int tot = is_instancing ? batch->inst[0]->vertex_len : batch->verts[0]->vertex_len;
/* Hack : get "vbo" data without actually drawing. */
int *select_id = (void *)state->select_buf->data;
@@ -1091,7 +1123,8 @@ static void draw_call_single_do(DRWShadingGroup *shgroup,
DRWResourceHandle handle,
int vert_first,
int vert_count,
- int inst_count)
+ int inst_count,
+ bool do_base_instance)
{
draw_call_batching_flush(shgroup, state);
@@ -1118,7 +1151,7 @@ static void draw_call_single_do(DRWShadingGroup *shgroup,
batch,
vert_first,
vert_count,
- DRW_handle_id_get(&handle),
+ do_base_instance ? DRW_handle_id_get(&handle) : 0,
inst_count,
state->baseinst_loc);
}
@@ -1292,7 +1325,7 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
case DRW_CMD_DRAW:
if (!USE_BATCHING || state.obmats_loc == -1 || (G.f & G_FLAG_PICKSEL) ||
cmd->draw.batch->inst) {
- draw_call_single_do(shgroup, &state, cmd->draw.batch, cmd->draw.handle, 0, 0, 0);
+ draw_call_single_do(shgroup, &state, cmd->draw.batch, cmd->draw.handle, 0, 0, 0, true);
}
else {
draw_call_batching_do(shgroup, &state, &cmd->draw);
@@ -1305,7 +1338,8 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
cmd->procedural.handle,
0,
cmd->procedural.vert_count,
- 1);
+ 1,
+ true);
break;
case DRW_CMD_DRAW_INSTANCE:
draw_call_single_do(shgroup,
@@ -1314,7 +1348,8 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
cmd->instance.handle,
0,
0,
- cmd->instance.inst_count);
+ cmd->instance.inst_count,
+ cmd->instance.use_attribs == 0);
break;
case DRW_CMD_DRAW_RANGE:
draw_call_single_do(shgroup,
@@ -1323,7 +1358,8 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
(DRWResourceHandle)0,
cmd->range.vert_first,
cmd->range.vert_count,
- 1);
+ 1,
+ true);
break;
}
}