In most constructs accepting a shader, shader lists
are also accepted. A shader list consists of one or more shader items
like one of the two above in sequence. For example, suppose that a named shader
has been defined with the following command:
shader "named_shader2" "shader2" ( parameters )
then the following shader list can be written:
"shader1" ( parameters ) = "named_shader2" "shader3" ( parameters )
This shader list will call three shaders in sequence, shader1, shader2, and shader3, in this order, each with its parameters. All shaders get the same result pointer, so each operates on the results of the previous. A shader list like this can be substituted for all instances of the meta symbol shader_list in this chapter.
Shader lists are maintained by storing a link to the next shader in the previous shader. In the above example, the anonymous shader shader1 contains a link to name_shader2, which contains a link to shader3. This means that once this list is set up, any reference to named_shader2 will implicitly also call shader3 because the link in named_shader2 will remain in the shader until changed in another shader list. This can have surprising results. This is not a problem in anonymous shaders because, not having a name, they cannot be referenced in more than one place. In general it is a good idea to avoid putting named shaders in shader lists.
Copyright © 1986, 2015 NVIDIA ARC GmbH. All rights reserved.