Esempio n. 1
0
        //public void DrawUser<T>(int primitiveCount, T[] vertexes)
        //{
        //    GCHandle h = GCHandle.Alloc(vertexes, GCHandleType.Pinned);
        //    try
        //    {
        //        unsafe
        //        {
        //            void* pter = Marshal.UnsafeAddrOfPinnedArrayElement(vertexes, 0).ToPointer();
        //            DrawUser(primitiveCount, pter, ClrRuntime.Runtime.SizeOf<T>());
        //        }
        //    }
        //    finally
        //    {
        //        h.Free();
        //    }

        //}

        //public void DrawIndexedUser<T, I>(int minVertexIndex, int numVertices, int primitiveCount, I[] indices, T[] vertices)
        //{
        //    GCHandle hv = GCHandle.Alloc(vertices, GCHandleType.Pinned);
        //    GCHandle hi = GCHandle.Alloc(indices, GCHandleType.Pinned);
        //    try
        //    {
        //        unsafe
        //        {
        //            void* pVertices = Marshal.UnsafeAddrOfPinnedArrayElement(vertices, 0).ToPointer();
        //            void* pIndices = Marshal.UnsafeAddrOfPinnedArrayElement(indices, 0).ToPointer();
        //            IndexFormat indexFormat = Marshal.SizeOf(typeof(I)) == 2 ? IndexFormat.Index16 : IndexFormat.Index32;

        //            DrawIndexedUser(minVertexIndex, numVertices, primitiveCount, pIndices, indexFormat, pVertices, ClrRuntime.Runtime.SizeOf<T>());
        //        }
        //    }
        //    finally
        //    {
        //        hv.Free();
        //        hi.Free();
        //    }
        //}

        public InputLayout CreateInputLayout <T>(ShaderCode bytecode)
            where T : struct
        {
            var vd = VertexDescriptor.GetDescriptor <T>();

            return(CreateInputLayout(vd.Elements, bytecode));
        }
Esempio n. 2
0
 public ShaderCompilationUnit(ShaderCode code, T shader)
 {
     Code   = code;
     Shader = shader;
 }
Esempio n. 3
0
 public abstract InputLayout CreateInputLayout(VertexElement[] elements, ShaderCode signature);