From 77ad9c21cd8dbf8f5d4341359092beb479a6aa4e Mon Sep 17 00:00:00 2001 From: Kai Rohmer Date: Tue, 10 Dec 2024 10:43:02 +0100 Subject: [PATCH] remove test changes and new test content to be split out into another PR --- .../libraries/custom/custom_inline_node.mtlx | 79 ------------------ .../custom/custom_inline_node_defaults.mtlx | 33 -------- .../custom_inline_node_multiple_output.mtlx | 61 -------------- .../custom_inline_node_reserved_words.mtlx | 40 --------- .../libraries/custom/custom_node.mtlx | 67 --------------- .../custom/custom_node_gen_versioning.mtlx | 34 -------- .../custom/custom_node_multiple_output.mtlx | 38 --------- .../custom/custom_node_reserved_words.mtlx | 64 -------------- .../custom/custom_node_resources.mtlx | 50 ----------- .../libraries/custom/example_procedural.mtlx | 83 ------------------- .../custom/mdl/mx_custom_library_1_6.mdl | 23 ----- .../custom/mdl/mx_custom_library_1_7.mdl | 14 ---- .../custom/mdl/mx_custom_library_1_8.mdl | 16 ---- .../custom/mdl/mx_custom_library_1_9.mdl | 16 ---- .../libraries/custom/mdl/mx_custom_node.mdl | 55 ------------ .../mdl/mx_custom_node_reserved_words.mdl | 34 -------- .../MaterialXGenGlsl/GenGlsl.cpp | 7 +- .../MaterialXTest/MaterialXGenMdl/GenMdl.cpp | 16 +--- .../MaterialXTest/MaterialXGenMsl/GenMsl.cpp | 7 +- .../MaterialXTest/MaterialXGenOsl/GenOsl.cpp | 7 +- 20 files changed, 5 insertions(+), 739 deletions(-) delete mode 100644 resources/Materials/TestSuite/libraries/custom/custom_inline_node.mtlx delete mode 100644 resources/Materials/TestSuite/libraries/custom/custom_inline_node_defaults.mtlx delete mode 100644 resources/Materials/TestSuite/libraries/custom/custom_inline_node_multiple_output.mtlx delete mode 100644 resources/Materials/TestSuite/libraries/custom/custom_inline_node_reserved_words.mtlx delete mode 100644 resources/Materials/TestSuite/libraries/custom/custom_node.mtlx delete mode 100644 resources/Materials/TestSuite/libraries/custom/custom_node_gen_versioning.mtlx delete mode 100644 resources/Materials/TestSuite/libraries/custom/custom_node_multiple_output.mtlx delete mode 100644 resources/Materials/TestSuite/libraries/custom/custom_node_reserved_words.mtlx delete mode 100644 resources/Materials/TestSuite/libraries/custom/custom_node_resources.mtlx delete mode 100644 resources/Materials/TestSuite/libraries/custom/example_procedural.mtlx delete mode 100644 resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_6.mdl delete mode 100644 resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_7.mdl delete mode 100644 resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_8.mdl delete mode 100644 resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_9.mdl delete mode 100644 resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_node.mdl delete mode 100644 resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_node_reserved_words.mdl diff --git a/resources/Materials/TestSuite/libraries/custom/custom_inline_node.mtlx b/resources/Materials/TestSuite/libraries/custom/custom_inline_node.mtlx deleted file mode 100644 index fd10e12a8c..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/custom_inline_node.mtlx +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/Materials/TestSuite/libraries/custom/custom_inline_node_defaults.mtlx b/resources/Materials/TestSuite/libraries/custom/custom_inline_node_defaults.mtlx deleted file mode 100644 index dfe58b1d40..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/custom_inline_node_defaults.mtlx +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/Materials/TestSuite/libraries/custom/custom_inline_node_multiple_output.mtlx b/resources/Materials/TestSuite/libraries/custom/custom_inline_node_multiple_output.mtlx deleted file mode 100644 index 69413c5ba3..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/custom_inline_node_multiple_output.mtlx +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/Materials/TestSuite/libraries/custom/custom_inline_node_reserved_words.mtlx b/resources/Materials/TestSuite/libraries/custom/custom_inline_node_reserved_words.mtlx deleted file mode 100644 index a6876cafcc..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/custom_inline_node_reserved_words.mtlx +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/Materials/TestSuite/libraries/custom/custom_node.mtlx b/resources/Materials/TestSuite/libraries/custom/custom_node.mtlx deleted file mode 100644 index fc959dbc43..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/custom_node.mtlx +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/Materials/TestSuite/libraries/custom/custom_node_gen_versioning.mtlx b/resources/Materials/TestSuite/libraries/custom/custom_node_gen_versioning.mtlx deleted file mode 100644 index 82586fce23..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/custom_node_gen_versioning.mtlx +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/Materials/TestSuite/libraries/custom/custom_node_multiple_output.mtlx b/resources/Materials/TestSuite/libraries/custom/custom_node_multiple_output.mtlx deleted file mode 100644 index 66165ba3c4..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/custom_node_multiple_output.mtlx +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/Materials/TestSuite/libraries/custom/custom_node_reserved_words.mtlx b/resources/Materials/TestSuite/libraries/custom/custom_node_reserved_words.mtlx deleted file mode 100644 index 7e59ca0e3d..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/custom_node_reserved_words.mtlx +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/Materials/TestSuite/libraries/custom/custom_node_resources.mtlx b/resources/Materials/TestSuite/libraries/custom/custom_node_resources.mtlx deleted file mode 100644 index 6f2c181512..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/custom_node_resources.mtlx +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/Materials/TestSuite/libraries/custom/example_procedural.mtlx b/resources/Materials/TestSuite/libraries/custom/example_procedural.mtlx deleted file mode 100644 index a7d6715dce..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/example_procedural.mtlx +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_6.mdl b/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_6.mdl deleted file mode 100644 index 02d443d7c9..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_6.mdl +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright Contributors to the MaterialX Project -// SPDX-License-Identifier: Apache-2.0 -// - -// Note, this module has to be placed in an MDL search path in order to get picked up correctly. - -// MDL language version number -// This is NOT a version or revision number of the module content itself. -mdl 1.6; - -// Example function to test the version handling. -// Note, the changes here are only for testing! -// In general all versions should produce an output according to the node specification as good as possible. -// Increasing the language version should only be done when new language features allow to implement the -// specified behavior more precisely or more efficiently. -// The version number is NOT meant for versioning the nodules content itself, e.g., after adding new functions or fixing bugs). - -// just a simple example function -export color custom_library_function(float scale = 1.0) -{ - return color(0.25, 0.5, 0.75) * scale; -} diff --git a/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_7.mdl b/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_7.mdl deleted file mode 100644 index 5217ac4c4d..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_7.mdl +++ /dev/null @@ -1,14 +0,0 @@ -// -// Copyright Contributors to the MaterialX Project -// SPDX-License-Identifier: Apache-2.0 -// - -// Note, this module has to be placed in an MDL search path in order to get picked up correctly. - -// MDL language version number -// This is NOT a version or revision number of the module content itself. -mdl 1.7; - -// no changes when upgrading the code generator to produce MDL 1.8 code -// forward all unchanged definitions from the previous version -export using .::mx_custom_library_1_6 import custom_library_function; diff --git a/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_8.mdl b/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_8.mdl deleted file mode 100644 index e3c00b6f95..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_8.mdl +++ /dev/null @@ -1,16 +0,0 @@ -// -// Copyright Contributors to the MaterialX Project -// SPDX-License-Identifier: Apache-2.0 -// - -// Note, this module has to be placed in an MDL search path in order to get picked up correctly. - -// MDL language version number -// This is NOT a version or revision number of the module content itself. -mdl 1.8; - -// Note, have a look into mx_custom_library_1_6 for details. - -// no changes when upgrading the code generator to produce MDL 1.8 code -// forward all unchanged definitions from the previous version -export using .::mx_custom_library_1_7 import custom_library_function; diff --git a/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_9.mdl b/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_9.mdl deleted file mode 100644 index 8f6068a87c..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_library_1_9.mdl +++ /dev/null @@ -1,16 +0,0 @@ -// -// Copyright Contributors to the MaterialX Project -// SPDX-License-Identifier: Apache-2.0 -// - -// Note, this module has to be placed in an MDL search path in order to get picked up correctly. - -// MDL language version number -// This is NOT a version or revision number of the module content itself. -mdl 1.9; - -// Note, have a look into mx_custom_library_1_6 for details. - -// no changes when upgrading the code generator to produce MDL 1.7 code -// forward all unchanged definitions from the previous version -export using .::mx_custom_library_1_8 import custom_library_function; diff --git a/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_node.mdl b/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_node.mdl deleted file mode 100644 index f547ba5a4d..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_node.mdl +++ /dev/null @@ -1,55 +0,0 @@ -// -// Copyright Contributors to the MaterialX Project -// SPDX-License-Identifier: Apache-2.0 -// - -// Note, this module has to be placed in an MDL search path in order to get picked up correctly. - - -// MDL language version number -// Select the version that supports the required features based on the MDL specification. -// Since the MDL generator in MaterialX requires MDL 1.6 it's a good default. -// If you have MDL functions in an older language version it's not required to increase the version number. -// If your module requires functionality of a higher version, `targetVersion` has to be adjusted accordingly -// during code generation in `GenMdlOption`. The default option always uses the latest version, -// which means no changes are required unless the option was set manually. -mdl 1.6; - -// MDL standard modules -import ::math::*; -import ::tex::*; -import ::state::*; - -// A simple example of a custom node implementation in MDL. -export color custom_node_function(float red, float green, float blue) -{ - return color(red * 0.25, green * 0.5, blue * 0.75); -} - -// Example to illustrate implementations fpr multiple output nodes in MDL. -// It uses a structure that might be defined locally. -// The actual name of struct is anonymous to the code code generator. -export struct custom_struct -{ - color tint = color(0.0); - float roughness = 0.0; - bool unused = false; // not part of the MaterialX node definition. -}; -export custom_struct custom_node_multiple_output_function(float scale) -{ - custom_struct output; - output.tint = color(0.1, scale, 0.1); - output.roughness = scale; - return output; -} - -// Example for nodes with resource parameters. -export color custom_node_image_luminance( - uniform texture_2d file = texture_2d(), - float2 texcoord = float2(::state::texture_coordinate(0).x, ::state::texture_coordinate(0).y) -) -{ - float3 c = tex::lookup_float3(tex: file, coord: texcoord); - float lum = math::dot(c, float3(0.212671f, 0.715160f, 0.072169f)); - return color(lum); -} diff --git a/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_node_reserved_words.mdl b/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_node_reserved_words.mdl deleted file mode 100644 index a0c3140794..0000000000 --- a/resources/Materials/TestSuite/libraries/custom/mdl/mx_custom_node_reserved_words.mdl +++ /dev/null @@ -1,34 +0,0 @@ -// -// Copyright Contributors to the MaterialX Project -// SPDX-License-Identifier: Apache-2.0 -// - -// Note, this module has to be placed in an MDL search path in order to get picked up correctly. -// For all reserved words, please see the latest MDL Specification document. - -mdl 1.6; - -// "auto" is a reserved word in MDL. -// if the MaterialX node definition has a parameter that conflicts with such a reserved word, -// a prefix "mxp_" needs to be added. -// "a" is not a reserved word and no prefix is added. This allow to integrate existing MDL modules without changes. -export color reserved_parmeter_name_function(float a, float mxp_auto) -{ - return a * color(mxp_auto * 0.25, mxp_auto * 0.5, mxp_auto * 1.0); -} - -// "out" and "private" are also reserved words. -// A prefix "mxp_" needs to be added when an output name in the MaterialX node definition conflicts -// with a reserved word in MDL. -export struct custom_struct -{ - color mxp_out = color(0.0); - float mxp_private = 0.0; -}; -export custom_struct reserved_output_name_function(float scale) -{ - custom_struct output; - output.mxp_out = color(0.1, scale, 0.1); - output.mxp_private = scale; - return output; -} diff --git a/source/MaterialXTest/MaterialXGenGlsl/GenGlsl.cpp b/source/MaterialXTest/MaterialXGenGlsl/GenGlsl.cpp index b62c2f815e..979320bd91 100644 --- a/source/MaterialXTest/MaterialXGenGlsl/GenGlsl.cpp +++ b/source/MaterialXTest/MaterialXGenGlsl/GenGlsl.cpp @@ -139,12 +139,7 @@ static void generateGlslCode(GlslType type) mx::FileSearchPath searchPath = mx::getDefaultDataSearchPath(); mx::FilePathVec testRootPaths; - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/libraries/metal")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/lights")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/locale")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/nprlib")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/pbrlib")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/stdlib")); + testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite")); testRootPaths.push_back(searchPath.find("resources/Materials/Examples/StandardSurface")); // Create the requested shader generator. diff --git a/source/MaterialXTest/MaterialXGenMdl/GenMdl.cpp b/source/MaterialXTest/MaterialXGenMdl/GenMdl.cpp index 2adc9f5738..610b237163 100644 --- a/source/MaterialXTest/MaterialXGenMdl/GenMdl.cpp +++ b/source/MaterialXTest/MaterialXGenMdl/GenMdl.cpp @@ -210,13 +210,7 @@ void MdlShaderGeneratorTester::preprocessDocument(mx::DocumentPtr doc) if (!_mdlCustomResolver) _mdlCustomResolver = MdlStringResolver::create(); - mx::FileSearchPath searchPath = mx::getDefaultDataSearchPath(); - - // add an additional search path for the custom MDL - // in an real-world application, the custom modules would be located in an already MDL search path - mx::FilePath customNodeTestSearchPath = searchPath.find("resources/Materials/TestSuite/libraries/custom/mdl"); - - _mdlCustomResolver->initialize(doc, &_logFile, { _searchPath.asString(), customNodeTestSearchPath.asString() }); + _mdlCustomResolver->initialize(doc, &_logFile, { _searchPath.asString() }); mx::flattenFilenames(doc, _mdlCustomResolver->getMdlSearchPaths(), _mdlCustomResolver); } @@ -363,13 +357,7 @@ TEST_CASE("GenShader: MDL Shader Generation", "[genmdl]") mx::FileSearchPath searchPath = mx::getDefaultDataSearchPath(); mx::FilePathVec testRootPaths; - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/libraries/custom")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/libraries/metal")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/lights")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/locale")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/nprlib")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/pbrlib")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/stdlib")); + testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite")); testRootPaths.push_back(searchPath.find("resources/Materials/Examples/StandardSurface")); testRootPaths.push_back(searchPath.find("resources/Materials/Examples/UsdPreviewSurface")); diff --git a/source/MaterialXTest/MaterialXGenMsl/GenMsl.cpp b/source/MaterialXTest/MaterialXGenMsl/GenMsl.cpp index 2bdcb9bf91..32baaec5f0 100644 --- a/source/MaterialXTest/MaterialXGenMsl/GenMsl.cpp +++ b/source/MaterialXTest/MaterialXGenMsl/GenMsl.cpp @@ -122,12 +122,7 @@ static void generateMslCode() mx::FileSearchPath searchPath = mx::getDefaultDataSearchPath(); mx::FilePathVec testRootPaths; - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/libraries/metal")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/lights")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/locale")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/nprlib")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/pbrlib")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/stdlib")); + testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite")); testRootPaths.push_back(searchPath.find("resources/Materials/Examples/StandardSurface")); const mx::FilePath logPath("genmsl_msl23_layout_generate_test.txt"); diff --git a/source/MaterialXTest/MaterialXGenOsl/GenOsl.cpp b/source/MaterialXTest/MaterialXGenOsl/GenOsl.cpp index 3986e0ea47..6e613c85b8 100644 --- a/source/MaterialXTest/MaterialXGenOsl/GenOsl.cpp +++ b/source/MaterialXTest/MaterialXGenOsl/GenOsl.cpp @@ -182,12 +182,7 @@ static void generateOslCode() mx::FileSearchPath searchPath = mx::getDefaultDataSearchPath(); mx::FilePathVec testRootPaths; - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/libraries/metal")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/lights")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/locale")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/nprlib")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/pbrlib")); - testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite/stdlib")); + testRootPaths.push_back(searchPath.find("resources/Materials/TestSuite")); testRootPaths.push_back(searchPath.find("resources/Materials/Examples/StandardSurface")); const mx::FilePath logPath("genosl_vanilla_generate_test.txt");