imageworks/OpenShadingLanguage — pull request #144 by lgritz (2012-06-07 04:18:49+00:00)
Title: Review: change getattribute type semantics

Adjust the spec for OSL getattribute() to perform automatic type conversions.

Specifically, getattribute(name,value) no longer requires an exact match between value and the type of the named attribute. The automatic type conversions include those that are allowed by assignment in OSL source code: int to float, float to int (truncation), float or int to triple (replicating the value), any triple to any other triple. Additionally, the following conversions which are not allowed by assignment in OSL source code will also be performed by this call: float (or int) to float[2] (replication into both array elements), float[2] to triple (setting the third component to 0).

Also add a handy 'convert_value' utility to ShadingSystem to make it easy for RendererServices client code to implement getattribute() with the new extended type conversion rules.