Skip to content

0.7.0: the Slang rule takes the project's arguments, per-file ones, and a storage - #17

Merged
Sunrisepeak merged 1 commit into
mainfrom
feat/slang-rule-options
Sep 12, 2026
Merged

0.7.0: the Slang rule takes the project's arguments, per-file ones, and a storage#17
Sunrisepeak merged 1 commit into
mainfrom
feat/slang-rule-options

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

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):

option what it is
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
options::storage the axis rules-spirv already had. header embeds (as before, still the default); object and sidecar ask slangc for a bare .spv and the surface does the rest

profile_for gains the Vulkan 1.4 row (SPIR-V 1.6); without it a 1.4 build fell to spirv_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-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. Object storage was run locally through the same fixture with tools = ["mcpp-embed"] and produced the .incbin payload; it shares every line with spirv-object-storage past the rule, so no third fixture.

Local runs against mcpp 2026.9.12.2 / gcc 16.1.0: slang-consumer (both shaders ok, negative leg refused with the listing), slang-sidecar (found from the root, sidecar payload was not found from /tmp).

No engine floor moves: everything here is spelling inside the rule.

Consumer side this unblocks: Sunrisepeak/xrgui#8.

…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
Sunrisepeak merged commit 95a7553 into main Sep 12, 2026
3 checks passed
@Sunrisepeak
Sunrisepeak deleted the feat/slang-rule-options branch September 12, 2026 07:19
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant