ATI + two GL contexts sharing resources = trouble?

Hi

I have some problems with my opengl usage scenarion on radeons HD.

I have two threads - the renderer thread and loader thread, each has it’s own opengl
context and they share resources via wglShareLists(LoaderContext, RendererContext);

The loader thread reads processes requests from renderer thread,
loads and decompresses resources and uploads them to buffers.

(Basically the loader thread calls only those functions:
glGenTextures, glBindTexture, glCompressedTexImage2D, glTexImage2D, glGenBuffers, glBindBuffer, glBufferData)

The renderer thread renders stuff to FBO’s and processes new resources as they are singnaled as ready to use.

Now on ‘that other hardware ;)’ (nvidia) all is fine, but on all radeons HD (both catalysts 9.5 and 9.6)
when the new resource is loaded on the worker thread (it is not yet binded or used by rendering thread) the other resources
(GL_ARRAY_BUFFER objects to be exact) get’s messed for a duration of one frame - they just contain some garbage to the call
of ‘SwapBuffers’ after that call they are back to normal.

It seems to me that driver relocated (changed address) of the resources that were still referenced in command buffer.
so after the command buffer gets flushed and the new one is constructed all is ok - the new addreses are proper again.

This couses realy uggly visual glitches - large triangles apearing on the screen from nowhere, etc. etc.
(It’s not the faulty hardware, I’v tested this on several radeons hd 4800 on different machines running windows XP SP3, windows vista and windows vista x64)

It is known issue ?
If yes - is there any workaround ?
I need to stream my resources from disk - couse i have a realy huge database of elements to render and i cannot have them at once in memory,
olso the preparation of the resources takes some amount of time - so solution with two threads is ideal. (expect the visual glitches on ATI :|)

Afaik you don’t gain much by doing the actual uploads in a secondary thread. I think the better solution is to only load the data into the buffers in the loader thread, and let the render thread gen/map buffers, and unmap/upload textures. This way you only have one context. Use PBO’s for textures.

Then again, some things may have changed lately :slight_smile: