ExampleShaders compiles with the glslang on PATH, not the one crafter-build links, so it misses the regressions it was written for #170
Labels
No labels
claude:blocked
claude:done
claude:failed
claude:in-progress
claude:ready
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.Graphics#170
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
tests/ExampleShaders(#164) exists because crafter-build compiles the examples' shaders with the glslang it links, unpinned, and a change there broke Sponza without anything noticing. The test compiles them with theglslangonPATHinstead (tests/ExampleShaders/main.cpp:113-117), which its header says "need not be the glslang crafter-build links" (:16-17). In practice it never is, so a shader that only crafter-build's glslang rejects still passes. Line numbers refer to670df31.Details
glslangis the runtime's/usr/bin/glslang(16.4.0, on the runtime'slibglslang.so.16), while/app/bin/crafter-buildlinks no glslang library, so it carries its own. Natively it is the distro's (16.6.0 here).Shader::Compile(implementations/Crafter.Build-Shader.cppin Crafter.Build, lines as ofb26807f): a define without a value is#define NAME 1there (:159) and an empty macro with the CLI's-DNAME; andShader::Compilefails when GlslangToSpv logs anything (:195-206), while the test only looks at the CLI's exit status (main.cpp:117).examples/<Name>/*.glsland takes the stage from the file name (:48-59,:89-94), not from the examples' registrations. That covers every example today, but a shader in a subdirectory would be left out silently, which the header says cannot happen (:13-14).temp_directory_path()/crafter-example-shaders-test(:83), ignorescreate_directories' error (:85) and uses the throwingdirectory_iterator(:89,:91), so a stale unwritable directory or an unreadable entry shows up as failures or an abort instead of a clear message.LibraryTest(project.cpp:564), which builds every library source into it, though it imports onlystd.Suggested fix
Let crafter-build compile them, as
HeapASReadhas its shaders compiled: register each example's shaders on the test'sconfig.shaderswith theShaderType, defines and variant its example uses, so the linked glslang andShader::Compile's rules decide, and a shader that no longer compiles fails the test's build.mainthen only checks that the.spvfiles are there. That drops the CLI, the temp directory and the stage guessing; the cost is keeping the registrations in step with the examples'project.cppfiles.