Skip to content

Add processed assets and improve browser rendering and runtime support - #4040

Merged
borisbat merged 1 commit into
masterfrom
boris/preview-runtime-fixes
Sep 16, 2026
Merged

borisbat merged 1 commit into
masterfrom
boris/preview-runtime-fixes

Conversation

@borisbat

@borisbat borisbat commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Behavior changes: binary-save buffers are released after callbacks, and processed loads reject invalid geometry before upload.

Why. Portable rendering and browser workflows need compact assets, reliable audio, and reproducible state captures.

What changes.

  • Add checksum-pinned meshoptimizer bindings, BC texture processing, processed glTF containers, pooled uploads, and optional PBR passes.
  • Correct serializer allocation, packed skinning, vertex defaults, shadow derivatives, and known-size output reservations.
  • Move threaded WebAudio mixing to a pthread and fix browser callback and snapshot ownership.
  • Add registered live capture/report transport and optional Wasm debug symbols.

Observable behavior.

  • Large valid assets avoid unreserved-allocation failures; malformed geometry fails during loading.
  • Packed rendering preserves skinning and attribute defaults across draw order.
  • Browser teardown removes owned listeners; expired capture replies no longer replace reports.

Where to look. Asset processing lives in dasGLTF, dasMeshOptimizer, and dasStbImage; lifecycle changes are in dasAudio, dasImgui, and dasLiveHost.

Validation, claims, ledger

Validation

  • The single full preflight found two lint warnings and a missing generated C-ABI example binding. Both warnings were fixed; the documented example prerequisite was built and its compile check passed. Skipped lanes were run individually, without a second full preflight.
  • Native OpenGL checks verified draw-time attribute restoration, packed skin attributes, and zero GL errors. A threaded Wasm browser fixture verified safe resize/fullscreen events after ImGui shutdown.
  • Actual Wasm releases on macOS verified symbol output and named stacks. Live-browser audio stress, capture/replay, rendering, and input checks passed.
  • The full AOT, interpreted, JIT, native C++, and utility lanes passed before review follow-ups. The dependency-delivery and callback-cleanup follow-ups passed native/WASM rebuilds and focused interpreter/JIT regressions.

Claims - stated, not tested

  • Worker allocation and device-start failure cleanup were inspected; artificial OS failure injection was not performed. A defect there would affect startup or teardown when resources cannot be allocated.

Not done

  • The suggested shared traversal refactors for PBR passes and ordinary/packed geometry uploads are left separate; this change fixes their concrete rendering behavior without expanding that refactor.

Copilot AI lite review requested due to automatic review settings September 16, 2026 01:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are confirmed correctness issues in the changed code (notably exception-safe cleanup in binary_save and an immutable header buffer being written via _builtin_read) that should be fixed before approval.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR expands daslang’s portable rendering + browser workflow support by introducing processed glTF assets (packed geometry + BC textures), adding meshoptimizer and texture-block compression modules, and improving runtime/browser lifecycle correctness (binary-save buffer ownership, ImGui callback teardown, WebAudio mixing threading, and live capture transport).

Changes:

  • Add new stdlib-facing modules: meshoptimizer, stbimage/texture_blocks, and gltf/gltf_processed (+ docs + tests).
  • Improve runtime/browser correctness: reclaim binary_save temporary buffers, add Emscripten ImGui callback ownership/teardown, and move WebAudio mixing off the AudioWorklet thread.
  • Add live capture/report transport for browser workflows (JS adapter + daslang provider/restore module + tests).
File summaries
File Description
utils/daspkg/README.md Document WASM symbol inclusion behavior
utils/daspkg/commands.das Add include-symbols support to wasm release pipeline
tests/language/bin_serializer.das Add regression tests for serializer stride + buffer reclaim
tests/dasGLTF/test_gltf_processed.das Validate processed asset roundtrip + rejection cases
tests/dasGLTF/test_gltf_pbr_common.das Add shadow math regression tests
tests/dasGLTF/test_gltf_atmosphere.das Add atmosphere transmittance regression test
src/simulate/bin_serializer.cpp Fix array element stride + free save buffers post-callback
skills/daslang/references/everything.md Register new modules and public symbols in reference
modules/dasStbImage/tests/test_texture_blocks.das Add texture blocks mip/cache/decode tests
modules/dasStbImage/tests/test_allocation_limits.das Ensure large outputs reserve under allocation limits
modules/dasStbImage/stbimage/texture_blocks.das Implement BC compression/mips/cache/validation/decode
modules/dasStbImage/src/stb_dxt.version Track vendored stb_dxt provenance
modules/dasStbImage/src/dasStbImage.h Add native compression function declaration
modules/dasStbImage/src/dasStbImage.cpp Implement + bind stb_compress_blocks
modules/dasStbImage/src/dasStbImage_impl.cpp Compile stb_dxt implementation into module
modules/dasStbImage/README.md Document texture block compression APIs
modules/dasStbImage/CMakeLists.txt Wire stb_dxt + AOT .das into build
modules/dasStbImage/.das_module Register stbimage/texture_blocks native path
modules/dasMeshOptimizer/vendor/src/vfetchoptimizer.cpp Vendor meshoptimizer source
modules/dasMeshOptimizer/vendor/src/stripifier.cpp Vendor meshoptimizer source
modules/dasMeshOptimizer/vendor/src/spatialorder.cpp Vendor meshoptimizer source
modules/dasMeshOptimizer/vendor/src/rasterizer.cpp Vendor meshoptimizer source
modules/dasMeshOptimizer/vendor/src/quantization.cpp Vendor meshoptimizer source
modules/dasMeshOptimizer/vendor/src/overdrawoptimizer.cpp Vendor meshoptimizer source
modules/dasMeshOptimizer/vendor/src/indexanalyzer.cpp Vendor meshoptimizer source
modules/dasMeshOptimizer/vendor/src/allocator.cpp Vendor meshoptimizer source
modules/dasMeshOptimizer/vendor/LICENSE.md Vendor meshoptimizer license
modules/dasMeshOptimizer/tests/test_meshoptimizer.das Add meshoptimizer binding tests
modules/dasMeshOptimizer/tests/test_allocation_limits.das Ensure large outputs reserve under limits
modules/dasMeshOptimizer/src/dasMeshOptimizer.h Add AOT header for bindings
modules/dasMeshOptimizer/src/dasMeshOptimizer.cpp Implement checked bindings + module registration
modules/dasMeshOptimizer/README.md Document meshoptimizer module contract
modules/dasMeshOptimizer/MESHOPTIMIZER.LICENSE Install-facing license file
modules/dasMeshOptimizer/CMakeLists.txt Add module build + install rules
modules/dasMeshOptimizer/.das_module Register dynamic module for dll builds
modules/dasLiveHost/web/README.md Document browser live capture transport
modules/dasLiveHost/web/live_capture.js Implement browser FS mailbox + UI + upload/download
modules/dasLiveHost/tests/test_live_capture.das Add provider/restore correctness tests
modules/dasLiveHost/tests/test_capture_transport.cjs Add node-based transport regression test
modules/dasLiveHost/live/README_capture.md Document registered capture providers and invariants
modules/dasLiveHost/live/live_capture.das Implement live capture registry, validate, restore, mailbox
modules/dasLiveHost/.das_module Register live_capture native path
modules/dasImgui/widgets/imgui_live.das Add arch citation for browser callback routing
modules/dasImgui/widgets/imgui_drawlist_builtin.das Add drawlist primitives with live registration
modules/dasImgui/widgets/imgui_boost_runtime.das Fix snapshot payload ownership + unsafe tightening
modules/dasImgui/tests/test_snapshot_payload_ownership.das Test payload ownership transfer on snapshot
modules/dasImgui/src/module_imgui_app.cpp Emscripten callback install/teardown ownership fixes
modules/dasImgui/REVIEW.md Point checklist at ARCHITECTURE.md
modules/dasImgui/ARCHITECTURE.md Add browser callback routing architecture doc
modules/dasGLTF/tools/convert.das Add processed glTF conversion tool
modules/dasGLTF/tests/test_surface_controls.das Add surface default behavior tests
modules/dasGLTF/tests/test_rendering_contracts.das Add packed geometry contract tests
modules/dasGLTF/README.md Document processed assets + optional rendering paths
modules/dasGLTF/gltf/gltf_scene.das Add overload to eval animation clips by value
modules/dasGLTF/gltf/gltf_processed_gl.das Add GL upload path for processed assets + pools
modules/dasGLTF/gltf/gltf_pbr_common.das Add shadow PCF/receiver-plane helpers
modules/dasGLTF/gltf/gltf_gl.das Track missing-attribute defaults + texture borrowing/pooling
modules/dasGLTF/gltf/gltf_atmosphere.das Add atmosphere transmittance helper module
modules/dasGLTF/ARCHITECTURE.md Add architecture notes for new math/format behavior
modules/dasGLTF/.das_module Register new gltf module paths
modules/dasAudio/src/dasAudio.cpp Move WebAudio mixing to pthread ring-buffer worker
modules/dasAudio/CMakeLists.txt Update threaded web build description
modules/dasAudio/ARCHITECTURE.md Document threaded WASM audio architecture rationale
doc/source/stdlib/sec_media.rst Include generated docs for new modules
doc/source/stdlib/handmade/module-texture_blocks.rst Add module blurb for docs build
doc/source/stdlib/handmade/module-meshoptimizer.rst Add module blurb for docs build
doc/source/stdlib/handmade/module-gltf_processed.rst Add module blurb for docs build
doc/source/stdlib/handmade/function-stbimage-stb_compress_blocks-0xcc27189d5d081eae.rst Add function blurb for docs build
doc/source/stdlib/handmade/function-meshoptimizer-meshopt_remap_vertices-0xe33b3a97b651e4e8.rst Add function blurb for docs build
doc/source/stdlib/handmade/function-meshoptimizer-meshopt_remap_indices-0x69706c78732a40b2.rst Add function blurb for docs build
doc/source/stdlib/handmade/function-meshoptimizer-meshopt_optimize_fetch-0xcd80344cb34f875f.rst Add function blurb for docs build
doc/source/stdlib/handmade/function-meshoptimizer-meshopt_optimize_cache-0x9f5637f748a14874.rst Add function blurb for docs build
doc/source/stdlib/handmade/function-meshoptimizer-meshopt_generate_remap-0xdbd2de7ee479a3c2.rst Add function blurb for docs build
doc/source/stdlib/handmade/function-meshoptimizer-meshopt_encode_vertices-0xe1ad9380a82a899d.rst Add function blurb for docs build
doc/source/stdlib/handmade/function-meshoptimizer-meshopt_encode_indices-0xcebc111796f37b7c.rst Add function blurb for docs build
doc/source/stdlib/handmade/function-meshoptimizer-meshopt_decode_vertices-0x25019ef686d88461.rst Add function blurb for docs build
doc/source/stdlib/handmade/function-meshoptimizer-meshopt_decode_indices-0xc16e60c000f53bf4.rst Add function blurb for docs build
doc/reflections/das2rst.das Register new modules for doc generation
daslib/fio.das Minor fread/fload changes (header read + emptiness check)
daslib/daspkg.das Add arch citation for release symbol option
daslib/ARCHITECTURE.md Document release symbols option plumbing
CMakeLists.txt Add build toggle for dasMeshOptimizer
Review details
  • Files reviewed: 76/98 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread daslib/fio.das
Comment thread src/simulate/bin_serializer.cpp Outdated
Copilot AI review requested due to automatic review settings September 16, 2026 02:08
@borisbat
borisbat force-pushed the boris/preview-runtime-fixes branch from e6692b3 to 9ec9787 Compare September 16, 2026 02:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The current diff introduces non-portable hard-coded /tmp paths in a new test and a comment-hygiene violation that should be fixed before approval.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 76/76 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread tests/dasGLTF/test_gltf_processed.das
Comment thread tests/language/bin_serializer.das Outdated
Fetch meshoptimizer 1.2 through a checksum-pinned CMake dependency. Add checked
mesh codecs, BC texture compression and fallback decoding, processed glTF
containers, packed GPU geometry and shared texture ownership.

Extend PBR rendering with local shadows, atmospheric attenuation and optional
surface/material buffers. Preserve skin attributes and draw-time vertex defaults,
and evaluate shadow derivatives before varying bounds checks.

Fix binary-array allocation stride and release serialization buffers after normal
and failed callbacks. Move threaded WebAudio mixing to a pthread-fed PCM ring.
Correct browser input callback teardown and snapshot payload ownership, add
registered live capture/report transport, and honor Wasm release symbol requests.

Add focused regression coverage and public API documentation.
Copilot AI review requested due to automatic review settings September 16, 2026 02:22
@borisbat
borisbat force-pushed the boris/preview-runtime-fixes branch from 9ec9787 to 42f7024 Compare September 16, 2026 02:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

mo_fetch can overflow used*stride before the size check on 32-bit targets, risking under-allocation and out-of-bounds writes.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 76/76 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread modules/dasMeshOptimizer/src/dasMeshOptimizer.cpp
Comment thread modules/dasLiveHost/web/live_capture.js
@borisbat
borisbat merged commit 673dc27 into master Sep 16, 2026
42 checks passed
@borisbat
borisbat deleted the boris/preview-runtime-fixes branch September 16, 2026 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants