Am Montag, 7. April 2008 08:30:20 schrieb Alexander Dorofeyev:
Oh, you are right. Must be fixed some other way then, I guess, maybe moving assignment to isInDraw lower or moving ActivateContext higher. From what I understood from Bioshock bug (http://bugs.winehq.org/show_bug.cgi?id=9973), moving ActivateContext in drawPrimitive produces bugs in other programs, right? Could you add to that bug a short description of what games etc needed to reproduce these problems?
There are two design issues here:
One is that FindContext, which executes before the wglMakeCurrent call does OpenGL calls. In some situations it has to do, e.g. reading the texture from a Pbuffer before switching to some other buffer, in some cases it can't, e.g. on a thread switch. I am not sure about the solution yet, but maybe we have to ActivateContext the old render target in FindContext before reading back textures if we find a thread switch and target switch at the same time.
The other issue, and that's the problem with Bioshock, is that ActivateContext isn't really aware of the FBO stuff. I've been discussing this with Henri some time ago, but we didn't find a solution. The nicest way would be to make ActivateContext select tge fbo, color buffer 0 and the depth stencil, and to make color buffers 1+ regular states handled in the state table. Unfortunately that doesn't work because drivers don't like it if we activate an incomplete fbo.