13.07.2015 Views

CUDA contexts in Maya

CUDA contexts in Maya

CUDA contexts in Maya

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Particle Render Blit• Blit <strong>in</strong>to VBOs— copy the <strong>CUDA</strong> simulated data <strong>in</strong>to the GL buffers.void jobBlit(Data* d){void* glVboPositionsPtr = 0;size_t nBytes = 0;cudaGraphicsMapResources(1, &d->cuGlRes, d->cuStream);cudaGraphicsResourceGetMappedPo<strong>in</strong>ter(&glVboPositionsPtr, (size_t*)&nBytes, d->cuGlRes);cudaMemcpyAsync(glVboPositionsPtr, d->cuPositions, nBytes, cudaMemcpyDeviceToDevice, d->cuStream);}cudaGraphicsUnmapResources(1, &d->cuGlRes, d->cuStream);void jobSync(Data* d){cudaStreamSynchronize(d->cuStream);}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!