Thin canvas modes, node execution, and canvas draw shell

This commit is contained in:
2026-06-16 18:30:24 +02:00
parent 8906756d12
commit b56a46a82c
9 changed files with 398 additions and 320 deletions

View File

@@ -395,6 +395,57 @@ pp::panopainter::LegacyCanvasDrawMergeLayerPathExecution make_node_canvas_layer_
draw_layer_frame);
}
void execute_node_canvas_draw_unmerged_pass(
NodeCanvas& node_canvas,
const glm::mat4& proj,
const glm::mat4& camera,
const glm::ivec4& c,
float yaw,
float pitch,
float roll)
{
const auto blend_gate = node_canvas_blend_gate_plan(
node_canvas.m_cache_rtt.getWidth(),
node_canvas.m_cache_rtt.getHeight(),
node_canvas.m_canvas->m_layers,
node_canvas.m_canvas->m_current_stroke ? node_canvas.m_canvas->m_current_stroke->m_brush.get() : nullptr);
const bool use_blend = blend_gate.shader_blend;
const bool copy_blend_destination = use_blend && !blend_gate.reads_destination_color;
const auto layer_orientation = glm::eulerAngleYXZ(yaw, pitch, roll);
pp::panopainter::execute_legacy_canvas_draw_node_canvas_unmerged_pass(
node_canvas,
use_blend,
copy_blend_destination,
proj,
camera,
layer_orientation,
c,
[&](int x, int y, int width, int height) {
apply_node_canvas_viewport(x, y, width, height);
},
[&](auto state, bool enabled) {
apply_node_canvas_capability(state, enabled);
},
[&] {
node_canvas.m_sampler.bind(0);
set_active_texture_unit(0);
},
[&](size_t layer_index, int plane_index, const glm::mat4& plane_mvp_z, const Brush* brush, bool copy_blend_destination, bool use_nearest_sampler) {
return make_node_canvas_layer_path_execution(
node_canvas,
layer_index,
plane_index,
plane_mvp_z,
brush,
copy_blend_destination,
use_nearest_sampler);
},
[&](const char* message) {
LOG("NodeCanvas onion frame range failed: %s", message);
});
}
void execute_node_canvas_draw_merge_tail(
NodeCanvas& node_canvas,
const glm::mat4& ortho_proj,
@@ -626,46 +677,7 @@ void NodeCanvas::draw()
});
},
[&] {
const auto blend_gate = node_canvas_blend_gate_plan(
m_cache_rtt.getWidth(),
m_cache_rtt.getHeight(),
m_canvas->m_layers,
m_canvas->m_current_stroke ? m_canvas->m_current_stroke->m_brush.get() : nullptr);
const bool use_blend = blend_gate.shader_blend;
const bool copy_blend_destination = use_blend && !blend_gate.reads_destination_color;
const auto layer_orientation = glm::eulerAngleYXZ(yaw, pitch, roll);
pp::panopainter::execute_legacy_canvas_draw_node_canvas_unmerged_pass(
*this,
use_blend,
copy_blend_destination,
proj,
camera,
layer_orientation,
c,
[&](int x, int y, int width, int height) {
apply_node_canvas_viewport(x, y, width, height);
},
[&](auto state, bool enabled) {
apply_node_canvas_capability(state, enabled);
},
[&] {
m_sampler.bind(0);
set_active_texture_unit(0);
},
[&](size_t layer_index, int plane_index, const glm::mat4& plane_mvp_z, const Brush* brush, bool copy_blend_destination, bool use_nearest_sampler) {
return make_node_canvas_layer_path_execution(
*this,
layer_index,
plane_index,
plane_mvp_z,
brush,
copy_blend_destination,
use_nearest_sampler);
},
[&](const char* message) {
LOG("NodeCanvas onion frame range failed: %s", message);
});
execute_node_canvas_draw_unmerged_pass(*this, proj, camera, c, yaw, pitch, roll);
});
execute_node_canvas_draw_merge_tail(*this, ortho_proj, proj, camera, c);