Add renderer and package readiness validation gates
This commit is contained in:
@@ -14,6 +14,9 @@ struct AppTaskDispatchPlan {
|
||||
bool notify_worker = false;
|
||||
bool wait_for_completion = false;
|
||||
bool request_redraw = false;
|
||||
// When true, dispatch attempts from non-target threads are rejected instead
|
||||
// of being queued for later execution.
|
||||
bool reject_unsafe_cross_thread_dispatch = false;
|
||||
};
|
||||
|
||||
struct AppAsyncRedrawPlan {
|
||||
@@ -73,16 +76,20 @@ struct AppThreadStopPlan {
|
||||
std::size_t queued_task_count,
|
||||
bool worker_running,
|
||||
bool wait_for_completion,
|
||||
bool request_redraw_after_dispatch) noexcept
|
||||
bool request_redraw_after_dispatch,
|
||||
bool reject_unsafe_cross_thread_dispatch = false) noexcept
|
||||
{
|
||||
const bool queue_task = !already_on_target_thread;
|
||||
const bool queue_task = !already_on_target_thread && !reject_unsafe_cross_thread_dispatch;
|
||||
return AppTaskDispatchPlan {
|
||||
.execute_immediately = already_on_target_thread,
|
||||
.queue_task = queue_task,
|
||||
.remove_matching_unique_task = queue_task && unique && queued_task_count > 0U,
|
||||
.notify_worker = queue_task,
|
||||
.wait_for_completion = queue_task && worker_running && wait_for_completion,
|
||||
.request_redraw = request_redraw_after_dispatch,
|
||||
.request_redraw = !(!already_on_target_thread && reject_unsafe_cross_thread_dispatch)
|
||||
&& request_redraw_after_dispatch,
|
||||
.reject_unsafe_cross_thread_dispatch = !already_on_target_thread
|
||||
&& reject_unsafe_cross_thread_dispatch,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <string>
|
||||
@@ -147,6 +148,11 @@ struct StrokePreviewCompositePlan {
|
||||
bool uses_pattern = false;
|
||||
};
|
||||
|
||||
struct StrokePreviewCopySize {
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
};
|
||||
|
||||
struct CanvasBlendGateRequest {
|
||||
pp::renderer::Extent2D extent {};
|
||||
std::span<const int> layer_blend_modes;
|
||||
@@ -530,6 +536,17 @@ export_document_animation_frames_equirectangular_pngs(
|
||||
[[nodiscard]] StrokePreviewCompositePlan plan_stroke_preview_composite(
|
||||
StrokePreviewCompositeRequest request) noexcept;
|
||||
|
||||
[[nodiscard]] pp::foundation::Status copy_stroke_preview_result_to_texture(
|
||||
std::function<void()> bind_preview_texture,
|
||||
std::function<void(
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height)> copy_framebuffer_to_texture,
|
||||
StrokePreviewCopySize copy_size) noexcept;
|
||||
|
||||
[[nodiscard]] pp::foundation::Result<CanvasBlendGatePlan> plan_canvas_blend_gate(
|
||||
pp::renderer::RenderDeviceFeatures features,
|
||||
CanvasBlendGateRequest request) noexcept;
|
||||
@@ -556,4 +573,26 @@ export_document_animation_frames_equirectangular_pngs(
|
||||
|
||||
[[nodiscard]] const char* stroke_composite_path_name(StrokeCompositePath path) noexcept;
|
||||
|
||||
inline pp::foundation::Status copy_stroke_preview_result_to_texture(
|
||||
std::function<void()> bind_preview_texture,
|
||||
std::function<void(
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height)> copy_framebuffer_to_texture,
|
||||
StrokePreviewCopySize copy_size) noexcept
|
||||
{
|
||||
bind_preview_texture();
|
||||
copy_framebuffer_to_texture(
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
copy_size.width,
|
||||
copy_size.height);
|
||||
return pp::foundation::Status::success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user