ABSTRACT

C++ control constructs can be used to manipulate shading (Sh) programs. To express data-dependent control constructs, Sh supports a set of C++ macros that can encode control construct keywords into the operation stream processed by Sh. The basic nesting properties of the Sh control constructs will also be checked at C++ compile time. The arguments to Sh control construct keywords can be arbitrary expressions, including C++ functions, which can themselves invoke arbitrary sequences of Sh control constructs. The compiler will take the use of either conditional control construct as a hint only and may choose to use the alternative execution model in some circumstances. Attempts to execute Sh pro grams with non-terminating loops may therefore, on some compilation targets, fail to return to the host application.