Monday, January 16, 2012

More Video Code

The main D3D-related video code is now down to 900-odd lines. That's about twice as much as my D3D11 version, but much of it is lost device handling, capabilities checking and fallback modes, which don't exist with D3D11.

Been spending a lot of time playing around with switching modes, Alt-Tabbing back and forth, and so on, and things seem solid and behave correctly.

An old DirectQ bug where Aero would be disabled if you switched from a fullscreen mode to a windowed mode has been fixed. This was due to some badly placed window resizing code.

A lot of the old window management code from GLQuake has gone. This was old stuff that was only needed because OpenGL forces you to do much of your own window management; D3D, being more tighly integrated with the windowing system, does much of it for you.

I now have a more robust way of specifying when the video mode list has changed and forcing the first run back to 640x480 windowed mode (required to protect you from accidentally specifying a bad mode from the new list). This means that I was able to drop my "d3d_mode" cvar and bring back good old "vid_mode".

I haven't yet worked out how resolutions and refresh rates are going to work together in the menus.

I've removed the ability to resize the window by dragging it's borders. This was more of a cutesy feature than anything that seemed essential, and it has interactions with the currently selected video mode that complicate things excessively.

I may yet go back and rework the modes list so that it exactly replicates GLQuake's list, with mode 0 being a windowed mode which may vary (depending on values of vid_width and vid_height) and the rest of the modes being the fullscreen modes. Depends on how things work out with refresh rates, but I have a hunch that the new code should be able to do it without too much mess.

I'm going to add multisampling to the video options menu. It was released in the last version but not especially advertised because I was uncertain how stable it was, but I'm happier with the code I have coming together now and am satisfied that I can provide a stable implementation.

The only remaining thing that I have any wobbles about is how to deal with cases where people try to force settings in their driver's control panel. I really wish that those things would just go away.

That's all for now.

No comments: