mauvecow / DxPortLib

DxPortLib is a portability library for DxLib based software.
Other
41 stars 6 forks source link

Long-term: Direct3D backend. #3

Open mauvecow opened 8 years ago

mauvecow commented 8 years ago

Stability of OpenGL support on Windows is apparently lacking and seems to conflict with the Steam Overlay more than I'd like, even when it does work.

This is going to mean a few things:

Not too bad but a fair bit of work and testing. The 3D math also likely needs to be thoroughly tested before it finishes being integrated.

mauvecow commented 8 years ago

This is likely to be the first up due to the fact that I really want to replace DxLib on Windows, so some notes on how this is going to go down.

On Windows we will just default to D3D. There's really no reason not to! OpenGL can be a fallback, but apparently we do not get access to SDL_RecreateWindow publicly, so I'm not 100% sure what to do there. I'll check to see if creating the window with SDL_WINDOW_OPENGL does any damage to D3D, I suppose? (Alt: If SDL_CreateWindow fails, we try to open sans OpenGL and see what happens.)

Technically, we could use ANGLE on Windows, but it is not supported on XP and that's basically the number one problem area for bad or nonexistent OpenGL drivers, and I'd like to keep supporting the 1~2% there.

Need to get ZBuffers sorted out pretty soon. They're attached to framebuffers, regardless; DxLib appears to supply a default? Need to check.

The screen offsets I am probably going to handle with by translating the projection matrix on the GL side.

Shader support is going to wait awhile as we're sticking with classic, bad-style D3D.

mauvecow commented 8 years ago

Also: we'll continue to use SetPresetProgram until shaders become sorted out properly.

mauvecow commented 8 years ago

Since I'm reviewing this again, I should note that I received a number of bug reports related to that it just crashes if GL initialization fails. It shouldn't fail, but we have no proper handler for it.

To prevent crashing, when it's time to add a new backend, also add a Dummy backend so that it doesn't have to deal with NULL calls all the time.