OpenShadingLanguage
OpenShadingLanguage copied to clipboard
Allow list initializer as function argument.
Problem
Initializer lists are not allowed as function arguments, would be nice if they were, and would possibly simplify some of the MaterialX code base for OSL code generation.
struct vector2
{
float x;
float y;
};
void NG_switch_vector2I(vector2 in1, vector2 in2, vector2 in3, output vector2 out)
{
out = in1;
}
shader test_shader
(
vector2 input = {1,2}, // this works
output float out = 0
)
{
vector2 outVec;
vector2 in1 = {0,1}; // this works
NG_switch_vector2I(
in1, // this works
vector2(0.000000, 0.000000), // this works
{0.000000, 0.000000}, // this doesn't work
outVec);
out = outVec.x;
}
Expected behavior: I expected this to compile just fine...
Actual behavior: But it didn't... I get the following compile error.
> oslc test.osl
test.osl:24: error: Cannot construct type 'unknown'
FAILED test.osl
Steps to Reproduce
- Compile the shader code above
- Get compile error
Versions
- OSL branch/version: 1.13.8.0
- OS: MacOS Sequoia
- C++ compiler:
- LLVM version: 17.0.6
- OIIO version: 2.5.9.0