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); }
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); }