diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2017-12-18 15:14:59 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-18 15:14:59 -0800 |
| commit | 393e25fd2e2b8c5ff82ff4c6b14a9d7152d37a5e (patch) | |
| tree | a3b0617e7ce5a5bfcf43454893f6c2962b7ec382 /tests/bindings | |
| parent | 46b68ed41daecfaf1761e299cf040156e0f65ac0 (diff) | |
Work on getting rewriter + IR playing nice together. (#314)
* Work on getting rewriter + IR playing nice together.
There are a few different changes here, with the goal of improving the interaction between the "rewriter" code generation approach and the new IR and type legalization code.
The main changes are:
- Add a new pass that occurs before the AST legalization pass, which walks the (used) AST declarations and tries to discover (1) which declarations need to be specialized/lowered via the IR, and (2) which declarations need to be included in the resulting AST module.
- AST-based legalization now uses the generated list when in "rewriter" mode, so that we should be working around issues that users were seeing with types not getting emitted.
- TODO: we still need an equivalent fixup in the case of non-"rewriter" emit, so this may still be a problem for `.slang` files.
- IR type legalization now precedes AST legalization, so that we can record information on how any IR global values got legalized (e.g., if they got split). Then AST legalization includes logic to reconstruct suitable tuple expressions to reference a split global.
- When emitting using IR + AST, we walk all of the declarations that we decided belonged to the IR, but which were subsequently referenced in the AST, to make sure they get output (this would include `struct` types that are declared in a file compiled via IR, but never used in IR-based code).
The rewriter+IR use case still doesn't *quite* work, but the logic for walking the AST in a pre-pass ends up being needed/useful to fix some pure rewriter bugs, so I'm getting this checked in sooner rather than later.
* Fixup: walk arguments to generic declaration reference
The gotcha here is that the code for walking the AST would walk a line of code like:
SomeType a;
and know to traverse the declaration of `SomeType`, but if it saw a line of code like:
ParameterBlock<SomeType> b;
it would traverse the declaration of `ParameterBlock`, but fail to visit that of `SomeType`.
Diffstat (limited to 'tests/bindings')
| -rw-r--r-- | tests/bindings/multiple-parameter-blocks.slang | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/bindings/multiple-parameter-blocks.slang b/tests/bindings/multiple-parameter-blocks.slang index 0a73fdcbd..5fcb9c6d5 100644 --- a/tests/bindings/multiple-parameter-blocks.slang +++ b/tests/bindings/multiple-parameter-blocks.slang @@ -29,20 +29,20 @@ float4 main(float v : V) : SV_Target #else -Texture2D _S1 : register(t0, space0); -Texture2D _S2[4] : register(t1, space0); -SamplerState _S3 : register(s0, space0); +Texture2D _SV01pL0 : register(t0, space0); +Texture2D _SV01pL1[4] : register(t1, space0); +SamplerState _SV01pL2 : register(s0, space0); -Texture2D _S12 : register(t0, space1); -Texture2D _S13[4] : register(t1, space1); -SamplerState _S14 : register(s0, space1); +Texture2D _SV02p1L0 : register(t0, space1); +Texture2D _SV02p1L1[4] : register(t1, space1); +SamplerState _SV02p1L2 : register(s0, space1); float4 main(float v : V) : SV_Target { - return use(_S1, _S3) - + use(_S2[int(v)], _S3) - + use(_S12, _S14) - + use(_S13[int(v)], _S14); + return use(_SV01pL0, _SV01pL2) + + use(_SV01pL1[int(v)], _SV01pL2) + + use(_SV02p1L0, _SV02p1L2) + + use(_SV02p1L1[int(v)], _SV02p1L2); } #endif |
