Shader System
Some management on the CPU side is necessary for the standard SpeedTree shaders to function correctly. In a nutshell, the CPU is used to compute and upload a series of uniform shader constants shared by the vertex and pixel shaders. In the shader source templates, these uniforms are defined in Template_Uniforms.fx (this file contains multiple definitions to accomodate various platforms), and ShaderConstants. in the C++ source. If the SpeedTree SDK is bypassed but the shaders are used, there are essentially four areas that need to be addressed (some of which can be skipped if the related system is bypassed) in the C++ code:
ShaderConstants.h, in the RenderInterface library, is the central database of uniform shader constants across all platforms. This header file defines the data type SStaticShaderConstant, which contains a single constant's register location (or array offset in the case of OpenGL/GLSL), size, whether it's used by a vertex shader, pixel shader, or both, and its update frequency which ranges from once-per-frame (least often) to once-per-material (most often).
Each uniform constant resides in the same constant register across all of the generated shaders, due to the Compiler application explcitly assigning them to specific registers. With this approach, with a uniform constant is set, its value is available to all shaders without having to be uploaded again after a different shader is bound.
As for the CPU-side unform constant definitions themselves, instead of a single table filled with entries that describe each uniform constant, each entry is declared individually, given the exact name as its counterpart in the shader source code. Because the uniform constants are assign a specific constant register, it is not necessary to lookup each by name. In the case of the SDK, the constant name from ShaderConstants.h reflects the same name the constant has in the shader source.
Also see the shader template file Templates_Uniforms.fx, which matches one-for-one with the uniform constants listed in the table here. The major difference is that the FX file has different blocks of constants based on the target platform, as well as different supporting structures for instancing support. Instancing is handled very differently on almost each platform. Only DX10 and DX11 are nearly identical.