diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-04-11 16:18:29 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-04-11 16:18:29 -0700 |
| commit | baf194e7456ba4568dcf11249896af35b3ce18cc (patch) | |
| tree | f75e20db450100d41bfa9c384a8bab0fdc28a749 /tests/bugs | |
| parent | 6322983fa4dc84ef1e9dd8fad54d4c1580436e67 (diff) | |
Introduce an IR-level type system (#481)
* Introduce an IR-level type system
Up to this point, the Slang IR has used the front-end type system to represent types in the IR.
As a result (but ultimately more importantly) the IR representation of generics and specialization has used AST-level concepts embedded in the IR.
For example, to express the specialization of `vector<T,N>` to a concrete type `float` for `T`, we needed an IR operation that could represent the specialization, with operands that somehow represented the type argument `float`.
The whole thing was very complicated.
The big idea of this change is to introduce a new representation in which types in the IR are just ordinary instructions, so that using them as operands makes sense. The hierarchy of IR types closely mirrors the AST-side hierarchy for now, and that will probably be something we should maintain going forward.
In order to make these changes work, though, I also had to do major overhauls of things like the way substitutions are performed, how we check interface conformances, the way lookup through interface types is done, etc. etc. This is a big change, and unfortunately any attempt to summarize it in the commit message wouldn't do it justice.
* Fix 64-bit build warning
* Fix up some clang warnings/errors
Diffstat (limited to 'tests/bugs')
| -rw-r--r-- | tests/bugs/gh-103.slang | 8 | ||||
| -rw-r--r-- | tests/bugs/gh-333.slang | 12 | ||||
| -rw-r--r-- | tests/bugs/implicit-conversion-binary-op.hlsl | 2 | ||||
| -rw-r--r-- | tests/bugs/split-nested-types.hlsl | 17 | ||||
| -rw-r--r-- | tests/bugs/split-nested-types.slang | 4 | ||||
| -rw-r--r-- | tests/bugs/vec-init-list.hlsl | 8 |
6 files changed, 44 insertions, 7 deletions
diff --git a/tests/bugs/gh-103.slang b/tests/bugs/gh-103.slang index b89f38098..5d271d508 100644 --- a/tests/bugs/gh-103.slang +++ b/tests/bugs/gh-103.slang @@ -2,6 +2,12 @@ // Ensure that matrix-times-scalar works +#ifndef __SLANG__ +#define C _SV022SLANG_parameterGroup_C +#define a _SV022SLANG_ParameterGroup_C1a +#define b _SV022SLANG_ParameterGroup_C1b +#endif + float4x4 doIt(float4x4 a, float b) { return a * b; @@ -13,7 +19,7 @@ cbuffer C float b; }; -float4 main() : SV_Target +float4 main() : SV_TARGET { return doIt(a, b)[0]; } diff --git a/tests/bugs/gh-333.slang b/tests/bugs/gh-333.slang index fdc478950..5a0a5769f 100644 --- a/tests/bugs/gh-333.slang +++ b/tests/bugs/gh-333.slang @@ -2,6 +2,16 @@ // Ensure declaration order in output is correct +#ifndef __SLANG__ +#define A _ST01A +#define x _SV01A1x +#define B _ST01B +#define y _SV01B1y +#define C _SV022SLANG_parameterGroup_CL0 +#define a _SV022SLANG_ParameterGroup_C1a +#define b _SV022SLANG_ParameterGroup_C1b +#endif + struct A { float x; @@ -19,7 +29,7 @@ cbuffer C B b; }; -float4 main() : SV_Target +float4 main() : SV_TARGET { return a.x; } diff --git a/tests/bugs/implicit-conversion-binary-op.hlsl b/tests/bugs/implicit-conversion-binary-op.hlsl index 75ff737da..b9a558474 100644 --- a/tests/bugs/implicit-conversion-binary-op.hlsl +++ b/tests/bugs/implicit-conversion-binary-op.hlsl @@ -10,7 +10,7 @@ float4 main( float4 a : A, uint4 b : B - ) : SV_Target + ) : SV_TARGET { return a * b; } diff --git a/tests/bugs/split-nested-types.hlsl b/tests/bugs/split-nested-types.hlsl index 0a8a8f9ff..8216a4e36 100644 --- a/tests/bugs/split-nested-types.hlsl +++ b/tests/bugs/split-nested-types.hlsl @@ -4,11 +4,24 @@ import split_nested_types; #else +#define A _ST01A +#define x _SV01A1x + +#define B _ST01B +#define y _SV01B1y + +#define M _ST01M +#define a _SV01M1a +#define b _SV01M1b + +#define C _SV022SLANG_parameterGroup_CL0 +#define m _SV022SLANG_ParameterGroup_C1m + struct A { int x; }; struct B { float y; }; -struct C { Texture2D t; SamplerState s; }; +struct CC { Texture2D t; SamplerState s; }; struct M { @@ -23,7 +36,7 @@ cbuffer C M m; } -float4 main() : SV_target +float4 main() : SV_TARGET { return m.b.y; } diff --git a/tests/bugs/split-nested-types.slang b/tests/bugs/split-nested-types.slang index ccf95d906..3bd4e239f 100644 --- a/tests/bugs/split-nested-types.slang +++ b/tests/bugs/split-nested-types.slang @@ -4,11 +4,11 @@ struct A { int x; }; struct B { float y; }; -struct C { Texture2D t; SamplerState s; }; +struct CC { Texture2D t; SamplerState s; }; struct M { A a; B b; - C c; + CC c; }; diff --git a/tests/bugs/vec-init-list.hlsl b/tests/bugs/vec-init-list.hlsl index be1bc5c6f..d9d0b83f9 100644 --- a/tests/bugs/vec-init-list.hlsl +++ b/tests/bugs/vec-init-list.hlsl @@ -2,6 +2,14 @@ // Check handling of initializer list for vector +#ifndef __SLANG__ + +#define C _SV022SLANG_parameterGroup_C +#define a _SV022SLANG_ParameterGroup_C1a +#define SV_Position SV_POSITION + +#endif + cbuffer C : register(b0) { float4 a; |
