0.7.0: the Slang rule takes the project's arguments, per-file ones, and a storage - #17
Merged
Merged
Conversation
…nd a storage
Three things a real Slang project needed and the rule could not say, found by
transcribing xrgui's shader config (17 shaders, five common slangc flags, one
shader with a flag of its own, `.spv` files loaded at run time):
options::extra_args slangc takes some two hundred options; the rule keeps
the ones that decide WHAT is produced and passes the
rest through verbatim, after its own and before `-o`.
options::per_file what one shader gets that the others do not. One
`compile()` call writes one surface, so calling it
twice with two option sets rewrote the generated
module with only the second call's shaders. A table
keyed by the path the constrained glob names keeps
the one call. A key naming no shader is refused,
listing the shaders seen: a typo that silently
applied nothing is the failure the table would
otherwise hide.
options::storage the axis `rules-spirv` already had. header embeds
(`-source-embed-style u32`, as before and still the
default); object and sidecar ask slangc for a bare
`.spv`, and the surface does the rest. Measured under
all three; the consumer's source is the same.
`profile_for` gains the 1.4 row: Vulkan 1.4 requires SPIR-V 1.6, and without
the row a 1.4 build fell to spirv_1_0.
The fixture grows a second shader and reads the ENTRY POINT'S NAME out of the
SPIR-V bytes: `-fvk-use-entrypoint-name` through extra_args makes both modules
carry their function's name, `-DOFFSET_ENTRY` through per_file switches one of
them again, and `scale.slang` would report `wrongMain` if the per-file macro
had leaked. CI adds the negative leg (a mistyped key refuses the build by name)
and a `slang-sidecar` fixture with the wrong-directory half.
No engine floor moves: everything here is spelling inside the rule.
Sunrisepeak
added a commit
to mcpplibs/mcpp-index
that referenced
this pull request
Sep 12, 2026
…ts, per-file ones, and a storage (#401) Three things a real Slang project needed and `mcpp.rules.slang` could not say, found by transcribing xrgui's shader config (17 shaders, five common slangc flags, one shader with a flag of its own, `.spv` files loaded at run time): options::extra_args slangc takes some two hundred options; the rule keeps the ones that decide WHAT is produced and passes the rest through verbatim, before `-o`. options::per_file what one shader gets that the others do not, without leaving one `compile()` call -- a second call rewrote the generated module with only its own shaders. A key naming no shader is refused, listing the shaders seen. options::storage the axis `rules-spirv` already had: header (embed, the default), object, sidecar. `profile_for` gains the Vulkan 1.4 row. No engine floor moves. The archive was downloaded twice and hashed the same; the CN asset was published from that file with gtc and read back byte-identical (165daa19...340c, 208991 bytes). No package in this index pins `mcpp.plugins`, so moving `latest` re-pins no consumer. mcpp-community/mcpp-plugins#17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three things a real Slang project needed and
mcpp.rules.slangcould not say, found by transcribing xrgui's shader config (17 shaders, five common slangc flags, one shader with a flag of its own,.spvfiles loaded at run time):options::extra_args-ooptions::per_filecompile()call writes one surface, so calling it twice with two option sets rewrote the generated module with only the second call's shaders. A table keyed by the path the constrained glob names keeps the one call. A key naming no shader is refused, listing the shaders seenoptions::storagerules-spirvalready had.headerembeds (as before, still the default);objectandsidecarask slangc for a bare.spvand the surface does the restprofile_forgains the Vulkan 1.4 row (SPIR-V 1.6); without it a 1.4 build fell tospirv_1_0.Measured. The fixture grows a second shader and reads the entry point's name out of the SPIR-V bytes:
-fvk-use-entrypoint-namethroughextra_argsmakes both modules carry their function's name,-DOFFSET_ENTRYthroughper_fileswitches one of them again, andscale.slangwould reportwrongMainif the per-file macro had leaked. CI adds the negative leg (a mistyped key refuses the build by name) and aslang-sidecarfixture with the wrong-directory half. Object storage was run locally through the same fixture withtools = ["mcpp-embed"]and produced the.incbinpayload; it shares every line withspirv-object-storagepast the rule, so no third fixture.Local runs against mcpp 2026.9.12.2 / gcc 16.1.0:
slang-consumer(both shadersok, negative leg refused with the listing),slang-sidecar(found from the root,sidecar payload was not foundfrom/tmp).No engine floor moves: everything here is spelling inside the rule.
Consumer side this unblocks: Sunrisepeak/xrgui#8.