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/hlsl | |
| 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/hlsl')
13 files changed, 76 insertions, 0 deletions
diff --git a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/Render.hlsl b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/Render.hlsl index bb05c82fd..73eeb8f81 100644 --- a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/Render.hlsl +++ b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/Render.hlsl @@ -1,4 +1,11 @@ //TEST(smoke):COMPARE_HLSL:-no-mangle -profile vs_4_0 -entry RenderBaseVS -profile ps_4_0 -entry RenderPS -target dxbc-assembly + +#ifndef __SLANG__ +#define cbPerObject _SV032SLANG_parameterGroup_cbPerObject +#define g_mWorldViewProjection _SV032SLANG_ParameterGroup_cbPerObject22g_mWorldViewProjection +#endif + + //-------------------------------------------------------------------------------------- // File: Render.hlsl // diff --git a/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_PS.hlsl b/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_PS.hlsl index 09c5dcc7e..d119653a9 100644 --- a/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_PS.hlsl +++ b/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_PS.hlsl @@ -1,4 +1,13 @@ //TEST:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile ps_4_0 -entry PSMain + +#ifndef __SLANG__ +#define cbPerFrame _SV031SLANG_parameterGroup_cbPerFrame +#define g_vLightDir _SV031SLANG_ParameterGroup_cbPerFrame11g_vLightDir +#define g_fAmbient _SV031SLANG_ParameterGroup_cbPerFrame10g_fAmbient +#define g_samLinear _SV011g_samLinear +#define g_txDiffuse _SV011g_txDiffuse +#endif + //-------------------------------------------------------------------------------------- // File: BasicHLSL11_PS.hlsl // diff --git a/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_VS.hlsl b/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_VS.hlsl index cb2c1b950..6d854a83b 100644 --- a/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_VS.hlsl +++ b/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_VS.hlsl @@ -1,4 +1,11 @@ //TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VSMain + +#ifndef __SLANG__ +#define cbPerObject _SV032SLANG_parameterGroup_cbPerObject +#define g_mWorldViewProjection _SV032SLANG_ParameterGroup_cbPerObject22g_mWorldViewProjection +#define g_mWorld _SV032SLANG_ParameterGroup_cbPerObject8g_mWorld +#endif + //-------------------------------------------------------------------------------------- // File: BasicHLSL11_VS.hlsl // diff --git a/tests/hlsl/dxsdk/CascadedShadowMaps11/RenderCascadeShadow.hlsl b/tests/hlsl/dxsdk/CascadedShadowMaps11/RenderCascadeShadow.hlsl index 3b4d32a0d..0f3b851df 100644 --- a/tests/hlsl/dxsdk/CascadedShadowMaps11/RenderCascadeShadow.hlsl +++ b/tests/hlsl/dxsdk/CascadedShadowMaps11/RenderCascadeShadow.hlsl @@ -1,4 +1,10 @@ //TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VSMain -entry VSMainPancake + +#ifndef __SLANG__ +#define cbPerObject _SV032SLANG_parameterGroup_cbPerObject +#define g_mWorldViewProjection _SV032SLANG_ParameterGroup_cbPerObject22g_mWorldViewProjection +#endif + //-------------------------------------------------------------------------------------- // File: RenderCascadeShadow.hlsl // diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02.fx b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02.fx index 941e001b3..e4b44b3d1 100644 --- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02.fx +++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02.fx @@ -1,4 +1,9 @@ //TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS + +#ifndef __SLANG__ +#define SV_Target SV_TARGET +#endif + //-------------------------------------------------------------------------------------- // File: Tutorial02.fx // diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03.fx b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03.fx index 941e001b3..e4b44b3d1 100644 --- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03.fx +++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03.fx @@ -1,4 +1,9 @@ //TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS + +#ifndef __SLANG__ +#define SV_Target SV_TARGET +#endif + //-------------------------------------------------------------------------------------- // File: Tutorial02.fx // diff --git a/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_VS.hlsl b/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_VS.hlsl index 800dbf3b3..80f7c452a 100644 --- a/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_VS.hlsl +++ b/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_VS.hlsl @@ -1,4 +1,11 @@ //TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VSMain + +#ifndef __SLANG__ +#define cbPerObject _SV032SLANG_parameterGroup_cbPerObject +#define g_mWorldViewProjection _SV032SLANG_ParameterGroup_cbPerObject22g_mWorldViewProjection +#define g_mWorld _SV032SLANG_ParameterGroup_cbPerObject8g_mWorld +#endif + //-------------------------------------------------------------------------------------- // File: DynamicShaderLinkage11_VS.hlsl // diff --git a/tests/hlsl/dxsdk/MultithreadedRendering11/MultithreadedRendering11_VS.hlsl b/tests/hlsl/dxsdk/MultithreadedRendering11/MultithreadedRendering11_VS.hlsl index 0d8d32ffa..c2239293e 100644 --- a/tests/hlsl/dxsdk/MultithreadedRendering11/MultithreadedRendering11_VS.hlsl +++ b/tests/hlsl/dxsdk/MultithreadedRendering11/MultithreadedRendering11_VS.hlsl @@ -1,4 +1,12 @@ //TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VSMain + +#ifndef __SLANG__ +#define cbPerObject _SV032SLANG_parameterGroup_cbPerObject +#define g_mWorld _SV032SLANG_ParameterGroup_cbPerObject8g_mWorld +#define cbPerScene _SV031SLANG_parameterGroup_cbPerScene +#define g_mViewProj _SV031SLANG_ParameterGroup_cbPerScene11g_mViewProj +#endif + //-------------------------------------------------------------------------------------- // File: MultithreadedRendering11_VS.hlsl // diff --git a/tests/hlsl/dxsdk/OIT11/SceneVS.hlsl b/tests/hlsl/dxsdk/OIT11/SceneVS.hlsl index 2f985d1d1..b361df0d6 100644 --- a/tests/hlsl/dxsdk/OIT11/SceneVS.hlsl +++ b/tests/hlsl/dxsdk/OIT11/SceneVS.hlsl @@ -1,4 +1,10 @@ //TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry SceneVS + +#ifndef __SLANG__ +#define cbPerObject _SV032SLANG_parameterGroup_cbPerObject +#define g_mWorldViewProjection _SV032SLANG_ParameterGroup_cbPerObject22g_mWorldViewProjection +#endif + //----------------------------------------------------------------------------- // File: SceneVS.hlsl // diff --git a/tests/hlsl/dxsdk/VarianceShadows11/RenderVarianceShadow.hlsl b/tests/hlsl/dxsdk/VarianceShadows11/RenderVarianceShadow.hlsl index 9837bf299..af5ba6343 100644 --- a/tests/hlsl/dxsdk/VarianceShadows11/RenderVarianceShadow.hlsl +++ b/tests/hlsl/dxsdk/VarianceShadows11/RenderVarianceShadow.hlsl @@ -1,5 +1,9 @@ //TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VSMain -profile ps_4_0 -entry PSMain +#ifndef __SLANG__ +#define cbPerObject _SV032SLANG_parameterGroup_cbPerObject +#define g_mWorldViewProjection _SV032SLANG_ParameterGroup_cbPerObject22g_mWorldViewProjection +#endif //-------------------------------------------------------------------------------------- // Globals diff --git a/tests/hlsl/simple/allow-uav-conditional.hlsl b/tests/hlsl/simple/allow-uav-conditional.hlsl index 1526244a2..3f12c9be8 100644 --- a/tests/hlsl/simple/allow-uav-conditional.hlsl +++ b/tests/hlsl/simple/allow-uav-conditional.hlsl @@ -2,6 +2,10 @@ // Check output for `[allow_uav_conditional]` +#ifndef __SLANG__ +#define gBuffer _SV07gBuffer +#endif + RWStructuredBuffer<uint> gBuffer : register(u0); [numthreads(16,1,1)] diff --git a/tests/hlsl/simple/compute-numthreads.hlsl b/tests/hlsl/simple/compute-numthreads.hlsl index ba18a8d16..4f3291671 100644 --- a/tests/hlsl/simple/compute-numthreads.hlsl +++ b/tests/hlsl/simple/compute-numthreads.hlsl @@ -2,6 +2,10 @@ // Confirm that we properly pass along the `numthreads` attribute on an entry point. +#ifndef __SLANG__ +#define b _SV01b +#endif + RWStructuredBuffer<float> b; [numthreads(32,1,1)] diff --git a/tests/hlsl/simple/literal-typing.hlsl b/tests/hlsl/simple/literal-typing.hlsl index 359b875f9..48ea5b2cb 100644 --- a/tests/hlsl/simple/literal-typing.hlsl +++ b/tests/hlsl/simple/literal-typing.hlsl @@ -17,6 +17,10 @@ Bad foo(int x) { Bad b; b.bad = x; return b; } // we either respect the suffix and call the right overload, // or ignore it and call the wrong one. +#ifndef __SLANG__ +#define b _SV01b +#endif + RWStructuredBuffer<uint> b; [numthreads(32,1,1)] void main(uint3 tid : SV_DispatchThreadID) |
