On 11/03/07, Erich Hoover ehoover@mines.edu wrote:
So, which change exactly are you concerned about? Changes are:
- The removal of "glDeleteTextures(1, &This->cursorTexture);" in device.c
This change should just keep SetCursorProperties from deleting the gl texture. By removing this call an application can set the cursor to A, change the cursor to B, then change the cursor back to A without having the texture deleted. 2) The temporary allocation of This->glDescription.textureName in surface.c This change should allow SetCursorProperties to retrieve "cursor A" the second time in the "A, B, A" sequence. Without this change, SetCursorProperties gets back a texture of "0" from the IWineD3DSurface_PreLoad call. This allocation is temporary since SetCursorProperties immediately resets that value: This->cursorTexture = pSur->glDescription.textureName; ... pSur->glDescription.textureName = 0; /* Prevent the texture from being changed or deleted */
I don't think I'm missing anything here... However, the implementation of item #2 could be changed around by using flags, as you discussed in a previous email, and this would seem more consistent with the intent of SFLAG_FORCELOAD (see the attached patch).
Erich Hoover ehoover@mines.edu
You're trying to solve the wrong problem :-) The problem is that when we set the textureName to 0 we essentially kick the GL texture out of the surface which is then left in a somewhat inconsistent state. Calling SetCursorProperties again with the same surface will then fail because the surface no longer has a GL texture associated with it. The proper way to fix this is to make a copy of the GL texture rather than playing tricks with the surface loading code.