예제 #1
0
        /// <summary>
        /// Maps a buffer to an OpenGL buffer object.
        /// </summary>
        /// <param name="bufferId">The unsigned integer name of the OpenGL buffer</param>
        /// <returns>A pointer mapped to the OpenGL buffer</returns>
        public static DeviceBuffer GLMapBufferObject(UInt32 bufferId)
        {
            DeviceBuffer result = new DeviceBuffer();

            CudaUtil.Call(CudaMem.cuGLMapBufferObject(out result.ptr.ptr, out result.sizeInBytes, bufferId));
            return(result);
        }
예제 #2
0
        public static DeviceBuffer2D GLMapBufferObject(UInt32 bufferId, uint widthInBytes)
        {
            DeviceBuffer2D result = new DeviceBuffer2D();
            UInt32         size;

            CudaUtil.Call(CudaMem.cuGLMapBufferObject(out result.ptr.ptr, out size, bufferId));
            result.ptr.pitch    = widthInBytes;
            result.widthInBytes = widthInBytes;
            result.height       = size / widthInBytes;
            return(result);
        }