Use blend gate plan for canvas copy decisions

This commit is contained in:
2026-06-03 18:37:58 +02:00
parent bc5b39057d
commit b576143afb
7 changed files with 73 additions and 19 deletions

View File

@@ -317,7 +317,7 @@ void canvas_blend_gate_preserves_legacy_fallbacks(pp::tests::Harness& h)
{
const std::vector<int> unknown_layer { 0, 99 };
const auto unknown = plan_canvas_blend_gate(
RenderDeviceFeatures {},
RenderDeviceFeatures { .texture_copy = true },
CanvasBlendGateRequest {
.extent = Extent2D { .width = 32, .height = 16 },
.layer_blend_modes = unknown_layer,
@@ -328,6 +328,9 @@ void canvas_blend_gate_preserves_legacy_fallbacks(pp::tests::Harness& h)
PP_EXPECT(h, unknown.value().complex_blend);
PP_EXPECT(h, unknown.value().compatibility_fallback);
PP_EXPECT(h, unknown.value().first_complex_layer_index == 1);
PP_EXPECT(h, unknown.value().path == StrokeCompositePath::ping_pong_textures);
PP_EXPECT(h, unknown.value().requires_auxiliary_texture);
PP_EXPECT(h, unknown.value().requires_texture_copy);
}
const std::vector<int> normal_layers { 0 };
@@ -344,6 +347,21 @@ void canvas_blend_gate_preserves_legacy_fallbacks(pp::tests::Harness& h)
PP_EXPECT(h, unsupported.value().shader_blend);
PP_EXPECT(h, unsupported.value().stroke_complex);
PP_EXPECT(h, unsupported.value().compatibility_fallback);
PP_EXPECT(h, !unsupported.value().requires_texture_copy);
}
const auto unknown_fetch = plan_canvas_blend_gate(
RenderDeviceFeatures { .framebuffer_fetch = true },
CanvasBlendGateRequest {
.extent = Extent2D { .width = 32, .height = 16 },
.layer_blend_modes = unknown_layer,
});
PP_EXPECT(h, unknown_fetch);
if (unknown_fetch) {
PP_EXPECT(h, unknown_fetch.value().compatibility_fallback);
PP_EXPECT(h, unknown_fetch.value().path == StrokeCompositePath::framebuffer_fetch);
PP_EXPECT(h, unknown_fetch.value().reads_destination_color);
PP_EXPECT(h, !unknown_fetch.value().requires_texture_copy);
}
const auto dual_pattern = plan_canvas_blend_gate(