Menu

#371 RSL message passing function names act like keywords

fatal/crash
open
nobody
4
2012-09-20
2009-07-10
No

The names of message passing functions like surface, lightsource, incident, opposite etc are reserved words from the point of view of the shader compiler (ie, they're hardcoded into the scanner as keywords). This means that function name scoping doesn't work for these builtin functions, and the user can't define variables which override the names.

In particular, declaring a variable called incident:

surface test()
{
vector incident = 0;
}

doesn't work as "expected", resulting in a confusing "syntax error". This is used by at least one shader out there in the wild - noisysmoke.sl from the BRMT shader collection.

Even though it's arguably bad programming practise to override builtin functions with local variable names, the scoping should still work in such a circumstance.

Discussion

Anonymous
Anonymous

Add attachments
Cancel