Patent ID: 7619630

Claim:
A computer-readable storage medium comprising computer-executable instructions that when executed perform operations comprising: analyzing a shader program to find each constant expression that evaluates to a same set of intermediate values for all instances of the shader program; generating a first executable file corresponding to the shader program and to be executed in place of the shader program by replacing each found constant expression in the shader program with a unique reference; and generating a second executable file as a preshader program to be executed prior to execution of the first executable file, the second executable file comprising each replaced constant expression of the shader program, the second executable file as executed prior to the first executable file evaluating each replaced constant expression in such second executable file to produce an intermediate result and placing the intermediate result in a location corresponding to the unique reference associated with each found constant expression in the first executable file, each instance of the first executable file being executed in place of the shader program and after the execution of the second executable file, each instance of the first executable file upon encountering the unique reference therein retrieving the corresponding intermediate value as previously produced by the second executable file from the location corresponding to the unique reference and employing the retrieved intermediate value, wherein each replaced constant expression need only be evaluated once by the second executable file rather than multiple times by each instance of the first executable file.