Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Admonish slangc entry points / shader attributes #6033

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Ben-Fields
Copy link

Admonish the related non-functional compilation command in the reference manual until #5541 is addressed.

Admonish the related non-functional compilation command in the reference manual until shader-slang#5541 is addressed.
@Ben-Fields Ben-Fields requested a review from a team as a code owner January 8, 2025 17:59
@CLAassistant
Copy link

CLAassistant commented Jan 8, 2025

CLA assistant check
All committers have signed the CLA.

> The `slangc` CLI [does not currently support](https://github.com/shader-slang/slang/issues/5541) `[shader(...)]` attributes. Complile the above example with the following command instead:
>
> ```bat
> slangc hello-world.slang -target spirv -entry computeMain -o hello-world.spv
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not completely true though. slangc hello-world.slang -target spirv should work just fine. You need to specify the entry point explicitly only when targeting HLSL and GLSL, but not SPIRV.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, I use this feature regularly. Might be good to clarify what does or doesn't work, but slangc does support at least some mixed entry point work.

I thought at one point we discussed supporting mixed entry points via partially-compiled slang modules too. I haven't really investigated this though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@@ -179,6 +179,13 @@ we can compile the `computeMain()` entry point to SPIR-V using the following com
slangc hello-world.slang -target spirv -o hello-world.spv
```

> #### Note ####
> The `slangc` CLI [does not currently support](https://github.com/shader-slang/slang/issues/5541) `[shader(...)]` attributes for targets other than SPIRV. For other targets, the `-entry` argument is mandatory. Example:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is accurate to say slangc doesn't support [shader()] attribute because shaders with [shader()] attribute will be correctly compiled by slangc and the attribute will be reflected in the resulting code.

It is just that for targets without multi-entrypoint support, -stage or -profile argument is still needed even if the shader contains [shader()] attribute when using slangc.

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.

4 participants