Date
1 - 4 of 4
OCIOv2 with OSL native support, part III
Patrick Hodoul <patrick.hodoul@...>
HI,
That's again the OCIOv2 generating an OSL shader code related topic. Now I currently implement the corresponding OSL unit test framework in OCIO, and unfortunately I face some execution problems. To have some context, the OSL shader declaration is: shader OSL_OCIOMain(color4 inColor = {color(0), 1}, output color4 outColor = {color(0), 1}) And my framework mainly copies & pastes the [osl]/testsuite/example-deformer/osldeformer.cpp unit test. The output parameter declaration is causing some trouble. The code snippet is: <...>When the unit test runs, "shadsys->optimize_group()" generates the following outputs (from llvm_instance.cpp:1138): There is a mismatch between the OSL C++ declaration and the OSL shader declaration (structure vs. type). As I used the 'color4' for the input and output variables of the shader, I found nothing equivalent in OSL C++ & OIIO C++ types so, I switched to OIIO::TypeFloat4 and OSL::Vec4. But that's clearly not the right choice. What should be the declared types (for C++ OSL & OIIO) to match the shader 'color4' type (which is a structure containing a color and a float) ? Thanks, Patrick |
|
Larry Gritz
First, please note that the SymLocation stuff is very hot off the presses, and only is present in OSL master, not yet in any officially supported release.
It may be better to use the older find_symbol/symbol_address approach -- which you can see commented out in master's osldeformer example. That will work for released versions of OSL. But anyway, a color4 is not a real type (yet), it's a struct, so the implementation underneath is that there are two variables: "color4 mycolor" really just gets turned into "color mycolor.rgb" and "float mycolor.a". You can from the C++ side treat them as the two individual variables. On Aug 31, 2021, at 6:48 AM, Patrick Hodoul <patrick.hodoul@...> wrote:
|
|
Patrick Hodoul <patrick.hodoul@...>
Thanks for the fast answers.
First, please note that the SymLocation stuff is very hot off the presses, and only is present in OSL master, not yet in any officially supported release.Does the tag 'v1.11.14.2' represent the last official version? But anyway, a color4 is not a real type (yet), it's a struct, so the implementation underneath is that there are two variables: "color4 mycolor" really just gets turned into "color mycolor.rgb" and "float mycolor.a". You can from the C++ side treat them as the two individual variables.What about the input parameter which is also a color4 ? Should I have two input parameters (like for the output parameter)? -- Patrick |
|
Larry Gritz
On Aug 31, 2021, at 10:29 AM, Patrick Hodoul <patrick.hodoul@...> wrote:
|
|