Name

cgSetArraySize - sets the size of a resizable array parameter

Synopsis

#include <Cg/cg.h>

void cgSetArraySize( CGparameter param,
                     int size );

Parameters

param
The array parameter handle.
size
The new size of the array.

Return Values

None.

Description

cgSetArraySize sets the size of a resiable array parameter param to size.

Examples

If you have Cg program with a parameter like this :

/* ... */

float4 main(float4 myarray[])
{
  /* ... */
}

You can set the size of the myarray array parameter to 5 like so :

CGparameter arrayParam =
  cgGetNamedProgramParameter(program, CG_PROGRAM, "myarray");

cgSetArraySize(arrayParam, 5);

Errors

CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.

CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.

CG_ARRAY_HAS_WRONG_DIMENSION_ERROR is generated if the dimension of the array parameter param is not 1.

CG_PARAMETER_IS_NOT_RESIZABLE_ARRAY_ERROR is generated if param is not a resizable array.

CG_INVALID_PARAMETER_ERROR is generated if size is less than 0.

History

cgSetArraySize was introduced in Cg 1.2.

See Also

cgGetArraySize, cgGetArrayDimension, cgSetMultiDimArraySize