@native-sdk/cli 0.10.0 → 0.11.0
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/README.md +8 -6
- package/bin/native.js +2 -1
- package/build/app.zig +320 -60
- package/build/corewire.zig +53 -0
- package/build/test_shards.zig +49 -0
- package/build/ts_run.mjs +3 -3
- package/build.zig +1818 -87
- package/package.json +19 -14
- package/packages/core/compile-surface/core.ts +134 -72
- package/packages/core/package-lock.json +75 -357
- package/packages/core/package.json +25 -4
- package/packages/core/scripts/compiler_command.mjs +17 -12
- package/packages/core/scripts/compiler_typecheck.mjs +1 -0
- package/packages/core/scripts/gen_declarations.mjs +3 -2
- package/packages/core/scripts/gen_service_surface.mjs +22 -10
- package/packages/core/scripts/install_scriptc.mjs +182 -0
- package/packages/core/scripts/invoke_scriptc.mjs +18 -0
- package/packages/core/scripts/merge_static_archives.mjs +6 -1
- package/packages/core/scripts/npm_static_spike.mjs +2 -2
- package/packages/core/scripts/run_external_core_compiler.mjs +22 -10
- package/packages/core/scripts/run_external_service_compiler.mjs +15 -15
- package/packages/core/scripts/run_library_compiler.mjs +51 -0
- package/packages/core/scripts/run_native_tests.mjs +22 -0
- package/packages/core/scripts/scriptc-toolchain.json +101 -0
- package/packages/core/scripts/scriptc_toolchain.mjs +121 -0
- package/packages/core/scripts/stage_external_core.mjs +57 -1
- package/packages/core/scripts/surface_manifest_diff.mjs +19 -12
- package/packages/core/sdk/bytes.d.ts +2 -0
- package/packages/core/sdk/bytes.ts +86 -0
- package/packages/core/sdk/core.d.ts +308 -4
- package/packages/core/sdk/core.ts +320 -84
- package/packages/core/sdk/events.d.ts +247 -0
- package/packages/core/sdk/events.ts +230 -2
- package/packages/core/sdk/internal/image_identity.d.ts +7 -0
- package/packages/core/sdk/internal/image_identity.ts +71 -0
- package/packages/core/sdk/internal/markdown_policy.d.ts +5 -0
- package/packages/core/sdk/internal/markdown_policy.ts +878 -0
- package/packages/core/sdk/text.d.ts +27 -0
- package/packages/core/sdk/text.ts +206 -15
- package/packages/core/sdk/theme.d.ts +251 -0
- package/packages/core/sdk/theme.ts +267 -0
- package/packages/core/src/authorization.ts +137 -0
- package/packages/core/src/automation_commands.ts +201 -0
- package/packages/core/src/automation_interactions.ts +92 -0
- package/packages/core/src/bridge_descriptors.ts +104 -0
- package/packages/core/src/builtin_coordination.ts +172 -0
- package/packages/core/src/canvas_frame_coordination.ts +81 -0
- package/packages/core/src/canvas_presentation_lifecycle.ts +84 -0
- package/packages/core/src/canvas_scene_observation.ts +145 -0
- package/packages/core/src/chart_content.ts +161 -0
- package/packages/core/src/chart_plans.ts +432 -0
- package/packages/core/src/checker.ts +166 -19
- package/packages/core/src/code_content.ts +580 -0
- package/packages/core/src/command_coordination.ts +140 -0
- package/packages/core/src/component_composition.ts +94 -0
- package/packages/core/src/component_construction.ts +149 -0
- package/packages/core/src/contract.ts +25 -7
- package/packages/core/src/control_appearance.ts +232 -0
- package/packages/core/src/control_commands.ts +115 -0
- package/packages/core/src/control_content.ts +105 -0
- package/packages/core/src/control_geometry.ts +107 -0
- package/packages/core/src/control_payloads.ts +119 -0
- package/packages/core/src/control_primitives.ts +134 -0
- package/packages/core/src/devhost.ts +82 -7
- package/packages/core/src/devhost_journal.mjs +30 -7
- package/packages/core/src/effect_plans.ts +71 -0
- package/packages/core/src/flow_measurement.ts +121 -0
- package/packages/core/src/font_registry.ts +37 -0
- package/packages/core/src/glyph_atlas.ts +86 -0
- package/packages/core/src/gpu_packet_preparation.ts +130 -0
- package/packages/core/src/gpu_planning.ts +123 -0
- package/packages/core/src/gpu_presentation.ts +55 -0
- package/packages/core/src/host_flow.ts +89 -0
- package/packages/core/src/host_input_regions.ts +165 -0
- package/packages/core/src/image_registry.ts +66 -0
- package/packages/core/src/indicator_plans.ts +132 -0
- package/packages/core/src/infer.ts +150 -8
- package/packages/core/src/input_composition.ts +116 -0
- package/packages/core/src/intrinsic_measure.ts +100 -0
- package/packages/core/src/layout_coordination.ts +207 -0
- package/packages/core/src/leaf_plans.ts +134 -0
- package/packages/core/src/markup_development.ts +160 -0
- package/packages/core/src/measurement_coordination.ts +185 -0
- package/packages/core/src/modules.ts +1 -1
- package/packages/core/src/motion_sampling.ts +100 -0
- package/packages/core/src/paragraph_layout.ts +192 -0
- package/packages/core/src/portable_sources.json +74 -0
- package/packages/core/src/portable_sources.ts +17 -0
- package/packages/core/src/registered_font.ts +93 -0
- package/packages/core/src/render_animation_lifecycle.ts +128 -0
- package/packages/core/src/render_coordination.ts +170 -0
- package/packages/core/src/render_resources.ts +234 -0
- package/packages/core/src/runtime_policy.ts +3930 -0
- package/packages/core/src/scalar_text.ts +84 -0
- package/packages/core/src/service_contract.ts +2 -1
- package/packages/core/src/session_codecs.ts +309 -0
- package/packages/core/src/shell_admission.ts +126 -0
- package/packages/core/src/shell_coordination.ts +93 -0
- package/packages/core/src/sqlite_cli.ts +11 -0
- package/packages/core/src/status_validation.ts +232 -0
- package/packages/core/src/stream_policy.ts +63 -0
- package/packages/core/src/surface_recipes.ts +136 -0
- package/packages/core/src/system_admission.ts +60 -0
- package/packages/core/src/terminal_paint.ts +436 -0
- package/packages/core/src/text_document_width.ts +81 -0
- package/packages/core/src/text_measurement_cache.ts +69 -0
- package/packages/core/src/text_query_layout.ts +179 -0
- package/packages/core/src/text_run_layout.ts +410 -0
- package/packages/core/src/text_span_queries.ts +355 -0
- package/packages/core/src/typed_ast.ts +18 -1
- package/packages/core/src/types.ts +7 -5
- package/packages/core/src/vector_effects.ts +98 -0
- package/packages/core/src/vector_raster.ts +243 -0
- package/packages/core/src/view_components.ts +2415 -0
- package/packages/core/src/view_coordination.ts +198 -0
- package/packages/core/src/view_frontend.ts +980 -0
- package/packages/core/src/widget_audits.ts +202 -0
- package/packages/core/src/widget_changes.ts +258 -0
- package/packages/core/src/widget_metrics.ts +139 -0
- package/packages/core/src/widget_motion.ts +171 -0
- package/packages/core/src/widget_paint.ts +272 -0
- package/packages/core/src/widget_paint_walk.ts +203 -0
- package/packages/core/src/widget_presentation.ts +141 -0
- package/packages/core/src/widget_routing.ts +262 -0
- package/packages/core/src/window_lifecycle.ts +92 -0
- package/packages/core/testing/index.ts +430 -0
- package/schemas/app.schema.json +13 -0
- package/skill-data/core/SKILL.md +2 -2
- package/skill-data/core/references/web-engines-packaging-debugging.md +2 -1
- package/skill-data/native-ui/SKILL.md +76 -17
- package/skill-data/ts-core/SKILL.md +113 -9
- package/skill-data/ts-services/SKILL.md +1 -1
- package/skill-data/ts-services/references/service-surface.md +264 -144
- package/src/app_runner/root.zig +25 -12
- package/src/app_runner/ts_compiled_view.zig +1631 -0
- package/src/app_runner/ts_core_main.zig +143 -10
- package/src/app_runner/ts_core_mobile.zig +24 -12
- package/src/automation/server.zig +1 -3
- package/src/automation/snapshot.zig +9 -637
- package/src/automation/snapshot_reference.zig +656 -0
- package/src/automation/snapshot_serialization.zig +566 -0
- package/src/platform/linux/gtk_host.c +36 -24
- package/src/platform/linux/gtk_pixels.h +118 -0
- package/src/platform/linux/gtk_pixels_test.c +241 -0
- package/src/platform/linux/root.zig +2 -0
- package/src/platform/macos/appkit_host.m +188 -30
- package/src/platform/macos/pointer_motion_test.m +96 -0
- package/src/platform/macos/scroll_driver_test.m +105 -0
- package/src/platform/macos/spectrum_bins.h +34 -0
- package/src/platform/macos/spectrum_bins_test.c +56 -0
- package/src/platform/macos/text_keyboard_test.m +80 -0
- package/src/platform/macos/widget_focus_test.m +66 -0
- package/src/platform/null_platform.zig +26 -2
- package/src/platform/null_platform_tests.zig +13 -0
- package/src/platform/root.zig +1 -0
- package/src/platform/types.zig +13 -0
- package/src/platform/windows/root.zig +2 -0
- package/src/platform/windows/webview2_host.cpp +7 -2
- package/src/primitives/app_manifest/comptime_scene.zig +1 -1
- package/src/primitives/app_manifest/root.zig +2 -0
- package/src/primitives/app_manifest/tests.zig +4 -1
- package/src/primitives/app_manifest/validation.zig +2 -0
- package/src/primitives/canvas/a11y_audit.zig +3 -1
- package/src/primitives/canvas/canvas_frame_coordination_policy.zig +134 -0
- package/src/primitives/canvas/chart_content_policy.zig +75 -0
- package/src/primitives/canvas/chart_plan_policy.zig +196 -0
- package/src/primitives/canvas/code_content_policy.zig +162 -0
- package/src/primitives/canvas/commands.zig +29 -1
- package/src/primitives/canvas/component_composition.zig +125 -0
- package/src/primitives/canvas/component_composition_policy.zig +44 -0
- package/src/primitives/canvas/component_construction_policy.zig +187 -0
- package/src/primitives/canvas/container_layout_policy.zig +87 -0
- package/src/primitives/canvas/control_appearance_policy.zig +142 -0
- package/src/primitives/canvas/control_command_policy.zig +75 -0
- package/src/primitives/canvas/control_content_policy.zig +90 -0
- package/src/primitives/canvas/control_geometry_policy.zig +165 -0
- package/src/primitives/canvas/control_payload_policy.zig +48 -0
- package/src/primitives/canvas/control_primitive_policy.zig +129 -0
- package/src/primitives/canvas/effect_plan_policy.zig +96 -0
- package/src/primitives/canvas/events.zig +1027 -1
- package/src/primitives/canvas/flow_measurement_policy.zig +237 -0
- package/src/primitives/canvas/frame.zig +92 -23
- package/src/primitives/canvas/glyph_atlas_policy.zig +40 -0
- package/src/primitives/canvas/gpu.zig +10 -0
- package/src/primitives/canvas/gpu_packet_preparation_policy.zig +325 -0
- package/src/primitives/canvas/gpu_planning_policy.zig +364 -0
- package/src/primitives/canvas/gpu_presentation_policy.zig +74 -0
- package/src/primitives/canvas/grid_layout_policy.zig +51 -0
- package/src/primitives/canvas/indicator_plan_policy.zig +128 -0
- package/src/primitives/canvas/intrinsic_layout_policy.zig +87 -0
- package/src/primitives/canvas/intrinsic_measure_policy.zig +128 -0
- package/src/primitives/canvas/layout_audit.zig +5 -2
- package/src/primitives/canvas/layout_coordination_policy.zig +262 -0
- package/src/primitives/canvas/leaf_plan_policy.zig +117 -0
- package/src/primitives/canvas/markdown.zig +13 -3
- package/src/primitives/canvas/markdown_content_policy.zig +227 -0
- package/src/primitives/canvas/markdown_image_binding.zig +81 -0
- package/src/primitives/canvas/measurement_coordination_policy.zig +288 -0
- package/src/primitives/canvas/numeric_capabilities.zig +14 -0
- package/src/primitives/canvas/reference.zig +12 -6
- package/src/primitives/canvas/registered_font_policy.zig +152 -0
- package/src/primitives/canvas/render.zig +48 -0
- package/src/primitives/canvas/render_cache_policy.zig +184 -0
- package/src/primitives/canvas/render_coordination_policy.zig +163 -0
- package/src/primitives/canvas/render_damage_policy.zig +160 -0
- package/src/primitives/canvas/render_effects.zig +14 -0
- package/src/primitives/canvas/render_generic_resources.zig +14 -0
- package/src/primitives/canvas/render_images.zig +14 -0
- package/src/primitives/canvas/render_layers.zig +14 -0
- package/src/primitives/canvas/render_override_policy.zig +119 -0
- package/src/primitives/canvas/render_paths.zig +14 -0
- package/src/primitives/canvas/render_plan_policy.zig +199 -0
- package/src/primitives/canvas/render_resource_policy.zig +476 -0
- package/src/primitives/canvas/root.zig +100 -0
- package/src/primitives/canvas/semantic_tree_policy.zig +158 -0
- package/src/primitives/canvas/serialization.zig +8 -1
- package/src/primitives/canvas/surface_layout_policy.zig +36 -0
- package/src/primitives/canvas/surface_recipe_policy.zig +231 -0
- package/src/primitives/canvas/terminal_grid.zig +10 -696
- package/src/primitives/canvas/terminal_grid_reference.zig +709 -0
- package/src/primitives/canvas/terminal_paint_policy.zig +191 -0
- package/src/primitives/canvas/text.zig +1 -0
- package/src/primitives/canvas/text_atlas.zig +113 -0
- package/src/primitives/canvas/text_cache_policy.zig +94 -0
- package/src/primitives/canvas/text_document_policy.zig +120 -0
- package/src/primitives/canvas/text_layout.zig +51 -2
- package/src/primitives/canvas/text_layout_cache.zig +29 -0
- package/src/primitives/canvas/text_layout_hash.zig +1 -0
- package/src/primitives/canvas/text_layout_types.zig +3 -0
- package/src/primitives/canvas/text_measure_cache.zig +46 -0
- package/src/primitives/canvas/text_measurement_policy.zig +124 -0
- package/src/primitives/canvas/text_metrics.zig +23 -0
- package/src/primitives/canvas/text_query_policy.zig +156 -0
- package/src/primitives/canvas/text_run_policy.zig +252 -0
- package/src/primitives/canvas/text_scalar_policy.zig +156 -0
- package/src/primitives/canvas/text_span_query_policy.zig +232 -0
- package/src/primitives/canvas/text_spans.zig +280 -8
- package/src/primitives/canvas/text_tests.zig +10 -0
- package/src/primitives/canvas/tokens.zig +38 -0
- package/src/primitives/canvas/ui.zig +250 -83
- package/src/primitives/canvas/ui_markup.zig +139 -33
- package/src/primitives/canvas/ui_markup_compiled.zig +319 -59
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +225 -0
- package/src/primitives/canvas/ui_markup_contract.zig +146 -14
- package/src/primitives/canvas/ui_markup_contract_tests.zig +77 -0
- package/src/primitives/canvas/ui_markup_reflect.zig +56 -0
- package/src/primitives/canvas/ui_markup_tests.zig +116 -0
- package/src/primitives/canvas/ui_markup_view.zig +258 -32
- package/src/primitives/canvas/ui_markup_view_tests.zig +142 -10
- package/src/primitives/canvas/ui_schema.zig +13 -1
- package/src/primitives/canvas/ui_schema_tests.zig +11 -7
- package/src/primitives/canvas/ui_tests.zig +1 -0
- package/src/primitives/canvas/vector.zig +36 -2
- package/src/primitives/canvas/vector_effect_policy.zig +236 -0
- package/src/primitives/canvas/vector_raster_policy.zig +190 -0
- package/src/primitives/canvas/virtual_extent_policy.zig +292 -0
- package/src/primitives/canvas/virtual_extents.zig +99 -3
- package/src/primitives/canvas/virtual_flow_policy.zig +108 -0
- package/src/primitives/canvas/widget_audit_policy.zig +293 -0
- package/src/primitives/canvas/widget_change_policy.zig +298 -0
- package/src/primitives/canvas/widget_invalidation.zig +113 -2
- package/src/primitives/canvas/widget_layout.zig +673 -128
- package/src/primitives/canvas/widget_layout_tests.zig +4 -0
- package/src/primitives/canvas/widget_metric_policy.zig +126 -0
- package/src/primitives/canvas/widget_metrics.zig +45 -6
- package/src/primitives/canvas/widget_paint_policy.zig +166 -0
- package/src/primitives/canvas/widget_paint_walk_policy.zig +252 -0
- package/src/primitives/canvas/widget_presentation_policy.zig +168 -0
- package/src/primitives/canvas/widget_render.zig +744 -74
- package/src/primitives/canvas/widget_render_controls.zig +1217 -133
- package/src/primitives/canvas/widget_render_scroll.zig +11 -3
- package/src/primitives/canvas/widget_render_style.zig +94 -0
- package/src/primitives/canvas/widget_render_surfaces.zig +61 -50
- package/src/primitives/canvas/widget_routing.zig +75 -0
- package/src/primitives/canvas/widget_routing_policy.zig +135 -0
- package/src/primitives/canvas/widget_runtime.zig +20 -1
- package/src/primitives/canvas/widget_semantics.zig +25 -0
- package/src/primitives/canvas/widget_text_input.zig +86 -23
- package/src/primitives/canvas/widget_text_select.zig +1 -0
- package/src/primitives/canvas/widget_tree.zig +8 -1
- package/src/primitives/canvas/widgets.zig +42 -12
- package/src/primitives/canvas/wrapped_layout_policy.zig +104 -0
- package/src/root.zig +21 -0
- package/src/runtime/accessibility_policy.zig +122 -0
- package/src/runtime/api.zig +28 -0
- package/src/runtime/app_dispatch_policy.zig +68 -0
- package/src/runtime/authorization_policy.zig +150 -0
- package/src/runtime/automation_command_policy.zig +241 -0
- package/src/runtime/automation_interaction_policy.zig +107 -0
- package/src/runtime/automation_snapshot.zig +52 -22
- package/src/runtime/automation_snapshot_reference.zig +290 -0
- package/src/runtime/automation_widget_dispatch.zig +267 -355
- package/src/runtime/automation_widget_dispatch_reference.zig +900 -0
- package/src/runtime/blob_policy.zig +58 -0
- package/src/runtime/blob_reference.zig +64 -0
- package/src/runtime/bridge_descriptor_policy.zig +206 -0
- package/src/runtime/builtin_bridge.zig +180 -44
- package/src/runtime/builtin_coordination_policy.zig +121 -0
- package/src/runtime/callback_policy_test_reference.zig +97 -0
- package/src/runtime/canvas_drag_policy.zig +94 -0
- package/src/runtime/canvas_fonts.zig +38 -10
- package/src/runtime/canvas_frame.zig +590 -134
- package/src/runtime/canvas_frame_helpers.zig +1 -0
- package/src/runtime/canvas_hover_policy.zig +131 -0
- package/src/runtime/canvas_images.zig +59 -30
- package/src/runtime/canvas_keyboard_focus_policy.zig +154 -0
- package/src/runtime/canvas_limits.zig +1 -1
- package/src/runtime/canvas_presentation_lifecycle_policy.zig +86 -0
- package/src/runtime/canvas_scene_observation_policy.zig +181 -0
- package/src/runtime/canvas_widget_context_menu.zig +4 -4
- package/src/runtime/canvas_widget_display.zig +110 -9
- package/src/runtime/canvas_widget_events.zig +718 -328
- package/src/runtime/canvas_widget_runtime.zig +437 -81
- package/src/runtime/canvas_widget_scroll_drivers.zig +39 -1
- package/src/runtime/canvas_widget_scroll_tests.zig +31 -0
- package/src/runtime/canvas_widget_state.zig +93 -56
- package/src/runtime/channel_sources.zig +80 -0
- package/src/runtime/command_policy.zig +161 -0
- package/src/runtime/component_policy.zig +83 -0
- package/src/runtime/core.zig +156 -6
- package/src/runtime/desktop_files.zig +189 -0
- package/src/runtime/effects.zig +466 -29
- package/src/runtime/effects_tests.zig +28 -0
- package/src/runtime/file_policy_test_reference.zig +113 -0
- package/src/runtime/flow.zig +418 -341
- package/src/runtime/flow_reference.zig +1426 -0
- package/src/runtime/font_registry_policy.zig +72 -0
- package/src/runtime/frame_profile.zig +24 -33
- package/src/runtime/gpu_surface_events.zig +97 -35
- package/src/runtime/host_event_pump.zig +303 -0
- package/src/runtime/host_event_pump_reference.zig +268 -0
- package/src/runtime/host_flow_policy.zig +155 -0
- package/src/runtime/host_input_regions_policy.zig +156 -0
- package/src/runtime/image_registry_policy.zig +94 -0
- package/src/runtime/input_composition_policy.zig +138 -0
- package/src/runtime/journal_policy.zig +66 -0
- package/src/runtime/journal_reference.zig +53 -0
- package/src/runtime/lifecycle_policy_test_reference.zig +97 -0
- package/src/runtime/markup_development_policy.zig +91 -0
- package/src/runtime/media_surface.zig +40 -1
- package/src/runtime/motion_sampling_policy.zig +159 -0
- package/src/runtime/recording_policy.zig +42 -0
- package/src/runtime/render_animation_policy.zig +206 -0
- package/src/runtime/replay_policy.zig +66 -0
- package/src/runtime/replay_policy_reference.zig +326 -0
- package/src/runtime/replay_progress_policy.zig +64 -0
- package/src/runtime/replay_progress_reference.zig +34 -0
- package/src/runtime/request_policy_test_reference.zig +188 -0
- package/src/runtime/root.zig +13 -0
- package/src/runtime/session_blobs.zig +157 -58
- package/src/runtime/session_blobs_reference.zig +692 -0
- package/src/runtime/session_codec.zig +361 -0
- package/src/runtime/session_codec_reference.zig +1027 -0
- package/src/runtime/session_journal.zig +246 -983
- package/src/runtime/session_record.zig +224 -45
- package/src/runtime/session_replay.zig +157 -415
- package/src/runtime/session_tests.zig +552 -0
- package/src/runtime/shell_admission_policy.zig +225 -0
- package/src/runtime/shell_coordination_policy.zig +138 -0
- package/src/runtime/shell_layout.zig +126 -1
- package/src/runtime/snapshot_policy.zig +60 -0
- package/src/runtime/snapshot_reference.zig +64 -0
- package/src/runtime/state.zig +16 -0
- package/src/runtime/status_validation.zig +190 -0
- package/src/runtime/system_admission_policy.zig +140 -0
- package/src/runtime/system_services.zig +46 -36
- package/src/runtime/tests.zig +1 -0
- package/src/runtime/ts_canvas_hooks.zig +261 -0
- package/src/runtime/ts_canvas_hooks_tests.zig +279 -0
- package/src/runtime/ts_canvas_icons.zig +234 -0
- package/src/runtime/ts_core_host.zig +2325 -411
- package/src/runtime/ts_core_host_tests.zig +1982 -0
- package/src/runtime/ts_test_host.zig +699 -0
- package/src/runtime/ts_ui_app.zig +1087 -45
- package/src/runtime/ui_app.zig +1117 -629
- package/src/runtime/ui_app_provenance.zig +147 -5
- package/src/runtime/ui_app_provenance_reference.zig +370 -0
- package/src/runtime/ui_app_tests.zig +619 -9
- package/src/runtime/ui_app_window_tests.zig +89 -0
- package/src/runtime/view.zig +25 -0
- package/src/runtime/view_canvas.zig +30 -6
- package/src/runtime/view_coordination_policy.zig +147 -0
- package/src/runtime/view_widget_control.zig +51 -14
- package/src/runtime/view_widget_scroll.zig +16 -5
- package/src/runtime/view_widget_text.zig +153 -68
- package/src/runtime/view_widget_tree.zig +460 -56
- package/src/runtime/webview_view_bridge_tests.zig +2 -0
- package/src/runtime/widget_motion_policy.zig +238 -0
- package/src/runtime/window_command_bridge_tests.zig +63 -0
- package/src/runtime/window_lifecycle_policy.zig +127 -0
- package/src/runtime/window_storage.zig +74 -8
- package/src/runtime/window_view_runtime.zig +148 -33
- package/src/runtime/window_views.zig +163 -10
- package/src/tooling/codesign.zig +125 -74
- package/src/tooling/components/identity_tests.zig +62 -36
- package/src/tooling/components/stepper.native +24 -0
- package/src/tooling/components/stepper.zig +0 -19
- package/src/tooling/components/timeline-item.native +22 -0
- package/src/tooling/components/timeline.native +5 -3
- package/src/tooling/components/timeline_item.zig +0 -32
- package/src/tooling/eject_components.zig +76 -8
- package/src/tooling/ios.zig +66 -12
- package/src/tooling/manifest.zig +35 -0
- package/src/tooling/package.zig +85 -1
- package/src/tooling/raw_manifest.zig +6 -0
- package/src/tooling/templates.zig +15 -3
- package/src/tooling/ts_core.zig +13 -3
- package/src/tooling/verbs.zig +22 -0
- package/tools/corewire/build_profile.mjs +54 -0
- package/tools/corewire/contract_intake.ts +303 -0
- package/tools/corewire/contract_intake.zig +82 -0
- package/tools/corewire/core.test.ts +166 -0
- package/tools/corewire/core_abi.zig +51 -0
- package/tools/corewire/core_cases.ts +233 -0
- package/tools/corewire/core_contract.ts +407 -0
- package/tools/corewire/core_emission.ts +136 -0
- package/tools/corewire/core_emission.zig +69 -0
- package/tools/corewire/core_goldens.json +3110 -0
- package/tools/corewire/core_policy.ts +14 -0
- package/tools/corewire/core_policy.zig +48 -0
- package/tools/corewire/core_projection.ts +360 -0
- package/tools/corewire/core_vocabulary.ts +6 -0
- package/tools/corewire/emit.zig +19 -1590
- package/tools/corewire/emit_facade.ts +714 -0
- package/tools/corewire/emit_facade.zig +10 -3752
- package/tools/corewire/emit_mirror.ts +290 -0
- package/tools/corewire/emit_profile.ts +50 -0
- package/tools/corewire/emit_service.ts +331 -0
- package/tools/corewire/emit_service.zig +23 -842
- package/tools/corewire/entry.test.ts +95 -0
- package/tools/corewire/entry_coordination.ts +127 -0
- package/tools/corewire/entry_coordination.zig +190 -0
- package/tools/corewire/facade_templates.ts +85 -0
- package/tools/corewire/filesystem.test.ts +166 -0
- package/tools/corewire/filesystem_coordination.ts +213 -0
- package/tools/corewire/filesystem_coordination.zig +245 -0
- package/tools/corewire/intake.test.ts +35 -0
- package/tools/corewire/intake_cases.ts +55 -0
- package/tools/corewire/intake_goldens.json +12237 -0
- package/tools/corewire/invocation.test.ts +24 -0
- package/tools/corewire/invocation.ts +175 -0
- package/tools/corewire/invocation.zig +136 -0
- package/tools/corewire/invocation_cases.ts +60 -0
- package/tools/corewire/invocation_fixture.ts +33 -0
- package/tools/corewire/invocation_goldens.json +1143 -0
- package/tools/corewire/invocation_tests.zig +111 -0
- package/tools/corewire/invocation_usage.ts +2 -0
- package/tools/corewire/lossless_projection.ts +96 -0
- package/tools/corewire/main.zig +7 -680
- package/tools/corewire/main_reference.zig +415 -0
- package/tools/corewire/mirror_templates.ts +55 -0
- package/tools/corewire/profile.test.ts +248 -0
- package/tools/corewire/profile.zig +56 -0
- package/tools/corewire/profile_emission.ts +202 -0
- package/tools/corewire/profile_library.json +29 -0
- package/tools/corewire/profile_tests.zig +136 -0
- package/tools/corewire/service.test.ts +75 -0
- package/tools/corewire/service_cases.ts +61 -0
- package/tools/corewire/service_contract.zig +40 -146
- package/tools/corewire/service_goldens.json +650 -0
- package/tools/corewire/service_projection.zig +52 -0
- package/tools/corewire/service_templates.ts +14 -0
- package/tools/corewire/shim_rt.zig +9 -0
- package/tools/corewire/sidecar.zig +267 -1438
- package/tools/corewire/emit_profile.zig +0 -521
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
//! Copied grid and scrolling continuations; native executes measurement queries.
|
|
2
|
+
const std = @import("std");
|
|
3
|
+
const builtin = @import("builtin");
|
|
4
|
+
const geometry = @import("geometry");
|
|
5
|
+
const widgets = @import("widgets.zig");
|
|
6
|
+
const surface = @import("surface_layout_policy.zig");
|
|
7
|
+
const virtual = @import("virtual_flow_policy.zig");
|
|
8
|
+
pub const Policy = surface.Policy;
|
|
9
|
+
|
|
10
|
+
fn word(bytes: []u8, at: usize, value: u32) void {
|
|
11
|
+
std.mem.writeInt(u32, bytes[at..][0..4], value, .little);
|
|
12
|
+
}
|
|
13
|
+
fn read(bytes: []const u8, at: usize) u32 {
|
|
14
|
+
return std.mem.readInt(u32, bytes[at..][0..4], .little);
|
|
15
|
+
}
|
|
16
|
+
fn put(bytes: []u8, at: usize, value: f32) void {
|
|
17
|
+
word(bytes, at, @bitCast(value));
|
|
18
|
+
}
|
|
19
|
+
fn float(bytes: []const u8, at: usize) f32 {
|
|
20
|
+
return @bitCast(read(bytes, at));
|
|
21
|
+
}
|
|
22
|
+
fn length(base: usize, count: usize, stride: usize) !usize {
|
|
23
|
+
return std.math.add(usize, base, try std.math.mul(usize, count, stride));
|
|
24
|
+
}
|
|
25
|
+
fn absent(bytes: []const u8, first: usize, end: usize) void {
|
|
26
|
+
if (!std.mem.allEqual(u8, bytes[first..end], 0)) @panic("invalid absent flow measurement fields");
|
|
27
|
+
}
|
|
28
|
+
fn rect(bytes: []const u8, at: usize) geometry.RectF {
|
|
29
|
+
return .init(float(bytes, at), float(bytes, at + 4), float(bytes, at + 8), float(bytes, at + 12));
|
|
30
|
+
}
|
|
31
|
+
pub const GridResult = struct {
|
|
32
|
+
bytes: [32]u8,
|
|
33
|
+
pub fn pending(self: GridResult) bool {
|
|
34
|
+
return read(&self.bytes, 4) == 1;
|
|
35
|
+
}
|
|
36
|
+
pub fn index(self: GridResult) usize {
|
|
37
|
+
return read(&self.bytes, 8);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
pub const GridPlan = struct {
|
|
41
|
+
allocator: std.mem.Allocator,
|
|
42
|
+
policy: Policy,
|
|
43
|
+
request: []u8,
|
|
44
|
+
result: []u8,
|
|
45
|
+
count: usize,
|
|
46
|
+
pub fn init(allocator: std.mem.Allocator, policy: Policy, count: usize, flows: usize, content: geometry.RectF, columns: usize, overscan: usize, gap: f32, item_extent: f32, scroll: f32, windowed: bool) !GridPlan {
|
|
47
|
+
const request = try allocator.alloc(u8, try length(128, count, 64));
|
|
48
|
+
errdefer allocator.free(request);
|
|
49
|
+
const result = try allocator.alloc(u8, try length(32, count, 32));
|
|
50
|
+
@memset(request, 0);
|
|
51
|
+
request[0..4].* = .{ 38, 1, @import("render_plan_policy.zig").numericFlags(), @intFromBool(windowed) };
|
|
52
|
+
word(request, 4, std.math.cast(u32, count) orelse @panic("grid measurement count exceeds wire range"));
|
|
53
|
+
const packet = request[16..92];
|
|
54
|
+
packet[0..4].* = .{ 4, 0, @as(u8, @intFromBool(windowed)) | (surface.anchorFlags(0, false) >> 2) | @as(u8, if (builtin.mode == .Debug or builtin.mode == .ReleaseSafe) 4 else 0), 0 };
|
|
55
|
+
for ([_]usize{ flows, columns, overscan }, 0..) |value, i| std.mem.writeInt(u64, packet[4 + i * 8 ..][0..8], value, .little);
|
|
56
|
+
const values = [_]f32{ content.x, content.y, content.width, content.height, gap, item_extent, 0, scroll, @floatFromInt(flows), @floatFromInt(columns), @floatFromInt(flows -| 1), @floatFromInt(columns -| 1) };
|
|
57
|
+
for (values, 0..) |value, i| put(packet, 28 + i * 4, value);
|
|
58
|
+
return .{ .allocator = allocator, .policy = policy, .request = request, .result = result, .count = count };
|
|
59
|
+
}
|
|
60
|
+
pub fn deinit(self: GridPlan) void {
|
|
61
|
+
self.allocator.free(self.request);
|
|
62
|
+
self.allocator.free(self.result);
|
|
63
|
+
}
|
|
64
|
+
pub fn setChild(self: GridPlan, index: usize, child: widgets.Widget, flow: bool, fills_width: bool) void {
|
|
65
|
+
const at = 128 + index * 64;
|
|
66
|
+
word(self.request, at, @as(u32, @intFromBool(flow)) | (@as(u32, @intFromBool(fills_width)) << 1));
|
|
67
|
+
const values = [_]f32{ child.frame.x, child.frame.y, child.frame.width, child.frame.height, child.layout.min_size.width, child.layout.min_size.height, child.layout.max_size.width, child.layout.max_size.height };
|
|
68
|
+
for (values, 0..) |value, i| put(self.request, at + 8 + i * 4, value);
|
|
69
|
+
}
|
|
70
|
+
pub fn run(self: GridPlan) GridResult {
|
|
71
|
+
@memset(self.result, 0xa5);
|
|
72
|
+
const written = self.policy(self.request, self.result);
|
|
73
|
+
if (written < 32 or read(self.result, 0) != 1 or read(self.result, 4) > 1) @panic("invalid grid measurement result");
|
|
74
|
+
const result: GridResult = .{ .bytes = self.result[0..32].* };
|
|
75
|
+
if (result.pending()) {
|
|
76
|
+
const index = result.index();
|
|
77
|
+
if (written != 32 or index >= self.count or read(self.request, 128 + index * 64) & 1 == 0 or read(self.request, 132 + index * 64) != 0) @panic("invalid grid measurement continuation");
|
|
78
|
+
absent(&result.bytes, 12, 32);
|
|
79
|
+
} else {
|
|
80
|
+
if (written != self.result.len or read(self.result, 24) > 1) @panic("invalid grid frame length or admission");
|
|
81
|
+
absent(&result.bytes, 8, 12);
|
|
82
|
+
absent(&result.bytes, 20, 24);
|
|
83
|
+
absent(&result.bytes, 28, 32);
|
|
84
|
+
if (!self.active()) absent(&result.bytes, 12, 20);
|
|
85
|
+
for (0..self.count) |i| {
|
|
86
|
+
const at = 32 + i * 32;
|
|
87
|
+
if (read(self.result, at) > 1) @panic("invalid grid frame flags");
|
|
88
|
+
if (self.enabled(i)) {
|
|
89
|
+
if (read(self.request, 128 + i * 64) & 1 == 0 or read(self.result, at + 4) >= read(self.result, at + 8) or read(self.result, at + 8) > self.count) @panic("invalid grid frame identity");
|
|
90
|
+
absent(self.result, at + 12, at + 16);
|
|
91
|
+
} else absent(self.result, at, at + 32);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
pub fn reply(self: GridPlan, result: GridResult, height: f32) void {
|
|
97
|
+
std.debug.assert(result.pending());
|
|
98
|
+
const at = 128 + result.index() * 64;
|
|
99
|
+
word(self.request, at + 4, 1);
|
|
100
|
+
put(self.request, at + 40, height);
|
|
101
|
+
}
|
|
102
|
+
pub fn active(self: GridPlan) bool {
|
|
103
|
+
return read(self.result, 24) != 0;
|
|
104
|
+
}
|
|
105
|
+
pub fn rows(self: GridPlan) u32 {
|
|
106
|
+
return read(self.result, 12);
|
|
107
|
+
}
|
|
108
|
+
pub fn extent(self: GridPlan) f32 {
|
|
109
|
+
return float(self.result, 16);
|
|
110
|
+
}
|
|
111
|
+
pub fn enabled(self: GridPlan, index: usize) bool {
|
|
112
|
+
return read(self.result, 32 + index * 32) != 0;
|
|
113
|
+
}
|
|
114
|
+
pub fn itemIndex(self: GridPlan, index: usize) u32 {
|
|
115
|
+
return read(self.result, 36 + index * 32);
|
|
116
|
+
}
|
|
117
|
+
pub fn itemCount(self: GridPlan, index: usize) u32 {
|
|
118
|
+
return read(self.result, 40 + index * 32);
|
|
119
|
+
}
|
|
120
|
+
pub fn frame(self: GridPlan, index: usize) geometry.RectF {
|
|
121
|
+
return rect(self.result, 48 + index * 32);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
pub const FlowAction = enum(u32) { done, extent, height, width };
|
|
126
|
+
pub const FlowResult = struct {
|
|
127
|
+
bytes: [32]u8,
|
|
128
|
+
pub fn action(self: FlowResult) FlowAction {
|
|
129
|
+
return @enumFromInt(read(&self.bytes, 4));
|
|
130
|
+
}
|
|
131
|
+
pub fn index(self: FlowResult) usize {
|
|
132
|
+
return read(&self.bytes, 8);
|
|
133
|
+
}
|
|
134
|
+
pub fn width(self: FlowResult) f32 {
|
|
135
|
+
return float(&self.bytes, 16);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
pub const FlowPlan = struct {
|
|
139
|
+
allocator: std.mem.Allocator,
|
|
140
|
+
policy: Policy,
|
|
141
|
+
request: []u8,
|
|
142
|
+
result: []u8,
|
|
143
|
+
count: usize,
|
|
144
|
+
pub fn init(allocator: std.mem.Allocator, policy: Policy, count: usize, operation: u8, options: virtual.Options) !FlowPlan {
|
|
145
|
+
// Reuse the established host conversion facts without borrowing any
|
|
146
|
+
// compiler result or retaining the temporary allocation's storage.
|
|
147
|
+
_ = try length(128, count, 64);
|
|
148
|
+
_ = try length(48, count, 32);
|
|
149
|
+
const base = try virtual.Plan.init(allocator, policy, count, options);
|
|
150
|
+
defer base.deinit();
|
|
151
|
+
const request = try allocator.alloc(u8, try length(144, count, 72));
|
|
152
|
+
errdefer allocator.free(request);
|
|
153
|
+
const result = try allocator.alloc(u8, try length(80, count, 32));
|
|
154
|
+
@memset(request, 0);
|
|
155
|
+
request[0..4].* = .{ 39, 1, operation, @import("render_plan_policy.zig").numericFlags() };
|
|
156
|
+
word(request, 4, std.math.cast(u32, count) orelse @panic("flow measurement count exceeds wire range"));
|
|
157
|
+
@memcpy(request[16..][0..base.request.len], base.request);
|
|
158
|
+
request[17] = operation;
|
|
159
|
+
return .{ .allocator = allocator, .policy = policy, .request = request, .result = result, .count = count };
|
|
160
|
+
}
|
|
161
|
+
pub fn deinit(self: FlowPlan) void {
|
|
162
|
+
self.allocator.free(self.request);
|
|
163
|
+
self.allocator.free(self.result);
|
|
164
|
+
}
|
|
165
|
+
fn state(self: FlowPlan, index: usize) usize {
|
|
166
|
+
return 144 + self.count * 64 + index * 8;
|
|
167
|
+
}
|
|
168
|
+
pub fn setChild(self: FlowPlan, index: usize, child: widgets.Widget, absolute: usize, flow: bool, fills_width: bool) void {
|
|
169
|
+
const at = 144 + index * 64;
|
|
170
|
+
word(self.request, at, @intFromBool(flow));
|
|
171
|
+
const values = [_]f32{ @floatFromInt(absolute), child.frame.width, child.frame.height, child.layout.min_size.width, child.layout.max_size.width, child.layout.min_size.height, child.layout.max_size.height, child.frame.x, child.frame.y };
|
|
172
|
+
for (values, 0..) |value, i| put(self.request, at + 4 + i * 4, value);
|
|
173
|
+
word(self.request, self.state(index) + 4, @intFromBool(fills_width));
|
|
174
|
+
}
|
|
175
|
+
pub fn run(self: FlowPlan) FlowResult {
|
|
176
|
+
@memset(self.result, 0xa5);
|
|
177
|
+
const written = self.policy(self.request, self.result);
|
|
178
|
+
if (written < 32 or read(self.result, 0) != 1 or read(self.result, 4) > 3) @panic("invalid flow measurement result");
|
|
179
|
+
const result: FlowResult = .{ .bytes = self.result[0..32].* };
|
|
180
|
+
absent(&result.bytes, 12, 16);
|
|
181
|
+
absent(&result.bytes, 20, 24);
|
|
182
|
+
absent(&result.bytes, 28, 32);
|
|
183
|
+
if (result.action() == .done) {
|
|
184
|
+
if (written != self.result.len or read(self.result, 24) > 1 or read(self.result, 32) != self.count or (if (self.request[2] == 2) read(self.result, 36) != 4 else read(self.result, 36) > 1)) @panic("invalid flow allocation length or mode");
|
|
185
|
+
absent(&result.bytes, 8, 12);
|
|
186
|
+
absent(&result.bytes, 16, 20);
|
|
187
|
+
for (0..self.count) |i| {
|
|
188
|
+
const at = 80 + i * 32;
|
|
189
|
+
if (read(self.result, at) != 0 and read(self.result, at) != 1 and read(self.result, at) != 3) @panic("invalid flow frame flags");
|
|
190
|
+
if (self.enabled(i) and read(self.request, 144 + i * 64) == 0) @panic("invalid flow frame admission");
|
|
191
|
+
if (!self.enabled(i)) absent(self.result, at, at + 32);
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
const index = result.index();
|
|
195
|
+
if (written != 32 or index >= self.count or read(self.request, 144 + index * 64) != 1 or read(self.result, 24) != 0) @panic("invalid flow child continuation");
|
|
196
|
+
if (result.action() == .extent) {
|
|
197
|
+
if (read(self.request, 8) != 0 or self.request[2] != 0) @panic("invalid repeated flow extent query");
|
|
198
|
+
} else if (read(self.request, self.state(index)) != 0 or (result.action() == .width) != (self.request[2] == 2)) @panic("invalid repeated flow measurement");
|
|
199
|
+
if (result.action() != .height) absent(&result.bytes, 16, 20);
|
|
200
|
+
}
|
|
201
|
+
return result;
|
|
202
|
+
}
|
|
203
|
+
pub fn reply(self: FlowPlan, result: FlowResult, value: f32) void {
|
|
204
|
+
switch (result.action()) {
|
|
205
|
+
.done => unreachable,
|
|
206
|
+
.extent => {
|
|
207
|
+
word(self.request, 8, 1);
|
|
208
|
+
put(self.request, 116, value);
|
|
209
|
+
},
|
|
210
|
+
.height, .width => {
|
|
211
|
+
word(self.request, self.state(result.index()), 1);
|
|
212
|
+
put(self.request, 144 + result.index() * 64 + @as(usize, if (result.action() == .height) 40 else 44), value);
|
|
213
|
+
},
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
pub fn active(self: FlowPlan) bool {
|
|
217
|
+
return read(self.result, 24) != 0;
|
|
218
|
+
}
|
|
219
|
+
pub fn itemCount(self: FlowPlan) u32 {
|
|
220
|
+
return read(self.result, 40);
|
|
221
|
+
}
|
|
222
|
+
pub fn extent(self: FlowPlan) f32 {
|
|
223
|
+
return float(self.result, 44);
|
|
224
|
+
}
|
|
225
|
+
pub fn mode(self: FlowPlan) u32 {
|
|
226
|
+
return read(self.result, 36);
|
|
227
|
+
}
|
|
228
|
+
pub fn enabled(self: FlowPlan, index: usize) bool {
|
|
229
|
+
return read(self.result, 80 + index * 32) & 1 != 0;
|
|
230
|
+
}
|
|
231
|
+
pub fn itemIndex(self: FlowPlan, index: usize) u32 {
|
|
232
|
+
return read(self.result, 84 + index * 32);
|
|
233
|
+
}
|
|
234
|
+
pub fn frame(self: FlowPlan, index: usize) geometry.RectF {
|
|
235
|
+
return rect(self.result, 88 + index * 32);
|
|
236
|
+
}
|
|
237
|
+
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const gpu_policy = @import("gpu_planning_policy.zig");
|
|
2
|
+
const render_cache = @import("render_cache_policy.zig");
|
|
1
3
|
const std = @import("std");
|
|
2
4
|
const geometry = @import("geometry");
|
|
3
5
|
const canvas = @import("root.zig");
|
|
@@ -88,6 +90,9 @@ pub const CanvasFrameProfile = frame_metrics.CanvasFrameProfile;
|
|
|
88
90
|
pub const canvasFrameProfile = frame_metrics.canvasFrameProfile;
|
|
89
91
|
|
|
90
92
|
pub const CanvasRenderPass = struct {
|
|
93
|
+
/// Static compiled owner for GPU programs and portable vector coverage;
|
|
94
|
+
/// payload pointers remain borrowed from this frame.
|
|
95
|
+
gpu_plan_policy: ?gpu_policy.Policy = null,
|
|
91
96
|
frame_index: u64 = 0,
|
|
92
97
|
timestamp_ns: u64 = 0,
|
|
93
98
|
surface_size: geometry.SizeF = .{},
|
|
@@ -173,7 +178,13 @@ pub const CanvasRenderPass = struct {
|
|
|
173
178
|
return self.layer_actions.len;
|
|
174
179
|
}
|
|
175
180
|
|
|
181
|
+
pub fn encoderCounts(self: CanvasRenderPass) gpu_policy.EncoderCounts {
|
|
182
|
+
if (self.gpu_plan_policy) |owner| return gpu_policy.encoderCounts(self, owner);
|
|
183
|
+
return .{ .commands = self.encoderCommandCount(), .caches = self.encoderCacheActionCount(), .binds = self.encoderBindPipelineCount(), .draws = self.encoderDrawBatchCount() };
|
|
184
|
+
}
|
|
185
|
+
|
|
176
186
|
pub fn encoderCommandCount(self: CanvasRenderPass) usize {
|
|
187
|
+
if (self.gpu_plan_policy) |owner| return gpu_policy.encoderCounts(self, owner).commands;
|
|
177
188
|
if (!self.requiresRender()) return 0;
|
|
178
189
|
var count: usize = 2 + self.encoderCacheActionCount() + self.encoderBindPipelineCount() + self.encoderDrawBatchCount();
|
|
179
190
|
if (self.scissorBounds() != null) count += 1;
|
|
@@ -181,6 +192,7 @@ pub const CanvasRenderPass = struct {
|
|
|
181
192
|
}
|
|
182
193
|
|
|
183
194
|
pub fn encoderCacheActionCount(self: CanvasRenderPass) usize {
|
|
195
|
+
if (self.gpu_plan_policy) |owner| return gpu_policy.encoderCounts(self, owner).caches;
|
|
184
196
|
if (!self.requiresRender()) return 0;
|
|
185
197
|
return self.pipeline_actions.len +
|
|
186
198
|
self.path_geometry_actions.len +
|
|
@@ -193,6 +205,7 @@ pub const CanvasRenderPass = struct {
|
|
|
193
205
|
}
|
|
194
206
|
|
|
195
207
|
pub fn encoderBindPipelineCount(self: CanvasRenderPass) usize {
|
|
208
|
+
if (self.gpu_plan_policy) |owner| return gpu_policy.encoderCounts(self, owner).binds;
|
|
196
209
|
if (!self.requiresRender()) return 0;
|
|
197
210
|
var count: usize = 0;
|
|
198
211
|
var bound_pipeline: ?RenderPipelineKind = null;
|
|
@@ -206,6 +219,7 @@ pub const CanvasRenderPass = struct {
|
|
|
206
219
|
}
|
|
207
220
|
|
|
208
221
|
pub fn encoderDrawBatchCount(self: CanvasRenderPass) usize {
|
|
222
|
+
if (self.gpu_plan_policy) |owner| return gpu_policy.encoderCounts(self, owner).draws;
|
|
209
223
|
return if (self.requiresRender()) self.batches.len else 0;
|
|
210
224
|
}
|
|
211
225
|
|
|
@@ -253,15 +267,18 @@ pub const CanvasRenderPass = struct {
|
|
|
253
267
|
|
|
254
268
|
pub fn encoderPlan(self: CanvasRenderPass, output: []RenderEncoderCommand) Error!RenderEncoderPlan {
|
|
255
269
|
var planner = RenderEncoderPlanner.init(output);
|
|
270
|
+
if (self.gpu_plan_policy) |owner| return planner.buildCompiled(self, owner);
|
|
256
271
|
return planner.build(self);
|
|
257
272
|
}
|
|
258
273
|
|
|
259
274
|
pub fn gpuPacket(self: CanvasRenderPass, output: []CanvasGpuCommand) Error!CanvasGpuPacket {
|
|
260
275
|
var planner = CanvasGpuPacketPlanner.init(output);
|
|
276
|
+
if (self.gpu_plan_policy) |owner| return planner.buildCompiled(self, owner);
|
|
261
277
|
return planner.build(self);
|
|
262
278
|
}
|
|
263
279
|
|
|
264
280
|
pub fn gpuPacketSummary(self: CanvasRenderPass) CanvasGpuPacketSummary {
|
|
281
|
+
if (self.gpu_plan_policy) |owner| return gpu_policy.summary(self, owner);
|
|
265
282
|
if (!self.requiresRender()) return .{};
|
|
266
283
|
var summary = CanvasGpuPacketSummary{
|
|
267
284
|
.load_action = self.loadAction(),
|
|
@@ -282,6 +299,9 @@ pub const CanvasRenderPass = struct {
|
|
|
282
299
|
};
|
|
283
300
|
|
|
284
301
|
pub const CanvasFrame = struct {
|
|
302
|
+
/// Static compiled owner for GPU programs and portable vector coverage;
|
|
303
|
+
/// payload pointers remain borrowed from this frame.
|
|
304
|
+
gpu_plan_policy: ?gpu_policy.Policy = null,
|
|
285
305
|
frame_index: u64 = 0,
|
|
286
306
|
timestamp_ns: u64 = 0,
|
|
287
307
|
surface_size: geometry.SizeF = .{},
|
|
@@ -342,14 +362,23 @@ pub const CanvasFrame = struct {
|
|
|
342
362
|
fn diagnosticsWithoutBudgetStatus(self: CanvasFrame) CanvasFrameDiagnostics {
|
|
343
363
|
const render_pass = self.renderPass();
|
|
344
364
|
const gpu_packet_summary = render_pass.gpuPacketSummary();
|
|
365
|
+
const encoder_counts = render_pass.encoderCounts();
|
|
366
|
+
return self.diagnosticsFromPlanningSummaries(gpu_packet_summary, encoder_counts);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
pub fn budgetStatusFromPlanningSummaries(self: CanvasFrame, gpu_packet_summary: CanvasGpuPacketSummary, encoder_counts: gpu_policy.EncoderCounts) CanvasFrameBudgetStatus {
|
|
370
|
+
return self.budget.status(self.diagnosticsFromPlanningSummaries(gpu_packet_summary, encoder_counts));
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
fn diagnosticsFromPlanningSummaries(self: CanvasFrame, gpu_packet_summary: CanvasGpuPacketSummary, encoder_counts: gpu_policy.EncoderCounts) CanvasFrameDiagnostics {
|
|
345
374
|
return .{
|
|
346
375
|
.frame_index = self.frame_index,
|
|
347
376
|
.command_count = self.render_plan.commandCount(),
|
|
348
377
|
.batch_count = self.batch_plan.batchCount(),
|
|
349
|
-
.encoder_command_count =
|
|
350
|
-
.encoder_cache_action_count =
|
|
351
|
-
.encoder_bind_pipeline_count =
|
|
352
|
-
.encoder_draw_batch_count =
|
|
378
|
+
.encoder_command_count = encoder_counts.commands,
|
|
379
|
+
.encoder_cache_action_count = encoder_counts.caches,
|
|
380
|
+
.encoder_bind_pipeline_count = encoder_counts.binds,
|
|
381
|
+
.encoder_draw_batch_count = encoder_counts.draws,
|
|
353
382
|
.pipeline_count = self.pipeline_cache_plan.entryCount(),
|
|
354
383
|
.pipeline_upload_count = self.pipeline_cache_plan.uploadCount(),
|
|
355
384
|
.pipeline_retain_count = self.pipeline_cache_plan.retainCount(),
|
|
@@ -417,6 +446,7 @@ pub const CanvasFrame = struct {
|
|
|
417
446
|
|
|
418
447
|
pub fn renderPass(self: CanvasFrame) CanvasRenderPass {
|
|
419
448
|
return .{
|
|
449
|
+
.gpu_plan_policy = self.gpu_plan_policy,
|
|
420
450
|
.frame_index = self.frame_index,
|
|
421
451
|
.timestamp_ns = self.timestamp_ns,
|
|
422
452
|
.surface_size = self.surface_size,
|
|
@@ -453,6 +483,11 @@ pub const CanvasFrame = struct {
|
|
|
453
483
|
};
|
|
454
484
|
|
|
455
485
|
pub const CanvasFrameOptions = struct {
|
|
486
|
+
text_cache_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
487
|
+
render_cache_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
488
|
+
render_plan_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
489
|
+
render_override_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
490
|
+
render_damage_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
456
491
|
frame_index: u64 = 0,
|
|
457
492
|
timestamp_ns: u64 = 0,
|
|
458
493
|
surface_size: geometry.SizeF = .{},
|
|
@@ -512,14 +547,26 @@ pub const CanvasFrameStorage = struct {
|
|
|
512
547
|
};
|
|
513
548
|
|
|
514
549
|
pub fn buildCanvasFrame(previous: ?DisplayList, next: DisplayList, options: CanvasFrameOptions, storage: CanvasFrameStorage) Error!CanvasFrame {
|
|
515
|
-
var
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
const
|
|
550
|
+
var cache_workspace = render_cache.Workspace.forFrame(options.render_cache_policy, storage, options, next.commands.len);
|
|
551
|
+
defer if (cache_workspace) |*workspace| workspace.deinit();
|
|
552
|
+
const planning_workspace: ?*render_cache.Workspace = if (cache_workspace) |*workspace| workspace else null;
|
|
553
|
+
const cache_owner: ?*render_cache.Workspace = if (options.render_cache_policy != null) planning_workspace else null;
|
|
554
|
+
var render_plan = try next.renderPlanWithWorkspace(storage.render_commands, options.render_plan_policy, planning_workspace);
|
|
555
|
+
const render_override_dirty_bounds = if (options.render_override_policy) |owner| blk: {
|
|
556
|
+
const result = @import("render_override_policy.zig").applyAndDamage(storage.render_commands[0..render_plan.commandCount()], options.previous_render_overrides, options.render_overrides, &[_]@import("render_override_policy.zig").DamageEntry{}, owner, planning_workspace.?);
|
|
557
|
+
render_plan.bounds = result.bounds;
|
|
558
|
+
break :blk result.dirty;
|
|
559
|
+
} else blk: {
|
|
560
|
+
const dirty = renderOverrideDirtyBounds(render_plan.commands, options.previous_render_overrides, options.render_overrides);
|
|
561
|
+
render_plan.bounds = applyRenderOverrides(storage.render_commands[0..render_plan.commandCount()], options.render_overrides);
|
|
562
|
+
break :blk dirty;
|
|
563
|
+
};
|
|
564
|
+
const batch_plan = try render_plan.batchPlanWithWorkspace(storage.render_batches, options.render_plan_policy, planning_workspace);
|
|
519
565
|
const pipeline_cache_plan = if (storage.pipeline_cache_entries.len == 0 and storage.pipeline_cache_actions.len == 0)
|
|
520
566
|
RenderPipelineCachePlan{}
|
|
521
567
|
else
|
|
522
|
-
try batch_plan.
|
|
568
|
+
try batch_plan.cachePlanWithWorkspace(
|
|
569
|
+
cache_owner,
|
|
523
570
|
options.previous_pipeline_cache,
|
|
524
571
|
options.frame_index,
|
|
525
572
|
storage.pipeline_cache_entries,
|
|
@@ -528,11 +575,12 @@ pub fn buildCanvasFrame(previous: ?DisplayList, next: DisplayList, options: Canv
|
|
|
528
575
|
const path_geometry_plan = if (storage.path_geometries.len == 0)
|
|
529
576
|
RenderPathGeometryPlan{}
|
|
530
577
|
else
|
|
531
|
-
try render_plan.
|
|
578
|
+
try render_plan.pathGeometryPlanWithPolicy(storage.path_geometries, options.render_cache_policy);
|
|
532
579
|
const path_geometry_cache_plan = if (storage.path_geometry_cache_entries.len == 0 and storage.path_geometry_cache_actions.len == 0)
|
|
533
580
|
RenderPathGeometryCachePlan{}
|
|
534
581
|
else
|
|
535
|
-
try path_geometry_plan.
|
|
582
|
+
try path_geometry_plan.cachePlanWithWorkspace(
|
|
583
|
+
cache_owner,
|
|
536
584
|
options.previous_path_geometry_cache,
|
|
537
585
|
options.frame_index,
|
|
538
586
|
storage.path_geometry_cache_entries,
|
|
@@ -541,11 +589,12 @@ pub fn buildCanvasFrame(previous: ?DisplayList, next: DisplayList, options: Canv
|
|
|
541
589
|
const image_plan = if (storage.images.len == 0)
|
|
542
590
|
RenderImagePlan{}
|
|
543
591
|
else
|
|
544
|
-
try render_plan.
|
|
592
|
+
try render_plan.imagePlanWithResourcesAndPolicy(options.image_resources, storage.images, options.render_cache_policy);
|
|
545
593
|
const image_cache_plan = if (storage.image_cache_entries.len == 0 and storage.image_cache_actions.len == 0)
|
|
546
594
|
RenderImageCachePlan{}
|
|
547
595
|
else
|
|
548
|
-
try image_plan.
|
|
596
|
+
try image_plan.cachePlanWithWorkspace(
|
|
597
|
+
cache_owner,
|
|
549
598
|
options.previous_image_cache,
|
|
550
599
|
options.frame_index,
|
|
551
600
|
storage.image_cache_entries,
|
|
@@ -554,18 +603,20 @@ pub fn buildCanvasFrame(previous: ?DisplayList, next: DisplayList, options: Canv
|
|
|
554
603
|
const layer_plan = if (storage.layers.len == 0)
|
|
555
604
|
RenderLayerPlan{}
|
|
556
605
|
else
|
|
557
|
-
try render_plan.
|
|
606
|
+
try render_plan.layerPlanWithPolicy(storage.layers, options.render_cache_policy);
|
|
558
607
|
const layer_cache_plan = if (storage.layer_cache_entries.len == 0 and storage.layer_cache_actions.len == 0)
|
|
559
608
|
RenderLayerCachePlan{}
|
|
560
609
|
else
|
|
561
|
-
try layer_plan.
|
|
610
|
+
try layer_plan.cachePlanWithWorkspace(
|
|
611
|
+
cache_owner,
|
|
562
612
|
options.previous_layer_cache,
|
|
563
613
|
options.frame_index,
|
|
564
614
|
storage.layer_cache_entries,
|
|
565
615
|
storage.layer_cache_actions,
|
|
566
616
|
);
|
|
567
|
-
const resource_plan = try next.
|
|
568
|
-
const resource_cache_plan = try resource_plan.
|
|
617
|
+
const resource_plan = try next.resourcePlanWithPolicy(storage.resources, options.render_cache_policy);
|
|
618
|
+
const resource_cache_plan = try resource_plan.cachePlanWithWorkspace(
|
|
619
|
+
cache_owner,
|
|
569
620
|
options.previous_resource_cache,
|
|
570
621
|
options.frame_index,
|
|
571
622
|
storage.resource_cache_entries,
|
|
@@ -574,18 +625,20 @@ pub fn buildCanvasFrame(previous: ?DisplayList, next: DisplayList, options: Canv
|
|
|
574
625
|
const visual_effect_plan = if (storage.visual_effects.len == 0)
|
|
575
626
|
VisualEffectPlan{}
|
|
576
627
|
else
|
|
577
|
-
try next.
|
|
628
|
+
try next.visualEffectPlanWithPolicy(storage.visual_effects, options.render_cache_policy);
|
|
578
629
|
const visual_effect_cache_plan = if (storage.visual_effect_cache_entries.len == 0 and storage.visual_effect_cache_actions.len == 0)
|
|
579
630
|
VisualEffectCachePlan{}
|
|
580
631
|
else
|
|
581
|
-
try visual_effect_plan.
|
|
632
|
+
try visual_effect_plan.cachePlanWithWorkspace(
|
|
633
|
+
cache_owner,
|
|
582
634
|
options.previous_visual_effect_cache,
|
|
583
635
|
options.frame_index,
|
|
584
636
|
storage.visual_effect_cache_entries,
|
|
585
637
|
storage.visual_effect_cache_actions,
|
|
586
638
|
);
|
|
587
|
-
const glyph_atlas_plan = try next.
|
|
588
|
-
const glyph_atlas_cache_plan = try glyph_atlas_plan.
|
|
639
|
+
const glyph_atlas_plan = try next.glyphAtlasPlanWithPolicy(storage.glyph_atlas_entries, options.text_cache_policy);
|
|
640
|
+
const glyph_atlas_cache_plan = try glyph_atlas_plan.cachePlanWithPolicy(
|
|
641
|
+
options.text_cache_policy,
|
|
589
642
|
options.previous_glyph_atlas_cache,
|
|
590
643
|
options.frame_index,
|
|
591
644
|
options.glyph_atlas_cache_retention_frames,
|
|
@@ -596,7 +649,8 @@ pub fn buildCanvasFrame(previous: ?DisplayList, next: DisplayList, options: Canv
|
|
|
596
649
|
const text_layout_cache_plan = if (storage.text_layout_cache_entries.len == 0 and storage.text_layout_cache_actions.len == 0)
|
|
597
650
|
TextLayoutCachePlan{}
|
|
598
651
|
else
|
|
599
|
-
try text_layout_plan.
|
|
652
|
+
try text_layout_plan.cachePlanWithPolicy(
|
|
653
|
+
options.text_cache_policy,
|
|
600
654
|
options.previous_text_layout_cache,
|
|
601
655
|
options.frame_index,
|
|
602
656
|
options.text_layout_cache_retention_frames,
|
|
@@ -608,7 +662,21 @@ pub fn buildCanvasFrame(previous: ?DisplayList, next: DisplayList, options: Canv
|
|
|
608
662
|
var changes: []const DiffChange = storage.changes[0..0];
|
|
609
663
|
var dirty_bounds: ?geometry.RectF = null;
|
|
610
664
|
|
|
611
|
-
if (
|
|
665
|
+
if (options.render_damage_policy) |owner| {
|
|
666
|
+
if (!full_repaint) changes = try DisplayList.diff(previous.?, next, storage.changes);
|
|
667
|
+
var rects: [max_canvas_frame_dirty_rects]geometry.RectF = undefined;
|
|
668
|
+
const result = @import("render_damage_policy.zig").finalize(.{
|
|
669
|
+
.full_repaint = full_repaint,
|
|
670
|
+
.surface_size = options.surface_size,
|
|
671
|
+
.scale = options.scale,
|
|
672
|
+
.render_bounds = render_plan.bounds,
|
|
673
|
+
.override_bounds = render_override_dirty_bounds,
|
|
674
|
+
.sample_extent_multiplier = options.backdrop_blur_sample_extent_multiplier,
|
|
675
|
+
}, changes, render_plan.commands, &rects, owner, planning_workspace.?);
|
|
676
|
+
full_repaint = result.full_repaint;
|
|
677
|
+
dirty_bounds = result.bounds;
|
|
678
|
+
if (full_repaint) changes = storage.changes[0..0];
|
|
679
|
+
} else if (full_repaint) {
|
|
612
680
|
dirty_bounds = fullRepaintBounds(options.surface_size, render_plan.bounds);
|
|
613
681
|
} else {
|
|
614
682
|
changes = try DisplayList.diff(previous.?, next, storage.changes);
|
|
@@ -639,6 +707,7 @@ pub fn buildCanvasFrame(previous: ?DisplayList, next: DisplayList, options: Canv
|
|
|
639
707
|
}
|
|
640
708
|
|
|
641
709
|
return .{
|
|
710
|
+
.gpu_plan_policy = options.render_cache_policy,
|
|
642
711
|
.frame_index = options.frame_index,
|
|
643
712
|
.timestamp_ns = options.timestamp_ns,
|
|
644
713
|
.surface_size = options.surface_size,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const std = @import("std");
|
|
2
|
+
pub const Policy = *const fn ([]const u8, []u8) usize;
|
|
3
|
+
pub fn word(bytes: []const u8, at: usize) u32 {
|
|
4
|
+
return std.mem.readInt(u32, bytes[at..][0..4], .little);
|
|
5
|
+
}
|
|
6
|
+
pub fn put(bytes: []u8, at: usize, value: usize) void {
|
|
7
|
+
std.mem.writeInt(u32, bytes[at..][0..4], std.math.cast(u32, value) orelse @panic("glyph atlas integer overflow"), .little);
|
|
8
|
+
}
|
|
9
|
+
pub fn integer(bytes: []u8, at: usize, value: u64) void {
|
|
10
|
+
std.mem.writeInt(u64, bytes[at..][0..8], value, .little);
|
|
11
|
+
}
|
|
12
|
+
pub fn float(bytes: []u8, at: usize, value: f32) void {
|
|
13
|
+
std.mem.writeInt(u32, bytes[at..][0..4], @bitCast(value), .little);
|
|
14
|
+
}
|
|
15
|
+
pub fn readFloat(bytes: []const u8, at: usize) f32 {
|
|
16
|
+
return @bitCast(word(bytes, at));
|
|
17
|
+
}
|
|
18
|
+
pub fn resultValid(bytes: []const u8, capacity: usize) bool {
|
|
19
|
+
if (bytes.len < 16) return false;
|
|
20
|
+
const count: usize = word(bytes, 0);
|
|
21
|
+
if (count > capacity or count > (bytes.len - 16) / 32 or bytes.len != 16 + count * 32 or word(bytes, 4) > 1 or word(bytes, 8) != 0 or word(bytes, 12) != 0) return false;
|
|
22
|
+
for (0..count) |i| {
|
|
23
|
+
const at = 16 + i * 32;
|
|
24
|
+
if (word(bytes, at + 16) > 3 or word(bytes, at + 20) > 3) return false;
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
test "glyph atlas copied transport bounds counts padding and subpixel values" {
|
|
29
|
+
var bytes: [48]u8 = @splat(0);
|
|
30
|
+
put(&bytes, 0, 1);
|
|
31
|
+
try std.testing.expect(resultValid(&bytes, 1));
|
|
32
|
+
try std.testing.expect(!resultValid(&bytes, 0));
|
|
33
|
+
for ([_]usize{ 0, 4, 8, 12, 32, 36 }) |at| {
|
|
34
|
+
const saved = word(&bytes, at);
|
|
35
|
+
put(&bytes, at, 0xffffffff);
|
|
36
|
+
try std.testing.expect(!resultValid(&bytes, 1));
|
|
37
|
+
put(&bytes, at, saved);
|
|
38
|
+
}
|
|
39
|
+
for (0..48) |length| try std.testing.expect(!resultValid(bytes[0..length], 1));
|
|
40
|
+
}
|
|
@@ -240,6 +240,8 @@ pub const CanvasGpuCommand = struct {
|
|
|
240
240
|
};
|
|
241
241
|
|
|
242
242
|
pub const CanvasGpuPacket = struct {
|
|
243
|
+
/// Process-local portable packet preparation; never serialized or hashed.
|
|
244
|
+
preparation_policy: ?@import("gpu_packet_preparation_policy.zig").Policy = null,
|
|
243
245
|
frame_index: u64 = 0,
|
|
244
246
|
timestamp_ns: u64 = 0,
|
|
245
247
|
/// Retained-command-state generation stamped into the binary wire
|
|
@@ -382,6 +384,10 @@ pub const RenderEncoderPlanner = struct {
|
|
|
382
384
|
return .{ .commands = self.commands[0..self.len] };
|
|
383
385
|
}
|
|
384
386
|
|
|
387
|
+
pub fn buildCompiled(self: *RenderEncoderPlanner, pass: canvas.CanvasRenderPass, policy: @import("gpu_planning_policy.zig").Policy) Error!RenderEncoderPlan {
|
|
388
|
+
return @import("gpu_planning_policy.zig").encoder(self, pass, policy);
|
|
389
|
+
}
|
|
390
|
+
|
|
385
391
|
fn append(self: *RenderEncoderPlanner, command: RenderEncoderCommand) Error!void {
|
|
386
392
|
if (self.len >= self.commands.len) return error.RenderEncoderListFull;
|
|
387
393
|
self.commands[self.len] = command;
|
|
@@ -454,6 +460,10 @@ pub const CanvasGpuPacketPlanner = struct {
|
|
|
454
460
|
};
|
|
455
461
|
}
|
|
456
462
|
|
|
463
|
+
pub fn buildCompiled(self: *CanvasGpuPacketPlanner, pass: canvas.CanvasRenderPass, policy: @import("gpu_planning_policy.zig").Policy) Error!CanvasGpuPacket {
|
|
464
|
+
return @import("gpu_planning_policy.zig").packet(self, pass, policy);
|
|
465
|
+
}
|
|
466
|
+
|
|
457
467
|
fn append(self: *CanvasGpuPacketPlanner, command: CanvasGpuCommand) Error!void {
|
|
458
468
|
if (self.len >= self.commands.len) return error.CanvasGpuCommandListFull;
|
|
459
469
|
if (!command.supported()) self.unsupported_count += 1;
|