Пример #1
0
        public static void srcToPtx(SourceCode sc)
        {
            var prg = new nvrtcProgram();
            var res = NVRTCNativeMethods.nvrtcCreateProgram(ref prg, sc.rendered, null, 0, null, null);

            res = NVRTCNativeMethods.nvrtcCompileProgram(prg, 2, optionPtr);
            SizeT ptxSize = new SizeT();

            res    = NVRTCNativeMethods.nvrtcGetPTXSize(prg, ref ptxSize);
            sc.ptx = new byte[ptxSize];
            res    = NVRTCNativeMethods.nvrtcGetPTX(prg, sc.ptx);
        }
Пример #2
0
        private static byte[] srcToPtx(string src)
        {
            var prg = new nvrtcProgram();
            var res = NVRTCNativeMethods.nvrtcCreateProgram(ref prg, src, null, 0, null, null);



            res = NVRTCNativeMethods.nvrtcCompileProgram(prg, 2, optionPtr);

            SizeT ptxSize = new SizeT();

            res = NVRTCNativeMethods.nvrtcGetPTXSize(prg, ref ptxSize);
            byte[] ptx = new byte[ptxSize];
            res = NVRTCNativeMethods.nvrtcGetPTX(prg, ptx);
            return(ptx);
        }