@native-sdk/cli 0.0.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +176 -0
- package/README.md +50 -1
- package/app.zon +30 -0
- package/assets/icon.icns +0 -0
- package/assets/icon.ico +0 -0
- package/assets/icon.png +0 -0
- package/assets/icon.svg +15 -0
- package/assets/native-sdk.entitlements +10 -0
- package/assets/native-sdk.manifest +12 -0
- package/bin/native.js +156 -0
- package/build/app.zig +716 -0
- package/build.zig +2593 -0
- package/build.zig.zon +24 -0
- package/native-sdk.d.ts +615 -0
- package/package.json +45 -8
- package/skill-data/automation/SKILL.md +248 -0
- package/skill-data/core/SKILL.md +249 -0
- package/skill-data/core/references/app-model-runtime.md +141 -0
- package/skill-data/core/references/bridge-security-native-capabilities.md +230 -0
- package/skill-data/core/references/frontend-assets.md +124 -0
- package/skill-data/core/references/project-anatomy.md +108 -0
- package/skill-data/core/references/web-engines-packaging-debugging.md +199 -0
- package/skill-data/native-ui/SKILL.md +1080 -0
- package/skills/native-sdk/SKILL.md +33 -0
- package/src/app_runner/root.zig +740 -0
- package/src/assets/root.zig +20 -0
- package/src/automation/protocol.zig +285 -0
- package/src/automation/root.zig +13 -0
- package/src/automation/server.zig +506 -0
- package/src/automation/snapshot.zig +1202 -0
- package/src/automation/watcher.zig +165 -0
- package/src/bridge/root.zig +507 -0
- package/src/debug/root.zig +246 -0
- package/src/embed/app_exports.zig +11 -0
- package/src/embed/c_api.zig +793 -0
- package/src/embed/c_exports.zig +10 -0
- package/src/embed/chrome.zig +168 -0
- package/src/embed/conversions.zig +359 -0
- package/src/embed/host.zig +960 -0
- package/src/embed/root.zig +81 -0
- package/src/embed/tests.zig +2552 -0
- package/src/embed/types.zig +382 -0
- package/src/embed/ui_host.zig +289 -0
- package/src/extensions/root.zig +197 -0
- package/src/frontend/root.zig +48 -0
- package/src/js/root.zig +65 -0
- package/src/platform/android/NativeSdkActivity.java +1370 -0
- package/src/platform/android/android_host.c +696 -0
- package/src/platform/android/files.zig +9 -0
- package/src/platform/android/native_sdk_app.h +237 -0
- package/src/platform/ios/files.zig +8 -0
- package/src/platform/ios/native_sdk_app.h +289 -0
- package/src/platform/ios/uikit_host.m +2739 -0
- package/src/platform/linux/cef_host.cpp +599 -0
- package/src/platform/linux/gtk_host.c +5362 -0
- package/src/platform/linux/gtk_host.h +265 -0
- package/src/platform/linux/root.zig +1519 -0
- package/src/platform/macos/appkit_host.h +604 -0
- package/src/platform/macos/appkit_host.m +10392 -0
- package/src/platform/macos/automation_host.h +14 -0
- package/src/platform/macos/automation_host.m +12 -0
- package/src/platform/macos/cef_host.mm +3028 -0
- package/src/platform/macos/root.zig +2260 -0
- package/src/platform/null_platform.zig +2232 -0
- package/src/platform/null_platform_tests.zig +670 -0
- package/src/platform/policy_values.zig +14 -0
- package/src/platform/root.zig +181 -0
- package/src/platform/types.zig +2681 -0
- package/src/platform/windows/cef_host.cpp +3 -0
- package/src/platform/windows/root.zig +1521 -0
- package/src/platform/windows/webview2_host.cpp +6230 -0
- package/src/primitives/app_dirs/root.zig +440 -0
- package/src/primitives/app_manifest/root.zig +109 -0
- package/src/primitives/app_manifest/tests.zig +758 -0
- package/src/primitives/app_manifest/types.zig +587 -0
- package/src/primitives/app_manifest/validation.zig +828 -0
- package/src/primitives/assets/root.zig +520 -0
- package/src/primitives/canvas/a11y_audit.zig +390 -0
- package/src/primitives/canvas/a11y_audit_tests.zig +225 -0
- package/src/primitives/canvas/app_icon.zig +1590 -0
- package/src/primitives/canvas/chart.zig +392 -0
- package/src/primitives/canvas/chart_tests.zig +751 -0
- package/src/primitives/canvas/commands.zig +446 -0
- package/src/primitives/canvas/drawing.zig +309 -0
- package/src/primitives/canvas/equality.zig +316 -0
- package/src/primitives/canvas/events.zig +696 -0
- package/src/primitives/canvas/font_coverage.zig +118 -0
- package/src/primitives/canvas/font_ttf.zig +510 -0
- package/src/primitives/canvas/font_ttf_tests.zig +280 -0
- package/src/primitives/canvas/fonts/Geist-Regular.ttf +0 -0
- package/src/primitives/canvas/fonts/GeistMono-Regular.ttf +0 -0
- package/src/primitives/canvas/frame.zig +679 -0
- package/src/primitives/canvas/frame_metrics.zig +462 -0
- package/src/primitives/canvas/gpu.zig +639 -0
- package/src/primitives/canvas/hash.zig +112 -0
- package/src/primitives/canvas/icons/alert.svg +1 -0
- package/src/primitives/canvas/icons/archive.svg +1 -0
- package/src/primitives/canvas/icons/arrow-down.svg +1 -0
- package/src/primitives/canvas/icons/arrow-right.svg +1 -0
- package/src/primitives/canvas/icons/arrow-up.svg +1 -0
- package/src/primitives/canvas/icons/check-circle.svg +1 -0
- package/src/primitives/canvas/icons/check.svg +1 -0
- package/src/primitives/canvas/icons/chevron-down.svg +1 -0
- package/src/primitives/canvas/icons/chevron-left.svg +1 -0
- package/src/primitives/canvas/icons/chevron-right.svg +1 -0
- package/src/primitives/canvas/icons/chevron-up.svg +1 -0
- package/src/primitives/canvas/icons/circle-dot.svg +1 -0
- package/src/primitives/canvas/icons/clock.svg +1 -0
- package/src/primitives/canvas/icons/copy.svg +1 -0
- package/src/primitives/canvas/icons/download.svg +1 -0
- package/src/primitives/canvas/icons/edit.svg +1 -0
- package/src/primitives/canvas/icons/ellipsis.svg +1 -0
- package/src/primitives/canvas/icons/external-link.svg +1 -0
- package/src/primitives/canvas/icons/eye.svg +1 -0
- package/src/primitives/canvas/icons/file-text.svg +1 -0
- package/src/primitives/canvas/icons/folder-open.svg +1 -0
- package/src/primitives/canvas/icons/folder.svg +1 -0
- package/src/primitives/canvas/icons/git-branch.svg +1 -0
- package/src/primitives/canvas/icons/git-merge.svg +1 -0
- package/src/primitives/canvas/icons/git-pull-request.svg +1 -0
- package/src/primitives/canvas/icons/info.svg +1 -0
- package/src/primitives/canvas/icons/menu.svg +1 -0
- package/src/primitives/canvas/icons/missing.svg +1 -0
- package/src/primitives/canvas/icons/moon.svg +1 -0
- package/src/primitives/canvas/icons/music.svg +1 -0
- package/src/primitives/canvas/icons/panel-left.svg +1 -0
- package/src/primitives/canvas/icons/panel-right.svg +1 -0
- package/src/primitives/canvas/icons/pause.svg +1 -0
- package/src/primitives/canvas/icons/play.svg +1 -0
- package/src/primitives/canvas/icons/plus.svg +1 -0
- package/src/primitives/canvas/icons/refresh-cw.svg +1 -0
- package/src/primitives/canvas/icons/repeat.svg +1 -0
- package/src/primitives/canvas/icons/save.svg +1 -0
- package/src/primitives/canvas/icons/search.svg +1 -0
- package/src/primitives/canvas/icons/send.svg +1 -0
- package/src/primitives/canvas/icons/settings.svg +1 -0
- package/src/primitives/canvas/icons/shuffle.svg +1 -0
- package/src/primitives/canvas/icons/skip-back.svg +1 -0
- package/src/primitives/canvas/icons/skip-forward.svg +1 -0
- package/src/primitives/canvas/icons/sun.svg +1 -0
- package/src/primitives/canvas/icons/terminal.svg +1 -0
- package/src/primitives/canvas/icons/trash.svg +1 -0
- package/src/primitives/canvas/icons/volume.svg +1 -0
- package/src/primitives/canvas/icons/wrench.svg +1 -0
- package/src/primitives/canvas/icons/x-circle.svg +1 -0
- package/src/primitives/canvas/icons/x.svg +1 -0
- package/src/primitives/canvas/icons.zig +249 -0
- package/src/primitives/canvas/layout_audit.zig +744 -0
- package/src/primitives/canvas/layout_audit_tests.zig +426 -0
- package/src/primitives/canvas/markdown.zig +1031 -0
- package/src/primitives/canvas/markdown_hostile_tests.zig +471 -0
- package/src/primitives/canvas/markdown_tests.zig +538 -0
- package/src/primitives/canvas/plan_key_index.zig +120 -0
- package/src/primitives/canvas/png.zig +355 -0
- package/src/primitives/canvas/reference.zig +1457 -0
- package/src/primitives/canvas/reference_blur.zig +104 -0
- package/src/primitives/canvas/reference_memo.zig +322 -0
- package/src/primitives/canvas/reference_paths.zig +184 -0
- package/src/primitives/canvas/reference_tests.zig +1650 -0
- package/src/primitives/canvas/render.zig +747 -0
- package/src/primitives/canvas/render_effects.zig +255 -0
- package/src/primitives/canvas/render_fingerprints.zig +256 -0
- package/src/primitives/canvas/render_generic_resources.zig +376 -0
- package/src/primitives/canvas/render_images.zig +247 -0
- package/src/primitives/canvas/render_layers.zig +260 -0
- package/src/primitives/canvas/render_paths.zig +347 -0
- package/src/primitives/canvas/render_resources.zig +51 -0
- package/src/primitives/canvas/render_tests.zig +3186 -0
- package/src/primitives/canvas/root.zig +744 -0
- package/src/primitives/canvas/serialization.zig +1528 -0
- package/src/primitives/canvas/svg_icon.zig +636 -0
- package/src/primitives/canvas/svg_icon_tests.zig +312 -0
- package/src/primitives/canvas/test_support.zig +422 -0
- package/src/primitives/canvas/testdata/markdown_document.md +83 -0
- package/src/primitives/canvas/tests.zig +30 -0
- package/src/primitives/canvas/text.zig +82 -0
- package/src/primitives/canvas/text_atlas.zig +408 -0
- package/src/primitives/canvas/text_batch_tests.zig +431 -0
- package/src/primitives/canvas/text_interaction.zig +615 -0
- package/src/primitives/canvas/text_layout.zig +1069 -0
- package/src/primitives/canvas/text_layout_cache.zig +281 -0
- package/src/primitives/canvas/text_layout_hash.zig +113 -0
- package/src/primitives/canvas/text_layout_types.zig +128 -0
- package/src/primitives/canvas/text_measure_cache.zig +279 -0
- package/src/primitives/canvas/text_metrics.zig +309 -0
- package/src/primitives/canvas/text_metrics_tests.zig +262 -0
- package/src/primitives/canvas/text_span_tests.zig +608 -0
- package/src/primitives/canvas/text_spans.zig +1010 -0
- package/src/primitives/canvas/text_tests.zig +1949 -0
- package/src/primitives/canvas/themes/geist.zig +470 -0
- package/src/primitives/canvas/tokens.zig +1522 -0
- package/src/primitives/canvas/ui.zig +2686 -0
- package/src/primitives/canvas/ui_markup.zig +3791 -0
- package/src/primitives/canvas/ui_markup_binary.zig +522 -0
- package/src/primitives/canvas/ui_markup_binary_tests.zig +591 -0
- package/src/primitives/canvas/ui_markup_compiled.zig +2565 -0
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +1669 -0
- package/src/primitives/canvas/ui_markup_contract.zig +1620 -0
- package/src/primitives/canvas/ui_markup_contract_tests.zig +953 -0
- package/src/primitives/canvas/ui_markup_edit.zig +416 -0
- package/src/primitives/canvas/ui_markup_edit_tests.zig +341 -0
- package/src/primitives/canvas/ui_markup_expr.zig +1152 -0
- package/src/primitives/canvas/ui_markup_expr_tests.zig +779 -0
- package/src/primitives/canvas/ui_markup_huge_model_tests.zig +505 -0
- package/src/primitives/canvas/ui_markup_reflect.zig +127 -0
- package/src/primitives/canvas/ui_markup_tests.zig +1545 -0
- package/src/primitives/canvas/ui_markup_view.zig +2352 -0
- package/src/primitives/canvas/ui_markup_view_tests.zig +3709 -0
- package/src/primitives/canvas/ui_provenance.zig +96 -0
- package/src/primitives/canvas/ui_provenance_tests.zig +186 -0
- package/src/primitives/canvas/ui_schema.zig +825 -0
- package/src/primitives/canvas/ui_schema_tests.zig +128 -0
- package/src/primitives/canvas/ui_tests.zig +1432 -0
- package/src/primitives/canvas/vector.zig +919 -0
- package/src/primitives/canvas/vector_tests.zig +547 -0
- package/src/primitives/canvas/virtual_extent_tests.zig +317 -0
- package/src/primitives/canvas/virtual_extents.zig +540 -0
- package/src/primitives/canvas/widget_access.zig +208 -0
- package/src/primitives/canvas/widget_anchored_tests.zig +264 -0
- package/src/primitives/canvas/widget_builtin_tests.zig +3160 -0
- package/src/primitives/canvas/widget_invalidation.zig +748 -0
- package/src/primitives/canvas/widget_layout.zig +2055 -0
- package/src/primitives/canvas/widget_layout_tests.zig +2691 -0
- package/src/primitives/canvas/widget_metrics.zig +228 -0
- package/src/primitives/canvas/widget_render.zig +2534 -0
- package/src/primitives/canvas/widget_render_controls.zig +1563 -0
- package/src/primitives/canvas/widget_render_scroll.zig +136 -0
- package/src/primitives/canvas/widget_render_style.zig +626 -0
- package/src/primitives/canvas/widget_render_surfaces.zig +794 -0
- package/src/primitives/canvas/widget_routing.zig +475 -0
- package/src/primitives/canvas/widget_runtime.zig +307 -0
- package/src/primitives/canvas/widget_runtime_tests.zig +3015 -0
- package/src/primitives/canvas/widget_semantics.zig +480 -0
- package/src/primitives/canvas/widget_semantics_tests.zig +2129 -0
- package/src/primitives/canvas/widget_tests.zig +8 -0
- package/src/primitives/canvas/widget_text_input.zig +351 -0
- package/src/primitives/canvas/widget_text_select.zig +147 -0
- package/src/primitives/canvas/widget_tree.zig +232 -0
- package/src/primitives/canvas/widgets.zig +1319 -0
- package/src/primitives/diagnostics/root.zig +445 -0
- package/src/primitives/geometry/root.zig +889 -0
- package/src/primitives/json/root.zig +272 -0
- package/src/primitives/platform_info/root.zig +450 -0
- package/src/primitives/trace/root.zig +569 -0
- package/src/root.zig +165 -0
- package/src/runtime/api.zig +431 -0
- package/src/runtime/async_bridge.zig +49 -0
- package/src/runtime/automation_commands.zig +686 -0
- package/src/runtime/automation_liveness_tests.zig +140 -0
- package/src/runtime/automation_snapshot.zig +246 -0
- package/src/runtime/automation_widget_dispatch.zig +617 -0
- package/src/runtime/bridge_dispatch_tests.zig +202 -0
- package/src/runtime/bridge_payload.zig +194 -0
- package/src/runtime/bridge_permission_tests.zig +551 -0
- package/src/runtime/bridge_responses.zig +414 -0
- package/src/runtime/builtin_bridge.zig +554 -0
- package/src/runtime/canvas_budget_edge_tests.zig +415 -0
- package/src/runtime/canvas_font_tests.zig +410 -0
- package/src/runtime/canvas_fonts.zig +229 -0
- package/src/runtime/canvas_frame.zig +1734 -0
- package/src/runtime/canvas_frame_animation_tests.zig +609 -0
- package/src/runtime/canvas_frame_cache_tests.zig +333 -0
- package/src/runtime/canvas_frame_helpers.zig +414 -0
- package/src/runtime/canvas_frame_invalidation_tests.zig +544 -0
- package/src/runtime/canvas_frame_packet_tests.zig +1353 -0
- package/src/runtime/canvas_frame_patch_tests.zig +1051 -0
- package/src/runtime/canvas_frame_retained_tests.zig +753 -0
- package/src/runtime/canvas_frame_tests.zig +9 -0
- package/src/runtime/canvas_frame_text_layout_budget_tests.zig +149 -0
- package/src/runtime/canvas_image_tests.zig +362 -0
- package/src/runtime/canvas_images.zig +224 -0
- package/src/runtime/canvas_limits.zig +317 -0
- package/src/runtime/canvas_screenshot_tests.zig +289 -0
- package/src/runtime/canvas_widget_accessibility_tests.zig +1494 -0
- package/src/runtime/canvas_widget_anchored_tests.zig +678 -0
- package/src/runtime/canvas_widget_chart_tests.zig +249 -0
- package/src/runtime/canvas_widget_clipboard_tests.zig +399 -0
- package/src/runtime/canvas_widget_context_menu.zig +318 -0
- package/src/runtime/canvas_widget_context_menu_tests.zig +462 -0
- package/src/runtime/canvas_widget_control_tests.zig +2164 -0
- package/src/runtime/canvas_widget_disclosure_tests.zig +440 -0
- package/src/runtime/canvas_widget_display.zig +677 -0
- package/src/runtime/canvas_widget_event_tests.zig +1779 -0
- package/src/runtime/canvas_widget_events.zig +1098 -0
- package/src/runtime/canvas_widget_floating_tests.zig +695 -0
- package/src/runtime/canvas_widget_layout_tests.zig +26 -0
- package/src/runtime/canvas_widget_runtime.zig +1335 -0
- package/src/runtime/canvas_widget_scroll_driver_tests.zig +582 -0
- package/src/runtime/canvas_widget_scroll_drivers.zig +202 -0
- package/src/runtime/canvas_widget_scroll_tests.zig +1549 -0
- package/src/runtime/canvas_widget_semantics_tests.zig +810 -0
- package/src/runtime/canvas_widget_split_tree_tests.zig +1031 -0
- package/src/runtime/canvas_widget_state.zig +798 -0
- package/src/runtime/canvas_widget_text_tests.zig +2104 -0
- package/src/runtime/canvas_widget_window_drag_tests.zig +284 -0
- package/src/runtime/clock.zig +231 -0
- package/src/runtime/core.zig +927 -0
- package/src/runtime/effects.zig +4197 -0
- package/src/runtime/effects_audio_tests.zig +690 -0
- package/src/runtime/effects_clipboard_tests.zig +317 -0
- package/src/runtime/effects_fetch_tests.zig +1031 -0
- package/src/runtime/effects_file_tests.zig +407 -0
- package/src/runtime/effects_tests.zig +1251 -0
- package/src/runtime/flow.zig +1175 -0
- package/src/runtime/frame_profile.zig +221 -0
- package/src/runtime/gpu_surface_events.zig +639 -0
- package/src/runtime/launch_timing.zig +59 -0
- package/src/runtime/markdown_app_tests.zig +224 -0
- package/src/runtime/native_command_event_tests.zig +431 -0
- package/src/runtime/platform_bridge_tests.zig +8 -0
- package/src/runtime/platform_config_tests.zig +392 -0
- package/src/runtime/root.zig +150 -0
- package/src/runtime/runtime_event_tests.zig +1079 -0
- package/src/runtime/session_journal.zig +1522 -0
- package/src/runtime/session_record.zig +332 -0
- package/src/runtime/session_replay.zig +274 -0
- package/src/runtime/session_state.zig +30 -0
- package/src/runtime/session_tests.zig +399 -0
- package/src/runtime/shell_layout.zig +472 -0
- package/src/runtime/shell_layout_tests.zig +1246 -0
- package/src/runtime/shell_view_tests.zig +604 -0
- package/src/runtime/state.zig +110 -0
- package/src/runtime/system_services.zig +392 -0
- package/src/runtime/test_support.zig +79 -0
- package/src/runtime/tests.zig +30 -0
- package/src/runtime/ui_app.zig +3290 -0
- package/src/runtime/ui_app_huge_model_tests.zig +351 -0
- package/src/runtime/ui_app_provenance.zig +370 -0
- package/src/runtime/ui_app_tests.zig +3254 -0
- package/src/runtime/ui_app_virtual_variable_tests.zig +485 -0
- package/src/runtime/ui_app_window_tests.zig +442 -0
- package/src/runtime/validation.zig +206 -0
- package/src/runtime/view.zig +908 -0
- package/src/runtime/view_canvas.zig +850 -0
- package/src/runtime/view_widget_control.zig +433 -0
- package/src/runtime/view_widget_scroll.zig +360 -0
- package/src/runtime/view_widget_text.zig +275 -0
- package/src/runtime/view_widget_tree.zig +843 -0
- package/src/runtime/webview_view_bridge_tests.zig +664 -0
- package/src/runtime/widget_bridge.zig +231 -0
- package/src/runtime/window_command_bridge_tests.zig +403 -0
- package/src/runtime/window_storage.zig +255 -0
- package/src/runtime/window_view_runtime.zig +727 -0
- package/src/runtime/window_views.zig +334 -0
- package/src/security/root.zig +118 -0
- package/src/tooling/android.zig +1172 -0
- package/src/tooling/assets.zig +128 -0
- package/src/tooling/buildgraph.zig +379 -0
- package/src/tooling/cef.zig +671 -0
- package/src/tooling/codesign.zig +172 -0
- package/src/tooling/components/identity_tests.zig +185 -0
- package/src/tooling/components/stepper.zig +113 -0
- package/src/tooling/components/timeline.native +27 -0
- package/src/tooling/components/timeline_item.zig +131 -0
- package/src/tooling/default_icon.icns +0 -0
- package/src/tooling/default_icon.png +0 -0
- package/src/tooling/dev.zig +172 -0
- package/src/tooling/doctor.zig +349 -0
- package/src/tooling/eject_components.zig +170 -0
- package/src/tooling/embedlib.zig +290 -0
- package/src/tooling/ios.zig +528 -0
- package/src/tooling/manifest.zig +1939 -0
- package/src/tooling/package.zig +2388 -0
- package/src/tooling/process_tree.zig +114 -0
- package/src/tooling/raw_manifest.zig +193 -0
- package/src/tooling/root.zig +22 -0
- package/src/tooling/templates.zig +3191 -0
- package/src/tooling/toolchain.zig +371 -0
- package/src/tooling/verbs.zig +204 -0
- package/src/tooling/web_engine.zig +135 -0
- package/src/tooling/xcodeproj.zig +462 -0
- package/src/window_state/root.zig +507 -0
- package/index.js +0 -2
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
const std = @import("std");
|
|
2
|
+
const geometry = @import("geometry");
|
|
3
|
+
const json = @import("json");
|
|
4
|
+
|
|
5
|
+
pub const CanvasFrameBudget = struct {
|
|
6
|
+
max_commands: usize = 0,
|
|
7
|
+
max_batches: usize = 0,
|
|
8
|
+
max_encoder_commands: usize = 0,
|
|
9
|
+
max_pipelines: usize = 0,
|
|
10
|
+
max_pipeline_uploads: usize = 0,
|
|
11
|
+
max_path_geometries: usize = 0,
|
|
12
|
+
max_path_geometry_uploads: usize = 0,
|
|
13
|
+
max_images: usize = 0,
|
|
14
|
+
max_image_uploads: usize = 0,
|
|
15
|
+
max_layers: usize = 0,
|
|
16
|
+
max_layer_uploads: usize = 0,
|
|
17
|
+
max_resources: usize = 0,
|
|
18
|
+
max_resource_uploads: usize = 0,
|
|
19
|
+
max_visual_effects: usize = 0,
|
|
20
|
+
max_visual_effect_uploads: usize = 0,
|
|
21
|
+
max_glyph_atlas_entries: usize = 0,
|
|
22
|
+
max_glyph_atlas_uploads: usize = 0,
|
|
23
|
+
max_glyph_atlas_evicts: usize = 0,
|
|
24
|
+
max_text_layouts: usize = 0,
|
|
25
|
+
max_text_layout_lines: usize = 0,
|
|
26
|
+
max_text_layout_uploads: usize = 0,
|
|
27
|
+
max_text_layout_evicts: usize = 0,
|
|
28
|
+
max_changes: usize = 0,
|
|
29
|
+
|
|
30
|
+
pub fn status(self: CanvasFrameBudget, diagnostics: CanvasFrameDiagnostics) CanvasFrameBudgetStatus {
|
|
31
|
+
return .{
|
|
32
|
+
.commands_over = budgetExceeded(self.max_commands, diagnostics.command_count),
|
|
33
|
+
.batches_over = budgetExceeded(self.max_batches, diagnostics.batch_count),
|
|
34
|
+
.encoder_commands_over = budgetExceeded(self.max_encoder_commands, diagnostics.encoder_command_count),
|
|
35
|
+
.pipelines_over = budgetExceeded(self.max_pipelines, diagnostics.pipeline_count),
|
|
36
|
+
.pipeline_uploads_over = budgetExceeded(self.max_pipeline_uploads, diagnostics.pipeline_upload_count),
|
|
37
|
+
.path_geometries_over = budgetExceeded(self.max_path_geometries, diagnostics.path_geometry_count),
|
|
38
|
+
.path_geometry_uploads_over = budgetExceeded(self.max_path_geometry_uploads, diagnostics.path_geometry_upload_count),
|
|
39
|
+
.images_over = budgetExceeded(self.max_images, diagnostics.image_count),
|
|
40
|
+
.image_uploads_over = budgetExceeded(self.max_image_uploads, diagnostics.image_upload_count),
|
|
41
|
+
.layers_over = budgetExceeded(self.max_layers, diagnostics.layer_count),
|
|
42
|
+
.layer_uploads_over = budgetExceeded(self.max_layer_uploads, diagnostics.layer_upload_count),
|
|
43
|
+
.resources_over = budgetExceeded(self.max_resources, diagnostics.resource_count),
|
|
44
|
+
.resource_uploads_over = budgetExceeded(self.max_resource_uploads, diagnostics.resource_upload_count),
|
|
45
|
+
.visual_effects_over = budgetExceeded(self.max_visual_effects, diagnostics.visual_effect_count),
|
|
46
|
+
.visual_effect_uploads_over = budgetExceeded(self.max_visual_effect_uploads, diagnostics.visual_effect_upload_count),
|
|
47
|
+
.glyph_atlas_entries_over = budgetExceeded(self.max_glyph_atlas_entries, diagnostics.glyph_atlas_entry_count),
|
|
48
|
+
.glyph_atlas_uploads_over = budgetExceeded(self.max_glyph_atlas_uploads, diagnostics.glyph_atlas_upload_count),
|
|
49
|
+
.glyph_atlas_evicts_over = budgetExceeded(self.max_glyph_atlas_evicts, diagnostics.glyph_atlas_evict_count),
|
|
50
|
+
.text_layouts_over = budgetExceeded(self.max_text_layouts, diagnostics.text_layout_count),
|
|
51
|
+
.text_layout_lines_over = budgetExceeded(self.max_text_layout_lines, diagnostics.text_layout_line_count),
|
|
52
|
+
.text_layout_uploads_over = budgetExceeded(self.max_text_layout_uploads, diagnostics.text_layout_upload_count),
|
|
53
|
+
.text_layout_evicts_over = budgetExceeded(self.max_text_layout_evicts, diagnostics.text_layout_evict_count),
|
|
54
|
+
.changes_over = budgetExceeded(self.max_changes, diagnostics.change_count),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
pub const CanvasFrameBudgetStatus = struct {
|
|
60
|
+
commands_over: bool = false,
|
|
61
|
+
batches_over: bool = false,
|
|
62
|
+
encoder_commands_over: bool = false,
|
|
63
|
+
pipelines_over: bool = false,
|
|
64
|
+
pipeline_uploads_over: bool = false,
|
|
65
|
+
path_geometries_over: bool = false,
|
|
66
|
+
path_geometry_uploads_over: bool = false,
|
|
67
|
+
images_over: bool = false,
|
|
68
|
+
image_uploads_over: bool = false,
|
|
69
|
+
layers_over: bool = false,
|
|
70
|
+
layer_uploads_over: bool = false,
|
|
71
|
+
resources_over: bool = false,
|
|
72
|
+
resource_uploads_over: bool = false,
|
|
73
|
+
visual_effects_over: bool = false,
|
|
74
|
+
visual_effect_uploads_over: bool = false,
|
|
75
|
+
glyph_atlas_entries_over: bool = false,
|
|
76
|
+
glyph_atlas_uploads_over: bool = false,
|
|
77
|
+
glyph_atlas_evicts_over: bool = false,
|
|
78
|
+
text_layouts_over: bool = false,
|
|
79
|
+
text_layout_lines_over: bool = false,
|
|
80
|
+
text_layout_uploads_over: bool = false,
|
|
81
|
+
text_layout_evicts_over: bool = false,
|
|
82
|
+
changes_over: bool = false,
|
|
83
|
+
|
|
84
|
+
pub fn ok(self: CanvasFrameBudgetStatus) bool {
|
|
85
|
+
return self.exceededCount() == 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
pub fn exceededCount(self: CanvasFrameBudgetStatus) usize {
|
|
89
|
+
var count: usize = 0;
|
|
90
|
+
if (self.commands_over) count += 1;
|
|
91
|
+
if (self.batches_over) count += 1;
|
|
92
|
+
if (self.encoder_commands_over) count += 1;
|
|
93
|
+
if (self.pipelines_over) count += 1;
|
|
94
|
+
if (self.pipeline_uploads_over) count += 1;
|
|
95
|
+
if (self.path_geometries_over) count += 1;
|
|
96
|
+
if (self.path_geometry_uploads_over) count += 1;
|
|
97
|
+
if (self.images_over) count += 1;
|
|
98
|
+
if (self.image_uploads_over) count += 1;
|
|
99
|
+
if (self.layers_over) count += 1;
|
|
100
|
+
if (self.layer_uploads_over) count += 1;
|
|
101
|
+
if (self.resources_over) count += 1;
|
|
102
|
+
if (self.resource_uploads_over) count += 1;
|
|
103
|
+
if (self.visual_effects_over) count += 1;
|
|
104
|
+
if (self.visual_effect_uploads_over) count += 1;
|
|
105
|
+
if (self.glyph_atlas_entries_over) count += 1;
|
|
106
|
+
if (self.glyph_atlas_uploads_over) count += 1;
|
|
107
|
+
if (self.glyph_atlas_evicts_over) count += 1;
|
|
108
|
+
if (self.text_layouts_over) count += 1;
|
|
109
|
+
if (self.text_layout_lines_over) count += 1;
|
|
110
|
+
if (self.text_layout_uploads_over) count += 1;
|
|
111
|
+
if (self.text_layout_evicts_over) count += 1;
|
|
112
|
+
if (self.changes_over) count += 1;
|
|
113
|
+
return count;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
pub const CanvasFrameDiagnostics = struct {
|
|
118
|
+
frame_index: u64 = 0,
|
|
119
|
+
command_count: usize = 0,
|
|
120
|
+
batch_count: usize = 0,
|
|
121
|
+
encoder_command_count: usize = 0,
|
|
122
|
+
encoder_cache_action_count: usize = 0,
|
|
123
|
+
encoder_bind_pipeline_count: usize = 0,
|
|
124
|
+
encoder_draw_batch_count: usize = 0,
|
|
125
|
+
pipeline_count: usize = 0,
|
|
126
|
+
pipeline_upload_count: usize = 0,
|
|
127
|
+
pipeline_retain_count: usize = 0,
|
|
128
|
+
pipeline_evict_count: usize = 0,
|
|
129
|
+
path_geometry_count: usize = 0,
|
|
130
|
+
path_geometry_vertex_count: usize = 0,
|
|
131
|
+
path_geometry_index_count: usize = 0,
|
|
132
|
+
path_geometry_upload_count: usize = 0,
|
|
133
|
+
path_geometry_retain_count: usize = 0,
|
|
134
|
+
path_geometry_evict_count: usize = 0,
|
|
135
|
+
image_count: usize = 0,
|
|
136
|
+
image_upload_count: usize = 0,
|
|
137
|
+
image_retain_count: usize = 0,
|
|
138
|
+
image_evict_count: usize = 0,
|
|
139
|
+
layer_count: usize = 0,
|
|
140
|
+
layer_opacity_count: usize = 0,
|
|
141
|
+
layer_clip_count: usize = 0,
|
|
142
|
+
layer_transform_count: usize = 0,
|
|
143
|
+
layer_upload_count: usize = 0,
|
|
144
|
+
layer_retain_count: usize = 0,
|
|
145
|
+
layer_evict_count: usize = 0,
|
|
146
|
+
resource_count: usize = 0,
|
|
147
|
+
resource_upload_count: usize = 0,
|
|
148
|
+
resource_retain_count: usize = 0,
|
|
149
|
+
resource_evict_count: usize = 0,
|
|
150
|
+
visual_effect_count: usize = 0,
|
|
151
|
+
visual_effect_shadow_count: usize = 0,
|
|
152
|
+
visual_effect_blur_count: usize = 0,
|
|
153
|
+
visual_effect_upload_count: usize = 0,
|
|
154
|
+
visual_effect_retain_count: usize = 0,
|
|
155
|
+
visual_effect_evict_count: usize = 0,
|
|
156
|
+
glyph_atlas_entry_count: usize = 0,
|
|
157
|
+
glyph_atlas_upload_count: usize = 0,
|
|
158
|
+
glyph_atlas_retain_count: usize = 0,
|
|
159
|
+
glyph_atlas_evict_count: usize = 0,
|
|
160
|
+
text_layout_count: usize = 0,
|
|
161
|
+
text_layout_line_count: usize = 0,
|
|
162
|
+
text_layout_upload_count: usize = 0,
|
|
163
|
+
text_layout_retain_count: usize = 0,
|
|
164
|
+
text_layout_evict_count: usize = 0,
|
|
165
|
+
gpu_packet_command_count: usize = 0,
|
|
166
|
+
gpu_packet_cache_action_count: usize = 0,
|
|
167
|
+
gpu_packet_cached_resource_command_count: usize = 0,
|
|
168
|
+
gpu_packet_unsupported_command_count: usize = 0,
|
|
169
|
+
gpu_packet_representable: bool = true,
|
|
170
|
+
change_count: usize = 0,
|
|
171
|
+
full_repaint: bool = false,
|
|
172
|
+
requires_render: bool = false,
|
|
173
|
+
dirty_bounds: ?geometry.RectF = null,
|
|
174
|
+
budget: CanvasFrameBudget = .{},
|
|
175
|
+
budget_status: CanvasFrameBudgetStatus = .{},
|
|
176
|
+
|
|
177
|
+
pub fn budgetOk(self: CanvasFrameDiagnostics) bool {
|
|
178
|
+
return self.budget_status.ok();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
pub fn writeJson(self: CanvasFrameDiagnostics, writer: anytype) !void {
|
|
182
|
+
try writer.print(
|
|
183
|
+
"{{\"frameIndex\":{d},\"commandCount\":{d},\"batchCount\":{d},\"encoderCommandCount\":{d},\"encoderCacheActionCount\":{d},\"encoderBindPipelineCount\":{d},\"encoderDrawBatchCount\":{d},\"pipelineCount\":{d},\"pipelineUploadCount\":{d},\"pipelineRetainCount\":{d},\"pipelineEvictCount\":{d},\"pathGeometryCount\":{d},\"pathGeometryVertexCount\":{d},\"pathGeometryIndexCount\":{d},\"pathGeometryUploadCount\":{d},\"pathGeometryRetainCount\":{d},\"pathGeometryEvictCount\":{d},\"layerCount\":{d},\"layerOpacityCount\":{d},\"layerClipCount\":{d},\"layerTransformCount\":{d},\"layerUploadCount\":{d},\"layerRetainCount\":{d},\"layerEvictCount\":{d}",
|
|
184
|
+
.{
|
|
185
|
+
self.frame_index,
|
|
186
|
+
self.command_count,
|
|
187
|
+
self.batch_count,
|
|
188
|
+
self.encoder_command_count,
|
|
189
|
+
self.encoder_cache_action_count,
|
|
190
|
+
self.encoder_bind_pipeline_count,
|
|
191
|
+
self.encoder_draw_batch_count,
|
|
192
|
+
self.pipeline_count,
|
|
193
|
+
self.pipeline_upload_count,
|
|
194
|
+
self.pipeline_retain_count,
|
|
195
|
+
self.pipeline_evict_count,
|
|
196
|
+
self.path_geometry_count,
|
|
197
|
+
self.path_geometry_vertex_count,
|
|
198
|
+
self.path_geometry_index_count,
|
|
199
|
+
self.path_geometry_upload_count,
|
|
200
|
+
self.path_geometry_retain_count,
|
|
201
|
+
self.path_geometry_evict_count,
|
|
202
|
+
self.layer_count,
|
|
203
|
+
self.layer_opacity_count,
|
|
204
|
+
self.layer_clip_count,
|
|
205
|
+
self.layer_transform_count,
|
|
206
|
+
self.layer_upload_count,
|
|
207
|
+
self.layer_retain_count,
|
|
208
|
+
self.layer_evict_count,
|
|
209
|
+
},
|
|
210
|
+
);
|
|
211
|
+
try writer.print(
|
|
212
|
+
",\"imageCount\":{d},\"imageUploadCount\":{d},\"imageRetainCount\":{d},\"imageEvictCount\":{d},\"resourceCount\":{d},\"resourceUploadCount\":{d},\"resourceRetainCount\":{d},\"resourceEvictCount\":{d},\"visualEffectCount\":{d},\"visualEffectShadowCount\":{d},\"visualEffectBlurCount\":{d},\"visualEffectUploadCount\":{d},\"visualEffectRetainCount\":{d},\"visualEffectEvictCount\":{d},\"glyphAtlasEntryCount\":{d},\"glyphAtlasUploadCount\":{d},\"glyphAtlasRetainCount\":{d},\"glyphAtlasEvictCount\":{d},\"textLayoutCount\":{d},\"textLayoutLineCount\":{d},\"textLayoutUploadCount\":{d},\"textLayoutRetainCount\":{d},\"textLayoutEvictCount\":{d},\"gpuPacketCommandCount\":{d},\"gpuPacketCacheActionCount\":{d},\"gpuPacketCachedResourceCommandCount\":{d},\"gpuPacketUnsupportedCommandCount\":{d}",
|
|
213
|
+
.{
|
|
214
|
+
self.image_count,
|
|
215
|
+
self.image_upload_count,
|
|
216
|
+
self.image_retain_count,
|
|
217
|
+
self.image_evict_count,
|
|
218
|
+
self.resource_count,
|
|
219
|
+
self.resource_upload_count,
|
|
220
|
+
self.resource_retain_count,
|
|
221
|
+
self.resource_evict_count,
|
|
222
|
+
self.visual_effect_count,
|
|
223
|
+
self.visual_effect_shadow_count,
|
|
224
|
+
self.visual_effect_blur_count,
|
|
225
|
+
self.visual_effect_upload_count,
|
|
226
|
+
self.visual_effect_retain_count,
|
|
227
|
+
self.visual_effect_evict_count,
|
|
228
|
+
self.glyph_atlas_entry_count,
|
|
229
|
+
self.glyph_atlas_upload_count,
|
|
230
|
+
self.glyph_atlas_retain_count,
|
|
231
|
+
self.glyph_atlas_evict_count,
|
|
232
|
+
self.text_layout_count,
|
|
233
|
+
self.text_layout_line_count,
|
|
234
|
+
self.text_layout_upload_count,
|
|
235
|
+
self.text_layout_retain_count,
|
|
236
|
+
self.text_layout_evict_count,
|
|
237
|
+
self.gpu_packet_command_count,
|
|
238
|
+
self.gpu_packet_cache_action_count,
|
|
239
|
+
self.gpu_packet_cached_resource_command_count,
|
|
240
|
+
self.gpu_packet_unsupported_command_count,
|
|
241
|
+
},
|
|
242
|
+
);
|
|
243
|
+
try writer.writeAll(",\"gpuPacketRepresentable\":");
|
|
244
|
+
try writer.writeAll(if (self.gpu_packet_representable) "true" else "false");
|
|
245
|
+
try writer.print(",\"changeCount\":{d},\"budgetExceededCount\":{d}", .{ self.change_count, self.budget_status.exceededCount() });
|
|
246
|
+
try writer.writeAll(",\"budgetOk\":");
|
|
247
|
+
try writer.writeAll(if (self.budgetOk()) "true" else "false");
|
|
248
|
+
try writer.writeAll(",\"fullRepaint\":");
|
|
249
|
+
try writer.writeAll(if (self.full_repaint) "true" else "false");
|
|
250
|
+
try writer.writeAll(",\"requiresRender\":");
|
|
251
|
+
try writer.writeAll(if (self.requires_render) "true" else "false");
|
|
252
|
+
try writer.writeAll(",\"dirtyBounds\":");
|
|
253
|
+
if (self.dirty_bounds) |bounds| {
|
|
254
|
+
try writeRectJson(bounds, writer);
|
|
255
|
+
} else {
|
|
256
|
+
try writer.writeAll("null");
|
|
257
|
+
}
|
|
258
|
+
try writer.writeByte('}');
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
pub const CanvasFrameProfileRisk = enum {
|
|
263
|
+
idle,
|
|
264
|
+
low,
|
|
265
|
+
moderate,
|
|
266
|
+
high,
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
pub const CanvasFrameProfile = struct {
|
|
270
|
+
frame_index: u64 = 0,
|
|
271
|
+
requires_render: bool = false,
|
|
272
|
+
full_repaint: bool = false,
|
|
273
|
+
dirty_bounds: ?geometry.RectF = null,
|
|
274
|
+
surface_area: f32 = 0,
|
|
275
|
+
dirty_area: f32 = 0,
|
|
276
|
+
dirty_ratio: f32 = 0,
|
|
277
|
+
command_count: usize = 0,
|
|
278
|
+
batch_count: usize = 0,
|
|
279
|
+
encoder_command_count: usize = 0,
|
|
280
|
+
cache_action_count: usize = 0,
|
|
281
|
+
cache_upload_count: usize = 0,
|
|
282
|
+
cache_retain_count: usize = 0,
|
|
283
|
+
cache_evict_count: usize = 0,
|
|
284
|
+
path_geometry_vertex_count: usize = 0,
|
|
285
|
+
path_geometry_index_count: usize = 0,
|
|
286
|
+
image_count: usize = 0,
|
|
287
|
+
layer_count: usize = 0,
|
|
288
|
+
visual_effect_count: usize = 0,
|
|
289
|
+
glyph_atlas_entry_count: usize = 0,
|
|
290
|
+
text_layout_line_count: usize = 0,
|
|
291
|
+
work_units: usize = 0,
|
|
292
|
+
risk: CanvasFrameProfileRisk = .idle,
|
|
293
|
+
|
|
294
|
+
pub fn writeJson(self: CanvasFrameProfile, writer: anytype) !void {
|
|
295
|
+
try writer.print(
|
|
296
|
+
"{{\"frameIndex\":{d},\"requiresRender\":{},\"fullRepaint\":{},\"dirtyBounds\":",
|
|
297
|
+
.{ self.frame_index, self.requires_render, self.full_repaint },
|
|
298
|
+
);
|
|
299
|
+
try writeOptionalRectJson(self.dirty_bounds, writer);
|
|
300
|
+
try writer.print(
|
|
301
|
+
",\"surfaceArea\":{d},\"dirtyArea\":{d},\"dirtyRatio\":{d},\"commandCount\":{d},\"batchCount\":{d},\"encoderCommandCount\":{d},\"cacheActionCount\":{d},\"cacheUploadCount\":{d},\"cacheRetainCount\":{d},\"cacheEvictCount\":{d},\"pathGeometryVertexCount\":{d},\"pathGeometryIndexCount\":{d},\"imageCount\":{d},\"layerCount\":{d},\"visualEffectCount\":{d},\"glyphAtlasEntryCount\":{d},\"textLayoutLineCount\":{d},\"workUnits\":{d},\"risk\":",
|
|
302
|
+
.{
|
|
303
|
+
self.surface_area,
|
|
304
|
+
self.dirty_area,
|
|
305
|
+
self.dirty_ratio,
|
|
306
|
+
self.command_count,
|
|
307
|
+
self.batch_count,
|
|
308
|
+
self.encoder_command_count,
|
|
309
|
+
self.cache_action_count,
|
|
310
|
+
self.cache_upload_count,
|
|
311
|
+
self.cache_retain_count,
|
|
312
|
+
self.cache_evict_count,
|
|
313
|
+
self.path_geometry_vertex_count,
|
|
314
|
+
self.path_geometry_index_count,
|
|
315
|
+
self.image_count,
|
|
316
|
+
self.layer_count,
|
|
317
|
+
self.visual_effect_count,
|
|
318
|
+
self.glyph_atlas_entry_count,
|
|
319
|
+
self.text_layout_line_count,
|
|
320
|
+
self.work_units,
|
|
321
|
+
},
|
|
322
|
+
);
|
|
323
|
+
try json.writeString(writer, @tagName(self.risk));
|
|
324
|
+
try writer.writeByte('}');
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
pub fn canvasFrameProfile(frame: anytype) CanvasFrameProfile {
|
|
329
|
+
const diagnostics = frame.diagnostics();
|
|
330
|
+
const surface_area = sizeArea(frame.surface_size);
|
|
331
|
+
const dirty_area = optionalRectArea(frame.dirty_bounds);
|
|
332
|
+
const cache_upload_count = diagnostics.pipeline_upload_count +
|
|
333
|
+
diagnostics.path_geometry_upload_count +
|
|
334
|
+
diagnostics.image_upload_count +
|
|
335
|
+
diagnostics.layer_upload_count +
|
|
336
|
+
diagnostics.resource_upload_count +
|
|
337
|
+
diagnostics.visual_effect_upload_count +
|
|
338
|
+
diagnostics.glyph_atlas_upload_count +
|
|
339
|
+
diagnostics.text_layout_upload_count;
|
|
340
|
+
const cache_retain_count = diagnostics.pipeline_retain_count +
|
|
341
|
+
diagnostics.path_geometry_retain_count +
|
|
342
|
+
diagnostics.image_retain_count +
|
|
343
|
+
diagnostics.layer_retain_count +
|
|
344
|
+
diagnostics.resource_retain_count +
|
|
345
|
+
diagnostics.visual_effect_retain_count +
|
|
346
|
+
diagnostics.glyph_atlas_retain_count +
|
|
347
|
+
diagnostics.text_layout_retain_count;
|
|
348
|
+
const cache_evict_count = diagnostics.pipeline_evict_count +
|
|
349
|
+
diagnostics.path_geometry_evict_count +
|
|
350
|
+
diagnostics.image_evict_count +
|
|
351
|
+
diagnostics.layer_evict_count +
|
|
352
|
+
diagnostics.resource_evict_count +
|
|
353
|
+
diagnostics.visual_effect_evict_count +
|
|
354
|
+
diagnostics.glyph_atlas_evict_count +
|
|
355
|
+
diagnostics.text_layout_evict_count;
|
|
356
|
+
var profile = CanvasFrameProfile{
|
|
357
|
+
.frame_index = frame.frame_index,
|
|
358
|
+
.requires_render = frame.requiresRender(),
|
|
359
|
+
.full_repaint = frame.full_repaint,
|
|
360
|
+
.dirty_bounds = frame.dirty_bounds,
|
|
361
|
+
.surface_area = surface_area,
|
|
362
|
+
.dirty_area = dirty_area,
|
|
363
|
+
.dirty_ratio = dirtyAreaRatio(dirty_area, surface_area),
|
|
364
|
+
.command_count = diagnostics.command_count,
|
|
365
|
+
.batch_count = diagnostics.batch_count,
|
|
366
|
+
.encoder_command_count = diagnostics.encoder_command_count,
|
|
367
|
+
.cache_action_count = cache_upload_count + cache_retain_count + cache_evict_count,
|
|
368
|
+
.cache_upload_count = cache_upload_count,
|
|
369
|
+
.cache_retain_count = cache_retain_count,
|
|
370
|
+
.cache_evict_count = cache_evict_count,
|
|
371
|
+
.path_geometry_vertex_count = diagnostics.path_geometry_vertex_count,
|
|
372
|
+
.path_geometry_index_count = diagnostics.path_geometry_index_count,
|
|
373
|
+
.image_count = diagnostics.image_count,
|
|
374
|
+
.layer_count = diagnostics.layer_count,
|
|
375
|
+
.visual_effect_count = diagnostics.visual_effect_count,
|
|
376
|
+
.glyph_atlas_entry_count = diagnostics.glyph_atlas_entry_count,
|
|
377
|
+
.text_layout_line_count = diagnostics.text_layout_line_count,
|
|
378
|
+
};
|
|
379
|
+
profile.work_units = canvasFrameProfileWorkUnits(profile, diagnostics);
|
|
380
|
+
profile.risk = canvasFrameProfileRisk(profile, diagnostics);
|
|
381
|
+
return profile;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
fn canvasFrameProfileWorkUnits(profile: CanvasFrameProfile, diagnostics: CanvasFrameDiagnostics) usize {
|
|
385
|
+
if (!profile.requires_render) return 0;
|
|
386
|
+
|
|
387
|
+
var units = profile.command_count +
|
|
388
|
+
profile.batch_count * 2 +
|
|
389
|
+
profile.encoder_command_count +
|
|
390
|
+
profile.cache_upload_count * 12 +
|
|
391
|
+
profile.cache_retain_count +
|
|
392
|
+
profile.cache_evict_count * 3 +
|
|
393
|
+
profile.image_count * 4 +
|
|
394
|
+
profile.layer_count * 3 +
|
|
395
|
+
diagnostics.visual_effect_shadow_count * 20 +
|
|
396
|
+
diagnostics.visual_effect_blur_count * 24 +
|
|
397
|
+
profile.glyph_atlas_entry_count * 2 +
|
|
398
|
+
profile.text_layout_line_count * 2;
|
|
399
|
+
units += profile.path_geometry_vertex_count / 8;
|
|
400
|
+
units += profile.path_geometry_index_count / 12;
|
|
401
|
+
if (profile.full_repaint or profile.dirty_ratio >= 0.75) {
|
|
402
|
+
units += 25;
|
|
403
|
+
} else if (profile.dirty_ratio >= 0.25) {
|
|
404
|
+
units += 10;
|
|
405
|
+
}
|
|
406
|
+
return units;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
fn canvasFrameProfileRisk(profile: CanvasFrameProfile, diagnostics: CanvasFrameDiagnostics) CanvasFrameProfileRisk {
|
|
410
|
+
if (!profile.requires_render) return .idle;
|
|
411
|
+
if (profile.full_repaint or
|
|
412
|
+
profile.dirty_ratio >= 0.75 or
|
|
413
|
+
profile.cache_upload_count > 16 or
|
|
414
|
+
profile.work_units >= 160 or
|
|
415
|
+
(diagnostics.visual_effect_blur_count > 0 and profile.dirty_ratio >= 0.25))
|
|
416
|
+
{
|
|
417
|
+
return .high;
|
|
418
|
+
}
|
|
419
|
+
if (profile.dirty_ratio >= 0.25 or
|
|
420
|
+
profile.cache_upload_count > 4 or
|
|
421
|
+
profile.work_units >= 80 or
|
|
422
|
+
profile.visual_effect_count > 0)
|
|
423
|
+
{
|
|
424
|
+
return .moderate;
|
|
425
|
+
}
|
|
426
|
+
return .low;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
fn sizeArea(size: geometry.SizeF) f32 {
|
|
430
|
+
return nonNegative(size.width) * nonNegative(size.height);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
fn optionalRectArea(rect: ?geometry.RectF) f32 {
|
|
434
|
+
const value = rect orelse return 0;
|
|
435
|
+
const normalized = value.normalized();
|
|
436
|
+
return nonNegative(normalized.width) * nonNegative(normalized.height);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
fn dirtyAreaRatio(dirty_area: f32, surface_area: f32) f32 {
|
|
440
|
+
if (surface_area <= 0) return if (dirty_area > 0) 1 else 0;
|
|
441
|
+
return std.math.clamp(dirty_area / surface_area, 0, 1);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
fn nonNegative(value: f32) f32 {
|
|
445
|
+
return @max(0, value);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
fn budgetExceeded(limit: usize, value: usize) bool {
|
|
449
|
+
return limit > 0 and value > limit;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
fn writeOptionalRectJson(rect: ?geometry.RectF, writer: anytype) !void {
|
|
453
|
+
if (rect) |value| {
|
|
454
|
+
try writeRectJson(value, writer);
|
|
455
|
+
} else {
|
|
456
|
+
try writer.writeAll("null");
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
fn writeRectJson(rect: geometry.RectF, writer: anytype) !void {
|
|
461
|
+
try writer.print("[{d},{d},{d},{d}]", .{ rect.x, rect.y, rect.width, rect.height });
|
|
462
|
+
}
|