Thursday, July 15, 2010

Testing on Linux

I've been doing some preliminary testing on Linux (running via Wine in a VM) and the initial indication is that there is a little work required on my part to get things running OK.

The primary problem is with DirectQ's use of the D3DX library, or more specifically the fact that the Wine developers have not fully implemented all functions in this library, leaving a lot of them as stubs. D3DXCreateRenderToSurface and D3DXDeclaratorFromFVF are both called very early during DirectQ's video startup, and according to info on the Wine pages, both are currently either unimplemented or not implemented correctly.

The latter can be easily worked around in my code (I just need to create my vertex declarations the long way instead and the problem just goes away) but the former is a more interesting case. In summary, an exception is being thrown from inside the Wine implementation of D3DXCreateRenderToSurface. I know this for a fact as I surrounded it with MessageBox calls, so I'm quite confident that I'm not blaming the Wine folks in the wrong here. No amount of error checking or working around on my part can do anything about that.

The only reasonably sane way of dealing with this is to surround the render target creation with a __try/__except handler and catch the failure, which actually works out quite OK. DirectQ already has code for an alternative underwater warp if the rendertarget failed to create anyway, so I guess this is the current fallback mode for Wine, and, one day if the Wine developers implement this properly, it will just start working automatically.

I'm going to do the vertex declaration changeover later on, but it's not beyond the bounds of possibility that there are other things either unimplemented or just broken in Wine, so that doesn't mean it's going to work after I get that done.

2 comments:

MK said...

How hard would it be to fix those issues in Wine?

mhquake said...

Quite easy actually... new post coming up!