Name
cgGetNamedProgramUniformBuffer - get a program uniform buffer parameter by block name
Synopsis
#include <Cg/cg.h>
CGparameter cgGetNamedProgramUniformBuffer( CGprogram program,
const char * blockName );
Parameters
- program
-
The program from which to retrieve the uniform buffer parameter.
- blockName
-
The block name of the uniform buffer parameter to retrieve.
Return Values
Returns the uniform buffer parameter with the matching block name from the program.
Returns NULL if the program has no parameter corresponding to blockName or an error occurs.
Description
The uniform buffer parameters of a program can be retrieved directly by
block name using cgGetNamedProgramUniformBuffer. The block names of
the uniform buffer parameters in a program can be discovered by iterating
through the program's parameters with cgGetFirstParameter
and cgGetNextParameter, calling
cgGetUniformBufferBlockName for each uniform
buffer parameter in turn.
Examples
If the file buf.cg contains this shader:
uniform myBuf {
float4 var;
} a : BUFFER;
float4 vertex() : POSITION
{
return float4(a.var.r, a.var.g, a.var.b, 1.0);
}
and if program refers to the CGprogram created from buf.cg, then calling:
CGparameter p = cgGetNamedProgramUniformBuffer(program, "myBuf");
results in p containing the CGparameter associated with variable a.
Errors
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program
is not a valid program handle.
CG_INVALID_POINTER_ERROR is generated if blockName is NULL.
History
cgGetNamedProgramUniformBuffer was introduced in Cg 3.1.
See Also
cgIsParameter,
cgGetFirstParameter,
cgGetNextParameter,
cgGetUniformBufferBlockName
|