Przeglądaj źródła

Changing inlineConstant to rootConstant keyword work. (#14)

This is version 1.7.33

Changed the text of the emitted reflection data for RootContants,
previously known as InlineConstants.

Signed-off-by: garrieta <[email protected]>
galibzon 3 lat temu
rodzic
commit
a951318e4a

+ 1 - 1
src/AzslcMain.cpp

@@ -23,7 +23,7 @@ namespace StdFs = std::filesystem;
 // For large features or milestones. Minor version allows for breaking changes. Existing tests can change.
 #define AZSLC_MINOR "7"
 // For small features or bug fixes. They cannot introduce breaking changes. Existing tests shouldn't change.
-#define AZSLC_REVISION "32" // non-initialized static const of any type seems to get a spurious 0 initializer
+#define AZSLC_REVISION "33" // Changing inlineConstant to rootConstant keyword work
 
 namespace AZ::ShaderCompiler
 {

+ 3 - 3
src/AzslcReflection.cpp

@@ -819,7 +819,7 @@ namespace AZ::ShaderCompiler
             uint32_t strideSize = BuildUserDefinedMemberLayout(structLayout, m_ir->m_rootConstantStructUID, options, options.m_packConstantBuffers, startAt, "");
             strideSize = GetPlatformEmitter().AlignRootConstants(strideSize);
 
-            rootConstantLayout["inputsForInlineConstants"] = structLayout;
+            rootConstantLayout["inputsForRootConstants"] = structLayout;
 
             const auto& bindInfo = rootSig.Get(m_ir->m_rootConstantStructUID);
             Json::Value dataView(Json::objectValue);
@@ -828,10 +828,10 @@ namespace AZ::ShaderCompiler
             ReflectBinding(dataView, bindInfo);
             dataView["sizeInBytes"] = strideSize;
 
-            rootConstantLayout["bufferForInlineConstants"] = dataView;
+            rootConstantLayout["bufferForRootConstants"] = dataView;
 
             // Add the layout to Root node
-            srgRoot["InlineConstantBuffer"] = rootConstantLayout;
+            srgRoot["RootConstantBuffer"] = rootConstantLayout;
         }
 
         m_out << srgRoot;

+ 6 - 6
tests/Advanced/srg-inlineconsts.py

@@ -19,12 +19,12 @@ def verifyOK(thefile, compilerPath, silent):
     if ok:
         predicates = []
 
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["count"]                    ==    1)
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["index"]                    ==    0)
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["space"]                    ==    0)
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["usage"]                    ==    "Read")
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["sizeInBytes"]              ==    60)
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["id"]                       ==    "Root_Constants")
+        predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["count"]                    ==    1)
+        predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["index"]                    ==    0)
+        predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["space"]                    ==    0)
+        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")
 
         if not silent: print (fg.CYAN+ style.BRIGHT+ "inline const verification..."+ style.RESET_ALL)
         ok = testfuncs.verifyAllPredicates(predicates, j)

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

@@ -1305,30 +1305,30 @@ def verifyPackingDirectXInlineConstants(thefile, compilerPath, silent):
         predicates = []
 
         # Inline constant buffer reflection data validation
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["count"]                    ==    1)
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["index"]                    ==    1)
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["space"]                    ==    0)
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["usage"]                    ==    "Read")
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["sizeInBytes"]              ==    60)
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["id"]                       ==    "Root_Constants")
+        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"]["usage"]                    ==    "Read")
+        predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["sizeInBytes"]              ==    60)
+        predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["id"]                       ==    "Root_Constants")
 
         # Inline constant structure members validation
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][0]["constantByteOffset"]    ==    0)
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][0]["constantByteSize"]      ==    16)
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][0]["constantId"]            ==    "varFloat4")
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][0]["qualifiedName"]         ==    "/Root_Constants/varFloat4")
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][0]["typeDimensions"]        ==    [])
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][0]["typeKind"]              ==    "Predefined")
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][0]["typeName"]              ==    "?float4")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][0]["constantByteOffset"]    ==    0)
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][0]["constantByteSize"]      ==    16)
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][0]["constantId"]            ==    "varFloat4")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][0]["qualifiedName"]         ==    "/Root_Constants/varFloat4")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][0]["typeDimensions"]        ==    [])
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][0]["typeKind"]              ==    "Predefined")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][0]["typeName"]              ==    "?float4")
 
         # Inline constant structure members validation
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][1]["constantByteOffset"]    ==    16)
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][1]["constantByteSize"]      ==    44)
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][1]["constantId"]            ==    "mat3x3")
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][1]["qualifiedName"]         ==    "/Root_Constants/mat3x3")
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][1]["typeDimensions"]        ==    [])
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][1]["typeKind"]              ==    "Predefined")
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][1]["typeName"]              ==    "?float3x3")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][1]["constantByteOffset"]    ==    16)
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][1]["constantByteSize"]      ==    44)
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][1]["constantId"]            ==    "mat3x3")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][1]["qualifiedName"]         ==    "/Root_Constants/mat3x3")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][1]["typeDimensions"]        ==    [])
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][1]["typeKind"]              ==    "Predefined")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][1]["typeName"]              ==    "?float3x3")
 
         if not silent: print (fg.CYAN+ style.BRIGHT+ "inline constant layouts verification..."+ style.RESET_ALL)
         ok = testfuncs.verifyAllPredicates(predicates, j)
@@ -1341,30 +1341,30 @@ def verifyPackingMetalInlineConstants(thefile, compilerPath, silent):
         predicates = []
 
         # Inline constant buffer reflection data validation
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["count"]                    ==    1)
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["index"]                    ==    1)
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["space"]                    ==    0)
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["usage"]                    ==    "Read")
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["sizeInBytes"]              ==    64)
-        predicates.append(lambda: j["InlineConstantBuffer"]["bufferForInlineConstants"]["id"]                       ==    "Root_Constants")
+        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"]["usage"]                    ==    "Read")
+        predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["sizeInBytes"]              ==    64)
+        predicates.append(lambda: j["RootConstantBuffer"]["bufferForRootConstants"]["id"]                       ==    "Root_Constants")
 
         # Inline constant structure members validation
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][0]["constantByteOffset"]    ==    0)
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][0]["constantByteSize"]      ==    16)
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][0]["constantId"]            ==    "varFloat4")
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][0]["qualifiedName"]         ==    "/Root_Constants/varFloat4")
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][0]["typeDimensions"]        ==    [])
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][0]["typeKind"]              ==    "Predefined")
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][0]["typeName"]              ==    "?float4")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][0]["constantByteOffset"]    ==    0)
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][0]["constantByteSize"]      ==    16)
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][0]["constantId"]            ==    "varFloat4")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][0]["qualifiedName"]         ==    "/Root_Constants/varFloat4")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][0]["typeDimensions"]        ==    [])
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][0]["typeKind"]              ==    "Predefined")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][0]["typeName"]              ==    "?float4")
 
         # Inline constant structure members validation
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][1]["constantByteOffset"]    ==    16)
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][1]["constantByteSize"]      ==    44)
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][1]["constantId"]            ==    "mat3x3")
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][1]["qualifiedName"]         ==    "/Root_Constants/mat3x3")
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][1]["typeDimensions"]        ==    [])
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][1]["typeKind"]              ==    "Predefined")
-        predicates.append(lambda: j["InlineConstantBuffer"]["inputsForInlineConstants"][1]["typeName"]              ==    "?float3x3")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][1]["constantByteOffset"]    ==    16)
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][1]["constantByteSize"]      ==    44)
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][1]["constantId"]            ==    "mat3x3")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][1]["qualifiedName"]         ==    "/Root_Constants/mat3x3")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][1]["typeDimensions"]        ==    [])
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][1]["typeKind"]              ==    "Predefined")
+        predicates.append(lambda: j["RootConstantBuffer"]["inputsForRootConstants"][1]["typeName"]              ==    "?float3x3")
 
         if not silent: print (fg.CYAN+ style.BRIGHT+ "inline constant layouts verification..."+ style.RESET_ALL)
         ok = testfuncs.verifyAllPredicates(predicates, j)