Because multiple DirectDraw interface versions may share the same
method implementations, CompatVtable may dispatch calls to an earlier
interface where that method implementation was already hooked.
Therefore a call to QueryInterface is needed even if the method
thinks the result will be the same interface type; a simple
AddRef may not have the same effect.
Releasing the last reference to a surface interface has a significant
performance impact. Mitigating the issue by eliminating some frequent
but unnecessary QueryInterface calls.
Fixes most of the performance drop reported in issue #24.
Windowed mode presentation is changed to use a series of blits clipped to
each top level window to work around performance issues when a clipper uses
a clip list instead of a window. Otherwise DirectDraw uses StretchBlt rather
than the driver Present call even if the clip list is a single rectangle
matching the window client area.
Fixes a performance issue reported in issue #24.
When the 3D projection matrix is not set (transformation is performed in
software), pixel (table) fog effects appear to be missing on some drivers.
The matrix itself normally isn't passed to the user mode SetTransform
driver function anyway due to the fixed-function shader converters being
enabled by default. Instead only UpdateWInfo is called with the W-range
calculated from the matrix.
For the initial identity matrix, UpdateWInfo receives the range (1.0, 1.0).
This seems to cause Intel (HD 4600) drivers to interpret pixel fog ranges as
Z-depth values, while with any other range specified eye-relative (W) depth
is used. The actual values otherwise don't seem to matter with respect to
how fog is rendered.
On AMD (RX 480), eye-relative depth is used irrespective of the W-range.
There is currently no information on how NVIDIA drivers behave, except that
with the default W-range no fog seems to be produced.
This fix replaces the W-range (1.0, 1.0) with (0.0, 1.0) which causes Intel
to also interpret fog range in eye-relative depth with the default identity
projection matrix.
Fixes missing fog on Intel HD (and hopefully NVIDIA) in Combat Mission
games reported in issue #20.
Changed primary surface caps to report video memory in case the surface
was only forced into system memory by DDrawCompat.
Fixes startup issues in C&C 95 and Red Alert, reported in issue #3.