imageworks/OpenShadingLanguage — pull request #302 by lgritz (2013-12-02 18:59:45+00:00)
Title: Refactor ShadingAttribState (now just use ShaderGroup / ShaderGroupRef).

This is a de-cluttering refactor I've wanted to do for a long time, but was always low priority. Decided to bang it out while my US-based coworkers were eating turkey and giving me an unusual degree of peace and quiet. The bottom line is that it removes the pointless "ShadingAttribState" wrapper around what was effectively just a ShaderGroup.

In the early days, we imagined ShadingAttribState would hold several shader groups (displacement, surface, volume, etc.) and a bunch of other related state. But in fact, no extra state materialized, and in practice there was no point having the attrib state hold more than one group.

This patch refactors and simplifies to get rid of the pointless additional abstraction layers:

* No ShadingAttribState, its usage is replaced by ShaderGroup. It holds just one group, no extra state.

* Modify ShaderGroupBegin() to return the ShaderGroupRef.

* Deprecated: (1) the use of ShadingSystem::state(), not necessary with SGB returning the group ref; (2) the idiom of using a bare Shader() call to imply that it forms a group of one layer only, instead, assume a surrounding ShaderGroupBegin() and ShaderGroupEnd(); (3) ShadingSystem::clear_attribs, which was never nontrivially implemented.

* Improve comments in oslexec.h.