Toggles the literal status of a parameter. A literal parameter has a value that doesn't change during the lifetime of an effect.
HRESULT SetLiteral( D3DXHANDLE hParameter, BOOL Literal );
If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be D3DERR_INVALIDCALL.
This methods only changes whether the parameter is a literal or not. To change the value of a parameter, use a method like ID3DXBaseEffect::SetBool or ID3DXBaseEffect::SetValue.
This function must be called before the effect is compiled. Here is an example of how one might use this function:
LPD3DXEFFECTCOMPILER pEffectCompiler;
char errors[1000];
HRESULT hr;
hr = D3DXCreateEffectCompilerFromFile("shader.fx",
NULL, NULL, 0,
&pEffectCompiler,
&errors);
//In the fx file, literalInt is declared as an int.
//By calling this function, the compiler will treat
//it as a literal (i.e. #define)
hr = pEffectCompiler->SetLiteral("literalInt", TRUE);
//create ten different variations of the same effect
LPD3DXBUFFER pEffects[10];
LPD3DXBUFFER pErrors;
for(int i = 0; i < 10; ++i)
{
hr = pEffectCompiler->SetInt("literalInt", i);
hr = pEffectCompiler->CompileEffect(0, &pEffects[i], &pErrors);
}
Header: Declared in D3dx9shader.h.