fix: ship silpom comparison shader as SPIR-V

This commit is contained in:
西风逍遥游 committed 2026-10-08 20:27:24 +08:00
1 parent 44b02254c8
commit b0ffb44f46
5 files changed
+35 -7

No files matched your search

+15
View File
@@ -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
+13 -3
View File
@@ -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);
@@ -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);
}
+6 -3
View File
@@ -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