imageworks/OpenShadingLanguage — pull request #181 by lgritz (2012-11-21 00:03:11+00:00)
Title: Improve error reporting when parsing oso, especially for unknown instructions

Improve error reporting when parsing oso, especially for unknown instructions.

In particular, when you previously compiled a shader that used a new feature (e.g., an OSL function / oso op that didn't exist before) then tried to use that .oso file with an older OSL-based renderer that didn't understand the new function, it gave a pretty cryptic error message:

Unsupported op blahblah in layer mylayer

And to make matters worse, it did this as the shader was being fed to LLVM, rather than when first parsed.

This patch makes the message much more intuitive, as well as being issued as soon as the oso file is parsed. To wit:

Parsing shader "test": instruction "blahblah" is not known. Maybe compiled with a too-new oslc?

This will happen earlier in the render, every time the oso is parsed (not only if the shader happens to be executed, triggering a JIT), and hopefully will make it more obvious that the most likely culprit is using an old renderer with a shader compiled with a newer oslc.