Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Toggles the literal status of a parameter. A literal parameter has a value that doesn't change during the lifetime of an effect.
Syntax
HRESULT SetLiteral(
[in] D3DXHANDLE hParameter,
[in] BOOL Literal
);
Parameters
-
hParameter [in]
-
Type: D3DXHANDLE
Unique identifier to a parameter. See Handles (Direct3D 9).
-
Literal [in]
-
Type: BOOL
Set to TRUE to make the parameter a literal, and FALSE if the parameter can change value during the shader lifetime.
Return value
Type: HRESULT
If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be D3DERR_INVALIDCALL.
Remarks
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);
}
Requirements
Requirement | Value |
---|---|
Header |
|
Library |
|
See also