Exemple #1
0
        internal static void VerifyParametersDrawUser <T>(PrimitiveType primitiveType, Shader shader, VertexDeclaration vertexDeclaration, T[] vertexData, int startVertex, int verticesCount) where T : struct
        {
            shader.VerifyNotDisposed();
            int num = Utilities.SizeOf <T>();

            if (shader == null)
            {
                throw new ArgumentNullException("shader");
            }
            if (vertexDeclaration == null)
            {
                throw new ArgumentNullException("vertexDeclaration");
            }
            if (vertexData == null)
            {
                throw new ArgumentNullException("vertexData");
            }
            if (vertexDeclaration.VertexStride / num * num != vertexDeclaration.VertexStride)
            {
                throw new InvalidOperationException($"Vertex is not an integer multiple of array element, vertex stride is {vertexDeclaration.VertexStride}, array element is {num}.");
            }
            if (startVertex < 0 || verticesCount < 0 || startVertex + verticesCount > vertexData.Length)
            {
                throw new ArgumentException("Vertices range is out of bounds.");
            }
        }