Name

cgGetUniformBufferBlockName - get block name from a uniform buffer parameter

Synopsis

#include <Cg/cg.h>

const char * cgGetUniformBufferBlockName( CGparameter param );

Parameters

param
The uniform buffer parameter.

Return Values

Returns the null-terminated block name string for the uniform buffer parameter.

Returns NULL if an error occurs.

Description

cgGetUniformBufferBlockName allows the application to retrieve the block name of a uniform buffer parameter in a Cg program or effect. This name can be used later to retrieve the parameter from the program or effect using cgGetNamedProgramUniformBuffer or cgGetNamedEffectUniformBuffer.

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 the call sequence:

CGparameter param = cgGetNamedParameter(program, "a");
const char * BlockName = cgGetUniformBufferBlockName(param);

results in BlockName pointing at the character string "myBuf"

Errors

CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.

CG_INVALID_PARAMETER_TYPE_ERROR is generated if param is not a uniform buffer parameter.

History

cgGetUniformBufferBlockName was introduced in Cg 3.1.

See Also

cgGetNamedParameter, cgGetNamedProgramUniformBuffer, cgGetNamedEffectUniformBuffer