Hi,
I wanted to play around with the improvements to ddraw/d3d, and tried to run Final Fantasy 8 which worked before in software rendering mode with the native direct music dlls.
Unfortunately FF8Config (and FF8 itself) crashes now with the recent changes. The patch which introduces the regression is: http://www.winehq.com/hypermail/wine-cvs/2002/11/0231.html (cvs version just before the patch works, applying the patch results in a pagefault.)
The problem appears to be that GL_IDirect3DImpl_3_CreateDevice gets called with an rclsid = IID_D3DDEVICE2_OpenGL instead of IID_D3DDEVICE3_OpenGL, so that an D3DDevice2 gets created for the Direct3D3 interface (which results in a pagefault later, when the device is used.) See traces below.
Im still trying to find the bug (and then a fix :-), but it would help me a lot, if someone could tell me where the GL_IDirect3DImpl_3_CreateDevice gets called from.
(I see that it is an entry in the vtable but haven't found the function there it gets gets called yet..)
regards, Jens Hoffmann
** trace for the old version: (cvs 11/24/02 16:14:09 CST) ** ... trace:ddraw:Main_DirectDraw_QueryInterface (0x403a4568)->({bb223240-e72b-11d0-a9b4-00aa00c0993e},0x40852 3cc) trace:ddraw:direct3d_create creating implementation at 0x403a5380. trace:ddraw:Main_DirectDraw_QueryInterface returning Direct3D3 interface at 0x403a5384. trace:ddraw:Main_DirectDraw_AddRef (0x403a4568)->() incrementing from 2. trace:ddraw:GL_IDirect3DImpl_3_CreateDevice (0x403a5380/0x403a5384)->({31416d44-86ae-11d2-822d-a8d53187cafc},0x403a4e28,0x408523d0) trace:ddraw:d3ddevice_create creating OpenGL device for surface = 0x403a4e28, d3d = 0x403a5380 trace:ddraw:d3ddevice_create visual found trace:ddraw:d3ddevice_create context created (0x80a0260) trace:ddraw:d3ddevice_create setting current context err:ddraw:set_context This function should not be called in the current state of the code... trace:ddraw:d3ddevice_create current context set trace:ddraw:d3ddevice_create creating implementation at 0x403a5770. trace:ddraw:create_device_helper returning OpenGL D3DDevice3 (nil) trace:ddraw:Thunk_IDirect3DDeviceImpl_3_EnumTextureFormats (0x403a5774)->(0x405393,0x42e014) thunking to IDirect3DDevice7 interface. ...
** trace for cvs head: ** ... trace:ddraw:Main_DirectDraw_QueryInterface (0x403a4540)->({bb223240-e72b-11d0-a9b4-00aa00c0993e},0x408523cc) trace:ddraw:direct3d_create creating implementation at 0x403a54b0. trace:ddraw:Main_DirectDraw_QueryInterface returning Direct3D3 interface at 0x403a54b4. trace:ddraw:Main_DirectDraw_AddRef (0x403a4540)->() incrementing from 2. trace:ddraw:GL_IDirect3DImpl_3_CreateDevice (0x403a54b0/0x403a54b4)->({31416d44-86ae-11d2-822d-a8d53187cafb},0x403a4f18,0x408523d0) trace:ddraw:d3ddevice_create creating OpenGL device for surface = 0x403a4f18, d3d = 0x403a54b0 trace:ddraw:d3ddevice_create visual found trace:ddraw:d3ddevice_create context created (0x809f818) trace:ddraw:d3ddevice_create setting current context trace:ddraw:set_context glxMakeCurrent 0x80690c0, 62914563, 0x809f818 trace:ddraw:d3ddevice_create current context set trace:ddraw:d3ddevice_create creating implementation at 0x403a55e8. trace:ddraw:create_device_helper returning OpenGL D3DDevice2 0x403a55f0 trace:ddraw:Thunk_IDirect3DDeviceImpl_2_NextViewport (0x403a55f0)->(0x405393,0x42cb40,00000000) thunking ...
Im still trying to find the bug (and then a fix :-), but it would help me a lot, if someone could tell me where the GL_IDirect3DImpl_3_CreateDevice gets called from.
Well, the real question is to wonder why the application requests to create a Direct3DDevice2 and not a D3DDevice3 as it should...
For that, look at any enumeration function called before this and check that it returns the right interface. Because, well, the application cannot just invent this GUID, it needs to get it from somewhere.
Check also your registry (so that maybe if there was a bug once, you maybe 'polluted' your registry with an old and wrong GIUD that now makes the application crash).
Anyway, not really able to debug right now (I am 'roaming' and on Win2K right now as I have no net access on Linux).
Lionel
On Tuesday 03 December 2002 04:09, Lionel Ulmer wrote:
Im still trying to find the bug (and then a fix :-), but it would help me a lot, if someone could tell me where the GL_IDirect3DImpl_3_CreateDevice gets called from.
Well, the real question is to wonder why the application requests to create a Direct3DDevice2 and not a D3DDevice3 as it should...
It turns out that FF8Config calls IDirect3DImpl_2_EnumDevices (2 times) but then calls GL_IDirect3DImpl_3_CreateDevice.
Now, I don't know yet why it calls the D3D2 for Enum and D3D3 for CreateDevice, but it explains why it didn't crash in the cvs version from 11/24/02: the patch which introduced the crash contains: - XCAST(EnumDevices) Thunk_IDirect3DImpl_2_EnumDevices, + XCAST(EnumDevices) GL_IDirect3DImpl_2_EnumDevices,
if I change "GL_" back to "Thunk_" in the current cvs so that the IDirect3DImpl gets casted to the Direct3D3 interface, then the program no longer crashes. (But that does not say much, since it only tests for features and doesn't really use D3D)
-- Jens
It turns out that FF8Config calls IDirect3DImpl_2_EnumDevices (2 times) but then calls GL_IDirect3DImpl_3_CreateDevice.
Could you send me a +ddraw trace of the problem happening ?
If this is what I think, the fix will be very easy to do and simplify our code a little bit.
Basically, we have one GUID per D3DDevice revision... And according to what you tell, this must be wrong => one just have to change the code to always report only one GUID and after do the dynamic COM cast according to the interface calling the function.
I will see what I can do this evening.
Lionel