1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

72 Commits

Author SHA1 Message Date
narzoul
8e07040750 Moved dynamic index/vertex buffers to separate class 2020-06-16 22:20:40 +02:00
narzoul
b5e3de76cb Use QueryThreadCycleTime for mitigation of busy waiting 2020-06-02 17:18:13 +02:00
narzoul
bff7253ecd Improved rendering performance for indexed and system memory primitives 2020-05-26 14:42:14 +02:00
narzoul
ca9404ec6f Suppress flushes from execute buffers
Mitigates performance issues in Rowan's Mig Alley (issue #12).
2020-05-26 00:15:41 +02:00
narzoul
757f648385 Support injection via dciman32.dll 2020-05-10 14:20:35 +02:00
narzoul
10f61c11e9 Emulate disabled font smoothing 2020-04-28 09:20:48 +02:00
narzoul
d06fe4e6ba Hook Direct3D execute buffer interface 2020-04-19 01:31:15 +02:00
narzoul
652bf67706 Hook Direct3D light and material interfaces 2020-04-17 23:53:18 +02:00
narzoul
ec7a40333e Attempt to mitigate thread scheduling issues caused by busy waiting
Fixes black intro videos in Star Wars Rebellion (issue #22)
and performance issues in The Longest Journey.
2020-04-12 16:18:56 +02:00
narzoul
aeaeeaed4d Log window message names 2020-02-01 14:11:47 +01:00
narzoul
bb6092e0bd Partial workaround for black D3DTA_DIFFUSE color on some drivers when RHW=0
Fixes black screen issues under some circumstances (e.g. underwater) in
Might and Magic 9 (issue #48).
2019-08-10 14:23:52 +02:00
narzoul
d23904afd2 Prefer color fills in system memory 2019-08-01 16:00:22 +02:00
narzoul
c526cc2506 Prefer locks and blits in system memory 2019-08-01 16:00:21 +02:00
narzoul
07de716af9 Reworked oversized surface support 2019-08-01 16:00:18 +02:00
narzoul
3e0eada40d Refactored adapter and device references 2019-08-01 16:00:17 +02:00
narzoul
26f8742dc2 Reverted forcing surfaces to system memory 2019-08-01 16:00:10 +02:00
narzoul
5b171691f0 Separate DirectDraw and UMD critical sections 2019-06-08 15:59:17 +02:00
narzoul
727be63db1 Implement GDI system palette emulation 2018-12-31 20:31:58 +01:00
narzoul
58aba66ca2 Hook all GDI threads 2018-12-08 21:57:13 +01:00
narzoul
785663700d Separate GDI and DirectDraw surfaces 2018-12-08 21:53:40 +01:00
narzoul
6183aed7da Optimize GDI redraw on window position changes 2018-12-08 21:53:38 +01:00
narzoul
39d148e3ba Aggregate render target locks 2018-02-03 17:02:32 +01:00
narzoul
4b02a40bc9 Hooked the IDirectDrawGammaControl interface 2017-06-05 16:35:48 +02:00
narzoul
640f746633 Implement 8/16 bit display mode emulation
8/16 bit display mode emulation is now implemented internally instead of
relying on the builtin Windows shims, as those are sometimes unreliable
(not triggering for some games on some systems when they should).

External DirectDraw hooks (such as the DWM8And16BitMitigation shim)
are disabled to avoid interference.

Fixes issues reported in #8, #9, #15.
2017-05-28 15:40:33 +02:00
narzoul
d1cd72b304 Hooked the IDirectDrawClipper interface 2017-05-20 11:34:28 +02:00
narzoul
cd22b333e3 Support oversized surfaces in system memory
AMD drivers reject system memory surfaces that are larger than the maximum
texture width/height supported by the driver (usually 4096x4096 for AMD).
This can cause issues in games that create larger system memory surfaces.

This workaround crops the driver resource dimensions to the allowed
maximum values and handles blitting outside this region by creating a
temporary resource that maps to the actual affected system memory region.

Fixes crashes with AMD drivers in Rainbow Six games and Desperados,
mentioned in issue #2 and #8.
2017-02-18 18:53:53 +01:00
narzoul
26995d6108 Create palettized surfaces in system memory 2016-12-22 20:49:00 +01:00
narzoul
d898961a7e Restore legacy double/triple buffered v-sync behavior
On recent drivers, double buffered DirectDraw flips no longer wait for the
vertical sync before returning and instead just insert the flip into the
flip queue for later execution. This effectively results in triple buffered
behavior (in the render-ahead sense) and causes up to an extra frame of
latency even if the flip queue size is set to 1.

To restore the legacy double buffered behavior, each flip waits for the
presented frame to leave the flip queue before returning.

To restore the legacy triple buffered behavior, the flip queue size is
forced to 1. This causes the flip to wait if the previous flip is still
pending.
2016-12-04 15:43:05 +01:00
narzoul
89f1556789 Lock render targets via off-screen plain copy
Video memory render target surfaces get an additional video memory off-screen
plain surface used for providing efficient direct memory access (locking).
All 2D operations starting with a lock are redirected to the off-screen plain
surface until the next rendering operation requires the render target surface.
The two surfaces are kept in sync via blits as needed.

Fixes performance issues in Rogue Spear menus, mentioned in issue #2.
2016-11-06 19:52:33 +01:00
narzoul
003c3e2f3b Moved Direct3D DDI struct logging to Log subdirectory 2016-11-05 11:46:01 +01:00
narzoul
32259119c3 Hooked the IDirect3DVertexBuffer interfaces 2016-10-31 13:48:26 +01:00
narzoul
2d22ace9f1 Hooked the IDirect3DTexture interfaces 2016-10-31 13:48:19 +01:00
narzoul
6e95f7ca1b Hooked the IDirect3DViewport interfaces 2016-10-31 13:48:12 +01:00
narzoul
7220b80999 Tagged all DirectDraw objects for tracking lifetime 2016-10-31 13:47:59 +01:00
narzoul
47f02667bf Moved FullScreenTagSurface implementation to separate layer 2016-10-23 15:28:08 +02:00
narzoul
0dbd210649 Moved CompatPrimarySurface implementation to separate layer 2016-10-23 15:28:02 +02:00
narzoul
19cce6b9d6 Preparation for splitting the DirectDrawSurface wrapper into layers 2016-10-23 15:27:56 +02:00
narzoul
b8832a92be Moved DLL related parts to Dll namespace and subdirectory 2016-10-23 15:27:50 +02:00
narzoul
7fc059a02f Moved config header to Config subdirectory 2016-10-23 15:27:44 +02:00
narzoul
367f581e74 Moved Win32 API hooks to Win32 namespace and subdirectory 2016-10-23 15:27:38 +02:00
narzoul
66bc66f42f Moved visitors to Visitors subdirectories 2016-10-23 15:27:32 +02:00
narzoul
2097d737dc Moved common parts to Common subdirectory 2016-10-23 15:27:26 +02:00
narzoul
3243a17daf Moved Direct3D DDI parts to D3dDdi namespace and subdirectory 2016-10-23 15:27:16 +02:00
narzoul
1a9b4ce860 Moved Direct3D parts to Direct3d namespace and subdirectory 2016-10-23 15:25:32 +02:00
narzoul
55f840cb50 Moved DirectDraw parts to DDraw namespace and subdirectory 2016-10-23 15:25:27 +02:00
narzoul
b65f98f0e3 Moved GDI parts to Gdi namespace and subdirectory 2016-10-23 15:25:20 +02:00
narzoul
12ad482d29 Hooked Direct3D display driver interfaces 2016-10-23 15:24:34 +02:00
narzoul
b9b4a2aafd Fixed incorrect z-buffer bit depths reported in D3DDEVICEDESC
Legacy DirectDraw interfaces specify the z-buffer format as a single bit depth
number instead of as a DDPIXELFORMAT struct. DirectDraw seems to convert a
legacy z-buffer bit depth of N into a DDPIXELFORMAT with dwFlags = DDPF_ZBUFFER,
dwZBufferBitDepth = N and dwZBitMask set to 1s in the lowest N bits.

Some drivers (so far noticed with AMD only) report the list of supported
z-buffer bit depths incorrectly, resulting in a game potentially selecting a
bit depth that can't actually be created via the legacy interfaces.
For example, the driver may report 16 and 32 bits as supported whereas all
32 bit z-buffer pixel formats use only 24 bits for z-buffer (with the
remaining bits unused or used as stencil buffer). Meanwhile the same driver
doesn't report 24 bits as supported when it's actually supported.

This fix overrides the set of supported z-buffer bit depths in D3DDEVICEDESC
structs for HAL devices to align with the actually supported pixel formats.

Fixes a startup issue in Rainbow Six mentioned in issue #2.
2016-06-12 14:21:09 +02:00
narzoul
6aba3b6f39 Extended hooking to IDirect3DDevice interfaces 2016-06-12 12:32:33 +02:00
narzoul
691b10bff8 Extended hooking to IDirect3D interfaces 2016-06-12 12:27:12 +02:00