コード例 #1
0
        public GraphicsBuffer(GraphicsBuffer.Target target, int count, int stride)
        {
            bool flag = GraphicsBuffer.RequiresCompute(target) && !SystemInfo.supportsComputeShaders;

            if (flag)
            {
                throw new ArgumentException("Attempting to create a graphics buffer that requires compute shader support, but compute shaders are not supported on this platform. Target: " + target.ToString());
            }
            bool flag2 = count <= 0;

            if (flag2)
            {
                throw new ArgumentException("Attempting to create a zero length graphics buffer", "count");
            }
            bool flag3 = stride <= 0;

            if (flag3)
            {
                throw new ArgumentException("Attempting to create a graphics buffer with a negative or null stride", "stride");
            }
            bool flag4 = (target & GraphicsBuffer.Target.Index) != (GraphicsBuffer.Target) 0 && stride != 2 && stride != 4;

            if (flag4)
            {
                throw new ArgumentException("Attempting to create an index buffer with an invalid stride: " + stride.ToString(), "stride");
            }
            bool flag5 = GraphicsBuffer.RequiresCompute(target) && stride % 4 != 0;

            if (flag5)
            {
                throw new ArgumentException("Stride must be a multiple of 4 unless the buffer is only used as a vertex buffer and/or index buffer ", "stride");
            }
            this.m_Ptr = GraphicsBuffer.InitBuffer(target, count, stride);
        }
コード例 #2
0
 private static extern IntPtr InitBuffer(GraphicsBuffer.Target target, int count, int stride);
コード例 #3
0
        private static bool RequiresCompute(GraphicsBuffer.Target target)
        {
            int num = 3;

            return((target & (GraphicsBuffer.Target)num) != target);
        }