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

Option to generate binding and layout information for slangc #5492

Open
tareksander opened this issue Nov 5, 2024 · 8 comments · May be fixed by #5507
Open

Option to generate binding and layout information for slangc #5492

tareksander opened this issue Nov 5, 2024 · 8 comments · May be fixed by #5507
Assignees
Labels
goal:client support Feature or fix needed for a current slang user.

Comments

@tareksander
Copy link

As far as I understand the documentation, layout and binding information (unless manually specified) is chosen by the language, and the only way know what was chosen is to use the reflection API. With something like a separate json output file that includes the descriptor set and binding for globals and the type layout, slangc could be used standalone for compilation.

@csyonghe
Copy link
Collaborator

csyonghe commented Nov 5, 2024

This is a good suggestion and is what we've been considering to add.
Currently there is already the slang-reflection-test code (that is compiled as a library) that does exactly this, and you can change the code slightly to compile that dll as an exe instead. But it would be useful to package them up directly in slangc.

@tareksander
Copy link
Author

If no one is working on it I can try implementing it. Shouldn't be that hard with the reflection API already in place.

@csyonghe
Copy link
Collaborator

csyonghe commented Nov 5, 2024

That will be fantastic. We appreciate your contribution! You can get started by taking a look at \tools\slang-reflection-test\slang-reflection-test-main.cpp, which should already have all the logic we want: reads the refection data, and print them out as json string.

@tareksander
Copy link
Author

So basically:

  • move most of the reflection test code to the main codebase
  • hook up the code in slangc with a compiler option
  • add the option to the documentation

Right?

@csyonghe
Copy link
Collaborator

csyonghe commented Nov 6, 2024

Yes, that should be it.

@tareksander
Copy link
Author

How can I run the tests to ensure I don't break anything?

@csyonghe
Copy link
Collaborator

csyonghe commented Nov 6, 2024

You can run slang-test from repository root directory without any parameters:

slang-test

To speed things up you can run tests in parallel with:

slang-test -use-test-server -server-count 12

To run tests with specific name:

slang-test tests/compute/simple.slang

To run test using a specific API:

slang-test -api d3d12
slang-test -api all-wgpu # run tests using all apis but wgpu.

@jkwak-work
Copy link
Collaborator

I like to recommend checking out our contribution guide.
https://github.com/shader-slang/slang/blob/master/CONTRIBUTION.md

@tareksander tareksander linked a pull request Nov 6, 2024 that will close this issue
@bmillsNV bmillsNV added the goal:client support Feature or fix needed for a current slang user. label Nov 7, 2024
@bmillsNV bmillsNV added this to the Q4 2024 (Fall) milestone Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
goal:client support Feature or fix needed for a current slang user.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants