Jump to content
  • Advertisement
Sign in to follow this  

CPU-GPU parallel processing

This topic is 4018 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am trying to render a bloodtree data set. I use both CPU and GPU to do this. For the CPU part I have a thread which processes the segments in parallel, the main program handles the GPU part. I am using a fragment shader to do this. I have a global counter which keeps track of the processed segments, the CPU or the GPU, whichever finishes first takes up the next segment. My problem is some segments are missing in the output, when I comment out the CPU thread part, the GPU renders all the segments, but when both are processing, the blood vessels are not continuous. Can anybody help? The code is given below: // Thread (CPU) function void threadFunction() { while (Counter < dataSize) { GLfloat *vert = new GLfloat[size]; GLfloat *norm = new GLfloat[size]; segmentComputation(vert, norm, Counter); // Function to process the segment lock(); Counter++; unlock(); } } void GPUFunction() { pthread_create(&CPUthd, 0, threadFunction, this); // call the CPU thread while(Counter < dataSize) { // enable fragment program // bind fragment program // send the fragment to be processed and increment counter lock(); Counter++; unlock(); // render to FBO // copy FBO to PBO // render PBO // render the CPU part } }

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!