Plan stroke preview composite sequence
This commit is contained in:
@@ -1264,6 +1264,52 @@ CanvasStrokeMaterialPlan plan_canvas_stroke_material(CanvasStrokeMaterialRequest
|
||||
return plan;
|
||||
}
|
||||
|
||||
StrokePreviewCompositePlan plan_stroke_preview_composite(StrokePreviewCompositeRequest request) noexcept
|
||||
{
|
||||
StrokePreviewCompositePlan plan;
|
||||
plan.uses_mixer = request.uses_mixer;
|
||||
plan.uses_dual = request.uses_dual;
|
||||
plan.uses_pattern = request.uses_pattern;
|
||||
|
||||
auto append_step = [&plan](StrokePreviewCompositeStep step) noexcept {
|
||||
if (plan.step_count >= plan.steps.size()) {
|
||||
return;
|
||||
}
|
||||
plan.steps[plan.step_count] = step;
|
||||
++plan.step_count;
|
||||
};
|
||||
auto bind = [&plan](StrokePreviewTextureRole role, std::uint8_t slot) noexcept {
|
||||
if (plan.texture_slot_count >= plan.texture_slots.size()) {
|
||||
return;
|
||||
}
|
||||
plan.texture_slots[plan.texture_slot_count] = StrokePreviewTextureSlotPlan {
|
||||
.role = role,
|
||||
.slot = slot,
|
||||
};
|
||||
++plan.texture_slot_count;
|
||||
};
|
||||
|
||||
append_step(StrokePreviewCompositeStep::checkerboard_background);
|
||||
append_step(StrokePreviewCompositeStep::capture_background_texture);
|
||||
append_step(StrokePreviewCompositeStep::bind_final_composite_inputs);
|
||||
append_step(StrokePreviewCompositeStep::final_composite_draw);
|
||||
append_step(StrokePreviewCompositeStep::copy_preview_texture);
|
||||
|
||||
bind(StrokePreviewTextureRole::background, 0);
|
||||
bind(StrokePreviewTextureRole::stroke, 1);
|
||||
if (request.uses_dual) {
|
||||
bind(StrokePreviewTextureRole::dual, 3);
|
||||
}
|
||||
if (request.uses_pattern) {
|
||||
bind(StrokePreviewTextureRole::pattern, 4);
|
||||
}
|
||||
if (request.uses_mixer) {
|
||||
bind(StrokePreviewTextureRole::mixer, 3);
|
||||
}
|
||||
|
||||
return plan;
|
||||
}
|
||||
|
||||
pp::foundation::Result<CanvasBlendGatePlan> plan_canvas_blend_gate(
|
||||
pp::renderer::RenderDeviceFeatures features,
|
||||
CanvasBlendGateRequest request) noexcept
|
||||
|
||||
Reference in New Issue
Block a user