Skip to content

Embed Metal shaders for standalone binaries - #32

Draft
kernelzeroday wants to merge 1 commit into
antirez:mainfrom
kernelzeroday:agent/resolve-shader-next-to-executable
Draft

Embed Metal shaders for standalone binaries#32
kernelzeroday wants to merge 1 commit into
antirez:mainfrom
kernelzeroday:agent/resolve-shader-next-to-executable

Conversation

@kernelzeroday

@kernelzeroday kernelzeroday commented Aug 14, 2026

Copy link
Copy Markdown

Summary

  • embed h3_shaders.metal in both the CLI executable and libh3.a
  • compile the embedded source when no shader path is supplied, or when the default source-tree path is unavailable
  • retain explicit external shader paths for development and diagnostics
  • document single-file installation and exercise the embedded path in the Metal primitive test

Why

The high-level runtime passes a relative h3_shaders.metal path. As a result, copying h3 into a bin directory does not produce a usable CLI unless the shader source is copied alongside it or the command happens to run from the repository root.

Embedding the source keeps runtime Metal compilation (including device-specific preprocessor options) while making the executable relocatable and self-contained. It adds only the existing ~201 KiB shader source to linked binaries.

Validation

  • make -j16
  • make test -j16 — 1,768 core checks plus native AudioVAE Metal primitives and FFmpeg mux test pass
  • linked tests/test_audio_gpu.o against libh3.a and ran it from /tmp with no shader resource present
  • copied h3 alone to /tmp and completed a real 256x256, 22-frame MiniMax-H3 render from there; ffprobe confirmed H.264 video and 32 kHz stereo AAC output

@kernelzeroday
kernelzeroday force-pushed the agent/resolve-shader-next-to-executable branch from 0d29bfa to 4fea1df Compare August 14, 2026 22:27
@kernelzeroday kernelzeroday changed the title Resolve Metal shader beside executable Embed Metal shaders for standalone binaries Aug 14, 2026
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.

1 participant