makepad/libs/render_material/Cargo.toml
Admin 40ba658661 platform: shader packs -- draw shaders compiled ahead of time for the web. Recording (native): cx.record_shader_pack(true) makes every draw shader that is applied also run the WebGL2 backend's GLSL ES compile and keep its code plus the compiler's own reflection (io with pod types, samplers, uniform-buffer bindings, scope uniforms, table constants); take_shader_pack() serialises them into versioned bytes keyed by a hash of the shader's source. Use: cx.install_shader_pack(&'static [u8]) indexes the pack (entries deserialise on first lookup); the web draw-shader compile looks the key up first and builds the mapping from the entry exactly as from a compile (CxDrawShaderMapping::from_desc; DrawShaderReflection::from_desc), so the layouts are still computed for the target. Built with --cfg makepad_precompiled_shaders the web build leaves the shader compiler out (shader compile natives and render_material's front-end check too); a miss is logged as "not in pack: draw shader X (file:line), add the widget that creates it to a scan: list" and draws nothing, otherwise it compiles at run time. The key names a shader by what its code is made of (pipeline state, fields along the prototype chain, every function by its tokens via the new ScriptVm::fn_tokens, the functions they resolve to, transitively), never by heap indices, so it is the same in every process and load order. Checked: cargo test --release -p makepad-draw --test shader_pack (4: library shaders round-trip through a pack, keys independent of load order, keys follow the helpers a shader calls, a recorded pack installs by key), -p makepad-render-graph --test shader_pack (the kits' passes round-trip), -p makepad-platform --lib shader_pack.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 11:13:06 +02:00

13 lines
432 B
TOML

[package]
name = "makepad-render-material"
version = "0.1.0"
edition = "2021"
description = "Materials for the 3D renderer: the Splash hook set, derived variants, compile diagnostics, IBL"
license = "MIT OR Apache-2.0"
[dependencies]
makepad-draw = { path = "../../draw", version = "2.0.0" }
makepad-scene = { path = "../scene" }
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(makepad_precompiled_shaders)"] }