# `.hexshader` reference examples (version 1)

These CC0-1.0 zip files are format-1 packages. `inventory.json` binds the
exact three zip files by byte length, SHA-256 and package digest.

`reader.mjs` uses Node 22 built-ins only.

- `read`, `check`, `inspect` and `render-data` admit a format-1 package:
  `shader.json` with `"hexshader": 1`, `source.glsl`, `provenance.json`, the
  referenced `resources/` and `originals/` files, content addresses, PNG IHDR,
  and the package digest. They do not reimplement the APP field validators.
  `check` requires each published zip's bytes, SHA-256 and package digest to
  match the inventory.

`render.html` is a standalone WebGL2 software-render example. The APP proof
script drives it in an isolated headless Chrome profile and compares its pixels
with analytic values and the APP native software renderer.

From the repository's meta root:

```sh
python3 360-HEXTILE-APP/scripts/hexshader_reference_fixtures.py check 360-HEXTILE-WWW/app/static/examples/hexshader/inventory.json
node 360-HEXTILE-WWW/app/static/examples/hexshader/reader.mjs check 360-HEXTILE-WWW/app/static/examples/hexshader/reader.mjs
HEXTILE_REFERENCE_WINDOWS_PYTHON="$PWD/360-HEXTILE-APP/backend/venv/Scripts/python.exe" python3 360-HEXTILE-APP/scripts/hexshader_interop_probe.py check 360-HEXTILE-WWW/app/static/examples/hexshader/render.html
```

`reader.mjs inspect <package.hexshader>` reports the format-1 package digest,
members and space. Its `render-data <package.hexshader>` command emits verified
source, values, Looks and resource bytes for the standalone page. `read` prints
the format-1 package digest and member list. Admission holds everything in memory; it writes
no files, and a refusal cannot publish or draw. The proof reports the SHA-256
of this README, the reader and the renderer so a cited result binds their exact
bytes. It does not claim that a successful ZIP parse proves rendering.

The published zips demonstrate format 1, `direction_360`, one root
and bounded quote-included GLSL helpers, all ten current parameter types, a
schema-1 Look with complete values and no capture overrides, and still
`srgb-rgba8-png/1` resources sampled through ordinary
`hxSampleInputN` with nearest or linear filtering and clamp or repeat edges.
The reader deliberately refuses other required capabilities and unsupported
source constructs before compilation. The composite package places each
parameter type in its own observable lane, with separate PNG lanes for filtering,
straight-alpha edges and edge modes; the alternate Look redraws the lanes.

For the frozen examples the reader limits are 128 ZIP members, 32 MiB compressed,
64 MiB expanded/staging, 16 MiB per member, 4096×2048 per PNG, 64 MiB
aggregate decoded RGBA texture residency, four input slots, 32 source files
and 64 KiB source text. The standalone draw is limited to 512×256 output.
The example reader refuses packages outside these limits; they are not
format-invalid solely because they exceed them.
Admission checks are independent of a GPU. Rendering evidence is software GL;
installed-app and physical-GPU compatibility require separate qualification.
The package SHA-256 hashes provide integrity, not signatures or rights proof.

Original unsupported bytes remain available to callers because the reader
never alters its input. For admitted bundles, APP Open → edit → Export and
Open → Fork/Save Copy → Export retain inert top-level bundle-envelope
`extensions` outside document identity, including compatible legacy bundles.
Export creates a new validated package; identical ZIP bytes are not promised.
Keep original bytes when a host refuses or cannot support the input. Production
resource packages have finite host budgets: 1024 ZIP members, 2 GiB ZIP bytes,
4 GiB expanded/staging bytes, 1280 MiB per PNG, and 16 GiB cumulative decoded
RGBA work across unique frames. Multipart Open allows 2 MiB framing overhead;
central-directory and non-PNG metadata limits are 2 MiB. Packages using the
native no-resource policy retain the 8 MiB ZIP/expanded and 64/70-member limits.
For legacy schema 2/3, the presence of `resource_inputs` selects resource policy
even when the field is empty; schema 4 requires a typed nonempty resource closure.
These
budgets do not change this reader's smaller limits above or guarantee available
host memory or GPU residency. Sequences, mipmaps, Grad/cube sampling, feedback/multipass,
HDR and alpha master output are outside this version's demonstrated subset.

On this WSL host, Linux Chrome stalls when creating a WebGL2 context. The
command above runs only the isolated browser leg in Windows headless Chrome
with ANGLE SwiftShader; the Linux process still performs admission and the
unchanged native bake-worker comparison on Mesa llvmpipe. On a host with a
working local headless SwiftShader, omit the environment variable. The probe
also runs archive refusal and editable metadata round-trip checks.
