Patent ID: 7692660

Claim:
A method for generating an optimal shader constant configuration for shader constant buffers in a graphics pipeline based on observed run-time behavior of a number of shader programs as a particular application executes at run-time, the method comprising: updating each shader constant buffer with a particular subset of updated shader constants that need to be modified to execute a particular shader program each time state changes as the particular application runs, wherein the particular subset of updated shader constants are selected from a pool of shader constants; observing changes in the shader constants in each shader constant buffer as the particular application runs at runtime, wherein observing changes in the shader constants in each shader constant buffer as the particular application runs during run time, further comprises: determining which shader constants are being set, which shader constants are being updated and the order in which the shader constants are being set/updated as the particular application runs during run time; and designating each particular shader constant in each particular shader constant buffer associated with a particular shader program as being in one of: a first state which indicates that the particular shader does not consume the particular shader constant, a second state which indicates that the particular shader is consuming a stale value of the particular shader constant previously consumed by another shader, and a third state which indicates that the particular shader is the first shader to consume a newly set value of the particular shader constant; determining changes in usage patterns of shader constants in each shader constant buffer to generate usage pattern data based on the observed changes; and based on the determined changes in usage pattern data, determining an optimal shader constant configuration for each shader constant buffer including determining an optimal size of each of the particular shader constant buffers and selecting optimal shader constants to be included in each of the particular shader constant buffers to optimize performance of the graphics pipeline based on observed run-time behavior of a particular application.