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

Register re-use between shader stages with different layouts. #38

Closed
ashwinNV opened this issue Jun 20, 2017 · 2 comments · Fixed by #162
Closed

Register re-use between shader stages with different layouts. #38

ashwinNV opened this issue Jun 20, 2017 · 2 comments · Fixed by #162
Labels
kind:bug something doesn't work like it should kind:enhancement a desirable new feature, option, or behavior

Comments

@ashwinNV
Copy link

I'm reusing a register between two shader stages, with different layouts and names,
Is this supposed to be an error?

VS.vs.txt
PS.ps.txt

@tangent-vector tangent-vector added kind:bug something doesn't work like it should falcor kind:enhancement a desirable new feature, option, or behavior labels Jun 20, 2017
@tangent-vector
Copy link
Contributor

Assuming the two files are being passed together in the same "compile request" the intended behavior (not yet implemented) is:

  • Two parameters with different names, but the same register is allowed (even in the same file) but should probably warn. It is up to the user to do something sensible with the result, because my reflection data will expose both parameters.

  • Two parameters with the same name, but in different "translation units" (files), and with different layout and/or register assignment will generate an error.

Note that this kind of issue is only likely to come up when compiling from multiple files (one file per entry point) instead of a single file with multiple entry points. The latter is the preferred style for Slang, and is probably the most familiar to HLSL users.

@tangent-vector
Copy link
Contributor

The basic behavior that was requested was implemented in #93, just with a warning instead of an error in the first of the two cases:

  • If two parameters have different names, but use the same register, we report an error

  • If two declarations of the "same" parameter (same name for now) try to bind to different registers, then we report an error

There's still some work to be done here:

  1. I probably need a test case for this
  2. I probably need to make the first case a warning

tangent-vector added a commit to tangent-vector/slang that referenced this issue Aug 15, 2017
Closes shader-slang#38

- Change overlapping bindings case from error to warning (it is *technically* allowed in HLSL/GLSL)

- Make diagnostic messages for these cases include a note to point at the "other" declaration in each case, so that user can more easily isolate the problem

- Unrelated fix: make sure `slangc` sets up its diagnostic callback *before* parsing command-line options so that error messages output during options parsing will be visible

- Unrelated fix: make sure that formatting for diagnostic messages doesn't print diagnostic ID for notes (all have IDs < 0).
  - Note: eventually I'd like to not print diagnostic IDs at all (I think they are cluttering up our output), but doing that requires touching all the test cases...
tangent-vector-personal pushed a commit that referenced this issue Aug 15, 2017
Improve diagnostics for overlapping/conflicting bindings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug something doesn't work like it should kind:enhancement a desirable new feature, option, or behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants