Extract brush refresh and thin unmerged NodeCanvas pass
This commit is contained in:
@@ -1112,6 +1112,113 @@ inline void execute_legacy_canvas_draw_unmerged_node_canvas_shell(
|
||||
}
|
||||
}
|
||||
|
||||
template <
|
||||
typename NodeCanvasT,
|
||||
typename ApplyViewport,
|
||||
typename ApplyCapability,
|
||||
typename DrawFacePlane,
|
||||
typename BindSampler,
|
||||
typename MakeLayerPathExecution,
|
||||
typename MakeCacheToScreenCheckerboardPlane,
|
||||
typename LogOnionRangeFailure>
|
||||
inline void execute_legacy_canvas_draw_unmerged_node_canvas_pass(
|
||||
NodeCanvasT& node_canvas,
|
||||
bool use_blend,
|
||||
const glm::mat4& proj,
|
||||
const glm::mat4& camera,
|
||||
const glm::mat4& orientation,
|
||||
const glm::ivec4& c,
|
||||
ApplyViewport&& apply_node_canvas_viewport,
|
||||
ApplyCapability&& apply_node_canvas_capability,
|
||||
DrawFacePlane&& draw_face_plane,
|
||||
BindSampler&& bind_sampler,
|
||||
MakeLayerPathExecution&& make_layer_path_execution,
|
||||
MakeCacheToScreenCheckerboardPlane&& make_cache_to_screen_checkerboard_plane,
|
||||
LogOnionRangeFailure&& log_onion_range_failure)
|
||||
{
|
||||
const auto prepare_blend_cache = [&] {
|
||||
apply_node_canvas_viewport(0, 0, node_canvas.m_cache_rtt.getWidth(), node_canvas.m_cache_rtt.getHeight());
|
||||
node_canvas.m_cache_rtt.bindFramebuffer();
|
||||
node_canvas.m_cache_rtt.clear({ 1, 1, 1, 0 });
|
||||
};
|
||||
|
||||
const auto draw_background = [&] {
|
||||
execute_legacy_canvas_draw_merge_background_setup(
|
||||
{
|
||||
.use_blend = use_blend,
|
||||
},
|
||||
{
|
||||
.disable_blend = [&] {
|
||||
apply_node_canvas_capability(pp::renderer::gl::blend_state(), false);
|
||||
},
|
||||
.draw_checkerboard_plane = make_legacy_canvas_draw_merge_background_checkerboard_plane(
|
||||
proj,
|
||||
camera,
|
||||
node_canvas.m_canvas->m_layers.size() + 500.f,
|
||||
node_canvas.m_canvas->m_plane_transform,
|
||||
draw_face_plane),
|
||||
});
|
||||
};
|
||||
|
||||
const auto configure_blend_state = [&](bool enable_shader_blend) {
|
||||
apply_node_canvas_capability(pp::renderer::gl::blend_state(), !enable_shader_blend);
|
||||
};
|
||||
|
||||
const auto disable_depth_test = [&] {
|
||||
apply_node_canvas_capability(pp::renderer::gl::depth_test_state(), false);
|
||||
};
|
||||
|
||||
execute_legacy_canvas_draw_unmerged_node_canvas_shell(
|
||||
node_canvas,
|
||||
use_blend,
|
||||
proj,
|
||||
camera,
|
||||
orientation,
|
||||
prepare_blend_cache,
|
||||
draw_background,
|
||||
configure_blend_state,
|
||||
disable_depth_test,
|
||||
make_layer_path_execution,
|
||||
log_onion_range_failure,
|
||||
[&] {
|
||||
node_canvas.m_cache_rtt.unbindFramebuffer();
|
||||
if (node_canvas.m_density != 1.f) {
|
||||
apply_node_canvas_viewport(0, 0, node_canvas.m_rtt.getWidth(), node_canvas.m_rtt.getHeight());
|
||||
} else {
|
||||
apply_node_canvas_viewport(c.x + App::I->off_x, c.y + App::I->off_y, c.z, c.w);
|
||||
}
|
||||
|
||||
execute_legacy_canvas_draw_merge_cache_to_screen_composite(
|
||||
LegacyCanvasDrawMergeCacheToScreenCompositeUniforms {
|
||||
.checkerboard = {
|
||||
.colorize = false,
|
||||
},
|
||||
.texture = {
|
||||
.mvp = glm::ortho<float>(-1, 1, -1, 1),
|
||||
.texture_slot = 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
.enable_blend = [&] {
|
||||
apply_node_canvas_capability(pp::renderer::gl::blend_state(), true);
|
||||
},
|
||||
.draw_checkerboard_plane = make_cache_to_screen_checkerboard_plane(),
|
||||
.bind_sampler = [&] {
|
||||
bind_sampler();
|
||||
},
|
||||
.bind_cache_texture = [&] {
|
||||
node_canvas.m_cache_rtt.bindTexture();
|
||||
},
|
||||
.draw_cache_texture = [&] {
|
||||
draw_face_plane();
|
||||
},
|
||||
.unbind_cache_texture = [&] {
|
||||
node_canvas.m_cache_rtt.unbindTexture();
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
inline void execute_legacy_canvas_draw_merge_plane_setup(
|
||||
const LegacyCanvasDrawMergePlaneSetupUniforms& uniforms,
|
||||
const LegacyCanvasDrawMergePlaneSetupExecution& execution)
|
||||
|
||||
Reference in New Issue
Block a user