Refine stroke sample execution boundary
This commit is contained in:
@@ -571,6 +571,17 @@ glm::vec4 Canvas::stroke_draw_samples(
|
||||
.slot = 1,
|
||||
},
|
||||
};
|
||||
const pp::panopainter::LegacyCanvasStrokeTextureInputDispatch destination_texture_dispatch {
|
||||
.activate_texture_unit = [&](int texture_slot) {
|
||||
set_active_texture_unit(texture_slot);
|
||||
},
|
||||
.bind_stroke_destination = [&] {
|
||||
m_tex[i].bind(); // bg, copy of framebuffer (copied before drawing)
|
||||
},
|
||||
.unbind_stroke_destination = [&] {
|
||||
m_tex[i].unbind();
|
||||
},
|
||||
};
|
||||
const auto result = pp::panopainter::execute_legacy_canvas_stroke_face_sample_polygon(
|
||||
pp::panopainter::LegacyStrokeFaceSamplePolygonExecutionRequest {
|
||||
.context = "Canvas::stroke_draw_samples",
|
||||
@@ -578,18 +589,6 @@ glm::vec4 Canvas::stroke_draw_samples(
|
||||
.polygon_vertices = P,
|
||||
.face_index = i,
|
||||
.copy_stroke_destination = copy_stroke_destination,
|
||||
.bind_destination_texture = [&](int face_index) {
|
||||
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
|
||||
destination_texture_binding,
|
||||
pp::panopainter::LegacyCanvasStrokeTextureInputDispatch {
|
||||
.activate_texture_unit = [&](int texture_slot) {
|
||||
set_active_texture_unit(texture_slot);
|
||||
},
|
||||
.bind_stroke_destination = [&] {
|
||||
m_tex[face_index].bind(); // bg, copy of framebuffer (copied before drawing)
|
||||
},
|
||||
});
|
||||
},
|
||||
.copy_framebuffer_to_destination_texture = [](
|
||||
int,
|
||||
int src_x,
|
||||
@@ -600,18 +599,6 @@ glm::vec4 Canvas::stroke_draw_samples(
|
||||
int height) {
|
||||
copy_framebuffer_to_texture_2d(src_x, src_y, dst_x, dst_y, width, height);
|
||||
},
|
||||
.unbind_destination_texture = [&](int face_index) {
|
||||
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
|
||||
destination_texture_binding,
|
||||
pp::panopainter::LegacyCanvasStrokeTextureInputDispatch {
|
||||
.activate_texture_unit = [&](int texture_slot) {
|
||||
set_active_texture_unit(texture_slot);
|
||||
},
|
||||
.unbind_stroke_destination = [&] {
|
||||
m_tex[face_index].unbind();
|
||||
},
|
||||
});
|
||||
},
|
||||
.upload_brush_vertices = [&](int, std::span<const vertex_t> vertices) {
|
||||
m_brush_shape.update_vertices(
|
||||
const_cast<vertex_t*>(vertices.data()),
|
||||
@@ -620,7 +607,9 @@ glm::vec4 Canvas::stroke_draw_samples(
|
||||
.draw_brush_shape = [&](int) {
|
||||
m_brush_shape.draw_fill();
|
||||
},
|
||||
});
|
||||
},
|
||||
destination_texture_binding,
|
||||
destination_texture_dispatch);
|
||||
|
||||
return result.dirty_bounds;
|
||||
}
|
||||
|
||||
@@ -1031,6 +1031,36 @@ template <typename ExecuteSample, typename BeginFace, typename PrepareDirtyReque
|
||||
});
|
||||
}
|
||||
|
||||
template <std::size_t BindingCount>
|
||||
[[nodiscard]] inline LegacyStrokeSampleExecutionResult execute_legacy_canvas_stroke_face_sample_polygon(
|
||||
const LegacyStrokeFaceSamplePolygonExecutionRequest& request,
|
||||
const std::array<LegacyCanvasStrokeTextureBinding, BindingCount>& destination_texture_bindings,
|
||||
const LegacyCanvasStrokeTextureInputDispatch& destination_texture_dispatch)
|
||||
{
|
||||
return execute_legacy_canvas_stroke_face_sample_polygon(
|
||||
LegacyStrokeFaceSamplePolygonExecutionRequest {
|
||||
.context = request.context,
|
||||
.target_size = request.target_size,
|
||||
.polygon_vertices = request.polygon_vertices,
|
||||
.face_index = request.face_index,
|
||||
.copy_stroke_destination = request.copy_stroke_destination,
|
||||
.bind_destination_texture = [&](int) {
|
||||
bind_legacy_canvas_stroke_texture_inputs(
|
||||
destination_texture_bindings,
|
||||
destination_texture_dispatch);
|
||||
},
|
||||
.copy_framebuffer_to_destination_texture =
|
||||
request.copy_framebuffer_to_destination_texture,
|
||||
.unbind_destination_texture = [&](int) {
|
||||
unbind_legacy_canvas_stroke_texture_inputs(
|
||||
destination_texture_bindings,
|
||||
destination_texture_dispatch);
|
||||
},
|
||||
.upload_brush_vertices = request.upload_brush_vertices,
|
||||
.draw_brush_shape = request.draw_brush_shape,
|
||||
});
|
||||
}
|
||||
|
||||
[[nodiscard]] inline LegacyCanvasStrokeMixPassResult execute_legacy_canvas_stroke_mix_pass(
|
||||
const LegacyCanvasStrokeMixPassRequest& request)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user