浏览代码

Isolate test file dependencies for dxilcontainer, linker and cmd tests. (#2014)

Those tests reach into HLSL, CodeGenHLSL, Samples and even quick-test directories to find the files they need. With this change, I move or copy files around to make sure that these test files are attributable to their consumer. I copied rather than moved files only in the case where a test in code explicitly reached into quick-test or Samples, because that essentially means that the file serves two different tests since they are also run as batch.
Tristan Labelle 6 年之前
父节点
当前提交
430102b952
共有 34 个文件被更改,包括 973 次插入98 次删除
  1. 212 0
      tools/clang/test/CodeGenHLSL/container/SimpleBezier11DS.hlsl
  2. 231 0
      tools/clang/test/CodeGenHLSL/container/SubD11_SmoothPS.hlsl
  3. 0 0
      tools/clang/test/CodeGenHLSL/container/abs2_m.ll
  4. 8 0
      tools/clang/test/CodeGenHLSL/linker/createHandle_multi.hlsl
  5. 10 0
      tools/clang/test/CodeGenHLSL/linker/createHandle_multi2.hlsl
  6. 13 0
      tools/clang/test/CodeGenHLSL/linker/lib_mat_cast.hlsl
  7. 13 0
      tools/clang/test/CodeGenHLSL/linker/lib_mat_cast2.hlsl
  8. 29 0
      tools/clang/test/CodeGenHLSL/linker/lib_mat_entry.hlsl
  9. 20 0
      tools/clang/test/CodeGenHLSL/linker/lib_mat_entry2.hlsl
  10. 14 0
      tools/clang/test/CodeGenHLSL/linker/lib_out_param_res.hlsl
  11. 12 0
      tools/clang/test/CodeGenHLSL/linker/lib_out_param_res_imp.hlsl
  12. 23 0
      tools/clang/test/CodeGenHLSL/linker/lib_unresolved_func1.hlsl
  13. 23 0
      tools/clang/test/CodeGenHLSL/linker/lib_unresolved_func2.hlsl
  14. 3 3
      tools/clang/unittests/HLSL/DxilContainerTest.cpp
  15. 25 25
      tools/clang/unittests/HLSL/LinkerTest.cpp
  16. 0 0
      utils/hct/cmdtestfiles/NonUniform.hlsl
  17. 23 0
      utils/hct/cmdtestfiles/TextRS.hlsli
  18. 57 0
      utils/hct/cmdtestfiles/TextVS.hlsl
  19. 0 0
      utils/hct/cmdtestfiles/batch_cmds.txt
  20. 0 0
      utils/hct/cmdtestfiles/batch_cmds2.txt
  21. 0 0
      utils/hct/cmdtestfiles/include-declarations.h
  22. 0 0
      utils/hct/cmdtestfiles/include-main.hlsl
  23. 191 0
      utils/hct/cmdtestfiles/lib_entries2.hlsl
  24. 0 0
      utils/hct/cmdtestfiles/lib_entries3.hlsl
  25. 0 0
      utils/hct/cmdtestfiles/lib_entry4.hlsl
  26. 0 0
      utils/hct/cmdtestfiles/lib_inc.hlsl
  27. 0 0
      utils/hct/cmdtestfiles/lib_inc0.hlsl
  28. 0 0
      utils/hct/cmdtestfiles/lib_inc0_b.hlsl
  29. 0 0
      utils/hct/cmdtestfiles/lib_inc1.hlsl
  30. 0 0
      utils/hct/cmdtestfiles/lib_inc2.hlsl
  31. 0 0
      utils/hct/cmdtestfiles/lib_inc3.hlsl
  32. 0 0
      utils/hct/cmdtestfiles/lib_res_match.hlsl
  33. 0 0
      utils/hct/cmdtestfiles/smoke.hlsl
  34. 66 70
      utils/hct/hcttestcmds.cmd

+ 212 - 0
tools/clang/test/CodeGenHLSL/container/SimpleBezier11DS.hlsl

@@ -0,0 +1,212 @@
+// RUN: %dxc -E main -T ds_6_0 %s | FileCheck %s
+
+// CHECK: domainLocation
+// CHECK: domainLocation
+// CHECK: Rsqrt
+// CHECK: storeOutput
+
+//--------------------------------------------------------------------------------------
+// File: SimpleBezier11.hlsl
+//
+// This sample shows an simple implementation of the DirectX 11 Hardware Tessellator
+// for rendering a Bezier Patch.
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//--------------------------------------------------------------------------------------
+
+// This allows us to compile the shader with a #define to choose
+// the different partition modes for the hull shader.
+// See the hull shader: [partitioning(BEZIER_HS_PARTITION)]
+// This sample demonstrates "integer", "fractional_even", and "fractional_odd"
+#ifndef BEZIER_HS_PARTITION
+#define BEZIER_HS_PARTITION "integer"
+#endif // BEZIER_HS_PARTITION
+
+// The input patch size.  In this sample, it is 16 control points.
+// This value should match the call to IASetPrimitiveTopology()
+#define INPUT_PATCH_SIZE 16
+
+// The output patch size.  In this sample, it is also 16 control points.
+#define OUTPUT_PATCH_SIZE 16
+
+//--------------------------------------------------------------------------------------
+// Constant Buffers
+//--------------------------------------------------------------------------------------
+cbuffer cbPerFrame : register( b0 )
+{
+    matrix g_mViewProjection;
+    float3 g_vCameraPosWorld;
+    float  g_fTessellationFactor;
+};
+
+//--------------------------------------------------------------------------------------
+// Vertex shader section
+//--------------------------------------------------------------------------------------
+struct VS_CONTROL_POINT_INPUT
+{
+    float3 vPosition        : POSITION;
+};
+
+struct VS_CONTROL_POINT_OUTPUT
+{
+    float3 vPosition        : POSITION;
+};
+
+// This simple vertex shader passes the control points straight through to the
+// hull shader.  In a more complex scene, you might transform the control points
+// or perform skinning at this step.
+
+// The input to the vertex shader comes from the vertex buffer.
+
+// The output from the vertex shader will go into the hull shader.
+
+VS_CONTROL_POINT_OUTPUT BezierVS( VS_CONTROL_POINT_INPUT Input )
+{
+    VS_CONTROL_POINT_OUTPUT Output;
+
+    Output.vPosition = Input.vPosition;
+
+    return Output;
+}
+
+//--------------------------------------------------------------------------------------
+// Constant data function for the BezierHS.  This is executed once per patch.
+//--------------------------------------------------------------------------------------
+struct HS_CONSTANT_DATA_OUTPUT
+{
+    float Edges[4]             : SV_TessFactor;
+    float Inside[2]            : SV_InsideTessFactor;
+};
+
+struct HS_OUTPUT
+{
+    float3 vPosition           : BEZIERPOS;
+};
+
+// This constant hull shader is executed once per patch.  For the simple Mobius strip
+// model, it will be executed 4 times.  In this sample, we set the tessellation factor
+// via SV_TessFactor and SV_InsideTessFactor for each patch.  In a more complex scene,
+// you might calculate a variable tessellation factor based on the camera's distance.
+
+HS_CONSTANT_DATA_OUTPUT BezierConstantHS( InputPatch<VS_CONTROL_POINT_OUTPUT, INPUT_PATCH_SIZE> ip,
+                                          uint PatchID : SV_PrimitiveID )
+{    
+    HS_CONSTANT_DATA_OUTPUT Output;
+
+    float TessAmount = g_fTessellationFactor;
+
+    Output.Edges[0] = Output.Edges[1] = Output.Edges[2] = Output.Edges[3] = TessAmount;
+    Output.Inside[0] = Output.Inside[1] = TessAmount;
+
+    return Output;
+}
+
+// The hull shader is called once per output control point, which is specified with
+// outputcontrolpoints.  For this sample, we take the control points from the vertex
+// shader and pass them directly off to the domain shader.  In a more complex scene,
+// you might perform a basis conversion from the input control points into a Bezier
+// patch, such as the SubD11 Sample.
+
+// The input to the hull shader comes from the vertex shader
+
+// The output from the hull shader will go to the domain shader.
+// The tessellation factor, topology, and partition mode will go to the fixed function
+// tessellator stage to calculate the UVW and domain points.
+
+[domain("quad")]
+[partitioning(BEZIER_HS_PARTITION)]
+[outputtopology("triangle_cw")]
+[outputcontrolpoints(OUTPUT_PATCH_SIZE)]
+[patchconstantfunc("BezierConstantHS")]
+HS_OUTPUT BezierHS( InputPatch<VS_CONTROL_POINT_OUTPUT, INPUT_PATCH_SIZE> p, 
+                    uint i : SV_OutputControlPointID,
+                    uint PatchID : SV_PrimitiveID )
+{
+    HS_OUTPUT Output;
+    Output.vPosition = p[i].vPosition;
+    return Output;
+}
+
+//--------------------------------------------------------------------------------------
+// Bezier evaluation domain shader section
+//--------------------------------------------------------------------------------------
+struct DS_OUTPUT
+{
+    float4 vPosition        : SV_POSITION;
+    float3 vWorldPos        : WORLDPOS;
+    float3 vNormal            : NORMAL;
+};
+
+//--------------------------------------------------------------------------------------
+float4 BernsteinBasis(float t)
+{
+    float invT = 1.0f - t;
+
+    return float4( invT * invT * invT,
+                   3.0f * t * invT * invT,
+                   3.0f * t * t * invT,
+                   t * t * t );
+}
+
+//--------------------------------------------------------------------------------------
+float4 dBernsteinBasis(float t)
+{
+    float invT = 1.0f - t;
+
+    return float4( -3 * invT * invT,
+                   3 * invT * invT - 6 * t * invT,
+                   6 * t * invT - 3 * t * t,
+                   3 * t * t );
+}
+
+//--------------------------------------------------------------------------------------
+float3 EvaluateBezier( const OutputPatch<HS_OUTPUT, OUTPUT_PATCH_SIZE> bezpatch,
+                       float4 BasisU,
+                       float4 BasisV )
+{
+    float3 Value = float3(0,0,0);
+    Value  = BasisV.x * ( bezpatch[0].vPosition * BasisU.x + bezpatch[1].vPosition * BasisU.y + bezpatch[2].vPosition * BasisU.z + bezpatch[3].vPosition * BasisU.w );
+    Value += BasisV.y * ( bezpatch[4].vPosition * BasisU.x + bezpatch[5].vPosition * BasisU.y + bezpatch[6].vPosition * BasisU.z + bezpatch[7].vPosition * BasisU.w );
+    Value += BasisV.z * ( bezpatch[8].vPosition * BasisU.x + bezpatch[9].vPosition * BasisU.y + bezpatch[10].vPosition * BasisU.z + bezpatch[11].vPosition * BasisU.w );
+    Value += BasisV.w * ( bezpatch[12].vPosition * BasisU.x + bezpatch[13].vPosition * BasisU.y + bezpatch[14].vPosition * BasisU.z + bezpatch[15].vPosition * BasisU.w );
+
+    return Value;
+}
+
+// The domain shader is run once per vertex and calculates the final vertex's position
+// and attributes.  It receives the UVW from the fixed function tessellator and the
+// control point outputs from the hull shader.  Since we are using the DirectX 11
+// Tessellation pipeline, it is the domain shader's responsibility to calculate the
+// final SV_POSITION for each vertex.  In this sample, we evaluate the vertex's
+// position using a Bernstein polynomial and the normal is calculated as the cross
+// product of the U and V derivatives.
+
+// The input SV_DomainLocation to the domain shader comes from fixed function
+// tessellator.  And the OutputPatch comes from the hull shader.  From these, you
+// must calculate the final vertex position, color, texcoords, and other attributes.
+
+// The output from the domain shader will be a vertex that will go to the video card's
+// rasterization pipeline and get drawn to the screen.
+
+[domain("quad")]
+DS_OUTPUT main( HS_CONSTANT_DATA_OUTPUT input, 
+                    float2 UV : SV_DomainLocation,
+                    const OutputPatch<HS_OUTPUT, OUTPUT_PATCH_SIZE> bezpatch )
+{
+    float4 BasisU = BernsteinBasis( UV.x );
+    float4 BasisV = BernsteinBasis( UV.y );
+    float4 dBasisU = dBernsteinBasis( UV.x );
+    float4 dBasisV = dBernsteinBasis( UV.y );
+
+    float3 WorldPos = EvaluateBezier( bezpatch, BasisU, BasisV );
+    float3 Tangent = EvaluateBezier( bezpatch, dBasisU, BasisV );
+    float3 BiTangent = EvaluateBezier( bezpatch, BasisU, dBasisV );
+    float3 Norm = normalize( cross( Tangent, BiTangent ) );
+
+    DS_OUTPUT Output;
+    Output.vPosition = mul( float4(WorldPos,1), g_mViewProjection );
+    Output.vWorldPos = WorldPos;
+    Output.vNormal = Norm;
+
+    return Output;    
+}

+ 231 - 0
tools/clang/test/CodeGenHLSL/container/SubD11_SmoothPS.hlsl

@@ -0,0 +1,231 @@
+// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s
+
+// CHECK: sample
+// CHECK: dot3
+// CHECK: dot3
+// CHECK: dot3
+// CHECK: Rsqrt
+// CHECK: sample
+// CHECK: sample
+// CHECK: Log
+// CHECK: Exp
+// CHECK: Rsqrt
+// CHECK: dot3
+// CHECK: Saturate
+// CHECK: storeOutput
+
+//--------------------------------------------------------------------------------------
+// File: SubD11.hlsl
+//
+// This file contains functions to convert from a Catmull-Clark subdivision
+// representation to a bicubic patch representation.
+// 
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//--------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------
+// A sample extraordinary SubD quad is represented by the following diagram:
+//
+//                        15              Valences:
+//                       /  \               Vertex 0: 5
+//                      /    14             Vertex 1: 4
+//          17---------16   /  \            Vertex 2: 5
+//          | \         |  /    \           Vertex 3: 3
+//          |  \        | /      13
+//          |   \       |/      /         Prefixes:
+//          |    3------2------12           Vertex 0: 9
+//          |    |      |      |            Vertex 1: 12
+//          |    |      |      |            Vertex 2: 16
+//          4----0------1------11           Vertex 3: 18
+//         /    /|      |      |
+//        /    / |      |      |
+//       5    /  8------9------10
+//        \  /  /
+//         6   /
+//          \ /
+//           7
+//
+// Where the quad bounded by vertices 0,1,2,3 represents the actual subd surface of interest
+// The 1-ring neighborhood of the quad is represented by vertices 4 through 17.  The counter-
+// clockwise winding of this 1-ring neighborhood is important, especially when it comes to compute
+// the corner vertices of the bicubic patch that we will use to approximate the subd quad (0,1,2,3).
+// 
+// The resulting bicubic patch fits within the subd quad (0,1,2,3) and has the following control
+// point layout:
+//
+//     12--13--14--15
+//      8---9--10--11
+//      4---5---6---7
+//      0---1---2---3
+//
+// The inner 4 control points of the bicubic patch are a combination of only the vertices (0,1,2,3)
+// of the subd quad.  However, the corner control points for the bicubic patch (0,3,15,12) are actually
+// a much more complex weighting of the subd patch and the 1-ring neighborhood.  In the example above
+// the bicubic control point 0 is actually a weighted combination of subd points 0,1,2,3 and 1-ring
+// neighborhood points 17, 4, 5, 6, 7, 8, and 9.  We can see that the 1-ring neighbor hood is simply
+// walked from the prefix value from the previous corner (corner 3 in this case) to the prefix 
+// prefix value for the current corner.  We add one more vertex on either side of the prefix values
+// and we have all the data necessary to calculate the value for the corner points.
+//
+// The edge control points of the bicubic patch (1,2,13,14,4,8,7,11) are also combinations of their 
+// neighbors, but fortunately each one is only a combination of 6 values and no walk is required.
+//--------------------------------------------------------------------------------------
+
+#define MOD4(x) ((x)&3)
+#ifndef MAX_POINTS
+#define MAX_POINTS 32
+#endif
+#define MAX_BONE_MATRICES 80
+                        
+//--------------------------------------------------------------------------------------
+// Textures
+//--------------------------------------------------------------------------------------
+Texture2D       g_txHeight : register( t0 );           // Height and Bump texture
+Texture2D       g_txDiffuse : register( t1 );          // Diffuse texture
+Texture2D       g_txSpecular : register( t2 );         // Specular texture
+
+//--------------------------------------------------------------------------------------
+// Samplers
+//--------------------------------------------------------------------------------------
+SamplerState g_samLinear : register( s0 );
+SamplerState g_samPoint : register( s0 );
+
+//--------------------------------------------------------------------------------------
+// Constant Buffers
+//--------------------------------------------------------------------------------------
+cbuffer cbTangentStencilConstants : register( b0 )
+{
+    float g_TanM[1024]; // Tangent patch stencils precomputed by the application
+    float g_fCi[16];    // Valence coefficients precomputed by the application
+};
+
+cbuffer cbPerMesh : register( b1 )
+{
+    matrix g_mConstBoneWorld[MAX_BONE_MATRICES];
+};
+
+cbuffer cbPerFrame : register( b2 )
+{
+    matrix g_mViewProjection;
+    float3 g_vCameraPosWorld;
+    float  g_fTessellationFactor;
+    float  g_fDisplacementHeight;
+    float3 g_vSolidColor;
+};
+
+cbuffer cbPerSubset : register( b3 )
+{
+    int g_iPatchStartIndex;
+}
+
+//--------------------------------------------------------------------------------------
+Buffer<uint4>  g_ValencePrefixBuffer : register( t0 );
+
+//--------------------------------------------------------------------------------------
+struct VS_CONTROL_POINT_OUTPUT
+{
+    float3 vPosition		: WORLDPOS;
+    float2 vUV				: TEXCOORD0;
+    float3 vTangent			: TANGENT;
+};
+
+struct BEZIER_CONTROL_POINT
+{
+    float3 vPosition	: BEZIERPOS;
+};
+
+struct PS_INPUT
+{
+    float3 vWorldPos        : POSITION;
+    float3 vNormal			: NORMAL;
+    float2 vUV				: TEXCOORD;
+    float3 vTangent			: TANGENT;
+    float3 vBiTangent		: BITANGENT;
+};
+
+
+//--------------------------------------------------------------------------------------
+// Smooth shading pixel shader section
+//--------------------------------------------------------------------------------------
+
+float3 safe_normalize( float3 vInput )
+{
+    float len2 = dot( vInput, vInput );
+    if( len2 > 0 )
+    {
+        return vInput * rsqrt( len2 );
+    }
+    return vInput;
+}
+
+static const float g_fSpecularExponent = 32.0f;
+static const float g_fSpecularIntensity = 0.6f;
+static const float g_fNormalMapIntensity = 1.5f;
+
+float2 ComputeDirectionalLight( float3 vWorldPos, float3 vWorldNormal, float3 vDirLightDir )
+{
+    // Result.x is diffuse illumination, Result.y is specular illumination
+    float2 Result = float2( 0, 0 );
+    Result.x = pow( saturate( dot( vWorldNormal, -vDirLightDir ) ), 2 );
+    
+    float3 vPointToCamera = normalize( g_vCameraPosWorld - vWorldPos );
+    float3 vHalfAngle = normalize( vPointToCamera - vDirLightDir );
+    Result.y = pow( saturate( dot( vHalfAngle, vWorldNormal ) ), g_fSpecularExponent );
+    
+    return Result;
+}
+
+float3 ColorGamma( float3 Input )
+{
+    return pow( Input, 2.2f );
+}
+
+float4 main( PS_INPUT Input ) : SV_TARGET
+{
+    float4 vNormalMapSampleRaw = g_txHeight.Sample( g_samLinear, Input.vUV );
+    float3 vNormalMapSampleBiased = ( vNormalMapSampleRaw.xyz * 2 ) - 1; 
+    vNormalMapSampleBiased.xy *= g_fNormalMapIntensity;
+    float3 vNormalMapSample = normalize( vNormalMapSampleBiased );
+    
+    float3 vNormal = safe_normalize( Input.vNormal ) * vNormalMapSample.z;
+    vNormal += safe_normalize( Input.vTangent ) * vNormalMapSample.x;
+    vNormal += safe_normalize( Input.vBiTangent ) * vNormalMapSample.y;
+                     
+    //float3 vColor = float3( 1, 1, 1 );
+    float3 vColor = g_txDiffuse.Sample( g_samLinear, Input.vUV ).rgb;
+    float vSpecular = g_txSpecular.Sample( g_samLinear, Input.vUV ).r * g_fSpecularIntensity;
+    
+    const float3 DirLightDirections[4] =
+    {
+        // key light
+        normalize( float3( -63.345150, -58.043934, 27.785097 ) ),
+        // fill light
+        normalize( float3( 23.652107, -17.391443, 54.972504 ) ),
+        // back light 1
+        normalize( float3( 20.470509, -22.939510, -33.929531 ) ),
+        // back light 2
+        normalize( float3( -31.003685, 24.242104, -41.352859 ) ),
+    };
+    
+    const float3 DirLightColors[4] = 
+    {
+        // key light
+        ColorGamma( float3( 1.0f, 0.964f, 0.706f ) * 1.0f ),
+        // fill light
+        ColorGamma( float3( 0.446f, 0.641f, 1.0f ) * 1.0f ),
+        // back light 1
+        ColorGamma( float3( 1.0f, 0.862f, 0.419f ) * 1.0f ),
+        // back light 2
+        ColorGamma( float3( 0.405f, 0.630f, 1.0f ) * 1.0f ),
+    };
+        
+    float3 fLightColor = 0;
+    for( int i = 0; i < 4; ++i )
+    {
+        float2 LightDiffuseSpecular = ComputeDirectionalLight( Input.vWorldPos, vNormal, DirLightDirections[i] );
+        fLightColor += DirLightColors[i] * vColor * LightDiffuseSpecular.x;
+        fLightColor += DirLightColors[i] * LightDiffuseSpecular.y * vSpecular;
+    }
+    
+    return float4( fLightColor, 1 );
+}

+ 0 - 0
tools/clang/test/HLSL/abs2_m.ll → tools/clang/test/CodeGenHLSL/container/abs2_m.ll


+ 8 - 0
tools/clang/test/CodeGenHLSL/linker/createHandle_multi.hlsl

@@ -0,0 +1,8 @@
+// RUN: %dxc -T lib_6_3 -auto-binding-space 11 -default-linkage external %s  | FileCheck %s
+
+// CHECK: %"class.Texture2D<float>" = type { float
+// CHECK: %"class.Texture2D<vector<float, 4> >" = type { <4 x float>
+
+Texture2D<float> T1;
+Texture2D<float4> T2;
+float foo() { return T1.Load(1) * T2.Load(2); }

+ 10 - 0
tools/clang/test/CodeGenHLSL/linker/createHandle_multi2.hlsl

@@ -0,0 +1,10 @@
+// RUN: %dxc -T lib_6_3 -auto-binding-space 11 -default-linkage external %s  | FileCheck %s
+
+// CHECK: %"class.Texture2D<vector<float, 4> >" = type { <4 x float>
+// CHECK: %"class.Texture2D<float>" = type { float
+
+typedef snorm float snorm_float;
+
+Texture2D<float4> T1a;
+Texture2D<snorm_float> T2a;
+float foo2() { return T1a.Load(1).x * T2a.Load(2); }

+ 13 - 0
tools/clang/test/CodeGenHLSL/linker/lib_mat_cast.hlsl

@@ -0,0 +1,13 @@
+// RUN: %dxc -T lib_6_3 -default-linkage external %s | FileCheck %s
+
+// CHECK: bitcast %class.matrix.float.4.3* {{.*}} to <12 x float>*
+
+float mat_array_test(in float4 in0,
+                     in float4 in1,
+                     float4x3 basisArray[2]) // cube map basis.
+{
+  uint index = in1.w;
+
+  float3 outputs = mul(in0.xyz, basisArray[index]);
+  return outputs.z + basisArray[in1.y][in1.z].y;
+}

+ 13 - 0
tools/clang/test/CodeGenHLSL/linker/lib_mat_cast2.hlsl

@@ -0,0 +1,13 @@
+// RUN: %dxc -T lib_6_3 -default-linkage external %s | FileCheck %s
+
+// CHECK: bitcast %class.matrix.float.4.3* {{.*}} to <12 x float>*
+
+float3 mat_test(in float4 in0,
+                                  in float4 in1,
+                                  inout float4x3 m)
+{
+uint basisIndex = in1.w;
+float3 outputs = mul(in0.xyz,
+            (float3x3)m);
+return outputs + m[in1.z];
+}

+ 29 - 0
tools/clang/test/CodeGenHLSL/linker/lib_mat_entry.hlsl

@@ -0,0 +1,29 @@
+// RUN: %dxc -T lib_6_3  %s | FileCheck %s
+
+
+// CHECK: @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %A, i32 2)
+// CHECK: @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %A, i32 3)
+// CHECK: @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %A, i32 4)
+
+// CHECK: @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %A, i32 5)
+// CHECK: @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %A, i32 6)
+// CHECK: @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %A, i32 7)
+
+
+// CHECK: [[BCI:%.*]] = bitcast [24 x float]* {{.*}} to [2 x %class.matrix.float.4.3]*
+// CHECK: call float @"\01?mat_array_test@@YAMV?$vector@M$03@@0Y01V?$matrix@M$03$02@@@Z"(<4 x float> {{.*}}, <4 x float> {{.*}}, [2 x %class.matrix.float.4.3]* [[BCI]]
+
+float mat_array_test(in float4 inGBuffer0,
+                                  in float4 inGBuffer1,
+                                  float4x3 basisArray[2]);
+
+cbuffer A {
+float4 g0;
+float4 g1;
+float4x3 m[2];
+};
+
+[shader("pixel")]
+float main() : SV_Target {
+  return mat_array_test( g0, g1, m);
+}

+ 20 - 0
tools/clang/test/CodeGenHLSL/linker/lib_mat_entry2.hlsl

@@ -0,0 +1,20 @@
+// RUN: %dxc -T lib_6_3  %s | FileCheck %s
+
+// CHECK: [[BCI:%.*]] = bitcast <12 x float>* {{.*}} to %class.matrix.float.4.3*
+// CHECK:call <3 x float> @"\01?mat_test@@YA?AV?$vector@M$02@@V?$vector@M$03@@0AIAV?$matrix@M$03$02@@@Z"(<4 x float> {{.*}}, <4 x float> {{.*}}, %class.matrix.float.4.3* {{.*}}[[BCI]])
+
+float3 mat_test(in float4 in0,
+                                  in float4 in1,
+                                  inout float4x3 m);
+
+cbuffer A {
+float4 g0;
+float4 g1;
+float4x3 M;
+};
+
+[shader("pixel")]
+float3 main() : SV_Target {
+  float4x3 m = M;
+  return mat_test( g0, g1, m);
+}

+ 14 - 0
tools/clang/test/CodeGenHLSL/linker/lib_out_param_res.hlsl

@@ -0,0 +1,14 @@
+// RUN: %dxc -T lib_6_3 -auto-binding-space 11 -default-linkage external %s | FileCheck %s
+
+// resources in return/params disallowed for lib_6_3
+// CHECK: error: Exported function
+// CHECK: GetBuf
+// CHECK: must not contain a resource in parameter or return type
+
+Buffer<float4> GetBuf();
+
+[shader("pixel")]
+float4 test(uint i:I) : SV_Target {
+  Buffer<float4> buf = GetBuf();
+  return buf[i];
+}

+ 12 - 0
tools/clang/test/CodeGenHLSL/linker/lib_out_param_res_imp.hlsl

@@ -0,0 +1,12 @@
+// RUN: %dxc -T lib_6_3 -auto-binding-space 11 -default-linkage external %s | FileCheck %s
+
+// resources in return/params disallowed for lib_6_3
+// CHECK: error: Exported function
+// CHECK: GetBuf
+// CHECK: must not contain a resource in parameter or return type
+
+Buffer<float4> buf;
+
+Buffer<float4> GetBuf() {
+  return buf;
+}

+ 23 - 0
tools/clang/test/CodeGenHLSL/linker/lib_unresolved_func1.hlsl

@@ -0,0 +1,23 @@
+// RUN: %dxc -T lib_6_3 -auto-binding-space 11 -default-linkage external %s | FileCheck %s
+
+// CHECK-DAG: define float @"\01?lib1_fn@@YAMXZ"()
+// CHECK-DAG: declare float @"\01?external_fn@@YAMXZ"()
+// CHECK-DAG: declare float @"\01?external_fn1@@YAMXZ"()
+// CHECK-DAG: define float @"\01?call_lib2@@YAMXZ"()
+// CHECK-DAG: declare float @"\01?lib2_fn@@YAMXZ"()
+// CHECK-NOT: @"\01?unused_fn1
+
+float external_fn();
+float external_fn1();
+float lib2_fn();
+float unused_fn1();
+
+float lib1_fn() {
+  if (false)
+    return unused_fn1();
+  return 11.0 * external_fn() * external_fn1();
+}
+
+float call_lib2() {
+  return lib2_fn();
+}

+ 23 - 0
tools/clang/test/CodeGenHLSL/linker/lib_unresolved_func2.hlsl

@@ -0,0 +1,23 @@
+// RUN: %dxc -T lib_6_3 -auto-binding-space 11 -default-linkage external %s | FileCheck %s
+
+// CHECK-DAG: define float @"\01?lib2_fn@@YAMXZ"()
+// CHECK-DAG: declare float @"\01?external_fn@@YAMXZ"()
+// CHECK-DAG: declare float @"\01?external_fn2@@YAMXZ"()
+// CHECK-DAG: define float @"\01?call_lib1@@YAMXZ"()
+// CHECK-DAG: declare float @"\01?lib1_fn@@YAMXZ"()
+// CHECK-NOT: @"\01?unused_fn2
+
+float external_fn();
+float external_fn2();
+float lib1_fn();
+float unused_fn2();
+
+float lib2_fn() {
+  if (false)
+    return unused_fn2();
+  return 22.0 * external_fn() * external_fn2();
+}
+
+float call_lib1() {
+  return lib1_fn();
+}

+ 3 - 3
tools/clang/unittests/HLSL/DxilContainerTest.cpp

@@ -1433,8 +1433,8 @@ HRESULT HlslFileVariables::SetFromText(_In_count_(len) const char *pText, size_t
 #ifdef _WIN32 // Reflection unsupported
 TEST_F(DxilContainerTest, ReflectionMatchesDXBC_CheckIn) {
   WEX::TestExecution::SetVerifyOutput verifySettings(WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures);
-  ReflectionTest(hlsl_test::GetPathToHlslDataFile(L"..\\CodeGenHLSL\\Samples\\DX11\\SimpleBezier11DS.hlsl").c_str(), false);
-  ReflectionTest(hlsl_test::GetPathToHlslDataFile(L"..\\CodeGenHLSL\\Samples\\DX11\\SubD11_SmoothPS.hlsl").c_str(), false);
+  ReflectionTest(hlsl_test::GetPathToHlslDataFile(L"..\\CodeGenHLSL\\container\\SimpleBezier11DS.hlsl").c_str(), false);
+  ReflectionTest(hlsl_test::GetPathToHlslDataFile(L"..\\CodeGenHLSL\\container\\SubD11_SmoothPS.hlsl").c_str(), false);
 }
 
 TEST_F(DxilContainerTest, ReflectionMatchesDXBC_Full) {
@@ -1486,7 +1486,7 @@ TEST_F(DxilContainerTest, ReflectionMatchesDXBC_Full) {
 #endif // _WIN32 - Reflection unsupported
 
 TEST_F(DxilContainerTest, ValidateFromLL_Abs2) {
-  CodeGenTestCheck(L"abs2_m.ll");
+  CodeGenTestCheck(L"..\\CodeGenHLSL\\container\\abs2_m.ll");
 }
 
 TEST_F(DxilContainerTest, DxilContainerUnitTest) {

+ 25 - 25
tools/clang/unittests/HLSL/LinkerTest.cpp

@@ -306,9 +306,9 @@ TEST_F(LinkerTest, RunLinkNoAlloca) {
 
 TEST_F(LinkerTest, RunLinkMatArrayParam) {
   CComPtr<IDxcBlob> pEntryLib;
-  CompileLib(L"..\\CodeGenHLSL\\shader_stages\\library\\lib_mat_entry.hlsl", &pEntryLib);
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_mat_entry.hlsl", &pEntryLib);
   CComPtr<IDxcBlob> pLib;
-  CompileLib(L"..\\CodeGenHLSL\\shader_stages\\library\\lib_mat_cast.hlsl", &pLib);
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_mat_cast.hlsl", &pLib);
 
   CComPtr<IDxcLinker> pLinker;
   CreateLinker(&pLinker);
@@ -326,9 +326,9 @@ TEST_F(LinkerTest, RunLinkMatArrayParam) {
 
 TEST_F(LinkerTest, RunLinkMatParam) {
   CComPtr<IDxcBlob> pEntryLib;
-  CompileLib(L"..\\CodeGenHLSL\\shader_stages\\library\\lib_mat_entry2.hlsl", &pEntryLib);
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_mat_entry2.hlsl", &pEntryLib);
   CComPtr<IDxcBlob> pLib;
-  CompileLib(L"..\\CodeGenHLSL\\shader_stages\\library\\lib_mat_cast2.hlsl", &pLib);
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_mat_cast2.hlsl", &pLib);
 
   CComPtr<IDxcLinker> pLinker;
   CreateLinker(&pLinker);
@@ -346,7 +346,7 @@ TEST_F(LinkerTest, RunLinkMatParam) {
 
 TEST_F(LinkerTest, RunLinkMatParamToLib) {
   CComPtr<IDxcBlob> pEntryLib;
-  CompileLib(L"..\\CodeGenHLSL\\shader_stages\\library\\lib_mat_entry2.hlsl", &pEntryLib);
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_mat_entry2.hlsl", &pEntryLib);
 
   CComPtr<IDxcLinker> pLinker;
   CreateLinker(&pLinker);
@@ -362,9 +362,9 @@ TEST_F(LinkerTest, RunLinkMatParamToLib) {
 
 TEST_F(LinkerTest, RunLinkResRet) {
   CComPtr<IDxcBlob> pEntryLib;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\lib_out_param_res.hlsl", &pEntryLib);
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_out_param_res.hlsl", &pEntryLib);
   CComPtr<IDxcBlob> pLib;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\lib_out_param_res_imp.hlsl", &pLib);
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_out_param_res_imp.hlsl", &pLib);
 
   CComPtr<IDxcLinker> pLinker;
   CreateLinker(&pLinker);
@@ -382,11 +382,11 @@ TEST_F(LinkerTest, RunLinkToLib) {
   LPCWSTR option[] = {L"-Zi"};
 
   CComPtr<IDxcBlob> pEntryLib;
-  CompileLib(L"..\\CodeGenHLSL\\shader_stages\\library\\lib_mat_entry2.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_mat_entry2.hlsl",
              &pEntryLib, option, 1);
   CComPtr<IDxcBlob> pLib;
   CompileLib(
-      L"..\\CodeGenHLSL\\shader_stages\\library\\lib_mat_cast2.hlsl",
+      L"..\\CodeGenHLSL\\linker\\lib_mat_cast2.hlsl",
       &pLib, option, 1);
 
   CComPtr<IDxcLinker> pLinker;
@@ -403,10 +403,10 @@ TEST_F(LinkerTest, RunLinkToLib) {
 
 TEST_F(LinkerTest, RunLinkToLibExport) {
   CComPtr<IDxcBlob> pEntryLib;
-  CompileLib(L"..\\CodeGenHLSL\\shader_stages\\library\\lib_mat_entry2.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_mat_entry2.hlsl",
              &pEntryLib);
   CComPtr<IDxcBlob> pLib;
-  CompileLib(L"..\\CodeGenHLSL\\shader_stages\\library\\lib_mat_cast2.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_mat_cast2.hlsl",
              &pLib);
 
   CComPtr<IDxcLinker> pLinker;
@@ -447,10 +447,10 @@ TEST_F(LinkerTest, RunLinkToLibWithUnresolvedFunctions) {
   LPCWSTR option[] = { L"-Zi" };
 
   CComPtr<IDxcBlob> pLib1;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\lib_unresolved_func1.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_unresolved_func1.hlsl",
              &pLib1, option, 1);
   CComPtr<IDxcBlob> pLib2;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\lib_unresolved_func2.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_unresolved_func2.hlsl",
              &pLib2, option, 1);
 
   CComPtr<IDxcLinker> pLinker;
@@ -477,10 +477,10 @@ TEST_F(LinkerTest, RunLinkToLibWithUnresolvedFunctionsExports) {
   LPCWSTR option[] = { L"-Zi" };
 
   CComPtr<IDxcBlob> pLib1;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\lib_unresolved_func1.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_unresolved_func1.hlsl",
     &pLib1, option, 1);
   CComPtr<IDxcBlob> pLib2;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\lib_unresolved_func2.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_unresolved_func2.hlsl",
     &pLib2, option, 1);
 
   CComPtr<IDxcLinker> pLinker;
@@ -512,10 +512,10 @@ TEST_F(LinkerTest, RunLinkToLibWithExportNamesSwapped) {
   LPCWSTR option[] = { L"-Zi" };
 
   CComPtr<IDxcBlob> pLib1;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\lib_unresolved_func1.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_unresolved_func1.hlsl",
     &pLib1, option, 1);
   CComPtr<IDxcBlob> pLib2;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\lib_unresolved_func2.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_unresolved_func2.hlsl",
     &pLib2, option, 1);
 
   CComPtr<IDxcLinker> pLinker;
@@ -544,10 +544,10 @@ TEST_F(LinkerTest, RunLinkToLibWithExportCollision) {
   LPCWSTR option[] = { L"-Zi" };
 
   CComPtr<IDxcBlob> pLib1;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\lib_unresolved_func1.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_unresolved_func1.hlsl",
     &pLib1, option, 1);
   CComPtr<IDxcBlob> pLib2;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\lib_unresolved_func2.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_unresolved_func2.hlsl",
     &pLib2, option, 1);
 
   CComPtr<IDxcLinker> pLinker;
@@ -569,10 +569,10 @@ TEST_F(LinkerTest, RunLinkToLibWithUnusedExport) {
   LPCWSTR option[] = { L"-Zi" };
 
   CComPtr<IDxcBlob> pLib1;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\lib_unresolved_func1.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_unresolved_func1.hlsl",
     &pLib1, option, 1);
   CComPtr<IDxcBlob> pLib2;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\lib_unresolved_func2.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_unresolved_func2.hlsl",
     &pLib2, option, 1);
 
   CComPtr<IDxcLinker> pLinker;
@@ -594,10 +594,10 @@ TEST_F(LinkerTest, RunLinkToLibWithNoExports) {
   LPCWSTR option[] = { L"-Zi" };
 
   CComPtr<IDxcBlob> pLib1;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\lib_unresolved_func1.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_unresolved_func1.hlsl",
     &pLib1, option, 1);
   CComPtr<IDxcBlob> pLib2;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\lib_unresolved_func2.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\lib_unresolved_func2.hlsl",
     &pLib2, option, 1);
 
   CComPtr<IDxcLinker> pLinker;
@@ -619,10 +619,10 @@ TEST_F(LinkerTest, RunLinkWithPotentialIntrinsicNameCollisions) {
   LPCWSTR option[] = { L"-Zi" };
 
   CComPtr<IDxcBlob> pLib1;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\createHandle_multi.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\createHandle_multi.hlsl",
     &pLib1, option, 1);
   CComPtr<IDxcBlob> pLib2;
-  CompileLib(L"..\\CodeGenHLSL\\shader-compat-suite\\createHandle_multi2.hlsl",
+  CompileLib(L"..\\CodeGenHLSL\\linker\\createHandle_multi2.hlsl",
     &pLib2, option, 1);
 
   CComPtr<IDxcLinker> pLinker;

+ 0 - 0
tools/clang/test/CodeGenHLSL/NonUniform.hlsl → utils/hct/cmdtestfiles/NonUniform.hlsl


+ 23 - 0
utils/hct/cmdtestfiles/TextRS.hlsli

@@ -0,0 +1,23 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// This code is licensed under the MIT License (MIT).
+// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
+// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
+// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
+// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
+//
+// Developed by Minigraph
+//
+// Author:  James Stanard 
+//
+
+#define Text_RootSig \
+	"RootFlags(ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT), " \
+	"CBV(b0, visibility = SHADER_VISIBILITY_VERTEX)," \
+	"CBV(b0, visibility = SHADER_VISIBILITY_PIXEL)," \
+	"DescriptorTable(SRV(t0, numDescriptors = 1), visibility = SHADER_VISIBILITY_PIXEL)," \
+	"StaticSampler(s0, visibility = SHADER_VISIBILITY_PIXEL," \
+		"addressU = TEXTURE_ADDRESS_CLAMP," \
+		"addressV = TEXTURE_ADDRESS_CLAMP," \
+		"addressW = TEXTURE_ADDRESS_CLAMP," \
+		"filter = FILTER_MIN_MAG_MIP_LINEAR)"

+ 57 - 0
utils/hct/cmdtestfiles/TextVS.hlsl

@@ -0,0 +1,57 @@
+// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s
+
+// CHECK: SV_VertexID
+
+//
+// Copyright (c) Microsoft. All rights reserved.
+// This code is licensed under the MIT License (MIT).
+// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
+// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
+// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
+// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
+//
+// Developed by Minigraph
+//
+// Author:  James Stanard 
+//
+
+#include "TextRS.hlsli"
+
+cbuffer cbFontParams : register( b0 )
+{
+	float2 Scale;			// Scale and offset for transforming coordinates
+	float2 Offset;
+	float2 InvTexDim;		// Normalizes texture coordinates
+	float TextSize;			// Height of text in destination pixels
+	float TextScale;		// TextSize / FontHeight
+	float DstBorder;		// Extra space around a glyph measured in screen space coordinates
+	uint SrcBorder;			// Extra spacing around glyphs to avoid sampling neighboring glyphs
+}
+
+struct VS_INPUT
+{
+	float2 ScreenPos : POSITION;	// Upper-left position in screen pixel coordinates
+	uint4  Glyph : TEXCOORD;		// X, Y, Width, Height in texel space
+};
+
+struct VS_OUTPUT
+{
+	float4 Pos : SV_POSITION;	// Upper-left and lower-right coordinates in clip space
+	float2 Tex : TEXCOORD0;		// Upper-left and lower-right normalized UVs
+};
+
+[RootSignature(Text_RootSig)]
+VS_OUTPUT main( VS_INPUT input, uint VertID : SV_VertexID )
+{
+	const float2 xy0 = input.ScreenPos - DstBorder;
+	const float2 xy1 = input.ScreenPos + DstBorder + float2(TextScale * input.Glyph.z, TextSize);
+	const uint2 uv0 = input.Glyph.xy - SrcBorder;
+	const uint2 uv1 = input.Glyph.xy + SrcBorder + input.Glyph.zw;
+
+	float2 uv = float2( VertID & 1, (VertID >> 1) & 1 );
+
+	VS_OUTPUT output;
+	output.Pos = float4( lerp(xy0, xy1, uv) * Scale + Offset, 0, 1 );
+	output.Tex = lerp(uv0, uv1, uv) * InvTexDim;
+	return output;
+}

+ 0 - 0
tools/clang/test/CodeGenHLSL/batch_cmds.txt → utils/hct/cmdtestfiles/batch_cmds.txt


+ 0 - 0
tools/clang/test/CodeGenHLSL/batch_cmds2.txt → utils/hct/cmdtestfiles/batch_cmds2.txt


+ 0 - 0
tools/clang/test/HLSL/include-declarations.h → utils/hct/cmdtestfiles/include-declarations.h


+ 0 - 0
tools/clang/test/HLSL/include-main.hlsl → utils/hct/cmdtestfiles/include-main.hlsl


+ 191 - 0
utils/hct/cmdtestfiles/lib_entries2.hlsl

@@ -0,0 +1,191 @@
+// RUN: %dxc -T lib_6_3 -auto-binding-space 11 %s | FileCheck %s
+
+// Make sure entry function exist.
+// CHECK: @cs_main()
+// Make sure signatures are lowered.
+// CHECK: dx.op.threadId
+// CHECK: dx.op.groupId
+
+// Make sure entry function exist.
+// CHECK: @gs_main()
+// Make sure signatures are lowered.
+// CHECK: dx.op.loadInput
+// CHECK: dx.op.storeOutput
+// CHECK: dx.op.emitStream
+// CHECK: dx.op.cutStream
+
+// Make sure entry function exist.
+// CHECK: @ds_main()
+// Make sure signatures are lowered.
+// CHECK: dx.op.loadPatchConstant
+// CHECK: dx.op.domainLocation
+// CHECK: dx.op.loadInput
+// CHECK: dx.op.storeOutput
+
+// Make sure patch constant function exist.
+// CHECK: HSPerPatchFunc
+// Make sure signatures are lowered.
+// CHECK: dx.op.storePatchConstant
+
+// Make sure entry function exist.
+// CHECK: @hs_main()
+// Make sure signatures are lowered.
+// CHECK: dx.op.outputControlPointID
+// CHECK: dx.op.loadInput
+// CHECK: dx.op.storeOutput
+
+// Make sure entry function exist.
+// CHECK: @vs_main()
+// Make sure signatures are lowered.
+// CHECK: dx.op.loadInput
+// CHECK: dx.op.storeOutput
+
+// Make sure entry function exist.
+// CHECK: @ps_main()
+// Make sure signatures are lowered.
+// CHECK: dx.op.loadInput
+// CHECK: dx.op.storeOutput
+// Finish ps_main
+// CHECK: ret void
+
+
+
+
+// Make sure function entrys exist.
+// CHECK: !dx.entryPoints = !{{{.*}}, {{.*}}, {{.*}}, {{.*}}, {{.*}}, {{.*}}, {{.*}}}
+// Make sure cs don't have signature.
+// CHECK: !"cs_main", null
+
+void StoreCSOutput(uint2 tid, uint2 gid);
+
+[shader("compute")]
+[numthreads(8,8,1)]
+void cs_main( uint2 tid : SV_DispatchThreadID, uint2 gid : SV_GroupID, uint2 gtid : SV_GroupThreadID, uint gidx : SV_GroupIndex )
+{
+    StoreCSOutput(tid, gid);
+}
+
+// GS
+
+struct GSOut {
+  float2 uv : TEXCOORD0;
+  float4 pos : SV_Position;
+};
+
+// geometry shader that outputs 3 vertices from a point
+[shader("geometry")]
+[maxvertexcount(3)]
+[instance(24)]
+void gs_main(InputPatch<GSOut, 2>points, inout PointStream<GSOut> stream) {
+
+  stream.Append(points[0]);
+
+  stream.RestartStrip();
+}
+
+// DS
+struct PSSceneIn {
+  float4 pos : SV_Position;
+  float2 tex : TEXCOORD0;
+  float3 norm : NORMAL;
+
+uint   RTIndex      : SV_RenderTargetArrayIndex;
+};
+
+struct HSPerVertexData {
+  // This is just the original vertex verbatim. In many real life cases this would be a
+  // control point instead
+  PSSceneIn v;
+};
+
+struct HSPerPatchData {
+  // We at least have to specify tess factors per patch
+  // As we're tesselating triangles, there will be 4 tess factors
+  // In real life case this might contain face normal, for example
+  float edges[3] : SV_TessFactor;
+  float inside : SV_InsideTessFactor;
+};
+
+// domain shader that actually outputs the triangle vertices
+[shader("domain")]
+[domain("tri")] PSSceneIn ds_main(const float3 bary
+                               : SV_DomainLocation,
+                                 const OutputPatch<HSPerVertexData, 3> patch,
+                                 const HSPerPatchData perPatchData) {
+  PSSceneIn v;
+
+  // Compute interpolated coordinates
+  v.pos = patch[0].v.pos * bary.x + patch[1].v.pos * bary.y + patch[2].v.pos * bary.z + perPatchData.edges[1];
+  v.tex = patch[0].v.tex * bary.x + patch[1].v.tex * bary.y + patch[2].v.tex * bary.z + perPatchData.edges[0];
+  v.norm = patch[0].v.norm * bary.x + patch[1].v.norm * bary.y + patch[2].v.norm * bary.z + perPatchData.inside;
+  v.RTIndex = 0;
+  return v;
+}
+
+// HS
+
+HSPerPatchData HSPerPatchFunc( const InputPatch< PSSceneIn, 3 > points, OutputPatch<HSPerVertexData, 3> outp)
+{
+    HSPerPatchData d;
+
+    d.edges[ 0 ] = 1;
+    d.edges[ 1 ] = 1;
+    d.edges[ 2 ] = 1;
+    d.inside = 1;
+
+    return d;
+}
+
+// hull per-control point shader
+[shader("hull")]
+[domain("tri")]
+[partitioning("fractional_odd")]
+[outputtopology("triangle_cw")]
+[patchconstantfunc("HSPerPatchFunc")]
+[outputcontrolpoints(3)]
+HSPerVertexData hs_main( const uint id : SV_OutputControlPointID,
+                               const InputPatch< PSSceneIn, 3 > points)
+{
+    HSPerVertexData v;
+
+    // Just forward the vertex
+    v.v = points[ id ];
+
+	return v;
+}
+
+// VS
+
+struct VS_INPUT
+{
+	float3 vPosition	: POSITION;
+	float3 vNormal		: NORMAL;
+	float2 vTexcoord	: TEXCOORD0;
+};
+
+struct VS_OUTPUT
+{
+	float3 vNormal		: NORMAL;
+	float2 vTexcoord	: TEXCOORD0;
+	float4 vPosition	: SV_POSITION;
+};
+
+
+[shader("vertex")]
+VS_OUTPUT vs_main(VS_INPUT Input)
+{
+	VS_OUTPUT Output;
+
+	Output.vPosition = float4( Input.vPosition, 1.0 );
+	Output.vNormal = Input.vNormal;
+	Output.vTexcoord = Input.vTexcoord;
+
+       return Output;
+}
+
+// PS
+[shader("pixel")]
+float4 ps_main(float4 a : A) : SV_TARGET
+{
+  return a;
+}

+ 0 - 0
tools/clang/test/CodeGenHLSL/lib_entries3.hlsl → utils/hct/cmdtestfiles/lib_entries3.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/lib_entry4.hlsl → utils/hct/cmdtestfiles/lib_entry4.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/lib_inc.hlsl → utils/hct/cmdtestfiles/lib_inc.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/lib_inc0.hlsl → utils/hct/cmdtestfiles/lib_inc0.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/lib_inc0_b.hlsl → utils/hct/cmdtestfiles/lib_inc0_b.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/lib_inc1.hlsl → utils/hct/cmdtestfiles/lib_inc1.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/lib_inc2.hlsl → utils/hct/cmdtestfiles/lib_inc2.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/lib_inc3.hlsl → utils/hct/cmdtestfiles/lib_inc3.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/lib_res_match.hlsl → utils/hct/cmdtestfiles/lib_res_match.hlsl


+ 0 - 0
utils/hct/smoke.hlsl → utils/hct/cmdtestfiles/smoke.hlsl


+ 66 - 70
utils/hct/hcttestcmds.cmd

@@ -5,44 +5,40 @@ if "%1"=="" (
   exit /b 1
 )
 
-if "%2"=="" (
-  echo Second argument to hcttestcmds should be the absolute path to tools\clang\test\HLSL
-  exit /b 1
-)
-
 echo Testing command line programs at %1 ...
 
 setlocal
 
 set script_dir=%~dp0
+set testfiles=%script_dir%cmdtestfiles
 
 pushd %1
 
 echo Smoke test for dxr command line program ...
-dxr.exe -remove-unused-globals %script_dir%\smoke.hlsl -Emain 1>nul 2>nul
+dxr.exe -remove-unused-globals "%testfiles%\smoke.hlsl" -Emain 1>nul 2>nul
 if %errorlevel% neq  0 (
-  echo Failed - %CD%\dxr.exe -remove-unused-globals %script_dir%\smoke.hlsl -Emain
+  echo Failed - %CD%\dxr.exe -remove-unused-globals "%testfiles%\smoke.hlsl" -Emain
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Fc smoke.hlsl.c 1>nul
+dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Fc smoke.hlsl.c 1>nul
 if %errorlevel% neq 0 (
-  echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Fc %CD%\smoke.hlsl.c
+  echo Failed - %CD%\dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Fc %CD%\smoke.hlsl.c
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Zi /Fd smoke.hlsl.d 1>nul
+dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Zi /Fd smoke.hlsl.d 1>nul
 if %errorlevel% neq 0 (
-  echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Zi /Fd %CD%\smoke.hlsl.d
+  echo Failed - %CD%\dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Zi /Fd %CD%\smoke.hlsl.d
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Zi /Fd %CD%\ /Fo smoke.hlsl.strip 1>nul
+dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Zi /Fd %CD%\ /Fo smoke.hlsl.strip 1>nul
 if %errorlevel% neq 0 (
-  echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Zi /Fd %CD%\
+  echo Failed - %CD%\dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Zi /Fd %CD%\
   call :cleanup 2>nul
   exit /b 1
 )
@@ -67,60 +63,60 @@ if %errorlevel% equ 0 (
   exit /b 1
 )
 
-dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Fe smoke.hlsl.e 1>nul
+dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Fe smoke.hlsl.e 1>nul
 if %errorlevel% neq 0 (
-  echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Fe %CD%\smoke.hlsl.e
+  echo Failed - %CD%\dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Fe %CD%\smoke.hlsl.e
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /ast-dump 1>nul
+dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /ast-dump 1>nul
 if %errorlevel% neq 0 (
-  echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /ast-dump
+  echo Failed - %CD%\dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /ast-dump
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Dcheck_warning 1>nul 2>smoke.warning.txt
+dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Dcheck_warning 1>nul 2>smoke.warning.txt
 if %errorlevel% neq 0 (
-  echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Dcheck_warning
+  echo Failed - %CD%\dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Dcheck_warning
   call :cleanup 2>nul
   exit /b 1
 )
 
 findstr warning: %CD%\smoke.warning.txt 1>nul
 if %errorlevel% neq 0 (
-  echo Failed to get warning message from command %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Dcheck_warning
+  echo Failed to get warning message from command %CD%\dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Dcheck_warning
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Dcheck_warning /no-warnings 1>nul 2>smoke.no.warning.txt
+dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Dcheck_warning /no-warnings 1>nul 2>smoke.no.warning.txt
 if %errorlevel% neq 0 (
-  echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Dcheck_warning /no-warnings
+  echo Failed - %CD%\dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Dcheck_warning /no-warnings
   call :cleanup 2>nul
   exit /b 1
 )
 
 findstr warning: %CD%\smoke.no.warning.txt 1>nul
 if %errorlevel% equ 0 (
-  echo no-warning option failed : %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Dcheck_warning /no-warnings
+  echo no-warning option failed : %CD%\dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Dcheck_warning /no-warnings
   call :cleanup 2>nul
   exit /b 1
 )
 
 
 echo Smoke test for dxc command line program ...
-dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Fh smoke.hlsl.h /Vn g_myvar 1> nul
+dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Fh smoke.hlsl.h /Vn g_myvar 1> nul
 if %errorlevel% neq 0 (
-  echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Fh %CD%\smoke.hlsl.h /Vn g_myvar
+  echo Failed - %CD%\dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Fh %CD%\smoke.hlsl.h /Vn g_myvar
   call :cleanup 2>nul
   exit /b 1
 )
 findstr g_myvar %CD%\smoke.hlsl.h 1>nul
 if %errorlevel% neq 0 (
   echo Failed to find the variable g_myvar in %CD%\smoke.hlsl.h
-  echo Debug with start devenv /debugexe %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Fh %CD%\smoke.hlsl.h /Vn g_myvar
+  echo Debug with start devenv /debugexe %CD%\dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Fh %CD%\smoke.hlsl.h /Vn g_myvar
   call :cleanup 2>nul
   exit /b 1
 )
@@ -131,28 +127,28 @@ if %errorlevel% neq 0 (
   exit /b 1
 )
 
-dxc.exe %script_dir%\smoke.hlsl /P preprocessed.hlsl 1>nul
+dxc.exe "%testfiles%\smoke.hlsl" /P preprocessed.hlsl 1>nul
 if %errorlevel% neq 0 (
   echo Failed to preprocess smoke.hlsl
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl -force_rootsig_ver rootsig_1_0 1>nul
+dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" -force_rootsig_ver rootsig_1_0 1>nul
 if %errorlevel% neq 0 (
   echo Failed to compile with forcing rootsignature rootsig_1_0
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl -force_rootsig_ver rootsig_1_1 1>nul
+dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" -force_rootsig_ver rootsig_1_1 1>nul
 if %errorlevel% neq 0 (
   echo Failed to compile with forcing rootsignature rootsig_1_1
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl -force_rootsig_ver rootsig_2_0 2>nul
+dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" -force_rootsig_ver rootsig_2_0 2>nul
 if %errorlevel% equ 0 (
   echo rootsig_2_0 is not supported but compilation passed
   call :cleanup 2>nul
@@ -175,30 +171,30 @@ if %errorlevel% neq 0 (
   exit /b 1
 )
 
-dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /HV 2016 1>nul
+dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /HV 2016 1>nul
 if %errorlevel% neq 0 (
   echo Failed to compile with HLSL version 2016
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /HV 2015 2>nul
+dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /HV 2015 2>nul
 if %errorlevel% equ 0 (
   echo Unsupported HLSL version 2015 should fail but did not fail
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Zi /Fo smoke.cso 1> nul
+dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Zi /Fo smoke.cso 1> nul
 if %errorlevel% neq 0 (
   echo Failed to compile to binary object from %CD%\smoke.hlsl
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Zi /Fo smoke.cso /Cc /Ni /No /Lx 1> nul
+dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Zi /Fo smoke.cso /Cc /Ni /No /Lx 1> nul
 if %errorlevel% neq 0 (
-  echo Failed to compile to binary object from %script_dir%\smoke.hlsl with disassembly options
+  echo Failed to compile to binary object from "%testfiles%\smoke.hlsl" with disassembly options
   call :cleanup 2>nul
   exit /b 1
 )
@@ -224,9 +220,9 @@ if %errorlevel% neq 0 (
   exit /b 1
 )
 
-dxc.exe %script_dir%\smoke.hlsl /D "semantic = SV_Position" /T vs_6_0 /Zi /DDX12 /Fo smoke.cso 1> nul
+dxc.exe "%testfiles%\smoke.hlsl" /D "semantic = SV_Position" /T vs_6_0 /Zi /DDX12 /Fo smoke.cso 1> nul
 if %errorlevel% neq 0 (
-  echo Failed to compile %script_dir%\smoke.hlsl with command line defines
+  echo Failed to compile "%testfiles%\smoke.hlsl" with command line defines
   call :cleanup 2>nul
   exit /b 1
 )
@@ -267,7 +263,7 @@ if %errorlevel% neq 0 (
   exit /b 1
 )
 
-dxc.exe "%2"\..\CodeGenHLSL\NonUniform.hlsl /T ps_6_0 /DDX12 /Fo NonUniform.cso 1>nul
+dxc.exe "%testfiles%\NonUniform.hlsl" /T ps_6_0 /DDX12 /Fo NonUniform.cso 1>nul
 if %errorlevel% neq 0 (
   echo Failed to compile NonUniform.hlsl
   call :cleanup 2>nul
@@ -344,9 +340,9 @@ if %errorlevel% equ 0 (
   exit /b 1
 )
 
-dxc.exe %2\..\CodeGenHLSL\Samples\MiniEngine\TextVS.hlsl /Tvs_6_0 /Zi /Fo TextVS.cso 1>nul
+dxc.exe "%testfiles%\TextVS.hlsl" /Tvs_6_0 /Zi /Fo TextVS.cso 1>nul
 if %errorlevel% neq 0 (
-  echo failed to compile %2\..\CodeGenHLSL\Samples\MiniEngine\TextVS.hlsl
+  echo failed to compile "%testfiles%\TextVS.hlsl"
   call :cleanup 2>nul
   exit /b 1
 )
@@ -409,7 +405,7 @@ if %errorlevel% neq 0 (
 )
 
 echo Smoke test for dxc.exe shader model upgrade...
-dxc.exe /T ps_5_0 %script_dir%\smoke.hlsl 1> nul
+dxc.exe /T ps_5_0 "%testfiles%\smoke.hlsl" 1> nul
 if %errorlevel% neq 0 (
   echo Failed shader model upgrade test - %CD%\dxc.exe /T ps_5_0 %CD%\smoke.hlsl
   call :cleanup 2>nul
@@ -481,7 +477,7 @@ if %errorlevel% neq 0 (
 )
 
 echo Smoke test for dxopt command line ...
-dxc /Odump /T ps_6_0 %script_dir%\smoke.hlsl > passes.txt
+dxc /Odump /T ps_6_0 "%testfiles%\smoke.hlsl" > passes.txt
 if %errorlevel% neq 0 (
   echo Failed to /ODump
   call :cleanup 2>nul
@@ -494,7 +490,7 @@ if %errorlevel% neq 0 (
   exit /b 1
 )
 echo -print-module >> passes.txt
-dxc /T ps_6_0 %script_dir%\smoke.hlsl /fcgl > smoke.hl.txt
+dxc /T ps_6_0 "%testfiles%\smoke.hlsl" /fcgl > smoke.hl.txt
 if %errorlevel% neq 0 (
   echo Failed to do a high-level codegen.
   call :cleanup 2>nul
@@ -514,37 +510,37 @@ if %errorlevel% neq 0 (
 )
 
 echo Smoke test for dxc_batch command line ...
-dxc_batch.exe -lib-link -multi-thread "%2"\..\CodeGenHLSL\batch_cmds2.txt 1>nul
+dxc_batch.exe -lib-link -multi-thread "%testfiles%\batch_cmds2.txt" 1>nul
 if %errorlevel% neq 0 (
-  echo Failed to run dxc_batch -lib-link -multi-thread %2\..\CodeGenHLSL\batch_cmds2.txt
+  echo Failed to run dxc_batch -lib-link -multi-thread "%testfiles%\batch_cmds2.txt"
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc_batch.exe -lib-link -multi-thread "%2"\..\CodeGenHLSL\batch_cmds.txt 1>nul
+dxc_batch.exe -lib-link -multi-thread "%testfiles%\batch_cmds.txt" 1>nul
 if %errorlevel% neq 0 (
-  echo Failed to run dxc_batch -lib-link -multi-thread %2\..\CodeGenHLSL\batch_cmds.txt
+  echo Failed to run dxc_batch -lib-link -multi-thread "%testfiles%\batch_cmds.txt"
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc_batch.exe -multi-thread "%2"\..\CodeGenHLSL\batch_cmds.txt 1>nul
+dxc_batch.exe -multi-thread "%testfiles%\batch_cmds.txt" 1>nul
 if %errorlevel% neq 0 (
-  echo Failed to run dxc_batch -multi-thread %2\..\CodeGenHLSL\batch_cmds.txt
+  echo Failed to run dxc_batch -multi-thread "%testfiles%\batch_cmds.txt"
   call :cleanup 2>nul
   exit /b 1
 )
 
 echo Smoke test for dxl command line ...
-dxc.exe -T lib_6_x "%2"\..\CodeGenHLSL\lib_entry4.hlsl -Fo lib_entry4.dxbc 1>nul
+dxc.exe -T lib_6_x "%testfiles%\lib_entry4.hlsl" -Fo lib_entry4.dxbc 1>nul
 if %errorlevel% neq 0 (
-  echo Failed to run dxc.exe -T "%2"\..\CodeGenHLSL\lib_6_x lib_entry4.hlsl -Fo lib_entry4.dxbc
+  echo Failed to run dxc.exe -T lib_6_x "%testfiles%\lib_entry4.hlsl" -Fo lib_entry4.dxbc
   call :cleanup 2>nul
   exit /b 1
 )
-dxc.exe -T lib_6_x "%2"\..\CodeGenHLSL\lib_res_match.hlsl -Fo lib_res_match.dxbc 1>nul
+dxc.exe -T lib_6_x "%testfiles%\lib_res_match.hlsl" -Fo lib_res_match.dxbc 1>nul
 if %errorlevel% neq 0 (
-  echo Failed to run dxc.exe -T "%2"\..\CodeGenHLSL\lib_6_x lib_res_match.hlsl -Fo lib_res_match.dxbc
+  echo Failed to run dxc.exe -T lib_6_x "%testfiles%\lib_res_match.hlsl" -Fo lib_res_match.dxbc
   call :cleanup 2>nul
   exit /b 1
 )
@@ -557,51 +553,51 @@ if %errorlevel% neq 0 (
 )
 
 echo Test for denorm options ...
-dxc.exe %script_dir%\smoke.hlsl /Tps_6_2 /denorm preserve 1>nul
+dxc.exe "%testfiles%\smoke.hlsl" /Tps_6_2 /denorm preserve 1>nul
 if %errorlevel% neq 0 (
-  echo Failed to compile %script_dir%\smoke.hlsl with /denorm ieee option
+  echo Failed to compile "%testfiles%\smoke.hlsl" with /denorm ieee option
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe %script_dir%\smoke.hlsl /Tps_6_2 /denorm ftz 1>nul
+dxc.exe "%testfiles%\smoke.hlsl" /Tps_6_2 /denorm ftz 1>nul
 if %errorlevel% neq 0 (
-  echo Failed to compile %script_dir%\smoke.hlsl with /denorm ftz option
+  echo Failed to compile "%testfiles%\smoke.hlsl" with /denorm ftz option
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe %script_dir%\smoke.hlsl /Tps_6_2 /denorm abc 2>nul
+dxc.exe "%testfiles%\smoke.hlsl" /Tps_6_2 /denorm abc 2>nul
 if %errorlevel% equ 0 (
-  echo dxc incorrectly compiled %script_dir%\smoke.hlsl with invalid /denorm option
+  echo dxc incorrectly compiled "%testfiles%\smoke.hlsl" with invalid /denorm option
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe %script_dir%\smoke.hlsl /Tps_6_1 /denorm any 2>nul
+dxc.exe "%testfiles%\smoke.hlsl" /Tps_6_1 /denorm any 2>nul
 if %errorlevel% equ 0 (
-  echo dxc incorrectly compiled %script_dir%\smoke.hlsl shader model 6.1 with /denorm option
+  echo dxc incorrectly compiled "%testfiles%\smoke.hlsl" shader model 6.1 with /denorm option
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe %script_dir%\smoke.hlsl /Tps_6_2 /enable-16bit-types 1>nul
+dxc.exe "%testfiles%\smoke.hlsl" /Tps_6_2 /enable-16bit-types 1>nul
 if %errorlevel% neq 0 (
-  echo Failed to compile %script_dir%\smoke.hlsl with /enable-16bit-types option
+  echo Failed to compile "%testfiles%\smoke.hlsl" with /enable-16bit-types option
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe %script_dir%\smoke.hlsl /Tps_6_1 /enable-16bit-types 2>nul
+dxc.exe "%testfiles%\smoke.hlsl" /Tps_6_1 /enable-16bit-types 2>nul
 if %errorlevel% equ 0 (
-  echo dxc incorrectly compiled %script_dir%\smoke.hlsl shader model 6.1 with /enable-16bit-types option
+  echo dxc incorrectly compiled "%testfiles%\smoke.hlsl" shader model 6.1 with /enable-16bit-types option
   call :cleanup 2>nul
   exit /b 1
 )
 
-dxc.exe %script_dir%\smoke.hlsl /Tps_6_2 /enable-16bit-types /HV 2017 2>nul
+dxc.exe "%testfiles%\smoke.hlsl" /Tps_6_2 /enable-16bit-types /HV 2017 2>nul
 if %errorlevel% equ 0 (
-  echo dxc incorrectly compiled %script_dir%\smoke.hlsl shader model 6.2 with /enable-16bit-types and /HV 2017 option
+  echo dxc incorrectly compiled "%testfiles%\smoke.hlsl" shader model 6.2 with /enable-16bit-types and /HV 2017 option
   call :cleanup 2>nul
   exit /b 1
 )
@@ -609,8 +605,8 @@ if %errorlevel% equ 0 (
 echo Test file with relative path and include
 mkdir subfolder 2>nul
 mkdir inc       2>nul
-copy "%2"\include-main.hlsl subfolder >nul
-copy "%2"\include-declarations.h inc  >nul
+copy "%testfiles%\include-main.hlsl" subfolder >nul
+copy "%testfiles%\include-declarations.h" inc  >nul
 dxc.exe -Tps_6_0 -I inc subfolder\include-main.hlsl >nul
 if %errorlevel% neq 0 (
   echo Failed to compile subfolder\include-main.hlsl
@@ -628,7 +624,7 @@ if %errorlevel% neq 0 (
 rem SPIR-V Change Starts
 echo Smoke test for SPIR-V CodeGen ...
 set spirv_smoke_success=0
-dxc.exe %script_dir%\smoke.hlsl /T ps_6_0 -spirv 1>%CD%\smoke.spirv.log 2>&1
+dxc.exe "%testfiles%\smoke.hlsl" /T ps_6_0 -spirv 1>%CD%\smoke.spirv.log 2>&1
 if %errorlevel% equ 0 set spirv_smoke_success=1
 findstr /c:"SPIR-V CodeGen not available" %CD%\smoke.spirv.log >nul
 if %errorlevel% equ 0 set spirv_smoke_success=1