diff --git a/libraries/CMakeLists.txt b/libraries/CMakeLists.txt
index d60a54cf3b..d13c180658 100644
--- a/libraries/CMakeLists.txt
+++ b/libraries/CMakeLists.txt
@@ -1,28 +1,129 @@
-if (MATERIALX_OSL_LEGACY_CLOSURES)
- set(PBRLIB_SUFFIX "legacy")
-else()
- set(PBRLIB_SUFFIX "mtlx")
-endif()
+function(mx_copy_files FILE_LIST DESTINATION_DIR)
+ set(options "")
+ set(oneValueArgs
+ INSTALLED_FILES_LIST)
+ set(multiValueArgs
+ SRC_DEST_REPLACE_RULE)
+ cmake_parse_arguments(args
+ "${options}"
+ "${oneValueArgs}"
+ "${multiValueArgs}"
+ ${ARGN})
+
+ string(COMPARE NOTEQUAL "${args_SRC_DEST_REPLACE_RULE}" "" HAS_REPLACE_RULE)
+ string(COMPARE NOTEQUAL "${args_INSTALLED_FILES_LIST}" "" HAS_INSTALLED_FILES_LIST)
+
+ foreach (F ${${FILE_LIST}})
+ set(SOURCE_FILE ${F})
+ set(DESTINATION_FILE ${F})
+ if (HAS_REPLACE_RULE)
+ list(GET args_SRC_DEST_REPLACE_RULE 0 SRC_RULE)
+ list(GET args_SRC_DEST_REPLACE_RULE 1 DST_RULE)
+ string(REPLACE ${SRC_RULE} ${DST_RULE} DESTINATION_FILE ${DESTINATION_FILE})
+ endif ()
+
+ get_filename_component(BUILD_DIR ${DESTINATION_DIR}/${DESTINATION_FILE} DIRECTORY)
+
+ add_custom_command(OUTPUT ${DESTINATION_DIR}/${DESTINATION_FILE}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${BUILD_DIR}
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE} ${DESTINATION_DIR}/${DESTINATION_FILE}
+ DEPENDS ${SOURCE_FILE}
+ )
+
+ if (HAS_INSTALLED_FILES_LIST)
+ list(APPEND ${args_INSTALLED_FILES_LIST} ${DESTINATION_DIR}/${DESTINATION_FILE})
+ endif ()
+ endforeach ()
+ if (HAS_INSTALLED_FILES_LIST)
+ set(${args_INSTALLED_FILES_LIST} ${${args_INSTALLED_FILES_LIST}} PARENT_SCOPE)
+ endif ()
+endfunction()
+
+
+set(LIBRARIES_BUILD_FOLDER ${CMAKE_CURRENT_BINARY_DIR}/build)
+
+set(SKIP_FILES
+ "CMakeLists.txt"
+ "pbrlib/genosl/pbrlib_genosl_impl.mtlx"
+ "pbrlib/genosl/pbrlib_genosl_impl.legacy")
+
+file(GLOB_RECURSE ALL_FILES CONFIGURE_DEPENDS *.*)
+foreach (F ${ALL_FILES})
+ cmake_path(RELATIVE_PATH F OUTPUT_VARIABLE RELATIVE_FILE)
+
+ if (${RELATIVE_FILE} IN_LIST SKIP_FILES)
+ continue()
+ endif ()
+
+ # convert to a list of path parts.
+ string(REPLACE "/" ";" PATH_LIST ${RELATIVE_FILE})
+
+ if ("genosl" IN_LIST PATH_LIST)
+ list(APPEND GENOSL_FILES ${RELATIVE_FILE})
+ elseif ("genmdl" IN_LIST PATH_LIST)
+ list(APPEND GENMDL_FILES ${RELATIVE_FILE})
+ elseif ("genglsl" IN_LIST PATH_LIST)
+ list(APPEND GENGLSL_FILES ${RELATIVE_FILE})
+ elseif ("genmsl" IN_LIST PATH_LIST)
+ list(APPEND GENMSL_FILES ${RELATIVE_FILE})
+ elseif ("_hwCommon" IN_LIST PATH_LIST)
+ list(APPEND GENGLSL_FILES ${RELATIVE_FILE})
+ list(APPEND GENMSL_FILES ${RELATIVE_FILE})
+ else ()
+ list(APPEND COMMON_FILES ${RELATIVE_FILE})
+ endif ()
+endforeach ()
+
+# Stage each file set in to the build location
+set(ALL_INSTALLED_LIBRARY_FILES "")
+
+mx_copy_files(COMMON_FILES ${LIBRARIES_BUILD_FOLDER}
+ INSTALLED_FILES_LIST ALL_INSTALLED_LIBRARY_FILES)
+
+if (MATERIALX_BUILD_GEN_OSL)
+ if (MATERIALX_OSL_LEGACY_CLOSURES)
+ list(APPEND GENOSL_FILES "pbrlib/genosl/pbrlib_genosl_impl.legacy")
+ else ()
+ list(APPEND GENOSL_FILES "pbrlib/genosl/pbrlib_genosl_impl.mtlx")
+ endif ()
+ mx_copy_files(GENOSL_FILES ${LIBRARIES_BUILD_FOLDER}
+ SRC_DEST_REPLACE_RULE ".legacy;.mtlx"
+ INSTALLED_FILES_LIST ALL_INSTALLED_LIBRARY_FILES)
+endif ()
+
+if (MATERIALX_BUILD_GEN_MDL)
+ mx_copy_files(GENMDL_FILES ${LIBRARIES_BUILD_FOLDER}
+ INSTALLED_FILES_LIST ALL_INSTALLED_LIBRARY_FILES)
+endif ()
+
+if (MATERIALX_BUILD_GEN_GLSL)
+ mx_copy_files(GENGLSL_FILES ${LIBRARIES_BUILD_FOLDER}
+ SRC_DEST_REPLACE_RULE "/_hwCommon/;/genglsl/"
+ INSTALLED_FILES_LIST ALL_INSTALLED_LIBRARY_FILES)
+endif ()
+
+if (MATERIALX_BUILD_GEN_MSL)
+ mx_copy_files(GENMSL_FILES ${LIBRARIES_BUILD_FOLDER}
+ SRC_DEST_REPLACE_RULE "/_hwCommon/;/genmsl/"
+ INSTALLED_FILES_LIST ALL_INSTALLED_LIBRARY_FILES)
+endif ()
+
+add_custom_target(MaterialX_Library_Files ALL
+ DEPENDS ${ALL_INSTALLED_LIBRARY_FILES})
+
+## Finally install the staged files
if(NOT SKBUILD)
- install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
- DESTINATION "${MATERIALX_INSTALL_STDLIB_PATH}"
- PATTERN "CMakeLists.txt" EXCLUDE
- PATTERN "pbrlib_genosl_impl.*" EXCLUDE)
- install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/pbrlib/genosl/pbrlib_genosl_impl.${PBRLIB_SUFFIX}"
- DESTINATION "${MATERIALX_INSTALL_STDLIB_PATH}/pbrlib/genosl/" RENAME pbrlib_genosl_impl.mtlx)
+ install(DIRECTORY ${LIBRARIES_BUILD_FOLDER}/
+ DESTINATION "${MATERIALX_INSTALL_STDLIB_PATH}")
endif()
-set(MATERIALX_PYTHON_LIBRARIES_PATH "${MATERIALX_PYTHON_FOLDER_NAME}/${MATERIALX_INSTALL_STDLIB_PATH}")
-if(SKBUILD)
- set(MATERIALX_PYTHON_LIBRARIES_PATH "${SKBUILD_PLATLIB_DIR}/MaterialX/libraries")
-endif()
+if (MATERIALX_BUILD_PYTHON)
+ set(MATERIALX_PYTHON_LIBRARIES_PATH "${MATERIALX_PYTHON_FOLDER_NAME}/${MATERIALX_INSTALL_STDLIB_PATH}")
+ if (SKBUILD)
+ set(MATERIALX_PYTHON_LIBRARIES_PATH "${SKBUILD_PLATLIB_DIR}/MaterialX/libraries")
+ endif ()
-if(MATERIALX_BUILD_PYTHON)
- install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
- DESTINATION "${MATERIALX_PYTHON_LIBRARIES_PATH}"
- PATTERN "CMakeLists.txt" EXCLUDE
- PATTERN "pbrlib_genosl_impl.*" EXCLUDE)
- install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/pbrlib/genosl/pbrlib_genosl_impl.${PBRLIB_SUFFIX}"
- DESTINATION "${MATERIALX_PYTHON_LIBRARIES_PATH}/pbrlib/genosl/" RENAME pbrlib_genosl_impl.mtlx)
+ install(DIRECTORY ${LIBRARIES_BUILD_FOLDER}/
+ DESTINATION "${MATERIALX_PYTHON_LIBRARIES_PATH}")
endif()
diff --git a/libraries/pbrlib/genglsl/lib/mx_environment_fis.glsl b/libraries/pbrlib/_hwCommon/lib/mx_environment_fis.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/lib/mx_environment_fis.glsl
rename to libraries/pbrlib/_hwCommon/lib/mx_environment_fis.glsl
diff --git a/libraries/pbrlib/genglsl/lib/mx_environment_none.glsl b/libraries/pbrlib/_hwCommon/lib/mx_environment_none.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/lib/mx_environment_none.glsl
rename to libraries/pbrlib/_hwCommon/lib/mx_environment_none.glsl
diff --git a/libraries/pbrlib/genglsl/lib/mx_environment_prefilter.glsl b/libraries/pbrlib/_hwCommon/lib/mx_environment_prefilter.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/lib/mx_environment_prefilter.glsl
rename to libraries/pbrlib/_hwCommon/lib/mx_environment_prefilter.glsl
diff --git a/libraries/pbrlib/genglsl/lib/mx_generate_albedo_table.glsl b/libraries/pbrlib/_hwCommon/lib/mx_generate_albedo_table.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/lib/mx_generate_albedo_table.glsl
rename to libraries/pbrlib/_hwCommon/lib/mx_generate_albedo_table.glsl
diff --git a/libraries/pbrlib/genglsl/lib/mx_generate_prefilter_env.glsl b/libraries/pbrlib/_hwCommon/lib/mx_generate_prefilter_env.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/lib/mx_generate_prefilter_env.glsl
rename to libraries/pbrlib/_hwCommon/lib/mx_generate_prefilter_env.glsl
diff --git a/libraries/pbrlib/genglsl/lib/mx_microfacet.glsl b/libraries/pbrlib/_hwCommon/lib/mx_microfacet.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/lib/mx_microfacet.glsl
rename to libraries/pbrlib/_hwCommon/lib/mx_microfacet.glsl
diff --git a/libraries/pbrlib/genglsl/lib/mx_microfacet_diffuse.glsl b/libraries/pbrlib/_hwCommon/lib/mx_microfacet_diffuse.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/lib/mx_microfacet_diffuse.glsl
rename to libraries/pbrlib/_hwCommon/lib/mx_microfacet_diffuse.glsl
diff --git a/libraries/pbrlib/genglsl/lib/mx_microfacet_sheen.glsl b/libraries/pbrlib/_hwCommon/lib/mx_microfacet_sheen.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/lib/mx_microfacet_sheen.glsl
rename to libraries/pbrlib/_hwCommon/lib/mx_microfacet_sheen.glsl
diff --git a/libraries/pbrlib/genglsl/lib/mx_microfacet_specular.glsl b/libraries/pbrlib/_hwCommon/lib/mx_microfacet_specular.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/lib/mx_microfacet_specular.glsl
rename to libraries/pbrlib/_hwCommon/lib/mx_microfacet_specular.glsl
diff --git a/libraries/pbrlib/genglsl/lib/mx_shadow.glsl b/libraries/pbrlib/_hwCommon/lib/mx_shadow.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/lib/mx_shadow.glsl
rename to libraries/pbrlib/_hwCommon/lib/mx_shadow.glsl
diff --git a/libraries/pbrlib/genglsl/lib/mx_transmission_opacity.glsl b/libraries/pbrlib/_hwCommon/lib/mx_transmission_opacity.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/lib/mx_transmission_opacity.glsl
rename to libraries/pbrlib/_hwCommon/lib/mx_transmission_opacity.glsl
diff --git a/libraries/pbrlib/genglsl/lib/mx_transmission_refract.glsl b/libraries/pbrlib/_hwCommon/lib/mx_transmission_refract.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/lib/mx_transmission_refract.glsl
rename to libraries/pbrlib/_hwCommon/lib/mx_transmission_refract.glsl
diff --git a/libraries/pbrlib/genglsl/mx_anisotropic_vdf.glsl b/libraries/pbrlib/_hwCommon/mx_anisotropic_vdf.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_anisotropic_vdf.glsl
rename to libraries/pbrlib/_hwCommon/mx_anisotropic_vdf.glsl
diff --git a/libraries/pbrlib/genglsl/mx_artistic_ior.glsl b/libraries/pbrlib/_hwCommon/mx_artistic_ior.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_artistic_ior.glsl
rename to libraries/pbrlib/_hwCommon/mx_artistic_ior.glsl
diff --git a/libraries/pbrlib/genglsl/mx_blackbody.glsl b/libraries/pbrlib/_hwCommon/mx_blackbody.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_blackbody.glsl
rename to libraries/pbrlib/_hwCommon/mx_blackbody.glsl
diff --git a/libraries/pbrlib/genglsl/mx_burley_diffuse_bsdf.glsl b/libraries/pbrlib/_hwCommon/mx_burley_diffuse_bsdf.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_burley_diffuse_bsdf.glsl
rename to libraries/pbrlib/_hwCommon/mx_burley_diffuse_bsdf.glsl
diff --git a/libraries/pbrlib/genglsl/mx_conductor_bsdf.glsl b/libraries/pbrlib/_hwCommon/mx_conductor_bsdf.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_conductor_bsdf.glsl
rename to libraries/pbrlib/_hwCommon/mx_conductor_bsdf.glsl
diff --git a/libraries/pbrlib/genglsl/mx_dielectric_bsdf.glsl b/libraries/pbrlib/_hwCommon/mx_dielectric_bsdf.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_dielectric_bsdf.glsl
rename to libraries/pbrlib/_hwCommon/mx_dielectric_bsdf.glsl
diff --git a/libraries/pbrlib/genglsl/mx_displacement_float.glsl b/libraries/pbrlib/_hwCommon/mx_displacement_float.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_displacement_float.glsl
rename to libraries/pbrlib/_hwCommon/mx_displacement_float.glsl
diff --git a/libraries/pbrlib/genglsl/mx_displacement_vector3.glsl b/libraries/pbrlib/_hwCommon/mx_displacement_vector3.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_displacement_vector3.glsl
rename to libraries/pbrlib/_hwCommon/mx_displacement_vector3.glsl
diff --git a/libraries/pbrlib/genglsl/mx_generalized_schlick_bsdf.glsl b/libraries/pbrlib/_hwCommon/mx_generalized_schlick_bsdf.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_generalized_schlick_bsdf.glsl
rename to libraries/pbrlib/_hwCommon/mx_generalized_schlick_bsdf.glsl
diff --git a/libraries/pbrlib/genglsl/mx_generalized_schlick_edf.glsl b/libraries/pbrlib/_hwCommon/mx_generalized_schlick_edf.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_generalized_schlick_edf.glsl
rename to libraries/pbrlib/_hwCommon/mx_generalized_schlick_edf.glsl
diff --git a/libraries/pbrlib/genglsl/mx_oren_nayar_diffuse_bsdf.glsl b/libraries/pbrlib/_hwCommon/mx_oren_nayar_diffuse_bsdf.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_oren_nayar_diffuse_bsdf.glsl
rename to libraries/pbrlib/_hwCommon/mx_oren_nayar_diffuse_bsdf.glsl
diff --git a/libraries/pbrlib/genglsl/mx_roughness_anisotropy.glsl b/libraries/pbrlib/_hwCommon/mx_roughness_anisotropy.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_roughness_anisotropy.glsl
rename to libraries/pbrlib/_hwCommon/mx_roughness_anisotropy.glsl
diff --git a/libraries/pbrlib/genglsl/mx_roughness_dual.glsl b/libraries/pbrlib/_hwCommon/mx_roughness_dual.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_roughness_dual.glsl
rename to libraries/pbrlib/_hwCommon/mx_roughness_dual.glsl
diff --git a/libraries/pbrlib/genglsl/mx_sheen_bsdf.glsl b/libraries/pbrlib/_hwCommon/mx_sheen_bsdf.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_sheen_bsdf.glsl
rename to libraries/pbrlib/_hwCommon/mx_sheen_bsdf.glsl
diff --git a/libraries/pbrlib/genglsl/mx_subsurface_bsdf.glsl b/libraries/pbrlib/_hwCommon/mx_subsurface_bsdf.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_subsurface_bsdf.glsl
rename to libraries/pbrlib/_hwCommon/mx_subsurface_bsdf.glsl
diff --git a/libraries/pbrlib/genglsl/mx_translucent_bsdf.glsl b/libraries/pbrlib/_hwCommon/mx_translucent_bsdf.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_translucent_bsdf.glsl
rename to libraries/pbrlib/_hwCommon/mx_translucent_bsdf.glsl
diff --git a/libraries/pbrlib/genglsl/mx_uniform_edf.glsl b/libraries/pbrlib/_hwCommon/mx_uniform_edf.glsl
similarity index 100%
rename from libraries/pbrlib/genglsl/mx_uniform_edf.glsl
rename to libraries/pbrlib/_hwCommon/mx_uniform_edf.glsl
diff --git a/libraries/pbrlib/genmsl/pbrlib_genmsl_impl.mtlx b/libraries/pbrlib/genmsl/pbrlib_genmsl_impl.mtlx
index e88a47a1dc..194f795737 100644
--- a/libraries/pbrlib/genmsl/pbrlib_genmsl_impl.mtlx
+++ b/libraries/pbrlib/genmsl/pbrlib_genmsl_impl.mtlx
@@ -2,31 +2,44 @@
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
-
+
-
+
-
+
@@ -47,28 +60,35 @@
-
+
-
-
+
+
-
+
-
+
-
+
-
+
diff --git a/libraries/stdlib/genglsl/lib/mx_hsv.glsl b/libraries/stdlib/_hwCommon/lib/mx_hsv.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/lib/mx_hsv.glsl
rename to libraries/stdlib/_hwCommon/lib/mx_hsv.glsl
diff --git a/libraries/stdlib/genglsl/lib/mx_noise.glsl b/libraries/stdlib/_hwCommon/lib/mx_noise.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/lib/mx_noise.glsl
rename to libraries/stdlib/_hwCommon/lib/mx_noise.glsl
diff --git a/libraries/stdlib/genglsl/lib/mx_sampling.glsl b/libraries/stdlib/_hwCommon/lib/mx_sampling.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/lib/mx_sampling.glsl
rename to libraries/stdlib/_hwCommon/lib/mx_sampling.glsl
diff --git a/libraries/stdlib/genglsl/lib/mx_transform_uv.glsl b/libraries/stdlib/_hwCommon/lib/mx_transform_uv.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/lib/mx_transform_uv.glsl
rename to libraries/stdlib/_hwCommon/lib/mx_transform_uv.glsl
diff --git a/libraries/stdlib/genglsl/lib/mx_transform_uv_vflip.glsl b/libraries/stdlib/_hwCommon/lib/mx_transform_uv_vflip.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/lib/mx_transform_uv_vflip.glsl
rename to libraries/stdlib/_hwCommon/lib/mx_transform_uv_vflip.glsl
diff --git a/libraries/stdlib/genglsl/mx_aastep.glsl b/libraries/stdlib/_hwCommon/mx_aastep.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_aastep.glsl
rename to libraries/stdlib/_hwCommon/mx_aastep.glsl
diff --git a/libraries/stdlib/genglsl/mx_cellnoise2d_float.glsl b/libraries/stdlib/_hwCommon/mx_cellnoise2d_float.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_cellnoise2d_float.glsl
rename to libraries/stdlib/_hwCommon/mx_cellnoise2d_float.glsl
diff --git a/libraries/stdlib/genglsl/mx_cellnoise3d_float.glsl b/libraries/stdlib/_hwCommon/mx_cellnoise3d_float.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_cellnoise3d_float.glsl
rename to libraries/stdlib/_hwCommon/mx_cellnoise3d_float.glsl
diff --git a/libraries/stdlib/genglsl/mx_creatematrix_vector3_matrix33.glsl b/libraries/stdlib/_hwCommon/mx_creatematrix_vector3_matrix33.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_creatematrix_vector3_matrix33.glsl
rename to libraries/stdlib/_hwCommon/mx_creatematrix_vector3_matrix33.glsl
diff --git a/libraries/stdlib/genglsl/mx_creatematrix_vector3_matrix44.glsl b/libraries/stdlib/_hwCommon/mx_creatematrix_vector3_matrix44.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_creatematrix_vector3_matrix44.glsl
rename to libraries/stdlib/_hwCommon/mx_creatematrix_vector3_matrix44.glsl
diff --git a/libraries/stdlib/genglsl/mx_creatematrix_vector4_matrix44.glsl b/libraries/stdlib/_hwCommon/mx_creatematrix_vector4_matrix44.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_creatematrix_vector4_matrix44.glsl
rename to libraries/stdlib/_hwCommon/mx_creatematrix_vector4_matrix44.glsl
diff --git a/libraries/stdlib/genglsl/mx_disjointover_color4.glsl b/libraries/stdlib/_hwCommon/mx_disjointover_color4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_disjointover_color4.glsl
rename to libraries/stdlib/_hwCommon/mx_disjointover_color4.glsl
diff --git a/libraries/stdlib/genglsl/mx_fractal3d_float.glsl b/libraries/stdlib/_hwCommon/mx_fractal3d_float.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_fractal3d_float.glsl
rename to libraries/stdlib/_hwCommon/mx_fractal3d_float.glsl
diff --git a/libraries/stdlib/genglsl/mx_fractal3d_vector2.glsl b/libraries/stdlib/_hwCommon/mx_fractal3d_vector2.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_fractal3d_vector2.glsl
rename to libraries/stdlib/_hwCommon/mx_fractal3d_vector2.glsl
diff --git a/libraries/stdlib/genglsl/mx_fractal3d_vector3.glsl b/libraries/stdlib/_hwCommon/mx_fractal3d_vector3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_fractal3d_vector3.glsl
rename to libraries/stdlib/_hwCommon/mx_fractal3d_vector3.glsl
diff --git a/libraries/stdlib/genglsl/mx_fractal3d_vector4.glsl b/libraries/stdlib/_hwCommon/mx_fractal3d_vector4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_fractal3d_vector4.glsl
rename to libraries/stdlib/_hwCommon/mx_fractal3d_vector4.glsl
diff --git a/libraries/stdlib/genglsl/mx_hsvtorgb_color3.glsl b/libraries/stdlib/_hwCommon/mx_hsvtorgb_color3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_hsvtorgb_color3.glsl
rename to libraries/stdlib/_hwCommon/mx_hsvtorgb_color3.glsl
diff --git a/libraries/stdlib/genglsl/mx_hsvtorgb_color4.glsl b/libraries/stdlib/_hwCommon/mx_hsvtorgb_color4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_hsvtorgb_color4.glsl
rename to libraries/stdlib/_hwCommon/mx_hsvtorgb_color4.glsl
diff --git a/libraries/stdlib/genglsl/mx_image_color3.glsl b/libraries/stdlib/_hwCommon/mx_image_color3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_image_color3.glsl
rename to libraries/stdlib/_hwCommon/mx_image_color3.glsl
diff --git a/libraries/stdlib/genglsl/mx_image_color4.glsl b/libraries/stdlib/_hwCommon/mx_image_color4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_image_color4.glsl
rename to libraries/stdlib/_hwCommon/mx_image_color4.glsl
diff --git a/libraries/stdlib/genglsl/mx_image_float.glsl b/libraries/stdlib/_hwCommon/mx_image_float.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_image_float.glsl
rename to libraries/stdlib/_hwCommon/mx_image_float.glsl
diff --git a/libraries/stdlib/genglsl/mx_image_vector2.glsl b/libraries/stdlib/_hwCommon/mx_image_vector2.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_image_vector2.glsl
rename to libraries/stdlib/_hwCommon/mx_image_vector2.glsl
diff --git a/libraries/stdlib/genglsl/mx_image_vector3.glsl b/libraries/stdlib/_hwCommon/mx_image_vector3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_image_vector3.glsl
rename to libraries/stdlib/_hwCommon/mx_image_vector3.glsl
diff --git a/libraries/stdlib/genglsl/mx_image_vector4.glsl b/libraries/stdlib/_hwCommon/mx_image_vector4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_image_vector4.glsl
rename to libraries/stdlib/_hwCommon/mx_image_vector4.glsl
diff --git a/libraries/stdlib/genglsl/mx_luminance_color3.glsl b/libraries/stdlib/_hwCommon/mx_luminance_color3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_luminance_color3.glsl
rename to libraries/stdlib/_hwCommon/mx_luminance_color3.glsl
diff --git a/libraries/stdlib/genglsl/mx_luminance_color4.glsl b/libraries/stdlib/_hwCommon/mx_luminance_color4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_luminance_color4.glsl
rename to libraries/stdlib/_hwCommon/mx_luminance_color4.glsl
diff --git a/libraries/stdlib/genglsl/mx_mix_surfaceshader.glsl b/libraries/stdlib/_hwCommon/mx_mix_surfaceshader.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_mix_surfaceshader.glsl
rename to libraries/stdlib/_hwCommon/mx_mix_surfaceshader.glsl
diff --git a/libraries/stdlib/genglsl/mx_noise2d_float.glsl b/libraries/stdlib/_hwCommon/mx_noise2d_float.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_noise2d_float.glsl
rename to libraries/stdlib/_hwCommon/mx_noise2d_float.glsl
diff --git a/libraries/stdlib/genglsl/mx_noise2d_vector2.glsl b/libraries/stdlib/_hwCommon/mx_noise2d_vector2.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_noise2d_vector2.glsl
rename to libraries/stdlib/_hwCommon/mx_noise2d_vector2.glsl
diff --git a/libraries/stdlib/genglsl/mx_noise2d_vector3.glsl b/libraries/stdlib/_hwCommon/mx_noise2d_vector3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_noise2d_vector3.glsl
rename to libraries/stdlib/_hwCommon/mx_noise2d_vector3.glsl
diff --git a/libraries/stdlib/genglsl/mx_noise2d_vector4.glsl b/libraries/stdlib/_hwCommon/mx_noise2d_vector4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_noise2d_vector4.glsl
rename to libraries/stdlib/_hwCommon/mx_noise2d_vector4.glsl
diff --git a/libraries/stdlib/genglsl/mx_noise3d_float.glsl b/libraries/stdlib/_hwCommon/mx_noise3d_float.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_noise3d_float.glsl
rename to libraries/stdlib/_hwCommon/mx_noise3d_float.glsl
diff --git a/libraries/stdlib/genglsl/mx_noise3d_vector2.glsl b/libraries/stdlib/_hwCommon/mx_noise3d_vector2.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_noise3d_vector2.glsl
rename to libraries/stdlib/_hwCommon/mx_noise3d_vector2.glsl
diff --git a/libraries/stdlib/genglsl/mx_noise3d_vector3.glsl b/libraries/stdlib/_hwCommon/mx_noise3d_vector3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_noise3d_vector3.glsl
rename to libraries/stdlib/_hwCommon/mx_noise3d_vector3.glsl
diff --git a/libraries/stdlib/genglsl/mx_noise3d_vector4.glsl b/libraries/stdlib/_hwCommon/mx_noise3d_vector4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_noise3d_vector4.glsl
rename to libraries/stdlib/_hwCommon/mx_noise3d_vector4.glsl
diff --git a/libraries/stdlib/genglsl/mx_premult_color4.glsl b/libraries/stdlib/_hwCommon/mx_premult_color4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_premult_color4.glsl
rename to libraries/stdlib/_hwCommon/mx_premult_color4.glsl
diff --git a/libraries/stdlib/genglsl/mx_ramplr_float.glsl b/libraries/stdlib/_hwCommon/mx_ramplr_float.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_ramplr_float.glsl
rename to libraries/stdlib/_hwCommon/mx_ramplr_float.glsl
diff --git a/libraries/stdlib/genglsl/mx_ramplr_vector2.glsl b/libraries/stdlib/_hwCommon/mx_ramplr_vector2.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_ramplr_vector2.glsl
rename to libraries/stdlib/_hwCommon/mx_ramplr_vector2.glsl
diff --git a/libraries/stdlib/genglsl/mx_ramplr_vector3.glsl b/libraries/stdlib/_hwCommon/mx_ramplr_vector3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_ramplr_vector3.glsl
rename to libraries/stdlib/_hwCommon/mx_ramplr_vector3.glsl
diff --git a/libraries/stdlib/genglsl/mx_ramplr_vector4.glsl b/libraries/stdlib/_hwCommon/mx_ramplr_vector4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_ramplr_vector4.glsl
rename to libraries/stdlib/_hwCommon/mx_ramplr_vector4.glsl
diff --git a/libraries/stdlib/genglsl/mx_ramptb_float.glsl b/libraries/stdlib/_hwCommon/mx_ramptb_float.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_ramptb_float.glsl
rename to libraries/stdlib/_hwCommon/mx_ramptb_float.glsl
diff --git a/libraries/stdlib/genglsl/mx_ramptb_vector2.glsl b/libraries/stdlib/_hwCommon/mx_ramptb_vector2.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_ramptb_vector2.glsl
rename to libraries/stdlib/_hwCommon/mx_ramptb_vector2.glsl
diff --git a/libraries/stdlib/genglsl/mx_ramptb_vector3.glsl b/libraries/stdlib/_hwCommon/mx_ramptb_vector3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_ramptb_vector3.glsl
rename to libraries/stdlib/_hwCommon/mx_ramptb_vector3.glsl
diff --git a/libraries/stdlib/genglsl/mx_ramptb_vector4.glsl b/libraries/stdlib/_hwCommon/mx_ramptb_vector4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_ramptb_vector4.glsl
rename to libraries/stdlib/_hwCommon/mx_ramptb_vector4.glsl
diff --git a/libraries/stdlib/genglsl/mx_rgbtohsv_color3.glsl b/libraries/stdlib/_hwCommon/mx_rgbtohsv_color3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_rgbtohsv_color3.glsl
rename to libraries/stdlib/_hwCommon/mx_rgbtohsv_color3.glsl
diff --git a/libraries/stdlib/genglsl/mx_rgbtohsv_color4.glsl b/libraries/stdlib/_hwCommon/mx_rgbtohsv_color4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_rgbtohsv_color4.glsl
rename to libraries/stdlib/_hwCommon/mx_rgbtohsv_color4.glsl
diff --git a/libraries/stdlib/genglsl/mx_rotate_vector2.glsl b/libraries/stdlib/_hwCommon/mx_rotate_vector2.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_rotate_vector2.glsl
rename to libraries/stdlib/_hwCommon/mx_rotate_vector2.glsl
diff --git a/libraries/stdlib/genglsl/mx_rotate_vector3.glsl b/libraries/stdlib/_hwCommon/mx_rotate_vector3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_rotate_vector3.glsl
rename to libraries/stdlib/_hwCommon/mx_rotate_vector3.glsl
diff --git a/libraries/stdlib/genglsl/mx_splitlr_float.glsl b/libraries/stdlib/_hwCommon/mx_splitlr_float.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_splitlr_float.glsl
rename to libraries/stdlib/_hwCommon/mx_splitlr_float.glsl
diff --git a/libraries/stdlib/genglsl/mx_splitlr_vector2.glsl b/libraries/stdlib/_hwCommon/mx_splitlr_vector2.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_splitlr_vector2.glsl
rename to libraries/stdlib/_hwCommon/mx_splitlr_vector2.glsl
diff --git a/libraries/stdlib/genglsl/mx_splitlr_vector3.glsl b/libraries/stdlib/_hwCommon/mx_splitlr_vector3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_splitlr_vector3.glsl
rename to libraries/stdlib/_hwCommon/mx_splitlr_vector3.glsl
diff --git a/libraries/stdlib/genglsl/mx_splitlr_vector4.glsl b/libraries/stdlib/_hwCommon/mx_splitlr_vector4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_splitlr_vector4.glsl
rename to libraries/stdlib/_hwCommon/mx_splitlr_vector4.glsl
diff --git a/libraries/stdlib/genglsl/mx_splittb_float.glsl b/libraries/stdlib/_hwCommon/mx_splittb_float.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_splittb_float.glsl
rename to libraries/stdlib/_hwCommon/mx_splittb_float.glsl
diff --git a/libraries/stdlib/genglsl/mx_splittb_vector2.glsl b/libraries/stdlib/_hwCommon/mx_splittb_vector2.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_splittb_vector2.glsl
rename to libraries/stdlib/_hwCommon/mx_splittb_vector2.glsl
diff --git a/libraries/stdlib/genglsl/mx_splittb_vector3.glsl b/libraries/stdlib/_hwCommon/mx_splittb_vector3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_splittb_vector3.glsl
rename to libraries/stdlib/_hwCommon/mx_splittb_vector3.glsl
diff --git a/libraries/stdlib/genglsl/mx_splittb_vector4.glsl b/libraries/stdlib/_hwCommon/mx_splittb_vector4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_splittb_vector4.glsl
rename to libraries/stdlib/_hwCommon/mx_splittb_vector4.glsl
diff --git a/libraries/stdlib/genglsl/mx_transformmatrix_vector2M3.glsl b/libraries/stdlib/_hwCommon/mx_transformmatrix_vector2M3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_transformmatrix_vector2M3.glsl
rename to libraries/stdlib/_hwCommon/mx_transformmatrix_vector2M3.glsl
diff --git a/libraries/stdlib/genglsl/mx_transformmatrix_vector3M4.glsl b/libraries/stdlib/_hwCommon/mx_transformmatrix_vector3M4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_transformmatrix_vector3M4.glsl
rename to libraries/stdlib/_hwCommon/mx_transformmatrix_vector3M4.glsl
diff --git a/libraries/stdlib/genglsl/mx_unpremult_color4.glsl b/libraries/stdlib/_hwCommon/mx_unpremult_color4.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_unpremult_color4.glsl
rename to libraries/stdlib/_hwCommon/mx_unpremult_color4.glsl
diff --git a/libraries/stdlib/genglsl/mx_worleynoise2d_float.glsl b/libraries/stdlib/_hwCommon/mx_worleynoise2d_float.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_worleynoise2d_float.glsl
rename to libraries/stdlib/_hwCommon/mx_worleynoise2d_float.glsl
diff --git a/libraries/stdlib/genglsl/mx_worleynoise2d_vector2.glsl b/libraries/stdlib/_hwCommon/mx_worleynoise2d_vector2.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_worleynoise2d_vector2.glsl
rename to libraries/stdlib/_hwCommon/mx_worleynoise2d_vector2.glsl
diff --git a/libraries/stdlib/genglsl/mx_worleynoise2d_vector3.glsl b/libraries/stdlib/_hwCommon/mx_worleynoise2d_vector3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_worleynoise2d_vector3.glsl
rename to libraries/stdlib/_hwCommon/mx_worleynoise2d_vector3.glsl
diff --git a/libraries/stdlib/genglsl/mx_worleynoise3d_float.glsl b/libraries/stdlib/_hwCommon/mx_worleynoise3d_float.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_worleynoise3d_float.glsl
rename to libraries/stdlib/_hwCommon/mx_worleynoise3d_float.glsl
diff --git a/libraries/stdlib/genglsl/mx_worleynoise3d_vector2.glsl b/libraries/stdlib/_hwCommon/mx_worleynoise3d_vector2.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_worleynoise3d_vector2.glsl
rename to libraries/stdlib/_hwCommon/mx_worleynoise3d_vector2.glsl
diff --git a/libraries/stdlib/genglsl/mx_worleynoise3d_vector3.glsl b/libraries/stdlib/_hwCommon/mx_worleynoise3d_vector3.glsl
similarity index 100%
rename from libraries/stdlib/genglsl/mx_worleynoise3d_vector3.glsl
rename to libraries/stdlib/_hwCommon/mx_worleynoise3d_vector3.glsl
diff --git a/libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx b/libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx
index f6454c13ac..b0390ffe98 100644
--- a/libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx
+++ b/libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx
@@ -22,22 +22,28 @@
-
+
-
+
-
+
-
+
-
+
-
+
@@ -64,70 +70,114 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -445,9 +495,11 @@
-
+
-
+
@@ -463,10 +515,12 @@
-
+
-
+
@@ -494,25 +548,33 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
+
@@ -545,7 +607,8 @@
-
+
@@ -584,7 +647,8 @@
-
+
@@ -689,9 +753,15 @@
-
-
-
+
+
+
diff --git a/source/MaterialXGenMsl/MslShaderGenerator.cpp b/source/MaterialXGenMsl/MslShaderGenerator.cpp
index 8db763d7e1..1883ef006a 100644
--- a/source/MaterialXGenMsl/MslShaderGenerator.cpp
+++ b/source/MaterialXGenMsl/MslShaderGenerator.cpp
@@ -616,15 +616,15 @@ void MslShaderGenerator::emitSpecularEnvironment(GenContext& context, ShaderStag
int specularMethod = context.getOptions().hwSpecularEnvironmentMethod;
if (specularMethod == SPECULAR_ENVIRONMENT_FIS)
{
- emitLibraryInclude("pbrlib/genglsl/lib/mx_environment_fis.glsl", context, stage);
+ emitLibraryInclude("pbrlib/genmsl/lib/mx_environment_fis.glsl", context, stage);
}
else if (specularMethod == SPECULAR_ENVIRONMENT_PREFILTER)
{
- emitLibraryInclude("pbrlib/genglsl/lib/mx_environment_prefilter.glsl", context, stage);
+ emitLibraryInclude("pbrlib/genmsl/lib/mx_environment_prefilter.glsl", context, stage);
}
else if (specularMethod == SPECULAR_ENVIRONMENT_NONE)
{
- emitLibraryInclude("pbrlib/genglsl/lib/mx_environment_none.glsl", context, stage);
+ emitLibraryInclude("pbrlib/genmsl/lib/mx_environment_none.glsl", context, stage);
}
else
{
@@ -638,11 +638,11 @@ void MslShaderGenerator::emitTransmissionRender(GenContext& context, ShaderStage
int transmissionMethod = context.getOptions().hwTransmissionRenderMethod;
if (transmissionMethod == TRANSMISSION_REFRACTION)
{
- emitLibraryInclude("pbrlib/genglsl/lib/mx_transmission_refract.glsl", context, stage);
+ emitLibraryInclude("pbrlib/genmsl/lib/mx_transmission_refract.glsl", context, stage);
}
else if (transmissionMethod == TRANSMISSION_OPACITY)
{
- emitLibraryInclude("pbrlib/genglsl/lib/mx_transmission_opacity.glsl", context, stage);
+ emitLibraryInclude("pbrlib/genmsl/lib/mx_transmission_opacity.glsl", context, stage);
}
else
{
@@ -939,20 +939,20 @@ void MslShaderGenerator::emitPixelStage(const ShaderGraph& graph, GenContext& co
context.getOptions().hwWriteDepthMoments;
if (shadowing)
{
- emitLibraryInclude("pbrlib/genglsl/lib/mx_shadow.glsl", context, stage);
+ emitLibraryInclude("pbrlib/genmsl/lib/mx_shadow.glsl", context, stage);
}
// Emit directional albedo table code.
if (context.getOptions().hwWriteAlbedoTable)
{
- emitLibraryInclude("pbrlib/genglsl/lib/mx_generate_albedo_table.glsl", context, stage);
+ emitLibraryInclude("pbrlib/genmsl/lib/mx_generate_albedo_table.glsl", context, stage);
emitLineBreak(stage);
}
// Emit environment prefiltering code
if (context.getOptions().hwWriteEnvPrefilter)
{
- emitLibraryInclude("pbrlib/genglsl/lib/mx_generate_prefilter_env.glsl", context, stage);
+ emitLibraryInclude("pbrlib/genmsl/lib/mx_generate_prefilter_env.glsl", context, stage);
emitLineBreak(stage);
}
@@ -970,7 +970,7 @@ void MslShaderGenerator::emitPixelStage(const ShaderGraph& graph, GenContext& co
// Emit uv transform code globally if needed.
if (context.getOptions().hwAmbientOcclusion)
{
- emitLibraryInclude("stdlib/genglsl/lib/" + _tokenSubstitutions[ShaderGenerator::T_FILE_TRANSFORM_UV], context, stage);
+ emitLibraryInclude("stdlib/genmsl/lib/" + _tokenSubstitutions[ShaderGenerator::T_FILE_TRANSFORM_UV], context, stage);
}
emitLightFunctionDefinitions(graph, context, stage);
diff --git a/source/MaterialXGenMsl/Nodes/HeightToNormalNodeMsl.cpp b/source/MaterialXGenMsl/Nodes/HeightToNormalNodeMsl.cpp
index ab467c89ea..bbcf1398e8 100644
--- a/source/MaterialXGenMsl/Nodes/HeightToNormalNodeMsl.cpp
+++ b/source/MaterialXGenMsl/Nodes/HeightToNormalNodeMsl.cpp
@@ -63,7 +63,7 @@ void HeightToNormalNodeMsl::emitFunctionDefinition(const ShaderNode&, GenContext
{
// Emit sampling functions
const ShaderGenerator& shadergen = context.getShaderGenerator();
- shadergen.emitLibraryInclude("stdlib/genglsl/lib/mx_sampling.glsl", context, stage);
+ shadergen.emitLibraryInclude("stdlib/genmsl/lib/mx_sampling.glsl", context, stage);
shadergen.emitLineBreak(stage);
}
}
diff --git a/source/MaterialXTest/CMakeLists.txt b/source/MaterialXTest/CMakeLists.txt
index 4835787ed8..e591a0beae 100644
--- a/source/MaterialXTest/CMakeLists.txt
+++ b/source/MaterialXTest/CMakeLists.txt
@@ -93,14 +93,16 @@ endif()
# TODO: Only do this stuff when it's relevant
-add_custom_command(TARGET MaterialXTest POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_directory
- ${CMAKE_CURRENT_SOURCE_DIR}/../../libraries ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/libraries)
-if(MATERIALX_OSL_LEGACY_CLOSURES)
- add_custom_command(TARGET MaterialXTest POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E rename
- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/libraries/pbrlib/genosl/pbrlib_genosl_impl.legacy ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/libraries/pbrlib/genosl/pbrlib_genosl_impl.mtlx)
-endif()
+# Copy the staged "libraries/build" folder for the tests - the dependency tracking here will ensure
+# edits to any of the "libraries" files are correctly accounted for in the unit tests.
+add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/libraries/README.md
+ COMMAND ${CMAKE_COMMAND} -E copy_directory
+ ${CMAKE_BINARY_DIR}/libraries/build ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/libraries
+ DEPENDS MaterialX_Library_Files)
+add_custom_target(MaterialXTest_Copy_Libraries
+ DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/libraries/README.md
+)
+add_dependencies(MaterialXTest MaterialXTest_Copy_Libraries)
if(MATERIALX_BUILD_GEN_MDL)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../source/MaterialXGenMdl/mdl/"