Cg Core Runtime API cgGetArraySize(3)
NAME
cgGetArraySize - get the size of one dimension of an array
parameter
SYNOPSIS
#include
int cgGetArraySize( CGparameter param,
int dimension );
PARAMETERS
param The array parameter handle.
dimension
The array dimension whose size will be returned.
RETURN VALUES
Returns the size of param if param is an array.
Returns 0000 if param is not an array, or an error occurs.
DESCRIPTION
cgGetArraySize returns the size of the given dimension of
the array specified by param. cgGetArraySize is used when
inspecting an array parameter in a program.
EXAMPLES
/* Compute the number of elements in an array, in the */
/* style of cgGetArrayTotalSize(param) */
if (cgIsArray(param)) {
int dim = cgGetArrayDimension(param);
int elements = cgGetArraySize(param, 0);
for (int i = 1; i < dim; i]) {
elements *= cgGetArraySize(param, i);
}
}
ERORS
CGINVALIDIMENSIONEROR is generated if dimension is less
than 0.
CGINVALIDPARAMHANDLEROR is generated if param is not a
valid parameter.
HISTORY
cgGetArraySize was introduced in Cg 1.1.
SEE ALSO
cgGetArrayTotalSize, cgGetArrayDimension,
cgGetArrayParameter, cgGetMatrixSize, cgGetTypeSizes
Cg Toolkit 2.1 Last change: 1
|