Forráskód Böngészése

Removed the --use-spaces command line option and made it always-on. We don't have any known use cases for disabling unique per-SRG register spaces. This simplification will make it easier to implement a new "spill" spaces feature to support unbounded arrays.

Updated all unit tests.

Signed-off-by: santorac <[email protected]>
santorac 3 éve
szülő
commit
5d60bb0703
46 módosított fájl, 224 hozzáadás és 632 törlés
  1. 1 1
      Platform/iOS/src/MetalPlatformEmitter.cpp
  2. 8 11
      src/AzslcBackend.cpp
  3. 0 1
      src/AzslcBackend.h
  4. 4 8
      src/AzslcEmitter.cpp
  5. 2 6
      src/AzslcMain.cpp
  6. 1 1
      src/AzslcPlatformEmitter.cpp
  7. 15 68
      src/AzslcUnboundedArraysValidator.cpp
  8. 0 10
      src/AzslcUnboundedArraysValidator.h
  9. 1 0
      tests/Advanced/inline-constant-layouts.azsl
  10. 1 1
      tests/Advanced/srg-layout-merged.py
  11. 26 26
      tests/Advanced/srg-layouts.py
  12. 5 5
      tests/Advanced/texture2DMS-to-texture2D-noms.txt
  13. 5 5
      tests/Advanced/texture2DMS-to-texture2D.txt
  14. 8 6
      tests/Advanced/unbounded-arrays-emission-tester.py
  15. 1 1
      tests/Advanced/unbounded-arrays-for-max-spaces.azsl
  16. 2 2
      tests/Advanced/unbounded-arrays-max-spaces.py
  17. 1 1
      tests/Advanced/unbounded-arrays-srg-layout.py
  18. 0 76
      tests/Emission/AsError/UnboundedArrays.azsl
  19. 5 1
      tests/Emission/FrequencyHonor.azsl
  20. 3 3
      tests/Emission/FrequencyHonor.txt
  21. 26 26
      tests/Emission/RootSig.txt
  22. 0 96
      tests/Emission/RootSigSpace.azsl
  23. 0 37
      tests/Emission/RootSigSpace.txt
  24. 26 26
      tests/Emission/RootSigUnique.txt
  25. 0 96
      tests/Emission/RootSigUniqueSpace.azsl
  26. 0 36
      tests/Emission/RootSigUniqueSpace.txt
  27. 11 12
      tests/Emission/UnboundedArrays.azsl
  28. 18 21
      tests/Emission/UnboundedArrays.txt
  29. 4 4
      tests/Emission/comprehensive.txt
  30. 4 4
      tests/Emission/dynamic-sampler-srg.txt
  31. 1 1
      tests/Emission/gmem.txt
  32. 1 1
      tests/Emission/mat33_padding_run_with_no-alignment-validation.txt
  33. 1 1
      tests/Emission/name-collision-avoidance.txt
  34. 1 1
      tests/Emission/nested-emission.txt
  35. 2 2
      tests/Emission/ordering.txt
  36. 3 3
      tests/Emission/ray-tracing-hello-world.txt
  37. 8 8
      tests/Emission/ray-tracing-procedural-geometry.txt
  38. 6 6
      tests/Emission/ray-tracing-simple-lighting.txt
  39. 0 0
      tests/Semantic/unbounded-arrays-unique-idx-should-pass-2srgs.azsl
  40. 9 0
      tests/Semantic/unbounded-arrays-unique-idx-should-pass-2srgs.txt
  41. 3 3
      tests/Semantic/unbounded-arrays-unique-idx-should-pass.txt
  42. 3 4
      tests/Semantic/unbounded-arrays3.azsl
  43. 2 4
      tests/Semantic/unbounded-arrays4.azsl
  44. 3 5
      tests/Semantic/unbounded-arrays5.azsl
  45. 2 1
      tests/testfuncs.py
  46. 1 1
      tests/testhelper.py

+ 1 - 1
Platform/iOS/src/MetalPlatformEmitter.cpp

@@ -38,7 +38,7 @@ namespace AZ::ShaderCompiler
         assert(structUid == bindInfo.m_uid);
         const auto& rootCBForEmission = codeEmitter.GetTranslatedName(RootConstantsViewName, UsageContext::DeclarationSite);
         const auto& rootConstClassForEmission = codeEmitter.GetTranslatedName(structUid.GetName(), UsageContext::ReferenceSite);
-        const auto& spaceX = (options.m_useLogicalSpaces) ? ", space" + std::to_string(bindInfo.m_registerBinding.m_pair[signatureQuery].m_logicalSpace) : "";
+        const auto& spaceX = ", space" + std::to_string(bindInfo.m_registerBinding.m_pair[signatureQuery].m_logicalSpace);
         strOut << "ConstantBuffer<" << rootConstClassForEmission << "> " << rootCBForEmission << " : register(b" << bindInfo.m_registerBinding.m_pair[signatureQuery].m_registerIndex << spaceX << ");\n\n";
         return strOut.str();
     }

+ 8 - 11
src/AzslcBackend.cpp

@@ -203,19 +203,16 @@ namespace AZ::ShaderCompiler
 
     void MultiBindingLocationMaker::SignalIncrementSpace(std::function<void(int, int)> warningMessageFunctionForMinDescOvershoot)
     {
-        if (m_options.m_useLogicalSpaces)
+        if (m_options.m_minAvailableDescriptors.m_spaces >= 0
+            && m_untainted.m_space >= m_options.m_minAvailableDescriptors.m_spaces)
         {
-            if (m_options.m_minAvailableDescriptors.m_spaces >= 0
-                && m_untainted.m_space >= m_options.m_minAvailableDescriptors.m_spaces)
-            {
-                warningMessageFunctionForMinDescOvershoot(m_untainted.m_space, m_options.m_minAvailableDescriptors.m_spaces);
-            }
+            warningMessageFunctionForMinDescOvershoot(m_untainted.m_space, m_options.m_minAvailableDescriptors.m_spaces);
+        }
 
-            m_untainted.IncrementSpace();
-            if (m_options.m_maxSpaces > m_merged.m_space + 1) // example: (1 > 0 + 1)  <=>  (1 > 1)  <=>  (false)  --> never increment space. stay at 0. which respects max-spaces=1
-            {
-                m_merged.IncrementSpace();
-            }
+        m_untainted.IncrementSpace();
+        if (m_options.m_maxSpaces > m_merged.m_space + 1) // example: (1 > 0 + 1)  <=>  (1 > 1)  <=>  (false)  --> never increment space. stay at 0. which respects max-spaces=1
+        {
+            m_merged.IncrementSpace();
         }
     }
 

+ 0 - 1
src/AzslcBackend.h

@@ -27,7 +27,6 @@ namespace AZ::ShaderCompiler
     //! This structure is typically filled from parsed user settings from the command line
     struct Options
     {
-        bool m_useLogicalSpaces = false;
         bool m_useUniqueIndices = false;
         bool m_emitConstantBufferBody = false;
         bool m_emitRootSig = false;

+ 4 - 8
src/AzslcEmitter.cpp

@@ -973,7 +973,7 @@ namespace AZ::ShaderCompiler
                 const QualifiedName implicitCB = MakeSrgConstantsCBName(srgId);
                 EmitStruct(srgInfo.m_implicitStruct, implicitStruct, options);
 
-                const auto spaceX = (options.m_useLogicalSpaces) ? ", space" + std::to_string(bindInfo.m_registerBinding.m_pair[bindSet].m_logicalSpace) : "";
+                const auto spaceX = ", space" + std::to_string(bindInfo.m_registerBinding.m_pair[bindSet].m_logicalSpace);
                 const auto implicitStructForEmission = GetTranslatedName(implicitStruct, UsageContext::ReferenceSite);
                 const auto implicitCBForEmission = GetTranslatedName(implicitCB, UsageContext::DeclarationSite);
                 m_out << "ConstantBuffer<" << implicitStructForEmission << "> " << implicitCBForEmission << " : register(b" << bindInfo.m_registerBinding.m_pair[bindSet].m_registerIndex << spaceX << ");\n\n";
@@ -1043,7 +1043,7 @@ namespace AZ::ShaderCompiler
         // note: instead of redoing this work ad-hoc, EmitText could be used directly on the ext type.
         const auto genericType = "<" + GetTranslatedName(varInfo->m_typeInfoExt.m_genericParameter, UsageContext::ReferenceSite) + ">";
 
-        const string spaceX = (options.m_useLogicalSpaces) ? ", space" + std::to_string(bindInfo.m_registerBinding.m_pair[bindSet].m_logicalSpace) : "";
+        const string spaceX = ", space" + std::to_string(bindInfo.m_registerBinding.m_pair[bindSet].m_logicalSpace);
         m_out << "ConstantBuffer " << genericType << " " << cbName;
         if (bindInfo.m_isUnboundedArray)
         {
@@ -1066,7 +1066,7 @@ namespace AZ::ShaderCompiler
 
         EmitEmptyLinesToLineNumber(varInfo->GetOriginalLineNumber());
 
-        const string spaceX = (options.m_useLogicalSpaces) ? ", space" + std::to_string(bindInfo.m_registerBinding.m_pair[bindSet].m_logicalSpace) : "";
+        const string spaceX = ", space" + std::to_string(bindInfo.m_registerBinding.m_pair[bindSet].m_logicalSpace);
         m_out << (varInfo->m_samplerState->m_isComparison ? "SamplerComparisonState " : "SamplerState ")
               << ReplaceSeparators(sId.m_name, Underscore);
         if (bindInfo.m_isUnboundedArray)
@@ -1111,11 +1111,7 @@ namespace AZ::ShaderCompiler
         auto*  varInfo = m_ir->GetSymbolSubAs<VarInfo>(tId.m_name);
         string varType = GetTranslatedName(varInfo->m_typeInfoExt, UsageContext::DeclarationSite);
         auto   registerTypeLetter = ToLower(BindingType::ToStr(RootParamTypeToBindingType(bindInfo.m_type)));
-        optional<string> stringifiedLogicalSpace;
-        if (options.m_useLogicalSpaces)
-        {
-            stringifiedLogicalSpace = std::to_string(bindInfo.m_registerBinding.m_pair[bindSet].m_logicalSpace);
-        }
+        optional<string> stringifiedLogicalSpace = std::to_string(bindInfo.m_registerBinding.m_pair[bindSet].m_logicalSpace);
 
         EmitEmptyLinesToLineNumber(varInfo->GetOriginalLineNumber());
 

+ 2 - 6
src/AzslcMain.cpp

@@ -307,11 +307,8 @@ int main(int argc, const char* argv[])
     std::string output;
     cli.add_option("-o", output, "Output file (writes to stdout if omitted).");
 
-    bool useSpaces = false;
-    cli.add_flag("--use-spaces", useSpaces, "Use a logical space index per SRG.");
-
     bool uniqueIdx = false;
-    cli.add_flag("--unique-idx", uniqueIdx, "Use unique indices for all registers. e.g. b0, t0, u0, s0 becomes b0, t1, u2, s3.");
+    cli.add_flag("--unique-idx", uniqueIdx, "Use unique indices for all registers. e.g. b0, t0, u0, s0 becomes b0, t1, u2, s3. Use on platforms that don't differentiate registers by resource type.");
 
     bool cbBody = false;
     cli.add_flag("--cb-body", cbBody, "Emit ConstantBuffer body rather than using <T>.");
@@ -526,7 +523,7 @@ int main(int argc, const char* argv[])
             std::for_each(namespaces.begin(), namespaces.end(),
                 [&](const string& space) { ir.AddAttributeNamespaceFilter(space); });
 
-            UnboundedArraysValidator::Options unboundedArraysValidationOptions = { useSpaces, uniqueIdx };
+            UnboundedArraysValidator::Options unboundedArraysValidationOptions = { uniqueIdx };
             if (*maxSpacesOpt)
             {
                 unboundedArraysValidationOptions.m_maxSpaces = maxSpaces;
@@ -537,7 +534,6 @@ int main(int argc, const char* argv[])
             walker.walk(&semanticListener, tree);
 
             Options emitOptions;
-            emitOptions.m_useLogicalSpaces = useSpaces;
             emitOptions.m_useUniqueIndices = uniqueIdx;
             emitOptions.m_emitConstantBufferBody = cbBody;
             emitOptions.m_emitRootSig = rootSig;

+ 1 - 1
src/AzslcPlatformEmitter.cpp

@@ -70,7 +70,7 @@ namespace AZ::ShaderCompiler
         assert(structUid == bindInfo.m_uid);
         const auto& rootCBForEmission = codeEmitter.GetTranslatedName(RootConstantsViewName, UsageContext::DeclarationSite);
         const auto& rootConstClassForEmission = codeEmitter.GetTranslatedName(structUid.GetName(), UsageContext::ReferenceSite);
-        const auto& spaceX = (options.m_useLogicalSpaces) ? ", space" + std::to_string(bindInfo.m_registerBinding.m_pair[signatureQuery].m_logicalSpace) : "";
+        const auto& spaceX = ", space" + std::to_string(bindInfo.m_registerBinding.m_pair[signatureQuery].m_logicalSpace);
         strOut << "ConstantBuffer<" << rootConstClassForEmission << "> " << rootCBForEmission << " : register(b" << bindInfo.m_registerBinding.m_pair[signatureQuery].m_registerIndex << spaceX << ");\n\n";
 
         return strOut.str();

+ 15 - 68
src/AzslcUnboundedArraysValidator.cpp

@@ -76,23 +76,6 @@ namespace AZ::ShaderCompiler
 
         if (!CanBeDeclaredAsUnboundedArray(typeClass))
         {
-            // The only possibility of error is if --use-spaces is false,
-            // and there's already an unbounded array of type 'b' declared in another SRG.
-            if (!m_options.m_useSpacesEnabled)
-            {
-                // We use register 0 because if --use-spaces was not specified in the command line
-                // then there's only one space for all registers and its index is 0, aka "space0".
-                const ArrayOfUnboundedUids& arrayOfUnboundedUids = m_unboundedUidsPerSpace[0];
-                const IdentifierUID& unboundedUid = arrayOfUnboundedUids[BindingType::B];
-                if (!unboundedUid.IsEmpty())
-                {
-                    if (errorMessage)
-                    {
-                        *errorMessage = ConcatString("The unbounded resource [", unboundedUid.GetName(), "], doesn't allow [", varUid.GetName(), "] to be added to the register space");
-                    }
-                    return false;
-                }
-            }
             return true;
         }
 
@@ -125,18 +108,16 @@ namespace AZ::ShaderCompiler
         auto findIt = m_srgToSpaceIndex.find(srgUid);
         if (findIt == m_srgToSpaceIndex.end())
         {
-            if (m_options.m_useSpacesEnabled)
+            if (m_options.m_maxSpaces - 1 > m_maxSpaceIndex)
             {
-                if (m_options.m_maxSpaces - 1 > m_maxSpaceIndex)
-                {
-                    spaceIndex = static_cast<SpaceIndex>(m_srgToSpaceIndex.size());
-                    m_maxSpaceIndex = std::max(spaceIndex, m_maxSpaceIndex);
-                }
-                else
-                {
-                    spaceIndex = m_maxSpaceIndex;
-                }
+                spaceIndex = static_cast<SpaceIndex>(m_srgToSpaceIndex.size());
+                m_maxSpaceIndex = std::max(spaceIndex, m_maxSpaceIndex);
+            }
+            else
+            {
+                spaceIndex = m_maxSpaceIndex;
             }
+
             // We are using resize() instead of push_back() because if the size doesn't change resize() is no-op.
             m_unboundedUidsPerSpace.resize(static_cast<size_t>(m_maxSpaceIndex) + 1);
             m_srgToSpaceIndex.emplace(srgUid, spaceIndex);
@@ -152,35 +133,16 @@ namespace AZ::ShaderCompiler
     {
         if (m_options.m_useUniqueIndicesEnabled)
         {
-            if (m_options.m_useSpacesEnabled)
+            // We allow only one unbounded array per SRG. But if, for a given SRG and unbounded array was already
+            // registered then it is an error to add another variable that consumes register resources.
+            IdentifierUID unboundedArrayUid = GetFirstUnboundedArrayFromSrg(srgUid);
+            if (!unboundedArrayUid.IsEmpty())
             {
-                // if --unique-idx is true, and --use-spaces is true, we allow only one
-                // unbounded array per SRG. But if, for a given SRG and unbounded array was already
-                // registered then it is an error to add another variable that consumes register resources.
-                IdentifierUID unboundedArrayUid = GetFirstUnboundedArrayFromSrg(srgUid);
-                if (!unboundedArrayUid.IsEmpty())
+                if (errorMessage)
                 {
-                    if (errorMessage)
-                    {
-                        *errorMessage = ConcatString("The unbounded resource [", unboundedArrayUid.GetName(), "], doesn't allow [", varUid.GetName(), "] to be added to the register space");
-                    }
-                    return false;
-                }
-            }
-            else
-            {
-                // if --unique-idx is true, and --use-spaces is false, we allow only one
-                // unbounded array across all SRGs. If an unbounded array was already
-                // registered in any SRG then it is an error to add another variable that consumes register resources.
-                IdentifierUID unboundedArrayUid = GetFirstUnboundedArrayAcrossAllSrgs();
-                if (!unboundedArrayUid.IsEmpty())
-                {
-                    if (errorMessage)
-                    {
-                        *errorMessage = ConcatString("The unbounded resource [", unboundedArrayUid.GetName(), "], doesn't allow [", varUid.GetName(), "] to be added to the register space");
-                    }
-                    return false;
+                    *errorMessage = ConcatString("The unbounded resource [", unboundedArrayUid.GetName(), "], doesn't allow [", varUid.GetName(), "] to be added to the register space");
                 }
+                return false;
             }
         }
         return true;
@@ -205,19 +167,4 @@ namespace AZ::ShaderCompiler
         return {};
     }
 
-    IdentifierUID UnboundedArraysValidator::GetFirstUnboundedArrayAcrossAllSrgs() const
-    {
-        for (const auto& arrayOfUnboundedUids : m_unboundedUidsPerSpace)
-        {
-            for (const auto& uid : arrayOfUnboundedUids)
-            {
-                if (!uid.IsEmpty())
-                {
-                    return uid;
-                }
-            }
-        }
-        return {};
-    }
-
 } // namespace AZ::ShaderCompiler

+ 0 - 10
src/AzslcUnboundedArraysValidator.h

@@ -20,11 +20,6 @@ namespace AZ::ShaderCompiler
 
         struct Options
         {
-            //! Takes the value of --use-spaces command line option.
-            //! When false, only one unbounded array of each type (b, t, u, s) can be daclared
-            //! across all SRGs.
-            //! When true, each SRG can have a its own unique set of unbounded arrays for b, t, u, s.
-            bool m_useSpacesEnabled = false;
             //! Takes the value of --unique-idx command line option.
             //! When false each register resource type b, t, u, s can have its own unbounded array per register space.
             //! When true only one of b, t, u, s can have the unbounded array.
@@ -67,14 +62,9 @@ namespace AZ::ShaderCompiler
 
         IdentifierUID GetFirstUnboundedArrayFromSrg(const IdentifierUID& srgUid) const;
 
-        IdentifierUID GetFirstUnboundedArrayAcrossAllSrgs() const;
-
         using SpaceIndex = uint32_t; // represents register space0, space1, ...
 
         //! Returns the space index that corresponds to the given SRG.
-        //! Calculating the correct space index depends on the commmand
-        //! line options --use-spaces (Options.m_useSpacesEnabled), and
-        //! --max-spaces (Options.m_maxSpaces).
         //! The calculated space index is stored in m_srgToSpaceIndex the first time
         //! this function is called for any given SRG.
         SpaceIndex GetSpaceIndexForSrg(const IdentifierUID& srgUid);

+ 1 - 0
tests/Advanced/inline-constant-layouts.azsl

@@ -17,3 +17,4 @@ float4 MainPS() : SV_Target0
     float4 useFloat = varFloat4;
     return useFloat; 
 }
+    

+ 1 - 1
tests/Advanced/srg-layout-merged.py

@@ -14,7 +14,7 @@ from clr import *
 import testfuncs
 
 def verify(thefile, compilerPath, silent):
-    j, ok = testfuncs.buildAndGetJson(thefile, compilerPath, silent, ["--namespace=vk", "--srg", "--use-spaces", "--max-spaces=2"])
+    j, ok = testfuncs.buildAndGetJson(thefile, compilerPath, silent, ["--namespace=vk", "--srg", "--max-spaces=2"])
 
     if ok:
         predicates = []

+ 26 - 26
tests/Advanced/srg-layouts.py

@@ -639,7 +639,7 @@ def verifyStructsPackingOpenGL(thefile, compilerPath, silent):
     return True if ok else False
 
 def verifyPackingRelaxedUseSpaces(thefile, compilerPath, silent):
-    j, ok = testfuncs.buildAndGetJson(thefile, compilerPath, silent, ["--srg", "--use-spaces"])
+    j, ok = testfuncs.buildAndGetJson(thefile, compilerPath, silent, ["--srg"])
 
     if ok:
         predicates = []
@@ -750,35 +750,35 @@ def verifyPackingRelaxedNoSpaces(thefile, compilerPath, silent):
         # Shader Resource Group 1
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][0]["type"]    == "ConstantBuffer<Light>")
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][0]["count"]   == 1)
-        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][0]["index"]   == 3)
-        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][0]["space"]   == 0)
+        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][0]["index"]   == 0)
+        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][0]["space"]   == 1)
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][0]["stride"]  == 144)
 
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][1]["type"]    == "Buffer<float3>")
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][1]["count"]   == 2)
-        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][1]["index"]   == 2)
-        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][1]["space"]   == 0)
+        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][1]["index"]   == 0)
+        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][1]["space"]   == 1)
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][1]["stride"]  == 12)
 
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][2]["type"]    == "StructuredBuffer<S>")
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][2]["count"]   == 2)
-        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][2]["index"]   == 4)
-        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][2]["space"]   == 0)
+        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][2]["index"]   == 2)
+        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][2]["space"]   == 1)
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][2]["stride"]  == 16)
 
         # Shader Resource Group 2
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["id"]       == "m_texCube1")
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["type"]     == "TextureCube")
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["count"]    == 1)
-        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["index"]    == 6)
-        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["space"]    == 0)
+        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["index"]    == 0)
+        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["space"]    == 2)
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["stride"]  == 16)
 
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["id"]       == "m_tex2d1")
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["type"]     == "Texture2D<float3>")
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["count"]    == 1)
-        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["index"]    == 7)
-        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["space"]    == 0)
+        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["index"]    == 1)
+        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["space"]    == 2)
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["stride"]  == 12)
 
 
@@ -829,35 +829,35 @@ def verifyPackingRelaxedUniqueIdx(thefile, compilerPath, silent):
         # Shader Resource Group 1
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][0]["type"]    == "ConstantBuffer<Light>")
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][0]["count"]   == 1)
-        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][0]["index"]   == 9)
-        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][0]["space"]   == 0)
+        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][0]["index"]   == 4)
+        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][0]["space"]   == 1)
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][0]["stride"]  == 144)
 
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][1]["type"]    == "Buffer<float3>")
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][1]["count"]   == 2)
-        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][1]["index"]   == 5)
-        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][1]["space"]   == 0)
+        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][1]["index"]   == 0)
+        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][1]["space"]   == 1)
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][1]["stride"]  == 12)
 
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][2]["type"]    == "StructuredBuffer<S>")
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][2]["count"]   == 2)
-        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][2]["index"]   == 7)
-        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][2]["space"]   == 0)
+        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][2]["index"]   == 2)
+        predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][2]["space"]   == 1)
         predicates.append(lambda: j["ShaderResourceGroups"][1]["inputsForBufferViews"][2]["stride"]  == 16)
 
         # Shader Resource Group 2
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["id"]       == "m_texCube1")
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["type"]     == "TextureCube")
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["count"]    == 1)
-        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["index"]    == 10)
-        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["space"]    == 0)
+        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["index"]    == 0)
+        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["space"]    == 2)
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][0]["stride"]  == 16)
 
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["id"]       == "m_tex2d1")
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["type"]     == "Texture2D<float3>")
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["count"]    == 1)
-        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["index"]    == 11)
-        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["space"]    == 0)
+        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["index"]    == 1)
+        predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["space"]    == 2)
         predicates.append(lambda: j["ShaderResourceGroups"][2]["inputsForImageViews"][1]["stride"]  == 12)
 
 
@@ -866,7 +866,7 @@ def verifyPackingRelaxedUniqueIdx(thefile, compilerPath, silent):
     return True if ok else False
 
 def verifyPackingRelaxedUniqueIdxUseSpaces(thefile, compilerPath, silent):
-    j, ok = testfuncs.buildAndGetJson(thefile, compilerPath, silent, ["--srg", "--unique-idx", "--use-spaces"])
+    j, ok = testfuncs.buildAndGetJson(thefile, compilerPath, silent, ["--srg", "--unique-idx"])
 
     if ok:
         predicates = []
@@ -1306,8 +1306,8 @@ def verifyPackingDirectXInlineConstants(thefile, compilerPath, silent):
 
         # Inline constant buffer reflection data validation
         predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["count"]                    ==    1)
-        predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["index"]                    ==    1)
-        predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["space"]                    ==    0)
+        predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["index"]                    ==    0)
+        predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["space"]                    ==    1)
         predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["usage"]                    ==    "Read")
         predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["sizeInBytes"]              ==    60)
         predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["id"]                       ==    "Root_Constants")
@@ -1342,8 +1342,8 @@ def verifyPackingMetalInlineConstants(thefile, compilerPath, silent):
 
         # Inline constant buffer reflection data validation
         predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["count"]                    ==    1)
-        predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["index"]                    ==    1)
-        predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["space"]                    ==    0)
+        predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["index"]                    ==    0)
+        predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["space"]                    ==    1)
         predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["usage"]                    ==    "Read")
         predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["sizeInBytes"]              ==    64)
         predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["id"]                       ==    "Root_Constants")

+ 5 - 5
tests/Advanced/texture2DMS-to-texture2D-noms.txt

@@ -1,8 +1,8 @@
-"Texture2D < float4 > PassSrg_m_texture0ms : register ( t0 ) ;"
-"Texture2D < float4 > PassSrg_m_texture1 : register ( t1 ) ;"
-"Texture2D < float4 > PassSrg_m_texture2ms : register ( t2 ) ;"
-"Texture2DArray < float4 > PassSrg_m_textureArray0ms : register ( t3 ) ;"
-"Texture2DArray < float4 > PassSrg_m_textureArray1 : register ( t4 ) ;"
+"Texture2D < float4 > PassSrg_m_texture0ms : register ( t0 , space0 ) ;"
+"Texture2D < float4 > PassSrg_m_texture1 : register ( t1 , space0 ) ;"
+"Texture2D < float4 > PassSrg_m_texture2ms : register ( t2 , space0 ) ;"
+"Texture2DArray < float4 > PassSrg_m_textureArray0ms : register ( t3 , space0 ) ;"
+"Texture2DArray < float4 > PassSrg_m_textureArray1 : register ( t4 , space0 ) ;"
 "float4 PassSrg_Load ( int2 texelLoc , int2 texelLocDelta , int element , int sampleIndex )"
 "{"
 "float4 color = float4 ( 0 , 0 , 0 , 0 ) ;"

+ 5 - 5
tests/Advanced/texture2DMS-to-texture2D.txt

@@ -1,8 +1,8 @@
-"Texture2DMS < float4 > PassSrg_m_texture0ms : register ( t0 ) ;"
-"Texture2D < float4 > PassSrg_m_texture1 : register ( t1 ) ;"
-"Texture2DMS < float4 > PassSrg_m_texture2ms : register ( t2 ) ;"
-"Texture2DMSArray < float4 > PassSrg_m_textureArray0ms : register ( t3 ) ;"
-"Texture2DArray < float4 > PassSrg_m_textureArray1 : register ( t4 ) ;"
+"Texture2DMS < float4 > PassSrg_m_texture0ms : register ( t0 , space0 ) ;"
+"Texture2D < float4 > PassSrg_m_texture1 : register ( t1 , space0 ) ;"
+"Texture2DMS < float4 > PassSrg_m_texture2ms : register ( t2 , space0 ) ;"
+"Texture2DMSArray < float4 > PassSrg_m_textureArray0ms : register ( t3 , space0 ) ;"
+"Texture2DArray < float4 > PassSrg_m_textureArray1 : register ( t4 , space0 ) ;"
 "float4 PassSrg_Load ( int2 texelLoc , int2 texelLocDelta , int element , int sampleIndex )"
 "{"
 "float4 color = float4 ( 0 , 0 , 0 , 0 ) ;"

+ 8 - 6
tests/Advanced/unbounded-arrays-emission-tester.py

@@ -23,11 +23,9 @@ resultFailed = 0
 def doTests(compiler, silent, azdxcpath):
     """
     This test validates:
-        1. Usage of --use-spaces when more than one SRG declare unbounded arrays.
-        2. Makes sure shader compilation fails if unbounded arrays of the same type of resource are declared
-           in different SRGs but --use-spaces is not used for compilation.
-        3. Expect the same shaders to fail if --unique-idx is used.
-        4. unbounded-arrays-unique-idx-should-pass.azsl with --unique-idx used to fail in v1.7.19, should pass now.
+        1. Compilation fails if an SRG has multiple unbounded arrays when --unique-idx is used.
+        2. unbounded-arrays-unique-idx-should-pass.azsl with --unique-idx used to fail in v1.7.19, should pass now.
+        2. unbounded-arrays-unique-idx-should-pass-2srgs.azsl with --unique-idx should pass too, because each SRG gets a unique register space.
     """
     global result
     global resultFailed
@@ -56,7 +54,11 @@ def doTests(compiler, silent, azdxcpath):
     sampleFilePath = os.path.abspath(os.path.join(workDir, "../Semantic/unbounded-arrays-unique-idx-should-pass.azsl"))
     if testhelper.verifyEmissionPatterns(sampleFilePath, compiler, silent, ["--unique-idx",]) : result += 1
     else: resultFailed += 1
-
+    
+    # expect success when using --unique-idx
+    sampleFilePath = os.path.abspath(os.path.join(workDir, "../Semantic/unbounded-arrays-unique-idx-should-pass-2srgs.azsl"))
+    if testhelper.verifyEmissionPatterns(sampleFilePath, compiler, silent, ["--unique-idx",]) : result += 1
+    else: resultFailed += 1
 
     testhelper.printFailedTestList(silent)
     

+ 1 - 1
tests/Advanced/unbounded-arrays-for-max-spaces.azsl

@@ -1,4 +1,4 @@
-// This file requires --use-spaces and (--max-spaces >= 4) to pass.
+// This file requires a separate register space per SRG and (--max-spaces >= 4) to pass.
 
 ShaderResourceGroupSemantic slot1
 {

+ 2 - 2
tests/Advanced/unbounded-arrays-max-spaces.py

@@ -22,7 +22,7 @@ result = 0  # to define for sub-tests
 resultFailed = 0
 def doTests(compiler, silent, azdxcpath):
     """
-    This test does a thorough validation of --use-spaces when with a limited amount
+    This test does a thorough validation of separate register spaces per SRG when a limited amount
     of spaces is defined with the command line argument --max-spaces.
     """
     global result
@@ -39,7 +39,7 @@ def doTests(compiler, silent, azdxcpath):
     numExpectedFailures = 0
     for maxSpaces in range(maxMaxSpaces):
         maxSpaces += 1
-        stderr, failed = testfuncs.buildAndGetError(sampleFilePath, compiler, True, ["--use-spaces", "--max-spaces", "%d" % maxSpaces])
+        stderr, failed = testfuncs.buildAndGetError(sampleFilePath, compiler, True, ["--max-spaces", "%d" % maxSpaces])
         if failed:
             stderr = stderr.decode('utf-8')
             srgA = "SRG%d" % maxSpaces

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

@@ -19,7 +19,7 @@ import testfuncs
 # in the json srg layout.
 
 def verify(thefile, compilerPath, silent):
-    j, ok = testfuncs.buildAndGetJson(thefile, compilerPath, silent, ["--srg", "--use-spaces"])
+    j, ok = testfuncs.buildAndGetJson(thefile, compilerPath, silent, ["--srg"])
 
     if ok:
         predicates = []

+ 0 - 76
tests/Emission/AsError/UnboundedArrays.azsl

@@ -1,76 +0,0 @@
-// 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
-{
-    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;
-}

+ 5 - 1
tests/Emission/FrequencyHonor.azsl

@@ -1,5 +1,9 @@
-ShaderResourceGroupSemantic Slot0  {    FrequencyId = 0; };
+// It looks like the original intent of this test was to show that lower number frequencies also got the lower number *registers*.
+// Now that each SRG gets its own unique register space, the register *spaces* follow the same order as the frequencies.
+// In either case, the order of the frequencies control the order of any indexing, not the order of appearance or the names.
+
 ShaderResourceGroupSemantic Slot1  {    FrequencyId = 1; };
+ShaderResourceGroupSemantic Slot0  {    FrequencyId = 0; };
 
 ShaderResourceGroup SRG0 : Slot1
 {

+ 3 - 3
tests/Emission/FrequencyHonor.txt

@@ -1,5 +1,5 @@
 "struct SRG0_SRGConstantsStruct"
-"ConstantBuffer < :: SRG0_SRGConstantsStruct > SRG0_SRGConstantBuffer : register ( b1 ) ;"
-"Texture2D SRG1_m_tex2D : register ( t0 ) ;"
+"ConstantBuffer < :: SRG0_SRGConstantsStruct > SRG0_SRGConstantBuffer : register ( b0 , space1 ) ;"
+"Texture2D SRG1_m_tex2D : register ( t0 , space0 ) ;"
 "struct SRG1_SRGConstantsStruct"
-"ConstantBuffer < :: SRG1_SRGConstantsStruct > SRG1_SRGConstantBuffer : register ( b0 ) ;
+"ConstantBuffer < :: SRG1_SRGConstantsStruct > SRG1_SRGConstantBuffer : register ( b0 , space0 ) ;

+ 26 - 26
tests/Emission/RootSig.txt

@@ -2,35 +2,35 @@
     Cmdargs: ['--root-sig', '--namespace', 'dx']
 */
 "CBV ( b0 , space = 0"
-"CBV ( b2 , space = 0"
-"CBV ( b3 , space = 0"
-"CBV ( b4 , space = 0"
+"CBV ( b0 , space = 2"
+"CBV ( b0 , space = 3"
+"CBV ( b0 , space = 5"
 "UAV ( u0 , space = 0"
 "Sampler ( s0  , space = 0, numDescriptors = 1 )"
 "Sampler ( s2  , space = 0, numDescriptors = 4 )"
-"SRV     ( t0  , space = 0, numDescriptors = 1 )"
-"SRV     ( t1  , space = 0, numDescriptors = 1 )"
-"SRV     ( t2  , space = 0, numDescriptors = 1 )"
-"SRV     ( t3  , space = 0, numDescriptors = 1 )"
-"CBV     ( b1  , space = 0, numDescriptors = 1 )"
-"SRV     ( t4  , space = 0, numDescriptors = 1 )"
-"SRV     ( t5  , space = 0, numDescriptors = 1 )"
-"SRV     ( t6  , space = 0, numDescriptors = 1 )"
-"SRV     ( t7  , space = 0, numDescriptors = 1 )"
-"UAV     ( u1  , space = 0, numDescriptors = 1 )"
-"UAV     ( u2  , space = 0, numDescriptors = 1 )"
-"UAV     ( u3  , space = 0, numDescriptors = 1 )"
-"UAV     ( u4  , space = 0, numDescriptors = 1 )"
-"UAV     ( u5  , space = 0, numDescriptors = 4 )"
-"UAV     ( u9  , space = 0, numDescriptors = 1 )"
-"UAV     ( u10 , space = 0, numDescriptors = 1 )"
-"UAV     ( u11 , space = 0, numDescriptors = 1 )"
-"UAV     ( u12 , space = 0, numDescriptors = 1 )"
-"UAV     ( u13 , space = 0, numDescriptors = 1 )"
-"SRV     ( t8  , space = 0, numDescriptors = 3 )"
-"SRV     ( t11 , space = 0, numDescriptors = 1 )"
-"UAV     ( u14 , space = 0, numDescriptors = 1 )"
-"UAV     ( u15 , space = 0, numDescriptors = 1 )"
+"SRV     ( t0  , space = 1, numDescriptors = 1 )"
+"SRV     ( t1  , space = 1, numDescriptors = 1 )"
+"SRV     ( t2  , space = 1, numDescriptors = 1 )"
+"SRV     ( t3  , space = 1, numDescriptors = 1 )"
+"CBV     ( b0  , space = 1, numDescriptors = 1 )"
+"SRV     ( t0  , space = 2, numDescriptors = 1 )"
+"SRV     ( t1  , space = 2, numDescriptors = 1 )"
+"SRV     ( t2  , space = 2, numDescriptors = 1 )"
+"SRV     ( t3  , space = 2, numDescriptors = 1 )"
+"UAV     ( u0  , space = 2, numDescriptors = 1 )"
+"UAV     ( u1  , space = 2, numDescriptors = 1 )"
+"UAV     ( u2  , space = 2, numDescriptors = 1 )"
+"UAV     ( u3  , space = 2, numDescriptors = 1 )"
+"UAV     ( u0  , space = 3, numDescriptors = 4 )"
+"UAV     ( u4  , space = 3, numDescriptors = 1 )"
+"UAV     ( u5  , space = 3, numDescriptors = 1 )"
+"UAV     ( u6  , space = 3, numDescriptors = 1 )"
+"UAV     ( u0  , space = 4, numDescriptors = 1 )"
+"UAV     ( u1  , space = 4, numDescriptors = 1 )"
+"SRV     ( t0  , space = 4, numDescriptors = 3 )"
+"SRV     ( t3  , space = 4, numDescriptors = 1 )"
+"UAV     ( u2  , space = 4, numDescriptors = 1 )"
+"UAV     ( u3  , space = 4, numDescriptors = 1 )"
 "StaticSampler ( s1 , space = 0 "
 "StaticSampler ( s6 , space = 0 "
 

+ 0 - 96
tests/Emission/RootSigSpace.azsl

@@ -1,96 +0,0 @@
-ShaderResourceGroupSemantic Slot0  {    FrequencyId = 0; };
-ShaderResourceGroupSemantic Slot1  {    FrequencyId = 1; };
-ShaderResourceGroupSemantic Slot2  {    FrequencyId = 2; };
-ShaderResourceGroupSemantic Slot3  {    FrequencyId = 3; };
-ShaderResourceGroupSemantic Slot4  {    FrequencyId = 4; };
-ShaderResourceGroupSemantic Slot5  {    FrequencyId = 5; };
-
-ShaderResourceGroup SRG0 : Slot0
-{
-    float4 float4Test00;
-    Sampler m_dynamicSampler_1;
-    float4 float4Test01;
-    SamplerComparisonState m_staticSampler1
-    {
-        ComparisonFunc = Never;
-    };
-    float4 float4Test02;
-    RWTexture3D m_texRW3D;
-    float4 float4Test03;
-    Sampler m_dynamicSampler_Array[4];
-    SamplerComparisonState m_staticSampler2
-    {
-        ComparisonFunc = Never;
-    };
-    float4 float4Test04;
-};
-
-ShaderResourceGroup SRG1 : Slot1
-{
-    struct SomeInsideStruct
-    {
-        float4x4                         m_someMatrix;
-    };
-
-    struct MaterialConstants
-    {
-        struct SomeNestedStruct
-        {
-            float4x4                     m_someMatrix;
-        }                                m_inlinedStructInstance;      // nested in the struct declaration
-        SomeInsideStruct                 m_insideScopeStruct;          // declared in the same SRG
-        bool4                            m_someBoolVariable;
-        double                           m_someDoubleVariable;
-    };
-    
-    ConstantBuffer<MaterialConstants>    m_materialConstants;
-    Texture2D                                   m_tex2D;         // texturePredefinedType
-    Texture2D<float4>                           m_tex2DG;        // genericTexturePredefinedType
-    Texture2DArray                              m_tex2DArray;    // texturePredefinedType
-    Texture2DArray<float4>                      m_tex2DArrayG;   // genericTexturePredefinedType
-};
-
-ShaderResourceGroup SRG2 : Slot2
-{
-    float4 exampleColor;
-    Texture2D                                   m_tex2D;         // texturePredefinedType
-    Texture2D<float4>                           m_tex2DG;        // genericTexturePredefinedType
-    Texture2DArray                              m_tex2DArray;    // texturePredefinedType
-    Texture2DArray<float4>                      m_tex2DArrayG;   // genericTexturePredefinedType
-    RWTexture2D                                 m_texRW2D;       // texturePredefinedType
-    RWTexture2D<float4>                         m_texRW2DG;      // genericTexturePredefinedType
-    RWTexture2DArray                            m_texRW2DArray;  // texturePredefinedType
-    RWTexture2DArray<float4>                    m_texRW2DArrayG; // genericTexturePredefinedType
-};
-
-ShaderResourceGroup SRG3 : Slot3
-{
-    float4 exampleColor;
-    RWTexture2D                                 m_texRW2D[4];       // texturePredefinedType
-    RWTexture2D<float4>                         m_texRW2DG;      // genericTexturePredefinedType
-    RWTexture2DArray                            m_texRW2DArray;  // texturePredefinedType
-    RWTexture2DArray<float4>                    m_texRW2DArrayG; // genericTexturePredefinedType
-};
-
-struct UserStruct
-{
-    int      m_myInt;
-    float    m_myFloat;
-    double   m_myDouble;
-    bool     m_myBool;
-};
-
-ShaderResourceGroup SRG4 : Slot4
-{
-    AppendStructuredBuffer<UserStruct>                 m_appendView;
-    ConsumeStructuredBuffer<UserStruct>                m_consumeView;
-    Buffer<float>                                      m_bufferView[3];
-    StructuredBuffer<UserStruct>                       m_structuredView;
-    RWBuffer<float4x4>                                 m_rwView;
-    RasterizerOrderedBuffer<int4>                      m_roView;
-};
-
-ShaderResourceGroup SRG5 : Slot5
-{
-    float4 exampleColor;
-};

+ 0 - 37
tests/Emission/RootSigSpace.txt

@@ -1,37 +0,0 @@
-/*
-    Cmdargs: ['--use-spaces', '--root-sig', '--namespace', 'dx']
-*/
-"CBV ( b0 , space = 0"
-"CBV ( b0 , space = 2"
-"CBV ( b0 , space = 3"
-"CBV ( b0 , space = 5"
-"UAV ( u0 , space = 0"
-"Sampler ( s0  , space = 0, numDescriptors = 1 )"
-"Sampler ( s2  , space = 0, numDescriptors = 4 )"
-"SRV     ( t0  , space = 1, numDescriptors = 1 )"
-"SRV     ( t1  , space = 1, numDescriptors = 1 )"
-"SRV     ( t2  , space = 1, numDescriptors = 1 )"
-"SRV     ( t3  , space = 1, numDescriptors = 1 )"
-"CBV     ( b0  , space = 1, numDescriptors = 1 )"
-"SRV     ( t0  , space = 2, numDescriptors = 1 )"
-"SRV     ( t1  , space = 2, numDescriptors = 1 )"
-"SRV     ( t2  , space = 2, numDescriptors = 1 )"
-"SRV     ( t3  , space = 2, numDescriptors = 1 )"
-"UAV     ( u0  , space = 2, numDescriptors = 1 )"
-"UAV     ( u1  , space = 2, numDescriptors = 1 )"
-"UAV     ( u2  , space = 2, numDescriptors = 1 )"
-"UAV     ( u3  , space = 2, numDescriptors = 1 )"
-"UAV     ( u0  , space = 3, numDescriptors = 4 )"
-"UAV     ( u4  , space = 3, numDescriptors = 1 )"
-"UAV     ( u5  , space = 3, numDescriptors = 1 )"
-"UAV     ( u6  , space = 3, numDescriptors = 1 )"
-"UAV     ( u0  , space = 4, numDescriptors = 1 )"
-"UAV     ( u1  , space = 4, numDescriptors = 1 )"
-"SRV     ( t0  , space = 4, numDescriptors = 3 )"
-"SRV     ( t3  , space = 4, numDescriptors = 1 )"
-"UAV     ( u2  , space = 4, numDescriptors = 1 )"
-"UAV     ( u3  , space = 4, numDescriptors = 1 )"
-"StaticSampler ( s1 , space = 0 "
-"StaticSampler ( s6 , space = 0 "
-
-

+ 26 - 26
tests/Emission/RootSigUnique.txt

@@ -2,35 +2,35 @@
     Cmdargs: ['--unique-idx', '--root-sig', '--namespace', 'dx']
 */
 "CBV ( b8 , space = 0"
-"CBV ( b22 , space = 0"
-"CBV ( b30 , space = 0"
-"CBV ( b39 , space = 0"
+"CBV ( b8 , space = 2"
+"CBV ( b7 , space = 3"
+"CBV ( b0 , space = 5"
 "UAV ( u0 , space = 0"
 "Sampler ( s1  , space = 0, numDescriptors = 1 )"
 "Sampler ( s3  , space = 0, numDescriptors = 4 )" 
-"SRV     ( t9  , space = 0, numDescriptors = 1 )"
-"SRV     ( t10 , space = 0, numDescriptors = 1 )"
-"SRV     ( t11 , space = 0, numDescriptors = 1 )"
-"SRV     ( t12 , space = 0, numDescriptors = 1 )"
-"CBV     ( b13 , space = 0, numDescriptors = 1 )"
-"SRV     ( t14 , space = 0, numDescriptors = 1 )"
-"SRV     ( t15 , space = 0, numDescriptors = 1 )"
-"SRV     ( t16 , space = 0, numDescriptors = 1 )"
-"SRV     ( t17 , space = 0, numDescriptors = 1 )"
-"UAV     ( u18 , space = 0, numDescriptors = 1 )"
-"UAV     ( u19 , space = 0, numDescriptors = 1 )"
-"UAV     ( u20 , space = 0, numDescriptors = 1 )"
-"UAV     ( u21 , space = 0, numDescriptors = 1 )"
-"UAV     ( u23 , space = 0, numDescriptors = 4 )"
-"UAV     ( u27 , space = 0, numDescriptors = 1 )"
-"UAV     ( u28 , space = 0, numDescriptors = 1 )"
-"UAV     ( u29 , space = 0, numDescriptors = 1 )"
-"UAV     ( u31 , space = 0, numDescriptors = 1 )"
-"UAV     ( u32 , space = 0, numDescriptors = 1 )"
-"SRV     ( t33 , space = 0, numDescriptors = 3 )"
-"SRV     ( t36 , space = 0, numDescriptors = 1 )"
-"UAV     ( u37 , space = 0, numDescriptors = 1 )"
-"UAV     ( u38 , space = 0, numDescriptors = 1 )"
+"SRV     ( t0  , space = 1, numDescriptors = 1 )"
+"SRV     ( t1 , space = 1, numDescriptors = 1 )"
+"SRV     ( t2 , space = 1, numDescriptors = 1 )"
+"SRV     ( t3 , space = 1, numDescriptors = 1 )"
+"CBV     ( b4 , space = 1, numDescriptors = 1 )"
+"SRV     ( t0 , space = 2, numDescriptors = 1 )"
+"SRV     ( t1 , space = 2, numDescriptors = 1 )"
+"SRV     ( t2 , space = 2, numDescriptors = 1 )"
+"SRV     ( t3 , space = 2, numDescriptors = 1 )"
+"UAV     ( u4 , space = 2, numDescriptors = 1 )"
+"UAV     ( u5 , space = 2, numDescriptors = 1 )"
+"UAV     ( u6 , space = 2, numDescriptors = 1 )"
+"UAV     ( u7 , space = 2, numDescriptors = 1 )"
+"UAV     ( u0 , space = 3, numDescriptors = 4 )"
+"UAV     ( u4 , space = 3, numDescriptors = 1 )"
+"UAV     ( u5 , space = 3, numDescriptors = 1 )"
+"UAV     ( u6 , space = 3, numDescriptors = 1 )"
+"UAV     ( u0 , space = 4, numDescriptors = 1 )"
+"UAV     ( u1 , space = 4, numDescriptors = 1 )"
+"SRV     ( t2 , space = 4, numDescriptors = 3 )"
+"SRV     ( t5 , space = 4, numDescriptors = 1 )"
+"UAV     ( u6 , space = 4, numDescriptors = 1 )"
+"UAV     ( u7 , space = 4, numDescriptors = 1 )"
 "StaticSampler ( s2 , space = 0 "
 "StaticSampler ( s7 , space = 0 "
 

+ 0 - 96
tests/Emission/RootSigUniqueSpace.azsl

@@ -1,96 +0,0 @@
-ShaderResourceGroupSemantic Slot0  {    FrequencyId = 0; };
-ShaderResourceGroupSemantic Slot1  {    FrequencyId = 1; };
-ShaderResourceGroupSemantic Slot2  {    FrequencyId = 2; };
-ShaderResourceGroupSemantic Slot3  {    FrequencyId = 3; };
-ShaderResourceGroupSemantic Slot4  {    FrequencyId = 4; };
-ShaderResourceGroupSemantic Slot5  {    FrequencyId = 5; };
-
-ShaderResourceGroup SRG0 : Slot0
-{
-    float4 float4Test00;
-    Sampler m_dynamicSampler_1;
-    float4 float4Test01;
-    SamplerComparisonState m_staticSampler1
-    {
-        ComparisonFunc = Never;
-    };
-    float4 float4Test02;
-    RWTexture3D m_texRW3D;
-    float4 float4Test03;
-    Sampler m_dynamicSampler_Array[4];
-    SamplerComparisonState m_staticSampler2
-    {
-        ComparisonFunc = Never;
-    };
-    float4 float4Test04;
-};
-
-ShaderResourceGroup SRG1 : Slot1
-{
-    struct SomeInsideStruct
-    {
-        float4x4                         m_someMatrix;
-    };
-
-    struct MaterialConstants
-    {
-        struct SomeNestedStruct
-        {
-            float4x4                     m_someMatrix;
-        }                                m_inlinedStructInstance;      // nested in the struct declaration
-        SomeInsideStruct                 m_insideScopeStruct;          // declared in the same SRG
-        bool4                            m_someBoolVariable;
-        double                           m_someDoubleVariable;
-    };
-    
-    ConstantBuffer<MaterialConstants>    m_materialConstants;
-    Texture2D                                   m_tex2D;         // texturePredefinedType
-    Texture2D<float4>                           m_tex2DG;        // genericTexturePredefinedType
-    Texture2DArray                              m_tex2DArray;    // texturePredefinedType
-    Texture2DArray<float4>                      m_tex2DArrayG;   // genericTexturePredefinedType
-};
-
-ShaderResourceGroup SRG2 : Slot2
-{
-    float4 exampleColor;
-    Texture2D                                   m_tex2D;         // texturePredefinedType
-    Texture2D<float4>                           m_tex2DG;        // genericTexturePredefinedType
-    Texture2DArray                              m_tex2DArray;    // texturePredefinedType
-    Texture2DArray<float4>                      m_tex2DArrayG;   // genericTexturePredefinedType
-    RWTexture2D                                 m_texRW2D;       // texturePredefinedType
-    RWTexture2D<float4>                         m_texRW2DG;      // genericTexturePredefinedType
-    RWTexture2DArray                            m_texRW2DArray;  // texturePredefinedType
-    RWTexture2DArray<float4>                    m_texRW2DArrayG; // genericTexturePredefinedType
-};
-
-ShaderResourceGroup SRG3 : Slot3
-{
-    float4 exampleColor;
-    RWTexture2D                                 m_texRW2D[4];       // texturePredefinedType
-    RWTexture2D<float4>                         m_texRW2DG;      // genericTexturePredefinedType
-    RWTexture2DArray                            m_texRW2DArray;  // texturePredefinedType
-    RWTexture2DArray<float4>                    m_texRW2DArrayG; // genericTexturePredefinedType
-};
-
-struct UserStruct
-{
-    int      m_myInt;
-    float    m_myFloat;
-    double   m_myDouble;
-    bool     m_myBool;
-};
-
-ShaderResourceGroup SRG4 : Slot4
-{
-    AppendStructuredBuffer<UserStruct>                 m_appendView;
-    ConsumeStructuredBuffer<UserStruct>                m_consumeView;
-    Buffer<float>                                      m_bufferView[3];
-    StructuredBuffer<UserStruct>                       m_structuredView;
-    RWBuffer<float4x4>                                 m_rwView;
-    RasterizerOrderedBuffer<int4>                      m_roView;
-};
-
-ShaderResourceGroup SRG5 : Slot5
-{
-    float4 exampleColor;
-};

+ 0 - 36
tests/Emission/RootSigUniqueSpace.txt

@@ -1,36 +0,0 @@
-/*
-    Cmdargs: ['--unique-idx', '--use-spaces', '--root-sig', '--namespace', 'dx']
-*/
-"CBV ( b8 , space = 0"
-"CBV ( b8 , space = 2"
-"CBV ( b7 , space = 3"
-"CBV ( b0 , space = 5"
-"UAV ( u0 , space = 0"
-"Sampler ( s1  , space = 0, numDescriptors = 1 "
-"Sampler ( s3  , space = 0, numDescriptors = 4 "
-"SRV     ( t0  , space = 1, numDescriptors = 1 "
-"SRV     ( t1  , space = 1, numDescriptors = 1 "
-"SRV     ( t2  , space = 1, numDescriptors = 1 "
-"SRV     ( t3  , space = 1, numDescriptors = 1 "
-"CBV     ( b4  , space = 1, numDescriptors = 1 "
-"SRV     ( t0  , space = 2, numDescriptors = 1 "
-"SRV     ( t1  , space = 2, numDescriptors = 1 "
-"SRV     ( t2  , space = 2, numDescriptors = 1 "
-"SRV     ( t3  , space = 2, numDescriptors = 1 "
-"UAV     ( u4  , space = 2, numDescriptors = 1 "
-"UAV     ( u5  , space = 2, numDescriptors = 1 "
-"UAV     ( u6  , space = 2, numDescriptors = 1 "
-"UAV     ( u7  , space = 2, numDescriptors = 1 "
-"UAV     ( u0  , space = 3, numDescriptors = 4 "
-"UAV     ( u4  , space = 3, numDescriptors = 1 "
-"UAV     ( u5  , space = 3, numDescriptors = 1 "
-"UAV     ( u6  , space = 3, numDescriptors = 1 "
-"UAV     ( u0  , space = 4, numDescriptors = 1 "
-"UAV     ( u1  , space = 4, numDescriptors = 1 "
-"SRV     ( t2  , space = 4, numDescriptors = 3 "
-"SRV     ( t5  , space = 4, numDescriptors = 1 "
-"UAV     ( u6  , space = 4, numDescriptors = 1 "
-"UAV     ( u7  , space = 4, numDescriptors = 1 "
-"StaticSampler ( s2 , space = 0 "
-"StaticSampler ( s7 , space = 0 "
-

+ 11 - 12
tests/Emission/UnboundedArrays.azsl

@@ -1,5 +1,4 @@
 // 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
 {
@@ -32,22 +31,22 @@ ShaderResourceGroup SRG1 : slot1
     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. 
+// SRG2 will take space1 because each SRG gets a unique register space.
+// Otherwise this shader wouldn't compile because all unbounded arrays in SRG1
+// would 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 
+    Texture2D<float4>        m_texSRVa;        // Takes t0, space1
+    Texture2D<float4>        m_texSRVb[];      // Takes t1+, space1
+    RWTexture2D<float4>      m_texUAVa;        // Takes u0, space1
+    RWTexture2D<float4>      m_texUAVb[];      // Takes u1+, space1
+    Sampler                  m_samplera;       // Takes s0, space1
+    Sampler                  m_samplerb[];     // Takes s1+, space1
+    ConstantBuffer<MyStruct> m_structArraya;   // Takes b1, space1
+    ConstantBuffer<MyStruct> m_structArrayb[]; // Takes b2+, space1 
 }
 
 float4 MainPS(float2 uv : TEXCOORD0) : SV_Target0

+ 18 - 21
tests/Emission/UnboundedArrays.txt

@@ -1,26 +1,23 @@
-/*
-    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 ) ;"
-"Texture2D < float4 > SRG1_m_texSRVb [] : register ( t1 , space0 ) ;"
-"RWTexture2D < float4 > SRG1_m_texUAVa : register ( u0 , space0 ) ;"
-"RWTexture2D < float4 > SRG1_m_texUAVb [] : register ( u1 , space0 ) ;"
-"SamplerState SRG1_m_samplera : register ( s0 , space0 ) ;"
-"SamplerState SRG1_m_samplerb [] : register ( s1 , space0 ) ;"
-"ConstantBuffer < :: SRG1_SRGConstantsStruct > SRG1_SRGConstantBuffer : register ( b0 , space0 ) ;"
-"ConstantBuffer < :: MyStruct > SRG1_m_structArraya : register ( b1 , space0 ) ;"
-"ConstantBuffer < :: MyStruct > SRG1_m_structArrayb [] : register ( b2 , space0 ) ;"
-"Texture2D < float4 > SRG2_m_texSRVa : register ( t0 , space1 ) ;"
-"Texture2D < float4 > SRG2_m_texSRVb [] : register ( t1 , space1 ) ;"
-"RWTexture2D < float4 > SRG2_m_texUAVa : register ( u0 , space1 ) ;"
-"RWTexture2D < float4 > SRG2_m_texUAVb [] : register ( u1 , space1 ) ;"
-"SamplerState SRG2_m_samplera : register ( s0 , space1 ) ;"
-"SamplerState SRG2_m_samplerb [] : register ( s1 , space1 ) ;"
-"ConstantBuffer < :: SRG2_SRGConstantsStruct > SRG2_SRGConstantBuffer : register ( b0 , space1 ) ;"
-"ConstantBuffer < :: MyStruct > SRG2_m_structArraya : register ( b1 , space1 ) ;"
-"ConstantBuffer < :: MyStruct > SRG2_m_structArrayb [] : register ( b2 , space1 ) ;"
+"Texture2D < float4 > SRG1_m_texSRVa : register ( t0  , space0 ) ;"
+"Texture2D < float4 > SRG1_m_texSRVb [] : register ( t1  , space0 ) ;"
+"RWTexture2D < float4 > SRG1_m_texUAVa : register ( u0  , space0 ) ;"
+"RWTexture2D < float4 > SRG1_m_texUAVb [] : register ( u1  , space0 ) ;"
+"SamplerState SRG1_m_samplera : register ( s0  , space0 ) ;"
+"SamplerState SRG1_m_samplerb [] : register ( s1  , space0 ) ;"
+"ConstantBuffer < :: SRG1_SRGConstantsStruct > SRG1_SRGConstantBuffer : register ( b0  , space0 ) ;"
+"ConstantBuffer < :: MyStruct > SRG1_m_structArraya : register ( b1  , space0 ) ;"
+"ConstantBuffer < :: MyStruct > SRG1_m_structArrayb [] : register ( b2  , space0 ) ;"
+"Texture2D < float4 > SRG2_m_texSRVa : register ( t0  , space1 ) ;"
+"Texture2D < float4 > SRG2_m_texSRVb [] : register ( t1  , space1 ) ;"
+"RWTexture2D < float4 > SRG2_m_texUAVa : register ( u0  , space1 ) ;"
+"RWTexture2D < float4 > SRG2_m_texUAVb [] : register ( u1  , space1 ) ;"
+"SamplerState SRG2_m_samplera : register ( s0  , space1 ) ;"
+"SamplerState SRG2_m_samplerb [] : register ( s1  , space1 ) ;"
+"ConstantBuffer < :: SRG2_SRGConstantsStruct > SRG2_SRGConstantBuffer : register ( b0  , space1 ) ;"
+"ConstantBuffer < :: MyStruct > SRG2_m_structArraya : register ( b1  , space1 ) ;"
+"ConstantBuffer < :: MyStruct > SRG2_m_structArrayb [] : register ( b2  , space1 ) ;"
 "float4 MainPS ( float2 uv : TEXCOORD0 ) : SV_Target0"
 "float4 diffuse = float4 ( 0 , 0 , 0 , 1 ) ;"
 "diffuse += :: SRG1_m_texSRVa . Sample ( :: SRG1_m_samplera , uv ) ;"

+ 4 - 4
tests/Emission/comprehensive.txt

@@ -27,10 +27,10 @@
 "void g ( int p = i ( ) )"
 "struct MySRGOne_I4"
 "int4 m_i4 ;"
-"TextureCube MySRGOne_m_environmentMap : register ( t0 ) ;"
-"Texture2D MySRGOne_tex : register ( t1 ) ;"
-"StructuredBuffer < MySRGOne_InnerStruct > MySRGOne_m_structured1 : register ( t2 ) ;"
-"SamplerState MySRGOne_m_sampler : register ( s0 ) ;"
+"TextureCube MySRGOne_m_environmentMap : register ( t0 , space0 ) ;"
+"Texture2D MySRGOne_tex : register ( t1 , space0 ) ;"
+"StructuredBuffer < MySRGOne_InnerStruct > MySRGOne_m_structured1 : register ( t2 , space0 ) ;"
+"SamplerState MySRGOne_m_sampler : register ( s0 , space0 ) ;"
 "struct MySRGOne_SRGConstantsStruct"
 "float4 MySRGOne_m_srgconstant1 ;"
 ":: MySRGOne_I4 MySRGOne_m_srgconstant2 ;"

+ 4 - 4
tests/Emission/dynamic-sampler-srg.txt

@@ -1,7 +1,7 @@
 # use string notation (double quotes) to list a series of tests you want to match from the output of compilation
 # spaces separate tokens. e.g. "id1 , id2" will match "thing<id1,id2>"
 
-"Texture2D SRG_m_texture [8] : register ( t0 ) ;"
-"SamplerState SRG_m_staticSamplerA : register ( s0 ) ;"
-"SamplerState SRG_m_dynamicSampler [4] : register ( s1 ) ;"
-"SamplerState SRG_m_staticSamplerB : register ( s5 ) ;"
+"Texture2D SRG_m_texture [8] : register ( t0 , space0 ) ;"
+"SamplerState SRG_m_staticSamplerA : register ( s0 , space0 ) ;"
+"SamplerState SRG_m_dynamicSampler [4] : register ( s1 , space0 ) ;"
+"SamplerState SRG_m_staticSamplerB : register ( s5 , space0 ) ;"

+ 1 - 1
tests/Emission/gmem.txt

@@ -1,5 +1,5 @@
 /*
-    Cmdargs: ['--use-spaces', '--namespace', 'vk']
+    Cmdargs: ['--namespace', 'vk']
 */
 "# if ! defined ( AZ_USE_SUBPASSINPUT )"
 "class SubpassInputStub"

+ 1 - 1
tests/Emission/mat33_padding_run_with_no-alignment-validation.txt

@@ -60,7 +60,7 @@
 "float3x3 SRG1_m_srg_mat25 ;"
 "int SRG1_m_i26 ;"
 "} ;"
-"ConstantBuffer < :: SRG1_SRGConstantsStruct > SRG1_SRGConstantBuffer : register ( b0 ) ;"
+"ConstantBuffer < :: SRG1_SRGConstantsStruct > SRG1_SRGConstantBuffer : register ( b0 , space0 ) ;"
 "float4 MainPS ( float2 uv : TEXCOORD0 ) : SV_Target0"
 "{"
 "float3x3 anotherMatrix ;"

+ 1 - 1
tests/Emission/name-collision-avoidance.txt

@@ -3,7 +3,7 @@
 
 "struct MySRGOne_InnerStruct3"
 "struct MySRGOne_InnerStruct31"
-"ConstantBuffer < :: MySRGOne_InnerStruct3 > MySRGOne_m_materialConstants : register ( b0 ) ;"
+"ConstantBuffer < :: MySRGOne_InnerStruct3 > MySRGOne_m_materialConstants : register ( b0 , space0 ) ;"
 ":: MySRGOne_InnerStruct3 mystruct = :: MySRGOne_m_materialConstants ;"
 ":: MySRGOne_InnerStruct31 meta ;"
 "MySRGOne_InnerStruct2 myuv ;"

+ 1 - 1
tests/Emission/nested-emission.txt

@@ -3,7 +3,7 @@
 
 "struct SRG_S"
 "float4 albedo ;"
-"StructuredBuffer < SRG_S > SRG_m_buf : register ( t0 ) ;"
+"StructuredBuffer < SRG_S > SRG_m_buf : register ( t0 , space0 ) ;"
 "struct Thingie_vd_S"
 "void Thingie ( )"
 ":: Thingie_vd_S s ;"

+ 2 - 2
tests/Emission/ordering.txt

@@ -12,8 +12,8 @@
 "struct Srg1_S"
 "struct Srg1_SRGConstantsStruct"
 "float4 Srg1_m_f4 ;"
-"ConstantBuffer < :: Srg1_SRGConstantsStruct > Srg1_SRGConstantBuffer : register ( b0 ) ;"
-"ConstantBuffer < :: Srg1_S > Srg1_m_cb1 : register ( b1 ) ;"
+"ConstantBuffer < :: Srg1_SRGConstantsStruct > Srg1_SRGConstantBuffer : register ( b0 , space0 ) ;"
+"ConstantBuffer < :: Srg1_S > Srg1_m_cb1 : register ( b1 , space0 ) ;"
 "float4 Srg1_GetDiffClrFromCB ( )"
 "return :: Srg1_m_cb1 . m_clr ;"
 "struct S2"

+ 3 - 3
tests/Emission/ray-tracing-hello-world.txt

@@ -1,4 +1,4 @@
-"RaytracingAccelerationStructure RaySRG_Scene : register ( t0 ) ;"
-"RWTexture2D < float4 > RaySRG_RenderTarget : register ( u0 ) ;"
-"ConstantBuffer < :: RayGenConstantBuffer > RaySRG_g_rayGenCB : register ( b0 ) ;"
+"RaytracingAccelerationStructure RaySRG_Scene : register ( t0 , space0 ) ;"
+"RWTexture2D < float4 > RaySRG_RenderTarget : register ( u0 , space0 ) ;"
+"ConstantBuffer < :: RayGenConstantBuffer > RaySRG_g_rayGenCB : register ( b0 , space0 ) ;"
 

+ 8 - 8
tests/Emission/ray-tracing-procedural-geometry.txt

@@ -1,9 +1,9 @@
-"RaytracingAccelerationStructure RaySRG_g_scene : register ( t0 ) ;"
-"RWTexture2D < float4 > RaySRG_g_renderTarget : register ( u0 ) ;"
-"ByteAddressBuffer RaySRG_g_indices : register ( t1 ) ;"
-"StructuredBuffer < Vertex > RaySRG_g_vertices : register ( t2 ) ;"
-"StructuredBuffer < PrimitiveInstancePerFrameBuffer > RaySRG_g_AABBPrimitiveAttributes : register ( t3 ) ;"
-"ConstantBuffer < :: SceneConstantBuffer > RaySRG_g_sceneCB : register ( b0 ) ;"
-"ConstantBuffer < :: PrimitiveConstantBuffer > RaySRG_l_materialCB : register ( b1 ) ;"
-"ConstantBuffer < :: PrimitiveInstanceConstantBuffer > RaySRG_l_aabbCB : register ( b2 ) ;"
+"RaytracingAccelerationStructure RaySRG_g_scene : register ( t0 , space0 ) ;"
+"RWTexture2D < float4 > RaySRG_g_renderTarget : register ( u0 , space0 ) ;"
+"ByteAddressBuffer RaySRG_g_indices : register ( t1 , space0 ) ;"
+"StructuredBuffer < Vertex > RaySRG_g_vertices : register ( t2 , space0 ) ;"
+"StructuredBuffer < PrimitiveInstancePerFrameBuffer > RaySRG_g_AABBPrimitiveAttributes : register ( t3 , space0 ) ;"
+"ConstantBuffer < :: SceneConstantBuffer > RaySRG_g_sceneCB : register ( b0 , space0 ) ;"
+"ConstantBuffer < :: PrimitiveConstantBuffer > RaySRG_l_materialCB : register ( b1 , space0 ) ;"
+"ConstantBuffer < :: PrimitiveInstanceConstantBuffer > RaySRG_l_aabbCB : register ( b2 , space0 ) ;"
 

+ 6 - 6
tests/Emission/ray-tracing-simple-lighting.txt

@@ -1,6 +1,6 @@
-"RaytracingAccelerationStructure RaySRG_Scene : register ( t0 ) ;"
-"RWTexture2D < float4 > RaySRG_RenderTarget : register ( u0 ) ;"
-"ByteAddressBuffer RaySRG_Indices : register ( t1 ) ;"
-"StructuredBuffer < Vertex > RaySRG_Vertices : register ( t2 ) ;"
-"ConstantBuffer < :: SceneConstantBuffer > RaySRG_g_sceneCB : register ( b0 ) ;"
-"ConstantBuffer < :: CubeConstantBuffer > RaySRG_g_cubeCB : register ( b1 ) ;"
+"RaytracingAccelerationStructure RaySRG_Scene : register ( t0 , space0 ) ;"
+"RWTexture2D < float4 > RaySRG_RenderTarget : register ( u0 , space0 ) ;"
+"ByteAddressBuffer RaySRG_Indices : register ( t1 , space0 ) ;"
+"StructuredBuffer < Vertex > RaySRG_Vertices : register ( t2 , space0 ) ;"
+"ConstantBuffer < :: SceneConstantBuffer > RaySRG_g_sceneCB : register ( b0 , space0 ) ;"
+"ConstantBuffer < :: CubeConstantBuffer > RaySRG_g_cubeCB : register ( b1 , space0 ) ;"

+ 0 - 0
tests/Semantic/AsError/unbounded-arrays-unique-idx-requires-use-spaces.azsl → tests/Semantic/unbounded-arrays-unique-idx-should-pass-2srgs.azsl


+ 9 - 0
tests/Semantic/unbounded-arrays-unique-idx-should-pass-2srgs.txt

@@ -0,0 +1,9 @@
+# list lines expected to have tokens matching the patterns in the strings. each space is a separation.
+
+"ByteAddressBuffer SRG1_m_meshBuffers [] : register ( t8 , space0 ) ;"
+"ConstantBuffer < :: SRG1_SRGConstantsStruct > SRG1_SRGConstantBuffer : register ( b6 , space0 ) ;"
+"ConstantBuffer < :: MyStruct > SRG1_m_data : register ( b7 , space0 ) ;"
+
+"ByteAddressBuffer SRG2_m_meshBuffers [] : register ( t8 , space1 ) ;"
+"ConstantBuffer < :: SRG2_SRGConstantsStruct > SRG2_SRGConstantBuffer : register ( b6 , space1 ) ;"
+"ConstantBuffer < :: MyStruct > SRG2_m_data : register ( b7 , space1 ) ;"

+ 3 - 3
tests/Semantic/unbounded-arrays-unique-idx-should-pass.txt

@@ -1,5 +1,5 @@
 # list lines expected to have tokens matching the patterns in the strings. each space is a separation.
 
-"ByteAddressBuffer SRG1_m_meshBuffers [] : register ( t8 ) ;"
-"ConstantBuffer < :: SRG1_SRGConstantsStruct > SRG1_SRGConstantBuffer : register ( b6 ) ;"
-"ConstantBuffer < :: MyStruct > SRG1_m_data : register ( b7 ) ;"
+"ByteAddressBuffer SRG1_m_meshBuffers [] : register ( t8 , space0 ) ;"
+"ConstantBuffer < :: SRG1_SRGConstantsStruct > SRG1_SRGConstantBuffer : register ( b6 , space0 ) ;"
+"ConstantBuffer < :: MyStruct > SRG1_m_data : register ( b7 , space0 ) ;"

+ 3 - 4
tests/Semantic/AsError/unbounded-arrays3.azsl → tests/Semantic/unbounded-arrays3.azsl

@@ -1,6 +1,5 @@
-// Makes sure unbounded arrays are supported across all register classes t,u,s,b,
-// This example should fail if ran without --use-spaces because SRG1 declares
-// an unbounded array of Texture2D  that will take over the whole t2+ registers in space0.
+// Makes sure unbounded arrays are supported across all register classes t,u,s,b.
+// This example demonstrates each SRG having a unique register space, allowing another texture.
 
 
 ShaderResourceGroupSemantic slot1
@@ -37,6 +36,6 @@ ShaderResourceGroup SRG1 : slot1
 
 ShaderResourceGroup SRG2 : slot2
 {
-    // #EC 48. If compiled without --use-spaces because SRG1::m_texSRVc[] takes over all t2+ registers.
+    // Having unique register spaces for each SRG allows this texture to use space1 while SRG1 uses space0
     Texture2D<float4>        m_texSRVa;
 }

+ 2 - 4
tests/Semantic/AsError/unbounded-arrays2.azsl → tests/Semantic/unbounded-arrays4.azsl

@@ -1,7 +1,5 @@
 // Makes sure unbounded arrays are supported across all register classes t,u,s,b,
-// In this example there's no SRG2 ConstantBuffer, but SRG2 does declare a ConstantBuffer
-// and if compiled without --use-spaces should fail.
- 
+// This example demonstrates each SRG having a unique register space, allowing another explicit ConstantBuffer.
  
 ShaderResourceGroupSemantic slot1
 {
@@ -37,6 +35,6 @@ ShaderResourceGroup SRG1 : slot1
 
 ShaderResourceGroup SRG2 : slot2
 {
-    // #EC 48. If compiled without --use-spaces because SRG1::m_structArrayc[] takes over all b2+ registers.
+    // Having unique register spaces for each SRG allows this constant buffer to use space1 while SRG1 uses space0.
     ConstantBuffer<MyStruct> m_structArraya;
 }

+ 3 - 5
tests/Semantic/AsError/unbounded-arrays1.azsl → tests/Semantic/unbounded-arrays5.azsl

@@ -1,6 +1,5 @@
-// Makes sure unbounded arrays are supported across all register classes t,u,s,b,
-// This example when ran without --use-spaces should fail.
-
+// Makes sure unbounded arrays are supported across all register classes t,u,s,b.
+// This example demonstrates each SRG having a unique register space, allowing another implicit ConstantBuffer.
 
 ShaderResourceGroupSemantic slot1
 {
@@ -36,7 +35,6 @@ ShaderResourceGroup SRG1 : slot1
 
 ShaderResourceGroup SRG2 : slot2
 {
-    // #EC 48. If compiled without --use-spaces because SRG1::m_structArrayc[] takes over all b2+ registers.
-    // In other words SRG1::m_structArrayc[] won't allow the SRG2 ConstanBuffer to be instantiated.
+    // Having unique register spaces for each SRG allows this to SRG's implicit constant buffer to use space1 while SRG1 uses space0.
     int m_data;
 }

+ 2 - 1
tests/testfuncs.py

@@ -58,6 +58,7 @@ def launchCompiler(compilerPath, options, silent):
     '''returns a tuple (standard-output-text, process-return-code)'''
     arglist = [compilerPath]
     arglist.extend(options)
+    print ("    Running: ", ' '.join(arglist))
     process = subprocess.Popen(arglist, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     out, err = process.communicate()
     if not silent:
@@ -174,6 +175,6 @@ def verifyAllPredicates(predicates, j, silent=True):
         allok = allok and ok
     if not allok and not silent:
         print ("dump as parsed:")
-        pp = pprint.PrettyPrinter(indent=2)
+        pp = pprint.PrettyPrinter(indent=2, width=160)
         pp.pprint(j)
     return allok

+ 1 - 1
tests/testhelper.py

@@ -43,7 +43,7 @@ def found(needle, haystack):
         return True
     return False
     
-# pars the argument mentioned in the shader source file Ex : Cmdargs: --namespace=vk   or Cmdargs: ['--unique-idx', '--use-spaces', '--root-sig', '--root-const', '0']
+# pars the argument mentioned in the shader source file Ex : Cmdargs: --namespace=vk   or Cmdargs: ['--unique-idx', '--root-sig', '--root-const', '0']
 def parse_strlist(sl):
     clean = re.sub("[\[\],\s]","",sl)
     splitted = re.split("[\'\"]",clean)