cgGetNamedEffectUniformBuffer
Keywords: cgGetNamedEffectUniformBuffer, NVIDIA, NVIDIA Cg Toolkit, Cg Toolkit, Shader, Shader Programming, GPU Shader Programming, GPU Program

> ## Name

> cgGetNamedEffectUniformBuffer - get a uniform buffer parameter from an effect by block name

> ## Synopsis

>     #include <Cg/cg.h>

>     CGparameter cgGetNamedEffectUniformBuffer( CGeffect effect,
>                                                const char * blockName );

> ## Parameters

> effect
>   The effect 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 effect.

> Returns NULL if the effect has no parameter corresponding to blockName or an error occurs.

> ## Description

> The uniform buffer parameters of an effect can be retrieved directly by block name using cgGetNamedEffectUniformBuffer. The block names of the uniform buffer parameters in an effect can be discovered by iterating through the effect's parameters with cgGetFirstParameter and cgGetNextParameter, calling cgGetUniformBufferBlockName for each uniform buffer parameter in turn.

> ## Examples

> If the file buf.fx 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 effect refers to the CGeffect created from buf.fx, then calling:

>       CGparameter p = cgGetNamedEffectUniformBuffer(effect, "myBuf");

> results in p containing the CGparameter associated with variable a.

> ## Errors

> CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.

> CG_INVALID_POINTER_ERROR is generated if blockName is NULL.

> ## History

> cgGetNamedEffectUniformBuffer was introduced in Cg 3.1.

> ## See Also

> cgIsParameter, cgGetFirstParameter, cgGetNextParameter, cgGetUniformBufferBlockName