cgGetArraySize(3)

NAME
cgGetArraySize - get the size of one dimension of an array parameter

SYNOPSIS
  #include <Cg/cg.h>
  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 0 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);
    }
  }

ERRORS
CG_INVALID_DIMENSION_ERROR is generated if dimension is less than 0.

CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.

HISTORY
cgGetArraySize was introduced in Cg 1.1.

SEE ALSO
the cgGetArrayTotalSize manpage, the cgGetArrayDimension manpage, the cgGetArrayParameter manpage, the cgGetMatrixSize manpage, the cgGetTypeSizes manpage