ID 576661 - MaterialX functions can't be defined and called by users in GLSL

Follow

Problem summary
MaterialX functions can't be defined and called by users in GLSL.
This seems to be caused by the new Autodesk Standard Surface (1.0.2.x) shader defining a few MaterialX functions by creating duplicates internally, instead of importing the original and complete MaterialX library into Mari.
 
 
Customer reported version
Mari 7.0v2
 
 
Customer reported platform
Alma 9
 
 
Steps to reproduce
  1. Add the three attached files to your Scripts folder
    1. mx_square.glslh and mx_square.glslc define the mx_square function.
    2. RegisterCustomNode_MatX.py adds the custom functions to Mari on launch.
       
  2. Launch Mari and open any Project.
     
 
Expected behaviour
As Mari doesn't currently support MaterialX, users should be able to define MaterialX functions, such as mx_square.
 
 
Actual behaviour
  • The canvas has the Rendering Error red screen, and says:
    Rendering Error. Shader failed to compile.
     
  • Tools > Shader Console and the MariLog.txt (also attached) display this kind of message:
    0(11) : error C1013: function "mx_square" is already defined at 0(3565)
 
The same will happen when trying to define and call other MaterialX functions, such as mx_pow5.
 
 
Workaround
To avoid this issue, define the desired function without using its original name from the MaterialX library. 
The best way to do this would be to add a prefix to the function name, to create names such as foundry_mx_square.
 
 
Reproduced by support
This bug has been reproduced in:
Mari 7.0v2 - Windows 10 - Rocky 9
Mari 7.0v1 - Windows 10 - Rocky 9
 
Unable to reproduce bug in:
Mari 6.0v3 - Windows 10 - CentOS 7
 
Earliest version tested
Mari 7.0v1 - This feature (Autodesk Standard Surface (1.0.2.x)) did not exist before this version
 
 

    We're sorry to hear that

    Please tell us why