OCIOv2 with OSL native support, part II

Patrick Hodoul

Hi OSL experts,


Finally, a prototype of the OpenColorIO library can generate a complete OSL shader from any color transformation (not yet implemented for everything but very close). Doing that exercise I faced several challenges on which I was able to find a solution. But I would like to have your feedback on several questions/solutions to help me improving the generated OSL code.


As there are many questions/comments, please keep the question number to answer so, it helps everyone to follow the discussion. If some questions need much more time, I will be at the next OSL TSC.


1.     After some tries, I finally selected the color4 and the vector4 types. These types are not by default supported by the other types (like color and vector for example) imposing me to create several helper methods.

a.     Why there are two categories of types (ex: vector vs. vector4 – or – color vs. color4)?

b.     Is there any pro or cons using vector4, color4?

c.     Any other known pending questions, concerns, etc. on that topic?

d.     For now, the shader parameters are color types. Could the shader have in and out parameters be color4? Any pros/cons using color4 in ‘public’ interface of a shader?

2.     There is no const keyword support. That’s clearly not problematic but I’m curious to know why.

3.     For types like vector, the language authorizes several accesses (i.e. val[0] or val.x). Once again, nothing problematic here but I’m curious about pros & cons. Is there any pitfalls (performance, etc.) to use one or the other?


Lastly, the OSL translation was tested using master. Which OSL version should I use to correctly highlight the OSL syntax (and backward compatibility) used by the translation result i.e., OSL_1, OS_1_11, etc.?


Join osl-dev@lists.aswf.io to automatically receive all group messages.