Some of the MaterialX shader codegen uses unordered data structures, and this reflects in the output shader. This causes problems for tests which are comparing against a static baseline. For example, testHdStMaterialXShaderGen_UsdPStextured has these lines
This is because the lines are printed in the order of _mxHdTextureMap, which is a MaterialX::StringMap aka std::unordered_map<std::string, std::string> (see pxr/imaging/hdSt/materialXShaderGen.cpp).
Either the testing baseline check needs to be smarter to handle undefined ordering where they can occur, or the codegen needs to sort the keys using the string values before printing.
Some of the MaterialX shader codegen uses unordered data structures, and this reflects in the output shader. This causes problems for tests which are comparing against a static baseline. For example,
testHdStMaterialXShaderGen_UsdPStextured
has these lineswhich will change order according to the stdlib implementation. On macOS, I observe
and the test fails.
This is because the lines are printed in the order of
_mxHdTextureMap
, which is aMaterialX::StringMap
akastd::unordered_map<std::string, std::string>
(seepxr/imaging/hdSt/materialXShaderGen.cpp
).Either the testing baseline check needs to be smarter to handle undefined ordering where they can occur, or the codegen needs to sort the keys using the string values before printing.