diff --git a/examples/silpom-ssdm-compare/README.md b/examples/silpom-ssdm-compare/README.md index 5701adfd..f4dda7ac 100644 --- a/examples/silpom-ssdm-compare/README.md +++ b/examples/silpom-ssdm-compare/README.md @@ -56,6 +56,21 @@ xvfb-run -a scripts/smoke_examples.sh silpom-ssdm-compare - Meshes: thin front card for classic POM; extruded slab for SilPOM/SSDM - `gl_FragDepth` only pulls toward the camera (Vulkan RH_ZO) +### Regenerating the shader + +The fragment stage ships as **committed SPIR-V** (`shaders/compare.frag.spv`), +loaded with `gfx.loadMeshShaderSpv`, so the example needs no runtime compiler and +renders the same stages on every host. After editing `shaders/compare.frag`, +regenerate the committed artifact with: + +```sh +glslc -o shaders/compare.frag.spv shaders/compare.frag +``` + +Hot reload (`eve_asset_reload`) recompiles the GLSL live through the engine's own +compiler; where that is unavailable the panels keep the committed SPIR-V and the +status line reports it. + ## Honesty bound True screen-space SSDM as a deferred/post pass (pyramid mip + screen warp over diff --git a/examples/silpom-ssdm-compare/main.nut b/examples/silpom-ssdm-compare/main.nut index ca9c4695..0b74ac5d 100644 --- a/examples/silpom-ssdm-compare/main.nut +++ b/examples/silpom-ssdm-compare/main.nut @@ -149,7 +149,14 @@ function makeThinMesh() { } function makeCard(mode, x) { - local shader = gfx.newMeshShader(fs.readText("shaders/compare.frag")); + // The fragment stage ships as committed SPIR-V next to its source, so the + // example needs no runtime compiler and every host renders the same stages. + // Regenerate with + // glslc -o shaders/compare.frag.spv shaders/compare.frag + local loaded = gfx.loadMeshShaderSpv("", "shaders/compare.frag.spv"); + if (!loaded.ok) + throw "silpom-ssdm-compare: compare.frag.spv unavailable: " + loaded.status.summary; + local shader = loaded.value; shader.declareFloat("mode"); shader.declareFloat("scale"); shader.declareFloat("minLayers"); @@ -277,12 +284,15 @@ eve_init = function() { eve_asset_reload <- function(path) { if (!cmpReady) return; if (path.find("compare.frag") == null) return; + // Live GLSL reload uses the engine's own compiler; when it is missing or the + // source fails to compile, the committed SPIR-V keeps rendering and the status + // line says so instead of failing the example. local src = fs.readText("shaders/compare.frag"); foreach (p in [cmpPom, cmpSil, cmpSsdm]) { local result = gfx.replaceShaderFromGlsl(p.shader, "", src); if (!result.ok) { - cmpStatus = "compile failed"; - print("[silpom-ssdm] compile failed\n"); + cmpStatus = "GLSL reload failed; keeping committed SPIR-V"; + print("[silpom-ssdm] " + cmpStatus + "\n"); return; } syncPanel(p); diff --git a/examples/silpom-ssdm-compare/shaders/compare.frag b/examples/silpom-ssdm-compare/shaders/compare.frag index f3f4225b..8f87daf3 100644 --- a/examples/silpom-ssdm-compare/shaders/compare.frag +++ b/examples/silpom-ssdm-compare/shaders/compare.frag @@ -258,7 +258,7 @@ void applySolidMarch(float mode, float scale, float minLayers, float maxLayers, shadow = mix(1.0, selfShadow(uv, 1.0 - hit.w, lightTS, scale, minLayers, maxLayers), 0.55); // Mild contact darkening in mortar trenches (reads depth without soft pillows). - float trench = smoothstep(0.85, 0.40, h); + float trench = 1.0 - smoothstep(0.40, 0.85, h); shadow *= mix(1.0, 0.72, trench); } diff --git a/examples/silpom-ssdm-compare/shaders/compare.frag.spv b/examples/silpom-ssdm-compare/shaders/compare.frag.spv new file mode 100644 index 00000000..2f0d76f4 Binary files /dev/null and b/examples/silpom-ssdm-compare/shaders/compare.frag.spv differ diff --git a/scripts/smoke_examples.sh b/scripts/smoke_examples.sh index 3a72c8f8..a0ad58f7 100644 --- a/scripts/smoke_examples.sh +++ b/scripts/smoke_examples.sh @@ -175,12 +175,15 @@ for name in "${EXAMPLES[@]}"; do if [[ -n "$reason" ]]; then echo "FAIL $name (${reason})" if [[ -n "$hit" ]]; then - grep -nF "$hit" "$log" 2>/dev/null | head -3 | sed 's/^/ /' + # Print the marker WITH context: a marker line alone hides the rest of a + # multi-line message (e.g. a compiler diagnostic on the following line), + # which is exactly what a CI reader needs to debug the failure. + grep -n -A 8 -F "$hit" "$log" 2>/dev/null | head -24 | sed 's/^/ /' fi echo " --- key output (non-frame-error lines, head 30) ---" grep -vF "frame error" "$log" 2>/dev/null | head -n 30 | sed 's/^/ | /' - echo " --- example output (last 10 lines) ---" - tail -n 10 "$log" | sed 's/^/ | /' + echo " --- example output (last 30 lines) ---" + tail -n 30 "$log" | sed 's/^/ | /' FAILED=$((FAILED + 1)) FAILED_NAMES+=("$name") else