Extract retained stroke preview pass orchestration plan
This commit is contained in:
@@ -2514,6 +2514,77 @@ void legacy_node_stroke_preview_stroke_setup_plan_preserves_curve_and_dual_input
|
||||
PP_EXPECT(h, pressure_fallback.points.empty());
|
||||
}
|
||||
|
||||
void legacy_node_stroke_preview_pass_orchestration_plan_preserves_feedback_material_and_composite_inputs(
|
||||
pp::tests::Harness& h)
|
||||
{
|
||||
const auto plan = pp::panopainter::plan_legacy_node_stroke_preview_pass_orchestration(
|
||||
pp::panopainter::LegacyNodeStrokePreviewPassOrchestrationRequest {
|
||||
.features = RenderDeviceFeatures { .framebuffer_fetch = false },
|
||||
.preview_size = glm::vec2(96.0F, 48.0F),
|
||||
.pattern_scale = 0.75F,
|
||||
.pattern_flipx = true,
|
||||
.pattern_flipy = false,
|
||||
.pattern_invert = true,
|
||||
.pattern_brightness = 0.2F,
|
||||
.pattern_contrast = 0.3F,
|
||||
.pattern_depth = 0.4F,
|
||||
.pattern_rand_offset = true,
|
||||
.pattern_enabled = true,
|
||||
.pattern_eachsample = false,
|
||||
.tip_mix = 0.5F,
|
||||
.tip_wet = 0.25F,
|
||||
.tip_noise = 0.1F,
|
||||
.dual_enabled = true,
|
||||
.dual_blend_mode = 2,
|
||||
.dual_opacity = 0.6F,
|
||||
.pattern_blend_mode = 3,
|
||||
.blend_mode = 4,
|
||||
.mvp = glm::ortho(-2.0F, 2.0F, -1.0F, 1.0F),
|
||||
});
|
||||
|
||||
PP_EXPECT(h, plan.feedback.compatibility_fallback);
|
||||
PP_EXPECT(h, !plan.feedback.reads_destination_color);
|
||||
PP_EXPECT(h, plan.copy_stroke_destination);
|
||||
PP_EXPECT(h, plan.background_colorize);
|
||||
|
||||
PP_EXPECT(h, plan.material.stroke_pass.uses_destination_feedback);
|
||||
PP_EXPECT(h, plan.material.composite_pass.use_dual);
|
||||
PP_EXPECT(h, plan.material.composite_pass.use_pattern);
|
||||
PP_EXPECT(h, plan.material.composite_pass.pattern_blend_mode == 3);
|
||||
PP_EXPECT(h, plan.material.composite_pass.dual_blend_mode == 2);
|
||||
PP_EXPECT(h, near(plan.material.composite_pass.dual_alpha, 0.6F));
|
||||
|
||||
PP_EXPECT(h, plan.composite.uses_mixer);
|
||||
PP_EXPECT(h, plan.composite.uses_dual == plan.material.composite_pass.use_dual);
|
||||
PP_EXPECT(h, plan.composite.uses_pattern == plan.material.composite_pass.use_pattern);
|
||||
const std::size_t expected_texture_slots =
|
||||
2U +
|
||||
(plan.composite.uses_dual ? 1U : 0U) +
|
||||
(plan.composite.uses_pattern ? 1U : 0U) +
|
||||
(plan.composite.uses_mixer ? 1U : 0U);
|
||||
PP_EXPECT(h, plan.composite.texture_slot_count == expected_texture_slots);
|
||||
PP_EXPECT(h, has_preview_texture_slot(plan.composite, StrokePreviewTextureRole::background, 0));
|
||||
PP_EXPECT(h, has_preview_texture_slot(plan.composite, StrokePreviewTextureRole::stroke, 1));
|
||||
PP_EXPECT(h, has_preview_texture_slot(plan.composite, StrokePreviewTextureRole::dual, 3));
|
||||
PP_EXPECT(h, has_preview_texture_slot(plan.composite, StrokePreviewTextureRole::mixer, 3));
|
||||
PP_EXPECT(h, has_preview_texture_slot(plan.composite, StrokePreviewTextureRole::pattern, 4));
|
||||
|
||||
PP_EXPECT(h, near(plan.stroke_shader.resolution, glm::vec2(96.0F, 48.0F)));
|
||||
PP_EXPECT(h, near(plan.stroke_shader.pattern.scale, glm::vec2(-0.75F, 0.75F)));
|
||||
PP_EXPECT(h, near(plan.stroke_shader.pattern.invert, 1.0F));
|
||||
PP_EXPECT(h, near(plan.stroke_shader.pattern.brightness, 0.2F));
|
||||
PP_EXPECT(h, near(plan.stroke_shader.pattern.contrast, 0.3F));
|
||||
PP_EXPECT(h, near(plan.stroke_shader.pattern.depth, 0.4F));
|
||||
PP_EXPECT(h, plan.stroke_shader.pattern.blend_mode == 3);
|
||||
PP_EXPECT(h, near(plan.stroke_shader.pattern.offset, glm::vec2(0.5F, 0.5F)));
|
||||
PP_EXPECT(h, plan.stroke_shader.uses_destination_feedback);
|
||||
PP_EXPECT(h, !plan.stroke_shader.uses_pattern);
|
||||
PP_EXPECT(h, !plan.stroke_shader.set_opacity);
|
||||
PP_EXPECT(h, near(plan.stroke_shader.mix_alpha, 0.0F));
|
||||
PP_EXPECT(h, near(plan.stroke_shader.wet, 0.0F));
|
||||
PP_EXPECT(h, near(plan.stroke_shader.noise, 0.0F));
|
||||
}
|
||||
|
||||
void plans_canvas_blend_gate_from_persisted_indices(pp::tests::Harness& h)
|
||||
{
|
||||
const std::vector<int> normal_layers { 0, 0, 0 };
|
||||
@@ -2977,6 +3048,9 @@ int main()
|
||||
harness.run(
|
||||
"legacy_node_stroke_preview_stroke_setup_plan_preserves_curve_and_dual_inputs",
|
||||
legacy_node_stroke_preview_stroke_setup_plan_preserves_curve_and_dual_inputs);
|
||||
harness.run(
|
||||
"legacy_node_stroke_preview_pass_orchestration_plan_preserves_feedback_material_and_composite_inputs",
|
||||
legacy_node_stroke_preview_pass_orchestration_plan_preserves_feedback_material_and_composite_inputs);
|
||||
harness.run("plans_canvas_blend_gate_from_persisted_indices", plans_canvas_blend_gate_from_persisted_indices);
|
||||
harness.run("canvas_blend_gate_preserves_legacy_fallbacks", canvas_blend_gate_preserves_legacy_fallbacks);
|
||||
harness.run("plans_canvas_stroke_feedback_paths", plans_canvas_stroke_feedback_paths);
|
||||
|
||||
Reference in New Issue
Block a user