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

Falcor shadow fixes #118

Merged

Conversation

tangent-vector
Copy link
Contributor

This is a bunch of fixes for issues I encountered while trying to run the Falcor VK "Shadows" sample.

The main interesting fix here is support for global-scope varying input/output with struct types that include system-value semantics on fields.

All varying input/output parameters need to be specified to the entry point that declared them.
In the case of HLSL/Slang this happens for free, but in the case of GLSL we need to be careful not to merge global-scope `in` or `out` parameters in ways that don't make sense.
This is a straightforward mapping given the infrastructure already in place.
GLSL technically supports varying (`in`, `out`) parameters of `struct` type, but there are some annoying constraints (not allowed for VS input), and it doesn't work with how an HLSL user would usually put "system-value" inputs/outputs into a `struct` together with ordinary inputs/outputs.

To work around this, this change adds support for using an imported Slang `struct` type for an `in` or `out` parameter, in which case it will (1) be scalarized and (2) will have system-value semantics mapped appropriately, just as for an entry-point parameter when cross-compiling an HLSL-style `main()`.

Changes:

- Add a notion of a `VaryingTupleExpr` and `VaryingTupleVarDecl`, similar to those for the resources-in-structs case

- Trigger use of these when we have a global-scope varying in/out using an imported `struct` type

- Also use these in the cross-compilation case for ordinary varying input/output (since this approach seems like it should be more general, and can hopefully handle stuff like GS input/output some day)

- When generating parameter binding information, special case global-scope input/output, and treat it the same as entry-point-parameter input/output

- Revamp how used resource ranges are computed so that we can eventually make this specific to an entry point

- Actually implement first signs of life for `maybeMoveTemp` so that assignments to the tuple-ified outputs will work better

- Add first test case that actually seems to work

- Add diagnostics for conflicting explicit bindings on a parameter

- Add diagnostic for different parameters with overlapping bindings

- Make global-scope varying input/output use a tracking data structure specific to the translation unit for computing locations (so that they are independent of other TUs)
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