Bläddra i källkod

Removed redundant tests and relocated some files where they should be. (#27)

Signed-off-by: galibzon <[email protected]>
galibzon 3 år sedan
förälder
incheckning
432595f328

+ 0 - 18
tests/Advanced/emission-tester.py

@@ -28,24 +28,6 @@ def doTests(compiler, silent, azdxcpath):
     #  because at that time it will still be set to the working directory of the calling script
     workDir = os.getcwd().replace('\\', '/')
 
-    if testhelper.verifyEmissionPatterns(os.path.abspath(os.path.join(workDir, "../Samples/Variants.azsl")), compiler, silent, []) : result += 1
-    else: resultFailed += 1
-
-    if testhelper.verifyEmissionPatterns(os.path.abspath(os.path.join(workDir, "../Samples/RootSig.azsl")), compiler, silent, ["--root-sig", "--namespace", "dx"]) : result += 1
-    else: resultFailed += 1
-
-    if testhelper.verifyEmissionPatterns(os.path.abspath(os.path.join(workDir, "../Samples/RootSigSpace.azsl")), compiler, silent, ["--use-spaces", "--root-sig", "--namespace", "dx"]) : result += 1
-    else: resultFailed += 1
-
-    if testhelper.verifyEmissionPatterns(os.path.abspath(os.path.join(workDir, "../Samples/RootSigUnique.azsl")), compiler, silent, ["--unique-idx", "--root-sig", "--namespace", "dx"]) : result += 1
-    else: resultFailed += 1
-
-    if testhelper.verifyEmissionPatterns(os.path.abspath(os.path.join(workDir, "../Samples/RootSigUniqueSpace.azsl")), compiler, silent, ["--unique-idx", "--use-spaces", "--root-sig", "--namespace", "dx"]) : result += 1
-    else: resultFailed += 1
-
-    if testhelper.verifyEmissionPatterns(os.path.abspath(os.path.join(workDir, "../Samples/UnboundedArrays.azsl_manual")), compiler, silent, ["--use-spaces",]) : result += 1
-    else: resultFailed += 1
-
     for base, dirs, files in os.walk(os.path.join(workDir, "../Emission/")):
         for f in files:
             if f.endswith(".azsl"):

+ 1 - 1
tests/Advanced/options.py

@@ -137,7 +137,7 @@ def doTests(compiler, silent, azdxcpath):
     #  because at that time it will still be set to the working directory of the calling script
     workDir = os.getcwd()
 
-    if verifyOptionsEmission(os.path.join(workDir, "../Samples/Variants.azsl"), compiler, silent) : result += 1
+    if verifyOptionsEmission(os.path.join(workDir, "../Emission/Variants.azsl"), compiler, silent) : result += 1
     else: resultFailed += 1
 
     if verifyOptionsEmissionIntegerRanges(os.path.join(workDir, "../Samples/VariantsRanges.azsl"), compiler, silent) : result += 1

+ 0 - 19
tests/Advanced/unbounded-arrays-emission-tester.py

@@ -36,25 +36,6 @@ def doTests(compiler, silent, azdxcpath):
     # You can get it once doTests() is called, but not during initialization of the module,
     #  because at that time it will still be set to the working directory of the calling script
     workDir = os.getcwd().replace('\\', '/')
-
-    # expect success when using --use-spaces
-    sampleFilePath = os.path.abspath(os.path.join(workDir, "../Samples/UnboundedArrays.azsl_manual"))
-    if testhelper.verifyEmissionPatterns(sampleFilePath, compiler, silent, ["--use-spaces",]) : result += 1
-    else: resultFailed += 1
-    
-    # expect to fail without --use-spaces
-    stderr, failed = testfuncs.buildAndGetError(sampleFilePath, compiler, silent, [])
-    if failed:
-        result += 1
-        if not silent:
-            stderr = stderr.decode('utf-8')
-            print (fg.CYAN + style.BRIGHT +
-               "unbounded-arrays-emission-tester.py: "+
-               "Good, got expected error when NOT using --use-spaces: " + stderr + style.RESET_ALL)
-    else:
-        resultFailed += 1
-        if not silent:
-            print(style.BRIGHT + fg.RED + "failed unbounded-arrays-emission-tester.py: was expecting error." + style.RESET_ALL)
             
     # expect to fail with --unique-idx
     sampleFilePath = os.path.abspath(os.path.join(workDir, "../Semantic/unbounded-arrays1.azsl"))

+ 1 - 1
tests/Advanced/unbounded-arrays-srg-layout.py

@@ -88,7 +88,7 @@ def doTests(compiler, silent, azdxcpath):
     #  because at that time it will still be set to the working directory of the calling script
     workDir = os.getcwd()
 
-    if verify(os.path.join(workDir, "../Samples/UnboundedArrays.azsl_manual"), compiler, silent) : result += 1
+    if verify(os.path.join(workDir, "../Emission/UnboundedArrays.azsl"), compiler, silent) : result += 1
     else: resultFailed += 1
 
 if __name__ == "__main__":

+ 5 - 4
tests/Samples/UnboundedArrays.azsl_manual → tests/Emission/AsError/UnboundedArrays.azsl

@@ -1,8 +1,9 @@
-// This sample makes sure unbounded arrays are supported across all register classes t,u,s,b,
-// the extension is ".azsl_manual" instead of ".azsl" because it is required to run manually with --use-spaces to pass.
-// otherwise the test automation system will pick it up and attempt to compile it without --use-spaces.
-// and it's used for full emission validation.
+// This sample makes sure unbounded arrays are supported across all register classes t,u,s,b.
 // For this shader to compile it is necessary to use --use-spaces.
+// This shader has been copied into the AsError/ directory because it is expected to
+// fail with error code 48 because it needs "--use-spaces" to compile successfully.
+//
+// #EC 48
 
 ShaderResourceGroupSemantic slot1
 {

+ 0 - 0
tests/Samples/RootSig.azsl → tests/Emission/RootSig.azsl


+ 3 - 1
tests/Samples/RootSig.txt → tests/Emission/RootSig.txt

@@ -1,4 +1,6 @@
-# Root signature produced with azslc.exe RootSig.azsl --root-sig
+/*
+    Cmdargs: ['--root-sig', '--namespace', 'dx']
+*/
 "CBV ( b0 , space = 0"
 "CBV ( b2 , space = 0"
 "CBV ( b3 , space = 0"

+ 0 - 0
tests/Samples/RootSigSpace.azsl → tests/Emission/RootSigSpace.azsl


+ 3 - 1
tests/Samples/RootSigSpace.txt → tests/Emission/RootSigSpace.txt

@@ -1,4 +1,6 @@
-# Root signature produced with azslc.exe RootSig.azsl --use-spaces --root-sig
+/*
+    Cmdargs: ['--use-spaces', '--root-sig', '--namespace', 'dx']
+*/
 "CBV ( b0 , space = 0"
 "CBV ( b0 , space = 2"
 "CBV ( b0 , space = 3"

+ 0 - 0
tests/Samples/RootSigUnique.azsl → tests/Emission/RootSigUnique.azsl


+ 3 - 1
tests/Samples/RootSigUnique.txt → tests/Emission/RootSigUnique.txt

@@ -1,4 +1,6 @@
-# Root signature produced with azslc.exe RootSig.azsl --unique-idx --root-sig
+/*
+    Cmdargs: ['--unique-idx', '--root-sig', '--namespace', 'dx']
+*/
 "CBV ( b8 , space = 0"
 "CBV ( b22 , space = 0"
 "CBV ( b30 , space = 0"

+ 0 - 0
tests/Samples/RootSigUniqueSpace.azsl → tests/Emission/RootSigUniqueSpace.azsl


+ 3 - 1
tests/Samples/RootSigUniqueSpace.txt → tests/Emission/RootSigUniqueSpace.txt

@@ -1,4 +1,6 @@
-# Root signature produced with azslc.exe RootSig.azsl --unique-idx --use-spaces --root-sig
+/*
+    Cmdargs: ['--unique-idx', '--use-spaces', '--root-sig', '--namespace', 'dx']
+*/
 "CBV ( b8 , space = 0"
 "CBV ( b8 , space = 2"
 "CBV ( b7 , space = 3"

+ 72 - 0
tests/Emission/UnboundedArrays.azsl

@@ -0,0 +1,72 @@
+// This sample makes sure unbounded arrays are supported across all register classes t,u,s,b.
+// For this shader to compile it is necessary to use --use-spaces.
+
+ShaderResourceGroupSemantic slot1
+{
+    FrequencyId = 1;
+};
+
+ShaderResourceGroupSemantic slot2
+{
+    FrequencyId = 2;
+};
+
+struct MyStruct
+{
+    float4 m_a;
+    float4 m_b;
+};
+
+ShaderResourceGroup SRG1 : slot1
+{
+    int m_index; // Triggers usage of b0.
+    uint2 m_rwTexCoord;
+
+    Texture2D<float4>        m_texSRVa;        // Takes t0, space0
+    Texture2D<float4>        m_texSRVb[];      // Takes t1+, space0
+    RWTexture2D<float4>      m_texUAVa;        // Takes u0, space0
+    RWTexture2D<float4>      m_texUAVb[];      // Takes u1+, space0
+    Sampler                  m_samplera;       // Takes s0, space0
+    Sampler                  m_samplerb[];     // Takes s1+, space0
+    ConstantBuffer<MyStruct> m_structArraya;   // Takes b1, space0
+    ConstantBuffer<MyStruct> m_structArrayb[]; // Takes b2+, space0 
+};
+
+// When using --use-spaces this SRG2 will take space1... Otherwise
+// this shader won't compile because all unbounded arrays in SRG1
+// take over all available registers in space0. 
+ShaderResourceGroup SRG2 : slot2
+{
+    int m_index; // Triggers usage of b0.
+    uint2 m_rwTexCoord;
+
+    Texture2D<float4>        m_texSRVa;        // Takes t0, space0
+    Texture2D<float4>        m_texSRVb[];      // Takes t1+, space0
+    RWTexture2D<float4>      m_texUAVa;        // Takes u0, space0
+    RWTexture2D<float4>      m_texUAVb[];      // Takes u1+, space0
+    Sampler                  m_samplera;       // Takes s0, space0
+    Sampler                  m_samplerb[];     // Takes s1+, space0
+    ConstantBuffer<MyStruct> m_structArraya;   // Takes b1, space0
+    ConstantBuffer<MyStruct> m_structArrayb[]; // Takes b2+, space0 
+}
+
+float4 MainPS(float2 uv : TEXCOORD0) : SV_Target0
+{
+    float4 diffuse = float4(0, 0, 0, 1);
+
+    diffuse += SRG1::m_texSRVa.Sample(SRG1::m_samplera, uv);
+    diffuse += SRG1::m_texSRVb[SRG1::m_index].Sample(SRG1::m_samplerb[SRG1::m_index], uv);
+    diffuse += SRG1::m_texUAVa[SRG1::m_rwTexCoord];
+    diffuse += SRG1::m_texUAVb[SRG1::m_index][SRG1::m_rwTexCoord];
+    diffuse += SRG1::m_structArraya.m_a;
+    diffuse += SRG1::m_structArrayb[SRG1::m_index].m_b;
+
+    diffuse += SRG2::m_texSRVa.Sample(SRG2::m_samplera, uv);
+    diffuse += SRG2::m_texSRVb[SRG2::m_index].Sample(SRG2::m_samplerb[SRG2::m_index], uv);
+    diffuse += SRG2::m_texUAVa[SRG2::m_rwTexCoord];
+    diffuse += SRG2::m_texUAVb[SRG2::m_index][SRG2::m_rwTexCoord];
+    diffuse += SRG2::m_structArraya.m_a;
+    diffuse += SRG2::m_structArrayb[SRG2::m_index].m_b;
+    
+    return diffuse;
+}

+ 3 - 0
tests/Samples/UnboundedArrays.txt → tests/Emission/UnboundedArrays.txt

@@ -1,3 +1,6 @@
+/*
+    Cmdargs: ['--use-spaces']
+*/
 # list lines expected to have tokens matching the patterns in the strings. each space is a separation.
 
 "Texture2D < float4 > SRG1_m_texSRVa : register ( t0 , space0 ) ;"

+ 0 - 0
tests/Samples/Variants.azsl → tests/Emission/Variants.azsl


+ 0 - 0
tests/Samples/Variants.txt → tests/Emission/Variants.txt