Documentation of "public methods" is odd

Zap Andersson

So I had fun. 

I was gonna convert an existing GLSL shader to OSL, which was quite complicated, using multiple nested functions. And since it's GLSL, every function had access to the shader parameters, since they are declared in a kinda 'global' scope in GLSL.

But in OSL, a function doesn't have access to the shader parameters. So I as painfully adding to each function so that parameters were passed down... it was a big shader, lots of things. Of course I screwed it up and it didn't work.

Then I noticed, by some happenstance... that OSL actually does support local functions inside the shader body, and these do have implicit access to the shader paranmeters!!!!

So I could basically delete all my changes and use almost the original GLSL as-is (with appropriate touch-up to types and stuff)!!! (And now the shader works!)

However, as far as I can tell, this is completely undocumented. Local functions are only mentioned but as "public methods" in the documentation, and as being "callable by the renderer", and nowhere is it mentioned these have implicit access to parameters.

Could we tweak this documentation perchance?

Would have saved me several days of work and three aborted tries to convert this danged shader :)


Join to automatically receive all group messages.