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

slangc should allow specifying output file(s) #11

Closed
tangent-vector opened this issue Jun 15, 2017 · 0 comments
Closed

slangc should allow specifying output file(s) #11

tangent-vector opened this issue Jun 15, 2017 · 0 comments
Labels
kind:enhancement a desirable new feature, option, or behavior

Comments

@tangent-vector
Copy link
Contributor

Right now slangc always just writes its output to the console, which is convenient for testing (and mirrors what fxc does by default) but it doesn't have any provision right now for specifying an output file.

In simple cases, we should be able to do something like:

slangc -o foo.dxbc -profile vs_5_0 -entry vsMain foo.hlsl

and get the result we expect (DXBC for the vsMain() entry point function output to the file foo.dxbc).

Ideally, the front-end driver should be able to infer the desired output format based on the file extension provided, so that you could change that command line to use -o foo.spv or -o foo.dxil and it would Do What I Mean).

(Cross-compilation from HLSL/Slang to GLSL should probably be triggered in a similar fashion, e.g.:

slangc foo.hlsl -o foo.glsl

That seems like a slightly more complex feature than what this issue is trying to get at.)

As a simple starting point, this should only be allowed for compilations that involve a single entry point, and output to one of the existing formats that is designed for single entry points: DXBC, DXIL, or SPIR-V.

Longer term, we should define a container format that can hold output for multiple entry points (in any format), but that is a larger change.

@tangent-vector tangent-vector added kind:enhancement a desirable new feature, option, or behavior slangc labels Jun 15, 2017
tangent-vector added a commit to tangent-vector/slang that referenced this issue Jul 25, 2017
Fixes shader-slang#11

- This adds a `-o` command-line option for specifying an output file.

- The code tries to be a bit smart, to glean an output format from a file extension, and also to associate multiple `-o` options with multiple `-entry` options if needed.

- There is a restriction that all the output files need to agree on the code generation target. This is reasonable for now, but might be something to lift eventualy

- There is a restriction that only one output file is allowed per entry point
  - Together with the previous item this means you can't output both a `.spv` and a `.spv.asm` in one pass, even though both should be possible

- There is currently a restriction that output paths only apply to entry points
  - This means there is no way to output reflection JSON to a file with `-o` (but that is mostly just a debugging feature for now)
  - This also means we don't support any "container" formats that can encapsulate multiple compiled entry points
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:enhancement a desirable new feature, option, or behavior
Projects
None yet
Development

No branches or pull requests

1 participant