Direct3D 9 - A Possible Philosophical Issue For Discussion
I've added 1 (one) vertex shader to it.
Now, before you start baying for my blood, there's a good and very valid reason for this. But before I give the reason, bear in mind what I said a good bit upthread about D3D being able to software-emulate vertex shaders. That means that it retains full compatibility: there's no bumping of the hardware requirements involved here.
Also - it's a single generic vertex shader that all vertices go through, so it keeps with the philosophy of "one place for everything and everything in one place".
Now for the good and valid reason. I lied: there's actually two.
First, and the biggie, is the dreaded Direct3D
half-texel offset problem. If you've noticed that the 2D GUI widgets look significantly poorer quality in D3D, that's the reason why. Another symptom would be black lines around the water textures with r_oldwater 0 (you didn't see this in D3D 8 because r_oldwater 0 wasn't supported).
The thing is, the
only way to cleanly and non-intrusively fix this is by tagging some lines of code onto a vertex shader. Believe me, I tried other ways, and they all had the downside of needing (in some cases significant) changes to the base engine code (FQ's GL_SetCanvas thing would have had impact throughout the codebase).
Essential reading:
http://aras-p.info/blog/2016/04/08/solving-dx9-half-pixel-offset/
Second reason: texture matrix. There are API differences with how the texture matrix is applied, and the only alternative way to work around them was to software-emulate the texture matrix and apply it before copying over texcoords. That ran incredibly slow.
Potential third reason: I only mentioned two above, but this is a potential third: there are also API differences with texgen, and if in the future Mark V ever uses texgen for anything, this is the cleanest and most performant way of bypassing them.
Anyway, I am willing to back out of this if Baker (or any other key user of Mark V) considers it too objectionable, or otherwise considers the fallback modes acceptable, but I do strongly recommend it as the best and most compatible solution. In particular I consider the half-texel offset problem completely unacceptable; while the others would have viable software fallbacks (at a performance cost), fixing half-texel offset acceptably but in a different way would require re-implementing the entire transform pipeline in software (or invasively modifying the base engine code in too many places).