http://bugs.winehq.org/show_bug.cgi?id=15644
--- Comment #11 from Tobias Jakobi liquid.acid@gmx.net 2008-10-18 08:27:26 --- Hi there,
I have sort of isolated the problem.
It's the glBindTexture(GL_TEXTURE_2D, texture) call in depth_blt that fails. According to the OpenGL reference there are two possible ways to trigger such a failure: (i) GL_INVALID_OPERATION is generated if texture was previously created with a target that doesn't match that of target. (ii) GL_INVALID_OPERATION is generated if glBindTexture is executed between the execution of glBegin and the corresponding execution of glEnd.
I highly doubt that (ii) is the cause, since that would also cause some other OpenGL calls to fail as well. Leaves us with (i).
I'm currently trying to figure out if GL_TEXTURE_2D is not always the correct target to use with the supplied texture id.
Note that (as Henri stated) the depth_blt function gets called from surface_load_ds_location. There are two calls there, only the second one (the "Copying depth texture to onscreen depth buffer" one) fails. The other one doesn't seem to cause any trouble.
Major difference: The first one is called with device->depth_blt_texture as texture id, the second one with This->glDescription.textureName.
AFAIK we can be sure that device->depth_blt_texture has a 2D target if it has been created inside surface_load_ds_location by the glGenTextures(1, &device->depth_blt_texture) call. That's because the first target where a tex id is bound to specifies the target of the texture object (that's what the OpenGL reference tells me).
I dunno where else it could be created, but at least for now I don't see why we can ALWAYS assume that it has target GL_TEXTURE_2D.
Can anyone comment on that?
The same applies for This->glDescription.textureName, as it may have a different target.
That's my research so far. I'm currently trying to figure out the correct target for the texture object passed to depth_blt and also pass this info to depth_blt as well, so it can be correctly handled there. We'll see if that fixes the problem.
Greets, Tobias