Cleanup: Overlay-Next: Split flat object sync to its own function
This allow to use the `Overlay` base class as intended.
This commit is contained in:
@@ -364,6 +364,9 @@ void Instance::draw(Manager &manager)
|
||||
draw_scope.begin_capture();
|
||||
}
|
||||
|
||||
outline.flat_objects_pass_sync(manager, view, resources, state);
|
||||
GreasePencil::compute_depth_planes(manager, view, resources, state);
|
||||
|
||||
/* Pre-Draw: Run the compute steps of all passes up-front
|
||||
* to avoid constant GPU compute/raster context switching. */
|
||||
{
|
||||
@@ -384,9 +387,8 @@ void Instance::draw(Manager &manager)
|
||||
|
||||
pre_draw(regular);
|
||||
pre_draw(infront);
|
||||
outline.pre_draw_ex(manager, view, resources, state);
|
||||
|
||||
GreasePencil::compute_depth_planes(manager, view, resources, state);
|
||||
outline.pre_draw(manager, view);
|
||||
}
|
||||
|
||||
resources.acquire(this->state, *DRW_viewport_texture_list_get());
|
||||
|
||||
@@ -186,8 +186,11 @@ class Outline : Overlay {
|
||||
}
|
||||
}
|
||||
|
||||
void pre_draw_ex(Manager &manager, View &view, Resources &res, const State &state)
|
||||
/* Flat objects outline workaround need to generate passes for each redraw. */
|
||||
void flat_objects_pass_sync(Manager &manager, View &view, Resources &res, const State &state)
|
||||
{
|
||||
outline_prepass_flat_ps_.init();
|
||||
|
||||
if (!enabled_) {
|
||||
return;
|
||||
}
|
||||
@@ -196,7 +199,6 @@ class Outline : Overlay {
|
||||
const bool is_transform = (G.moving & G_TRANSFORM_OBJ) != 0;
|
||||
/* Note: We need a dedicated pass since we have to populated it for each redraw. */
|
||||
auto &pass = outline_prepass_flat_ps_;
|
||||
pass.init();
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.framebuffer_set(&prepass_fb_);
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
@@ -211,8 +213,12 @@ class Outline : Overlay {
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
outline_prepass_flat_ps_.init();
|
||||
}
|
||||
|
||||
void pre_draw(Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
}
|
||||
|
||||
manager.generate_commands(outline_prepass_ps_, view);
|
||||
|
||||
Reference in New Issue
Block a user