# Patent

## Title
Multi-pass shading

## Abstract

An application binary interface includes a descriptor specifying a binary shader for each pass of a multi-pass shader. The application binary interface also includes a graphics state of a graphics object for each pass of the multi-pass shader. The graphics state for the first pass is an initial graphics state of the graphics object. The graphics state for each subsequent pass specifies a change from the graphics state of a previous pass. The application binary interface further includes parameters for the binary shaders. The application binary interface links the binary shaders together based on the parameters. Further, the parameters of the binary shaders may be modified at run time to configure the multi-pass shader. The binary shader of each pass is then executed based on the graphics state and parameters of the pass to render the graphics object.

## Background
CROSS-REFERENCE TO RELATED APPLICATION
The present application is a continuation and claims the priority benefit of U.S. patent application Ser. No. 10/959,695 entitled “Application Binary Interface for Multi-Pass Shaders” filed Oct. 6, 2004, the disclosure of which is incorporated herein by reference.


BACKGROUND
1. Field of the Invention
The present invention relates generally to computer graphics. More particularly, the present invention relates to systems and methods of controlling precompiled computer programs in computer graphics systems.
2. Background Art
Prior art computer graphics systems typically execute an application program, such as a computer video game program, to generate graphics images for display on a computer screen. One type of prior art computer graphics system includes an on-line compiler. In this type of computing system, the computer graphics system compiles portions of the application program while executing other portions of the application program in real time. In this way, a first portion of the application program executing in the computer graphics system can provide run time parameters for compiling a second portion of the application program.
In some situations, a portion of the application program written specifically for graphics hardware in the computer graphics system can be simplified by using run time parameters during compilation. For instance, a first portion of the application program may include a loop construct having a loop count parameter, and the compiler can unroll the loop construct based on a value of the loop count parameter provided by a second portion of the application program at run time. Including a compiler in the computer graphics system, however, increases the cost and complexity of the graphics computer system.
Another type of prior art computer graphics system executes precompiled application programs. In this type of computer graphics system, an application program is compiled into binary programs by using an off-line compiler. The binary programs are then provided to the computer graphics system, which executes the binary programs. Precompiling the application program avoids the need for an on-line compiler but may complicate portions of the application program written specifically for graphics hardware in the computer graphics system. Specifically, these portions of the application program may require fixed parameters at compile time.
One type of program typically found in an application program written for a computer graphics system is a shader. A shader generates visual effects for graphics objects. In many computer graphics systems, the shader controls multiple texture units in the graphics hardware, each of which can access samples from a texture. Moreover, the shader generates colors for the graphics object based on the textures accessed from the texture units.
Some shaders require a greater number of textures for creating a visual effect than the number of texture units available in the graphics hardware of a computer graphics system. Consequently, some compilers cannot compile these application programs for these computer graphics systems. Other compilers generate a multi-pass shader by breaking up the task of creating a visual effect into passes such that each pass requires no more texture units than the number of texture units available in the computer graphics system. Each pass of the multi-pass shader performs an operation on a graphics to generate a result. In this way, a pass of the multi-pass shader may perform an operation based on a result generated in a previous pass.
In those types of computer graphics systems that compile programs on-line, an application program can modify parameters of a shader to configure the shader at run time, which may simplify the task of programming the shader. In contrast, those computer graphics systems that rely on an off-line compiler may need to fix some parameters of the shader at the time of compilation (i.e., compile time). Consequently, the shader (i.e., the precompiled shader) is not configurable at run time, which may complicate the task of programming the shader.
In light of the above, there exists a need to simplify the task of programming a multi-pass shader. Additionally, these exists a need for a precompiled multi-pass shader that is configurable at run time.
SUMMARY OF THE CLAIMED INVENTION
An application binary interface addresses the need for simplifying the task of programming a multi-pass shader. Further, the application binary interface addresses the need for a precompiled multi-pass shader that is configurable at run time. For each pass of a multi-pass shader, the application binary interface specifies a binary shader, one or more parameters for the binary shader, and a graphics state. The graphics state for a first pass specifies an initial graphics state of a graphics object, and the graphics state of each subsequent pass specifies a change from the graphics state of a previous pass. The parameters link the binary shaders together so that a binary shader of a given pass can use a result generated by a binary shader of a previous pass. The binary application interface simplifies the task of programming the multi-pass shader by specifying the binary shaders, parameters for the binary shaders, and graphics states for the multi-pass shader in a binary file.
In one embodiment of the presently disclosed invention, a method for rendering an image with a graphics processor driven by a multi-pass shader program including a predetermined set of default steps is disclosed. Through the method, the multi-pass shader program is pre-complied to generate binary execution code for execution by the graphics processor. A first parameter of the image is received. A first pass of the multi-pass shader program is executed utilizing the binary execution code and the first parameter to obtain a first data value. At least one default step corresponding to a second pass of the multi-pass shader program is modified based upon the first data value. A second pass of the multi-pass shader is executed utilizing the binary execution code including the at least one default step as modified based upon the first data value to obtain a second data value. An operation is performed on the first data value and the second data value to obtain image rendering data. The image is then rendered, a portion of the image based upon the image rendering data. The multi-pass shader program effectuates a photorealistic effect in the portion of the image through the alteration of a color based on the angle and distance of an object with respect to a light source in the portion of the image.
In a second embodiment a further method for rendering an image with a graphics processor driven by a multi-pass shader program including a predetermined set of default steps is provided. The method includes pre-compiling the multi-pass shader program to generate binary execution code for execution by the graphics processor, receiving a first parameter of the image, and executing a first pass of the multi-pass shader program utilizing the binary execution code and the first parameter to obtain a first data value. A second parameter of the image is received and at least one default step of a second pass of the multi-pass shader program is modified based upon the second parameter. A second pass of the multi-pass shader program is executed utilizing the binary execution code including the at least one default step as modified based upon the second parameter to obtain a second data value and an operation is performed on the first data value and the second data value to obtain image rendering data. The image is rendered, a portion of the image based upon the image rendering data. The multi-pass shader program effectuates a photorealistic effect in the portion of the image through the alteration of a color based on the angle and distance of an object with respect to a light source in the portion of the image.
In a third claimed embodiment, a graphics processor driven by a multi-pass shader program including a predetermined set of default steps is disclosed. The graphics processor is configured to receive a first parameter of the image, execute a first pass of the multi-pass shader program utilizing binary execution code pre-compiled by the multi-pass shader, and the first parameter to obtain a first data value. The processor is further configured to modify at least one default step of a second pass of the multi-pass shader program based upon the first data value and execute a second pass of the multi-pass shader program utilizing the binary execution code including the at least one default step as modified based upon the first data value to obtain a second data value. An image is rendered in response to execution of the graphics processor, a portion of the image based upon the image rendering data. The multi-pass shader program effectuates a photorealistic effect in the portion of the image through the alteration of a color based on the angle and distance of an object with respect to a light source in the portion of the image.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a block diagram of an exemplary computing environment, in accordance with one embodiment of the present invention;
FIG. 2 is a block diagram of the exemplary computing system of FIG. 1;
FIG. 3 is a block diagram of the exemplary computer graphics system of FIG. 1;
FIG. 4 is a block diagram of the exemplary graphics pipeline of FIG. 3;
FIG. 5 is a block diagram of the exemplary application program of FIG. 1;
FIG. 6 is a block diagram of the exemplary binary program of FIG. 1;
FIG. 7 is a flow chart for a method of generating an application binary interface, in accordance with one embodiment of the present invention; and
FIG. 8 is a flow chart for a method of rendering a graphic object by using an application binary interface, in accordance with one embodiment of the present invention.



DETAILED DESCRIPTION
According to one embodiment of the present invention, an application binary interface includes a descriptor for each pass of a multi-pass shader specifying a binary shader for the pass. The application binary interface also includes one or more parameters for the binary shader of each pass. Further, the application binary interface includes a graphics state of each pass. The graphics state of the first pass is an initial graphics state of a graphics object, and the graphics state of each subsequent pass specifies a change from the graphics state of a previous pass. The parameters link the binary shaders together such that a binary shader of a given pass can use a result generated by a binary shader of a previous pass. The binary shader of each pass is then executed based on the graphics state and the parameters of the pass to render the graphics object.
FIG. 1 depicts an exemplary computing environment 100 in accordance with one embodiment of the present invention. The exemplary computing environment 100 includes a computing system 105 and a computer graphics system 120. The exemplary computing system 105 includes a computer program 110, a compiler 115, and a binary program 125. In operation, the computing system 105 executes the compiler 115 on the computer program 110 to generate the binary program 125. The binary program 125 is then provided to the computer graphics system 120. The computer graphics system 120 executes the binary program 125 and renders graphics images based on the binary program 125.
In one embodiment, the computer program 110 is a video game program. In this embodiment, the computer graphics system 120 executes the binary program 125 to render graphics images for the video game program. In another embodiment, the computing system 105 includes the computer graphics system 120.
FIG. 2 depicts the exemplary computing system 105 of FIG. 1. The exemplary computing system 105 includes a computing processor 200, input-output (I/O) device(s) 215, and a memory system 220 coupled in communication with each other via a communication bus 205. The memory system 220 stores the computer program 110 and the compiler 115. The computing processor 200 executes the compiler 115 on the computer program 110 to generate the binary program 125 and provides the binary program to the I/O device(s) 215.
In one embodiment, the binary program 125 includes computer program code stored on a compact disc read-only memory (CD-ROM). In another embodiment, the binary program 125 includes computer program code stored on a digital versatile disc (DVD). In still another embodiment, the binary program 125 includes computer program code stored on a portable memory device, such as a flash memory device.
FIG. 3 depicts the exemplary computer graphics system 120 of FIG. 1. The exemplary computer graphics system 120 includes input-output (I/O) device(s) 305, a computing processor 300, a memory system 320, and a graphics processor 325 coupled in communication with each other via a communication bus 315. In this embodiment, the I/O device(s) 305 receives the binary program 125 and the computing processor 300 stores the binary program 125 into the memory system 320. The computing processor 300 and the graphics processor 325 then execute various portions of the binary program 125 stored in the memory system 320 to render graphics images, as is described more fully herein.
FIG. 4 is a block diagram of the exemplary graphics processor 325 of FIG. 3. In this embodiment, the graphics processor 325 includes a graphics pipeline 400. The graphics pipeline 400 includes a transform unit 405, a raster unit 410, a texture unit 415, and a frame buffer 420. The transform unit 405 executes a vertex program to transform a graphics object into graphics primitives defined by vertices, such as lines and triangles. The raster unit 410 transforms the graphics primitives into pixels and generates a value for each pixel. Optionally, the texture unit 415 accesses samples from one or more textures and provides data based on the samples to the raster unit 410. In turn, the raster unit 410 generates the value for each pixel based on the data received from the texture unit 415. The frame buffer 420 stores the value of each pixel in the graphics object. In one embodiment, the value of each pixel represents a color of the pixel. In a further embodiment, the frame buffer 420 stores the value of each pixel in a graphics image composed of multiple graphics objects.
In one embodiment, the graphics pipeline 400 includes a plurality of texture units 415, each of which can access one or more textures. In this embodiment, each texture unit 415 concurrently generates an intermediate value for each pixel based on the texture accessed by the texture unit 415, and the raster unit 410 combines the intermediate values of the pixel to generate the value of the pixel. In another embodiment, the value of the pixel represents a color of the pixel.
FIG. 5 depicts the exemplary computer program 110 of FIG. 1. The computer program 110 includes an application 500 (i.e., application program) and a shader 505 (i.e., a shader program). The shader 505 includes computing instructions for rendering a graphics object, and the application 500 includes instructions for invoking the shader 505 to render a graphics object. Further, the application 500 can include instructions for invoking multiple shaders 505 to render multiple graphics objects for a graphics image.
FIG. 6 depicts the exemplary binary program 125 of FIG. 1. The binary program 125 includes a binary application 600 (i.e., a binary application program), one or more binary shaders 605 (i.e., binary shader programs) and an application binary interface 610. In this embodiment, the application binary interface 610 includes a descriptor for specifying a binary shader, one or more parameters for the binary shader, and a graphics state for each pass of a multi-pass shader. The graphics state of the first pass is an initial graphics state for a graphics object. The graphics state of each subsequent pass specifies a change from the graphics state of the previous pass. The parameters link the binary shaders together so that the binary shader of a given pass can use a result generated by the binary shader of a previous pass. For example, an input parameter of the binary shader of the given pass can be an output parameter of the binary shader of the previous pass. In this way, the passes of the multi-pass shader can be executed to render the graphics object. In a further embodiment, the passes of the multi-pass shaders are arranged in serial form. In this embodiment, a subsequent pass of the multi-pass shaders follows a previous pass of the multi-pass shader.
In one embodiment, the compiler 115 (FIG. 1) compiles the shader 505 (FIG. 5) to generate an expression for rendering a graphics object. Subsequently, the compiler 115 identifies subexpressions in the expression such that each subexpression can be executed by the graphics processor 325 (FIG. 3) in a single pass. The compiler 115 then generates the binary shader 605, one or more parameters for the binary shader, and the graphic state for each subexpression. In this embodiment, the graphics states link the binary shaders 605 together so that the graphics processor 325 can execute the binary shaders 605 to render the graphics object. For example, a binary shader 605 can store data in a location (e.g., a texture unit or frame buffer) in the graphics processor 325 and a graphics state can specify that location. Another binary shader 605 can then determine the location of the data based on the graphics state.
In another embodiment, a graphics state can specify characteristics of the computer graphics system 120 (FIG. 3) or a graphics image. For example, the graphics state can specify a number of texture units available in the graphics processor 325. As another example, the graphics state can specify a pixel size of the graphics image. In still another example, the graphics state can specify a texture program to be executed by the graphics processor 325 on the graphics object.
According to an exemplary embodiment, the application 500 (FIG. 5) includes computing instructions for invoking a shader 505 via the application binary interface 610. In this embodiment, the computing instructions include one or more variables, each of which corresponds to a parameter in the application binary interface 610. Consequently, the binary application 600 can determine the value of a variable and bind the value of the variable to the corresponding parameter at run time. In this way, the binary application 600 configures a multi-pass shader at run time based on the value of the variable.
In another embodiment, the value of a variable is limited to a predetermined set of values in the application 500. In this embodiment, the compiler 115 generates a binary shader 605 for each value in the predetermined set by setting the parameter to the value. In this way, the parameter of each binary shader 605 is fixed at compile time. The binary application 600 then determines the value of the variable at run time to select the binary shader 605 identified by the value of the variable. In this way, the binary application 600 configures a multi-pass shader at run time based on the value of the variable.
A representation of a shader, a multi-pass shader, and an exemplary application binary interface 610 for the multi-pass shader is depicted in Table 1. As depicted in Table 1, the shader is represented by the expression “output=cosine (texture_lookup(x,y))” in which “x” and “y” are input parameters and “output” represents an output value of the shader. The first pass of the multi-pass shader is represented by the subexpression “tmp=texture_lookup(x, y)” and the second pass is represented by the subexpression “output=cosine(tmp).” In the first pass, “x” and “y” are input parameters and “tmp” represents an output value of the first pass. In the second pass, “tmp” is an input parameter and “output” represents an output value of the second pass.
As is also depicted in table 1, the application binary interface 610 specifies the first pass and the second pass of the multi-pass shader. For the first pass, a descriptor is represented by “texture_lookup”, which identifies a binary shader for the first pass. Further, input parameters for the binary shader of the first pass are represented by “x” and “y”, and an output parameter for the binary shader of the first pass is represented by “tmp”. The output parameter “tmp” represents an output value for the binary shader of the first pass. Further, in this embodiment, the output value for the binary shader of the first pass is a result for the first pass. Additionally, an initial graphics state for a graphics object is represented by “texture unit 1”, which specifies that a first texture unit will access a texture for the binary shader of the first pass.
For the second pass, a descriptor is represented by “cosine”, which represents a binary shader for the second pass. Further, an input parameter for the binary shader of the second pass is represented by “tmp”, which is the output parameter of the first pass. Accordingly, the input parameter “tmp” for the binary shader of the second pass represents the output value of the binary shader of the first pass. Additionally, a graphics state of the second pass is represented by “frame buffer”, which specifies that the result of the second pass will be stored in a frame buffer. In this way, the graphics state of the second pass specifies a change from the graphics state of the first pass. Further, the parameter “tmp” links the binary shader of the second pass to the binary shader of the first pass such that the result of the first pass is an input parameter for the binary shader of the second pass. The output parameter “output” represents an output value for the binary shader of the second pass. Further, in this embodiment, the output value for the binary shader of the second pass is a result for the second pass.







TABLE 1







Shader









output = cosine (texture_lookup (x, y))







multi-pass shader









first pass: tmp = texture_lookup (x, y)



second pass: output = cosine (tmp)







application binary interface










first pass:
descriptor = texture_lookup




input parameter(s) = x, y




output parameter(s) = tmp




graphics state = texture unit 1



second pass:
descriptor = cosine




input parameter(s) = tmp




output parameter(s) = output




graphics state = frame buffer










FIG. 7 depicts a flow chart for a method 700 of generating the application binary interface 610 (FIG. 6), in accordance with one embodiment of the present invention. In step 705, the compiler 115 (FIG. 1) compiles the shader 505 (FIG. 5) to generate a first binary shader 605 (FIG. 6) and a first graphics state for a first pass of a multi-pass shader. In one embodiment, the compiler 115 compiles the application 500 (FIG. 5) together with the shader 505 to generate the first binary shader 605. It is to be appreciated that step 705 is optional in the present invention.
In step 710, the compiler 115 compiles the shader 505 to generate the next binary shader 605 and the next graphics state for the next pass of a multi-pass shader. In one embodiment, the compiler 115 compiles the application 500 together with the shader 505 to generate the binary shader 605 and the graphics state for this next pass. It is to be appreciated that step 710 is optional in the present invention.
In another embodiment, the compiler 115 performs steps 705 and 710 concurrently to generate the binary shader 605 and the graphics state for each pass of the multi-pass shader. In a further embodiment, the compiler 115 also generates the binary application 600 (FIG. 6).
In step 715, the compiler 115 determines whether the multi-pass shader includes additional passes. If the multi-pass shader includes additional passes, the method returns to step 710, otherwise the method proceeds to step 720. It is to be appreciated that step 715 is optional in the present invention.
In step 720, the compiler 115 generates a descriptor and one or more parameters for the first pass of the multi-pass shader. The descriptor of the first pass specifies the first binary shader. In one embodiment, the compiler 115 binds at least one parameter of the first pass to the first binary shader 605 at compile time. In another embodiment, the binary application 600 (FIG. 6) binds at least one parameter of the first pass to the first binary shader 605 at run time. In still another embodiment, the compiler 115 binds some of the parameters of the first pass to the first binary shader 605 at compile time and the binary application 600 binds some of the parameters of the first pass to the first binary shader 605 at run time.
In step 725, the compiler 115 generates a descriptor and one or more parameters for the next pass of the multi-pass shader. The descriptor of this pass specifies the binary shader of this pass. In one embodiment, the compiler 115 binds at least one parameter of this pass to the binary shader 605 of this pass at compile time. In another embodiment, the binary application 600 binds at least one parameter of this pass to the binary shader 605 at run time. In still another embodiment, the compiler 115 binds some of the parameters of this pass to the binary shader at compile time and the binary application 600 binds some of the parameters of this pass to the binary shader at run time.
In step 730, the compiler 115 determines whether the multi-pass shader includes additional passes. If the multi-pass shader includes additional passes, the method returns to step 725, otherwise the method ends. It is to be appreciated the application binary interface 610 comprises the parameter(s) generated for each pass of the multi-pass shader.
In one embodiment, the compiler 115 can perform steps 720-730 concurrently to generate the parameters(s) for each pass of the multi-pass shader. In another embodiment of the present invention, the compiler 115 can perform steps 705-730 concurrently to generate the binary shader 605, the graphics state, and the parameter(s) for each pass of the multi-pass shader. In a further embodiment, the compiler can also generate the binary application 600. In still another embodiment, the compiler 115 can perform steps 705 and 720 concurrently. In yet another embodiment, the compiler can perform steps 710 and 725 concurrently.
FIG. 8 depicts a flow chart for a method 800 of rendering a graphics object by using the application binary interface 610 (FIG. 6), in accordance with one embodiment of the present invention. In step 805, the binary application 600 (FIG. 6) configures a multi-pass shader. In one embodiment, the binary application 600 modifies at least one parameter of the application binary interface 610 at run time (i.e. during execution of the binary application 600) to configure the multi-pass shader. In another embodiment, the binary application 600 configures the multi-pass shader by selecting an application binary interface 610 among multiple application binary interfaces 610 based on one or more parameters at run time. It is to be appreciated that step 805 is optional in the present invention.
In step 810, the binary application 600 identifies the binary shader 605 (FIG. 6) and the graphics state for a first pass of a multi-pass shader based on the application binary interface 610. In one embodiment, the descriptor of the first pass specifies the binary shader 605 of the first pass. In this embodiment, the binary application 600 identifies the binary shader 605 of the first pass based on the descriptor of the first pass. In another embodiment, the descriptor specifies a plurality of binary shaders 605. In this embodiment, the binary application 600 selects the binary shader 605 of the first pass from the plurality of binary shaders 605 at run time based on one or more parameters for the binary shader 605 of the first pass in the application binary interface 610.
In step 815, the graphics processor 325 executes the first pass of the multi-pass shader by executing the first binary shader 605 based on the first graphics state to generate a result for the first pass. In one embodiment, the result for the first pass is a value of each pixel in the graphics object. In a further embodiment, the graphics processor 325 (FIG. 3) includes multiple texture units, each of which can access a texture. In this further embodiment, the graphics processor 325 executes the first binary shader on the multiple texture units in the graphics processor 325 to generate the value for each pixel based on the textures accessed by the texture units.
In step 820, the binary application 600 identifies the binary shader 605 and the graphics state for the next pass of the multi-pass shader based on the application binary interface 610. In one embodiment, the descriptor of this pass specifies the binary shader 605 of the pass. In this embodiment, the binary application 600 identifies the binary shader 605 of this pass based on the descriptor of this pass. In another embodiment, the descriptor specifies a plurality of binary shaders 605. In this embodiment, the binary application 600 selects the binary shader 605 of this pass from the plurality of binary shaders 605 at run time based on one or more parameters for the binary shader 605 of this pass in the application binary interface 610. In a further embodiment, some or all of the parameters for the binary shader 605 of this pass may be a result of a previous pass.
In step 825, the graphics processor 325 executes this next pass of the multi-pass shader by executing the binary shader 605 based on the graphics state to generate a result for this pass. In one embodiment, the result for this pass is a value of each pixel in the graphics object. In a further embodiment, the graphics processor 325 includes multiple texture units, each of which can access a texture. In this further embodiment, the graphics processor 325 executes the binary shader on the multiple texture units in the graphics processor 325 to generate the value for each pixel based on the textures accessed by the texture units.
In another embodiment, the graphics processor 325 generates the value of each pixel based on the value of the pixel generated in a previous pass. In this embodiment, the graphics state of this pass specifies the texture unit storing the intermediate color of each pixel generated in the previous pass. Consequently, the binary shader 605 of the current pass can access the value of the pixel generated in the previous pass to generate the value of the pixel for this pass. In a further embodiment, the value of the pixel generated for the last pass of the multi-pass shader is a color of the pixel. In another further embodiment, the graphics processor 325 stores the value of each pixel for each pass into the frame buffer 420 (FIG. 4) and then combines the values of each pixel to generate a color for the pixel in the frame buffer 420.
In step 830, the binary application 600 determines whether the multi-pass shader includes an additional pass based on the application binary interface 610. If the multi-pass shader includes an additional pass, the method returns to step 820, otherwise the method ends.
The embodiments discussed herein are illustrative of the present invention. As these embodiments of the present invention are described with reference to illustrations, various modifications or adaptations of the methods and/or specific structures described may become apparent to those skilled in the art. All such modifications, adaptations, or variations that rely upon the teachings of the present invention, and through which these teachings have advanced the art, are considered to be within the spirit and scope of the present invention. Hence, these descriptions and drawings should not be considered in a limiting sense, as it is understood that the present invention is in no way limited to only the embodiments illustrated.

## Claims

1. A method for rendering an image with a graphics processor driven by a multi-pass shader program including a descriptor and an input parameter, the method comprising:
pre-compiling, before run time, the multi-pass shader program to generate binary execution code for execution by the graphics processor by configuring a binary shader for each value in a predetermined set of values, wherein a variable of each binary shader is fixed at compile time to one of the predetermined values in the set;
receiving a first parameter of the image, a value of the first parameter being limited to one of the values in the predetermined set of values in the multi-pass shader program;
executing a first pass of the multi-pass shader program utilizing the binary execution code and the first parameter as the input parameter to obtain a first data value wherein the multi-pass shader program selects, at run-time, the binary shader comprising the binary execution code identified by the value of the first parameter in the first pass;
binding, at run time, the first data value as the input parameter for a second pass of the multi-pass shader program;
executing a second pass of the multi-pass shader program utilizing the binary execution code including the bound first data value to obtain a second data value;
performing an operation on the first data value and the second data value to obtain image rendering data; and
rendering the image, a portion of the image based upon the image rendering data, and wherein the multi-pass shader program effectuates a photorealistic effect in the portion of the image through the alteration of a color based on the angle and distance of an object with respect to a light source in the portion of the image.

2. The method of claim 1, wherein the operation includes modifying the first data value and the second data value.

3. The method of claim 1, wherein the first parameter of the image indicates the color to be applied to the portion of the image.

4. The method of claim 1, wherein the first parameter of the image indicates corresponds to a specified position of the light source.

5. The method of claim 1, further comprising:
executing a texture mapping operation;
applying the results of the texture mapping operation to an object in the rendered image.

6. The method of claim 1, wherein rendering the image occurs without the use of a texture mapping operation.

7. A method for rendering an image with a graphics processor driven by a multi-pass shader program including a descriptor and an input parameter, the method comprising:
pre-compiling, before run time, the multi-pass shader program to generate binary execution code for execution by the graphics processor by configuring a binary shader for each value in a predetermined set of values, wherein a variable of each binary shader is fixed at compile time to one of the predetermined values in the set;
receiving a first parameter of the image, a value of the first parameter being limited to one of the values in the predetermined set of values in the multi-pass shader program;
executing a first pass of the multi-pass shader program utilizing the binary execution code and the first parameter as the input parameter to obtain a first data value wherein the multi-pass shader program selects, at run-time, the binary shader comprising the binary execution code identified by the value of the first parameter in the first pass;
receiving a second parameter of the image;
binding, at run time, the first data value as the input parameter for a second pass of the multi-pass shader program;
executing a second pass of the multi-pass shader program utilizing the binary execution code including both the second parameter and the bound first data value to obtain a second data value;
performing an operation on the first data value and the second data value to obtain image rendering data; and
rendering the image, a portion of the image based upon the image rendering data, and wherein the multi-pass shader program effectuates a photorealistic effect in the portion of the image through the alteration of a color based on the angle and distance of an object with respect to a light source in the portion of the image.

8. The method of claim 7, wherein the operation includes modifying the first data value and the second data value.

9. The method of claim 7, wherein the first parameter indicates that a portion of the image is to be treated as if it is illuminated by a first light source at a first specified position and the second parameter indicates that the portion of the image is to be treated as if it is illuminated simultaneously by a second light source at a second specified position.

10. The method of claim 9, wherein the image rendering data results in the portion of the image being rendered as if it were illuminated by a first light source located at the first specified position and by a second light source at the second specified position.

11. The method of claim 7, further comprising:
executing a texture mapping operation;
applying the results of the texture mapping operation to an object in the rendered image.

12. The method of claim 7, wherein rendering the image occurs without the use of a texture mapping operation.

13. A graphics processor driven by a multi-pass shader program including a descriptor and an input parameter, the graphics processor configured to:
pre-compile, before run time, the multi-pass shader program to generate binary execution code for execution by the graphics processor by configuring a binary shader for each value in a predetermined set of values, wherein a variable of each binary shader is fixed at compile time to one of the predetermined values in the set;
receive a first parameter of the image, a value of the first parameter being limited to one of the values in the predetermined set of values in the multi-pass shader program;
execute a first pass of the multi-pass shader program utilizing binary execution code pre-compiled by the multi-pass shader, before run time, and further utilizing the first parameter as the input parameter to obtain a first data value wherein the multi-pass shader program selects, at run-time, the binary shader comprising the binary execution code identified by the value of the first parameter in the first pass;
bind, at run time, the first data value as the input parameter for a second pass of the multi-pass shader program; and
execute a second pass of the multi-pass shader program utilizing the binary execution code including the bound first data value to obtain a second data value, wherein an image is rendered in response to execution of the graphics processor, a portion of the image based upon the image rendering data, and wherein the multi-pass shader program effectuates a photorealistic effect in the portion of the image through the alteration of a color based on the angle and distance of an object with respect to a light source in the portion of the image.

14. A method for rendering an image with a graphics processor driven by a multi-pass shader program including a descriptor and an input parameter, the method comprising:
pre-compiling, before run time, the multi-pass shader program to generate binary execution code for execution by the graphics processor by configuring a binary shader for each value in a predetermined set of values, wherein a variable of each binary shader is fixed at compile time to one of the predetermined values in the set, wherein binary execution code is identified by the descriptor;
receiving a first parameter of the image, a value of the first parameter being limited to one of the values in the predetermined set of values in the multi-pass shader program;
executing a first pass of the multi-pass shader program utilizing the binary execution code and the first parameter as the input parameter to obtain a first data value wherein the multi-pass shader program selects, at run-time, the binary shader comprising the binary execution code identified by the value of the first parameter in the first pass;
binding, at run time, the first data value as the descriptor for a second pass of the multi-pass shader program;
executing a second pass of the multi-pass shader program utilizing the binary execution code including the bound first data value to obtain a second data value;
performing an operation on the first data value and the second data value to obtain image rendering data; and
rendering the image, a portion of the image based upon the image rendering data, and wherein the multi-pass shader program effectuates a photorealistic effect in the portion of the image through the alteration of a color based on the angle and distance of an object with respect to a light source in the portion of the image.

15. A computer implemented memory having embodied thereon a program, the program being executable by a processor to perform a method for rendering an image, the method comprising:
pre-compiling, before run time, a multi-pass shader program including a descriptor and an input parameter to generate binary execution code for execution by the processor by configuring a binary shader for each value in a predetermined set of values, wherein a variable of each binary shader is fixed at compile time to one of the predetermined values in the set;
receiving a first parameter of the image, a value of the first parameter being limited to one of the values in the predetermined set of values in the multi-pass shader program;
executing a first pass of the multi-pass shader program utilizing the binary execution code and the first parameter as an input parameter to obtain a first data value wherein the multi-pass shader program selects, at run-time, the binary shader comprising the binary execution code identified by the value of the first parameter in the first pass;
binding, at run time, the first data value as the input parameter for a second pass of the multi-pass shader program;
executing a second pass of the multi-pass shader program utilizing the binary execution code including the bound first data value to obtain a second data value;
performing an operation on the first data value and the second data value to obtain image rendering data; and
rendering the image, a portion of the image based upon the image rendering data, and wherein the multi-pass shader program effectuates a photorealistic effect in the portion of the image through the alteration of a color based on the angle and distance of an object with respect to a light source in the portion of the image.