Skip to content

[Platform] Package shader runtime dependencies and enforce UTF-8 end to end #145

Description

@proggeramlug

Parent: #126
Corresponds to EN-058 and EN-059 in docs/tickets.md

Problem

Two cross-platform correctness gaps can invalidate otherwise working rendering/features:

  1. Windows ray-query paths require DXC runtime DLLs, but packaging does not reliably deploy them and fallback can be silent.
  2. Non-ASCII file text can be decoded byte-by-byte/Latin-1 somewhere between platform file IO, Perry strings, world loading, and text rendering, producing mojibake.

Both are symptoms of an undefined runtime-asset/text boundary.

Outcome

A tested platform runtime contract for shipping shader compiler dependencies/data files and moving UTF-8 text from disk/fetch through Perry and Bloom without corruption.

Windows shader runtime

  • Decide and document how dxcompiler.dll and dxil.dll are versioned, fetched/built, licensed, packaged, and located at runtime.
  • Integrate tools/fetch-dxc.ps1 (or replacement) into developer build and release packaging; do not rely on untracked files in the current directory.
  • Verify hashes/version and fail packaging on missing files.
  • At startup report requested compiler/path, selected DXC/FXC state, and capabilities lost by fallback.
  • If ray-query/path tracing is explicitly requested and DXC is unavailable, return an actionable error; do not silently start a visually different path.
  • Package-install smoke must launch from the installed artifact directory on a clean Windows runner.

UTF-8 contract

  • Trace bytes at platform read/fetch, Perry materialization, FFI boundary, JSON/world parser, and glyph lookup to locate the first corruption.
  • Define file text APIs as UTF-8 with strict or replacement behavior; expose separate binary byte-buffer APIs.
  • Pass string length explicitly where NUL/embedded bytes matter.
  • Test BMP and non-BMP characters, combining marks, RTL samples, emoji, malformed UTF-8, and embedded NUL policy.
  • Ensure JSON/world names, UI/text rendering, asset paths supported by the platform, and error messages preserve text.
  • If the defect is in Perry, file/link the upstream issue and add a Bloom regression test that remains skipped only with a version-bounded reason.

General runtime asset manifest

Release artifacts should have a machine-checked manifest listing required runtime DLLs, shader libraries/metallibs, fonts/data, WASM glue, and licenses/hashes. Each target's packaging test validates the manifest and starts a minimal renderer/app when possible.

Acceptance criteria

  • A clean Windows packaged artifact enables its declared ray-query tier when DXC is included and reports a clear hard/soft fallback when deliberately removed.
  • Release CI fails if required DLLs/assets are absent or hash/version mismatched.
  • Arena 02 — Outdoor plaza and a multilingual/emoji fixture round-trip from UTF-8 file through world/UI/text output without mojibake on native and web.
  • Malformed UTF-8 behavior is deterministic, tested, and documented; binary APIs never decode implicitly.
  • Platform package manifests are validated for Windows, macOS app resources, and web distribution; extend to other release targets as their packaging exists.
  • Capability report and diagnostics identify runtime dependency failures without requiring a debugger.

Likely files

  • tools/fetch-dxc.ps1, Windows build/release scripts and native/windows/src/lib.rs
  • platform file IO implementations and shared string/FFI code
  • src/world/loader.ts, text/UI surface
  • .github/workflows/release.yml
  • platform target docs

Non-goals

  • Bundling arbitrary game assets into the engine package.
  • Implementing full international text shaping in this issue unless the current text renderer already claims it.
  • Treating FXC fallback as equivalent to DXC ray-query support.

Dependencies

Can start immediately. Coordinate string ABI with #141 and packaging smoke with #140.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions