imageworks/OpenShadingLanguage — pull request #410 by lgritz (2014-09-02 22:29:38+00:00)
Title: Use SIMD in texture system

See this OIIO pull request: https://github.com/OpenImageIO/oiio/pull/948

Basically, there is an OIIO-side overhaul of the TextureSystem guts that utilize SSE SIMD instructions to perform the math on texture lookups to all channels (up to 4) at once. On the OIIO side, I'm seeing texture lookups reduce time by 30-60%, depending on the exact machine architecture, SSE level supported/requested, number of channels requested, and whether or not derivatives of texture lookups are requested. Call it a roughly 2x improvement. Of course, how much this improves overall time in a real renderer depends heavily on how much time was texture math versus everything else a renderer does.

This pull request is the OSL-side changes that correspond. There is a compatibility break here in the OIIO texture API as well as, with these changes, the RendererServices API. (But no change in the shaders themselves, of course!)

Apps incorporating OSL will need to update their RendererServices implementations to match (primarily: nchannels and the derivative pointers are no longer inside the TextureOpt struct, but are passed explicitly to the various texture API calls). Also, apps will need to upgrade their OIIO and OSL versions simultaneously, this represents an incompatible change. But it's faster! And it paves the way for SIMD speedups on the OSL side as well, stay tuned for follow-ups.

More coming after this!