http://bugs.winehq.org/show_bug.cgi?id=11584
Stefan Dösinger stefandoesinger@gmx.at changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #31 from Stefan Dösinger stefandoesinger@gmx.at 2008-04-10 04:35:41 --- As far as I can see the problem will occur when the app switches threads while rendering to an offscreen surface. In that case it will try to alloc a texture, which calls activatecontext with lastActiveRenderTarget. Thus it works fine on render target switches, but on thread switches it fails because the new thread number isn't assigned yet.
This PreLoad call should be removed at all. The other one is needed, but this one here is at the wrong place. I am not sure why I added it there. Maybe it was a workaround for a bug elsewhere then we should track it down. If it is really needed it should probably be moved to SetRenderTarget rather than ActivateContext, or the recursion has to be prevented.
The other PreLoad needs some safeguards as well. For reading back on a target switch it works because the readback will activate the context for the old(current) render target, and since the new render target is set after FindContext it works as intended. If there is a thread switch we wouldn't have to read back at all, so we should make sure readTexture is only set on a target switch. However, there's still the issue if the thread and target are switched at the same time. In this case we have to activate the old target for the new thread, read back, then activate the new target for the new thread.