Skip to main content
gamedev.net
🔒 Locked

OpenGL multitreading

Started by Nielske 5 replies 1.9k views
Original Post
Nielske
Nielske
Hello, I am aware openGL isn't thread safe, so I didn't look into multitreading at all. But I am using c++/opengl/cuda and I have some unexplainable problems (with the cuda vs opengl) and I am thinking my visual studio is compiling it multitreaded which I never wished for. Is there any way to disable this, as I want to try this first before looking at other things.. Best Regards Nielske
TheGilb
TheGilb
I think it's very honourable that you want to solve your problem yourself and let's be honest, when the unexplainable occurs the best trick to fix it is to first of all rule out all the possible problems. However, you will find that in reality, unless you have actually written multithreaded code using a pthreads style api, openmp or unadulterated system api calls then your compiler is quite woefully out of tricks and wont automatically thread your code - that would be quite clever huh. But come on, this is the 21st century, OpenGL isn't an infant, it's a beast, and if you dont know everything about what you're doing with it then it can be tricky business tracking down bugs hidden in the gl state machine. Which is why I recommend you debug your program using a good tool for the job called GLIntercept. See normally you'd be paying a wedge of dosh for a ShaderX book for that tip, or spend a LONG time on google doing anything but coding, but because it's me I give you this information for free. What a guy.

http://glintercept.nutty.org/
Yann L
Yann L
Quote:
Original post by Nielske
I am aware openGL isn't thread safe, so I didn't look into multitreading at all.

This is a common misconception. OpenGL is perfectly threadsafe, as long as one adheres to a couple of simple rules.
stonemetal
stonemetal
It probably is but unless you are starting multiple threads it doesn't matter. to change it you can look through the project properties there is one about weather or not it is linking multithreaded enabled libraries but there is no way to set the executable build to single threaded.
Krohm
Krohm
Quote:
Original post by Nielske
But I am using c++/opengl/cuda and I have some unexplainable problems (with the cuda vs opengl) and I am thinking my visual studio is compiling it multitreaded which I never wished for.
What kind of problems? I don't think mixing those two togheter is a good idea. To a certain degree, it doesn't surprise me.
Previously "Krohm"
Nielske
Nielske
What kind of problems :
They are pretty CUDA related, but without accessing any PBO or reading from them, without launching CUDa kernels in between, I get errors when I try to unmap a BufferObject. The mapping itself succeeded but an unmapping error occurs (invalid device pointer it says)
I am asking in CUDA fora (on nvidia) itself too, but didn't get any usefull answer there.. so far..

Thx for the replies so far :D

[Edited by - Nielske on February 25, 2008 3:38:37 AM]
Nielske
Nielske
Hey,

The issue is "solved" or let's say tracked down to unregistering the Buffers in wrong order CUDA.
FYI :
If i register/map 3 buffers in order ABC, I need to unmap/unregister them in order CBA, if not a next reg/map/unmap/unregister will give an invaliddevicepointer on one of those buffers.

Topic can be closed because it's not really opengl, but more cuda<->opengl interop.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.