Shader::Check ignores included files and compile options, so stale .spv files are kept #35
Labels
No labels
bug
claude:blocked
claude:done
claude:failed
claude:in-progress
claude:ready
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Catcrafts/Crafter.Build#35
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Shader::Checkdecides whether a shader needs recompiling from one comparison: the shader source's mtime against the output's (implementations/Crafter.Build-Shader.cpp:40-43atc6b0bba).Anything else that changes the SPIR-V is invisible to it, so a build can ship stale shaders without any message. Found by reading the code.
What is not tracked
buildFiles(implementations/Crafter.Build-Clang.cpp:483-498), and glslang reads the includes from there, but they take no part in the staleness check (:506).Concrete case: Crafter.Graphics's five UI kernels all
#include "ui-shared.glsl", which holds the binding declarations and the shared item structs. Editing onlyui-shared.glslrebuilds none of them.entrypointandtypetoday, and the per-shaderdefines/variantadded for the descriptor-set shader builds (pending): changing a define without touching the source keeps the old output.Suggested fix
Use a stamp, like the std PCM does (
HashStampover the command and the source bytes): hash the source, every file the includer resolved during the compile, the entry point, the stage and the defines, and store it next to the.spv. The includer is called for every include glslang resolves, so a thin wrapper aroundDirStackFileIncludercan record the list at compile time without a separate scan.