Centralize canvas blend gate planning

This commit is contained in:
2026-06-03 18:20:01 +02:00
parent a89f5e6cf2
commit 1369a9048e
8 changed files with 327 additions and 86 deletions

View File

@@ -50,6 +50,30 @@ struct StrokeCompositePlan {
bool requires_explicit_transition = false;
};
struct CanvasBlendGateRequest {
pp::renderer::Extent2D extent {};
std::span<const int> layer_blend_modes;
bool has_stroke_blend_mode = false;
int stroke_blend_mode = 0;
bool dual_brush_blend = false;
bool pattern_blend = false;
};
struct CanvasBlendGatePlan {
bool shader_blend = false;
bool complex_blend = false;
bool compatibility_fallback = false;
bool stroke_complex = false;
bool dual_brush_complex = false;
bool pattern_complex = false;
int first_complex_layer_index = -1;
StrokeCompositePath path = StrokeCompositePath::fixed_function_blend;
bool reads_destination_color = false;
bool requires_auxiliary_texture = false;
bool requires_texture_copy = false;
bool requires_render_target_blit = false;
};
[[nodiscard]] pp::foundation::Status composite_layer(
std::span<pp::paint::Rgba> destination,
pp::renderer::Extent2D extent,
@@ -65,6 +89,10 @@ struct StrokeCompositePlan {
pp::renderer::RenderDeviceFeatures features,
StrokeCompositeRequest request) noexcept;
[[nodiscard]] pp::foundation::Result<CanvasBlendGatePlan> plan_canvas_blend_gate(
pp::renderer::RenderDeviceFeatures features,
CanvasBlendGateRequest request) noexcept;
[[nodiscard]] const char* stroke_composite_path_name(StrokeCompositePath path) noexcept;
}