Download Users Manual

Transcript
Cg Language Toolkit
‰
Numeric type when applied to expressions of numeric or compile‐time type ‰
Numeric vector type when applied to another vector type of the same number of elements
‰
Numeric matrix type when applied to another matrix type of the same number of rows and columns
Type Equivalency
Type T1 is equivalent to type T2 if any of the following are true: ‰
T2 is equivalent to T1.
‰
T1 and T2 are the same scalar, vector, or structure type.
A packed array type is not equivalent to the same size unpacked array.
‰
T1 is a typedef name of T2.
‰
T1 and T2 are arrays of equivalent types with the same number of elements.
‰
The unqualified types of T1 and T2 are equivalent, and both types have the same qualifications.
‰
T1 and T2 are functions with equivalent return types, the same number of parameters, and all corresponding parameters are pair‐wise equivalent.
Type-Promotion Rules
The cfloat and cint types behave like float and int types except for the usual arithmetic conversion behavior and function‐overloading rules (see “Function Overloading” on page 240).
The usual arithmetic conversions for binary operators are defined as follows:
1.
2.
If either operand is double, the other is converted to double.
Otherwise, if either operand is float, the other operand is converted to float.
3.
Otherwise, if either operand is half, the other operand is converted to half.
4.
Otherwise, if either operand is fixed, the other operand is converted to fixed.
236
NVIDIA
808-00504-0000-006