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

> ## 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) */
>     int elements = cgGetArraySize(param, 0);
>     if (elements>0) {
>       int dim = cgGetArrayDimension(param);
>       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

> cgGetArrayTotalSize, cgGetArrayDimension, cgGetArrayParameter, cgGetMatrixSize, cgGetTypeSizes