ShaderTools.Hlsl.Symbols.TypeFacts.GetNumElements C# (CSharp) Méthode

GetNumElements() static private méthode

static private GetNumElements ( this type ) : int
type this
Résultat int
        internal static int GetNumElements(this TypeSymbol type)
        {
            switch (type.Kind)
            {
                case SymbolKind.Array:
                {
                    var arrayType = (ArraySymbol) type;
                    return arrayType.Dimension ?? 0;
                }
                case SymbolKind.IntrinsicMatrixType:
                {
                    var matrixType = (IntrinsicMatrixTypeSymbol) type;
                    return matrixType.Rows * matrixType.Cols;
                }
                case SymbolKind.IntrinsicScalarType:
                {
                    return 1;
                }
                case SymbolKind.IntrinsicVectorType:
                {
                    var vectorType = (IntrinsicVectorTypeSymbol) type;
                    return vectorType.NumComponents;
                }
                default:
                {
                    return 1;
                }
            }
        }