#
Contexts that are on different threads can share object resources. For
example, it is acceptable for one context in one thread to modify a
texture and a second context in a second thread to modify the same
texture. Why? Because the shared object handling provided by the Apple
APIs automatically protects against thread errors. And, your application
is following the "one thread per context" guideline.
#
made me think I could load a tex and use it at the same time...the
visual artifacts are making me reconsider! I could call glFinish (or
glFlush maybe) but those calls are moot without already putting some
synchronization between the threads..
For VBO loading I already do that, e.g. load a VBO from thread 1, call
finish to ensure the cmd is submitted, then send a signal to the other
thread, the receipt of which indicates the first legal use of the VBO,
hence load is serialized before draw.
But in this texture case the texture is already loaded and is just being
_reloaded_, so my hope was to not require any locking. Perhaps a
"double-buffering" scheme will be needed.
cheers
Ben
Kamil Rocki wrote:
Hi, I do not know the exact context of Your application and its
limitations, but some garbage can be produced with concurrent
read/write. Note that texture loading tasks are You can use glFinish()
to explicitly end particular texture processing tasks if that is Your
question, but it may block Your other threads as well. As I have written
I do not now, how does Your application look like.
Did you Read that?
http://developer.apple.com/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_threading/chapter_12_section_3.html
On 2008-05-14, at 23:08, Ben Supnik wrote:
Hi Y'all,
My code will re-specify the contents of textures using
glTexSubImage2d...right now there is no locking between the main
thread (which may be using the texture) and the worker threads (which
are reloading textures).
On the GF8800 I see one-frame flashes in my scene as the textures are
reloaded.
At one point I got a crash in gDrawElements while other threads were
calling glSubTexImage2d...both stacks went into the driver a bit.
Do I need to be applying a bit more locking, either to be correct or
to avoid artifacts?