문제

In my OpenGL program I read from the header file to find out the geometry size and then malloc an Indice array and a Vertex array which I then pass to the VBO, is it even possible to read directly from the hard drive or is the GPUs memory linked to the computer's RAM only?

도움이 되었습니까?

해결책

The GPU is not directly connected to the system RAM. There's a bus inbetween, in current generation computers a PCI-Express bus. ATA storage has a controller inbetween. There is no direct connection between memories.

BUT there is DMA, which allows certain periphials to directly access the system memory through DMA channels. DMA on PCI-Express also works between periphials. Theoretically a GPU could do DMA to the ATA controller.

Practically this is of little use! Why? Because of filesystems. Even if there was some kind of driver support to let the GPU access a storage periphial directly, it'd still have to do all the filesystem business, which doesn't parallelize to the degree as GPUs are designed for.


Alas regarding your question:

In my OpenGL program I read from the header file to find out the geometry size and then malloc an Indice array and a Vertex array which I then pass to the VBO, is it even possible to read directly from the hard drive or is the GPUs memory linked to the computer's RAM only?

Why no simply memory map those files? That way you avoid allocating a buffer you're first reading into, and passing a memory mapped file pointer to OpenGL does allow the driver to actually perform a DMA transfer between the storage driver buffers and the GPU, which is as close as it gets to your original request. Of course the data on the storage device must be prepared in a format that's suitable for the GPU, otherwise it's of little use. If it requires some preprocessing, the best thing to use is the CPU. GPUs don't like to serialize data.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top