Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Direct3D 8 Frontend #3411

Merged
merged 306 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
306 commits
Select commit Hold shift + click to select a range
62e685b
[d3d8] Basic CopyRects cases
AlpyneDreams Oct 18, 2020
9b0555a
[d3d8] Separate vertex and pixel shaders, fix caching
AlpyneDreams Oct 18, 2020
d05a951
[d3d8] Correctly track SetTexture state
AlpyneDreams Jul 24, 2021
5cab65e
[d3d8] Add D3D9 bridge
AlpyneDreams Oct 9, 2022
c8e50fd
[d3d8] Fix GetAdapterModeCount using signed int
AlpyneDreams Sep 12, 2021
44a81a4
[d3d8] USe 'this->GetD3D9()' in generic types
AlpyneDreams Sep 12, 2021
959b327
[d3d8] Fix casting pointers to DWORD
AlpyneDreams Sep 12, 2021
b04a181
[d3d8] Stop d3d9types.h defining redundant rect/matrix
AlpyneDreams Sep 12, 2021
5d8ef77
[d3d8] Fix UUID decls on MinGW
AlpyneDreams Sep 12, 2021
229b036
[d3d8] Link lib_d3d9 directly rather than statically
AlpyneDreams Sep 16, 2021
60ddcbb
[d3d8] Specify d3d9::D3DPOOL
AlpyneDreams Sep 18, 2021
5fbe115
[d3d8] Fix dodgy bit flag check
AlpyneDreams Sep 18, 2021
c9cddbc
[d3d8] Zero-initialize D3D8StateCapture properly
AlpyneDreams Sep 18, 2021
d18b250
[d3d8] Remove unused stubs
AlpyneDreams Sep 18, 2021
013d365
[d3d8] Rebase fixes
AlpyneDreams May 11, 2022
0f5e81b
[d3d8] Add GetD3D9Nullable
AlpyneDreams Oct 9, 2022
9fddf35
[d3d8] Fix nullable SetIndices and SetStreamSource
AlpyneDreams May 13, 2022
adba683
[d3d8] Fix texture V clamping
AlpyneDreams May 14, 2022
7463fac
[d3d8] Add D3D9InterfaceBridge
AlpyneDreams May 14, 2022
726ec14
[d3d8] Add D3D8Options
AlpyneDreams May 14, 2022
dff672c
[d3d8] Bail if CreateDevice fails
AlpyneDreams May 15, 2022
4b89e1e
[d3d8] Add forceD16 hack
AlpyneDreams May 15, 2022
906bc02
[d3d8] Disallow null CopyRects
AlpyneDreams Oct 9, 2022
556beb0
[d3d8] Add SetCursorProperties
AlpyneDreams May 19, 2022
485446a
[d3d8] Fix deleted shaders not being cleared
AlpyneDreams May 19, 2022
e7b95b5
[d3d8] Add package-debug.sh
AlpyneDreams Oct 6, 2022
90c1e8a
[d3d8] Rebase: remove deleted header
AlpyneDreams Oct 9, 2022
7d29c77
[d3d8] Distinguish D3D9 bridge vs. interop
AlpyneDreams Oct 9, 2022
6cf0670
[d3d8] CreateVertexShader: Allow NULL pFunction
AlpyneDreams Oct 20, 2022
4a3ec03
[d3d8] Fix undefined behavior with this == NULL
AlpyneDreams Oct 20, 2022
a4e99d2
[d3d8] Support additional swap chains
AlpyneDreams Oct 20, 2022
0bf2c9a
[d3d8] Add custom build/setup scripts
AlpyneDreams Oct 20, 2022
604fdaa
[d3d8] Update README.md
AlpyneDreams Oct 20, 2022
df08641
[d3d8] Add better error for incompatible d3d9.dll
AlpyneDreams Oct 20, 2022
15fdf0e
[d3d8] Report PS/VS version 1.4
AlpyneDreams Oct 21, 2022
6f027b5
[d3d8] Support GetStreamSource
AlpyneDreams Oct 21, 2022
dcb304a
[d3d8] CopyRects: fix rect going out of scope
AlpyneDreams Oct 22, 2022
fa23055
[d3d8] CopyRects: accept unbound RTs
AlpyneDreams Oct 22, 2022
58d33b8
[d3d8] Implement basic IDirect3DVolumeTexture8
AlpyneDreams Oct 22, 2022
d16327b
[d3d8] [build] Fix --no-proton
AlpyneDreams Oct 22, 2022
98598fe
[d3d8] Add D3D8Volume() constructor
AlpyneDreams Oct 22, 2022
e2024ce
[d3d8] Support D3DVSD_SKIP
AlpyneDreams Oct 22, 2022
842e741
[d3d8] Better debug info for CreateVertexShader
AlpyneDreams Oct 22, 2022
e1c7c08
[d3d8] Support D3DVSD_TOKEN_CONSTMEM
AlpyneDreams Oct 22, 2022
425dc8d
[d3d8] Make vs rsq use src0.wwww
AlpyneDreams Oct 22, 2022
751a707
[d3d8] Separate vertex shader code
AlpyneDreams Oct 22, 2022
9331350
[d3d8] Update CopyRects to handle more cases
AlpyneDreams Oct 24, 2022
6e4f16f
[d3d8] Store present params in device
AlpyneDreams Oct 24, 2022
c09952e
[d3d8] Fix multiple backbuffers
AlpyneDreams Oct 24, 2022
c984b57
[d3d8] CreateImageSurface - use POOL_DEFAULT
AlpyneDreams Oct 24, 2022
8fbe853
[d3d8] Implement UpdateTexture
AlpyneDreams Oct 24, 2022
dac7ff7
[d3d8] Add Get*ShaderContstant
AlpyneDreams Oct 24, 2022
4c90cab
[d3d8] Store shader functions and declarations
AlpyneDreams Oct 24, 2022
59fc926
[d3d8] Add GetFrontBuffer
AlpyneDreams Oct 24, 2022
b6bf2fa
[d3d8] Implement barebones GetInfo
AlpyneDreams Oct 24, 2022
3d451f3
[d3d8] Implement ProcessVertices
AlpyneDreams Oct 24, 2022
f8b1ba7
[d3d8] No more stubs! 🎉
AlpyneDreams Oct 24, 2022
e14aa00
[d3d8] Fix bad jump in CopyRects
AlpyneDreams Oct 25, 2022
54d0814
[util] set enableDialogMode for Indiana Jones Emperor's Tomb
Blisto91 Oct 25, 2022
e126db1
[d3d8] chmod +x setup_d3d8.sh
AlpyneDreams Oct 28, 2022
c7b35d4
[d3d8] Fix native build
AlpyneDreams Nov 4, 2022
1db416c
[d3d8] Clean up vertex shader code
AlpyneDreams Nov 4, 2022
07aeed7
[d3d8] Implement stretching to systemmem
AlpyneDreams Nov 4, 2022
4cc3a42
[d3d8] CopyRects: Add GetRenderTargetData fast path
AlpyneDreams Nov 5, 2022
b8fff7d
[d3d8] VS: Declare correct usage indices
AlpyneDreams Nov 5, 2022
b3c970c
[d3d8] RSQ: Only replace .xyzw with .wwww
AlpyneDreams Nov 5, 2022
f4e2fd9
[d3d8] Fix SetRenderTarget
AlpyneDreams Nov 6, 2022
3f3e329
[d3d8] Cleanup texture and surface
AlpyneDreams Nov 6, 2022
5cd6fc9
[d3d8] Cache texture subresources
AlpyneDreams Nov 6, 2022
6268873
[d3d8] Make texture methods final
AlpyneDreams Nov 6, 2022
a4c979e
[d3d8] Properly free subresources
AlpyneDreams Nov 7, 2022
d6a17c0
[d3d8] Implicitly ref subresources
AlpyneDreams Nov 7, 2022
1a20f13
[d3d8] Cache temporary blit buffers
AlpyneDreams Nov 10, 2022
c2c8b64
[d3d8] Mark dest textures dirty, lock device
AlpyneDreams Nov 10, 2022
d804381
[d3d8] CopyRects: Use LockRect for system mem & managed
AlpyneDreams Nov 10, 2022
93210c4
[d3d8] CopyRects: Fail on managed->managed case
AlpyneDreams Nov 10, 2022
e9eb1a9
[d3d8] Fix cubemap mips
AlpyneDreams Nov 11, 2022
3da22c1
[d3d8] Use FVF reserved bit for shader handles
AlpyneDreams Nov 11, 2022
4dbac86
[d3d8] Surface desc size as bytes not bits
AlpyneDreams Nov 11, 2022
1074514
[build] Ensure setup_d3d8.sh works with spaces in basedir
AlpyneDreams Nov 11, 2022
ae4d635
[d3d8] Install to Proton lib64
AlpyneDreams Nov 12, 2022
c9e8cde
[d3d8] Fix CopyRects with offset in system mem
AlpyneDreams Nov 18, 2022
779c775
[d3d8] Clamp blocks per row to 1
AlpyneDreams Nov 18, 2022
efbd344
[d3d8] Hold on to render targets
AlpyneDreams Nov 18, 2022
3d732d0
[d3d8] Add D3D8Subresource
AlpyneDreams Nov 18, 2022
9b8f9c5
[d3d8] QueryInterface: Return errors when not implemented
AlpyneDreams Nov 19, 2022
06360ab
[d3d8] Implement QueryInterface
AlpyneDreams Nov 19, 2022
acd7ef7
[d3d8] CopyRects: Implement non-linear memcpy
AlpyneDreams Nov 19, 2022
b293a91
[d3d8] Don't hold on to render targets
AlpyneDreams Nov 19, 2022
540de48
[d3d8] Move CopyRects into d3d8_blit.cpp
AlpyneDreams Nov 19, 2022
f9e7f3f
[d3d8] Implement D3DRS_ZBIAS
AlpyneDreams Nov 24, 2022
e3cec97
[d3d8] Remove forceD16 hack
AlpyneDreams Nov 24, 2022
59aba58
[d3d8] Recognize more render states
AlpyneDreams Nov 24, 2022
7e959f5
[d3d8] Record SWVP in state blocks
AlpyneDreams Nov 24, 2022
9a21d35
[d3d8] Disallow cross-format blits in ram
AlpyneDreams Nov 27, 2022
18eb7fe
[d3d8] Implement full DXT CopyRect
AlpyneDreams Dec 6, 2022
6610faf
[Setup] Allow preserving current Proton installation
Sid127 Nov 12, 2022
44ab519
[setup] Fix compatibilitytool.vdf
AlpyneDreams Jan 3, 2023
8e198fe
[d3d8] CreateTexture: bail on fail
AlpyneDreams Jan 3, 2023
721e963
[d3d8] Ref backbuffers on creation
AlpyneDreams Jan 3, 2023
9517913
[d3d8] ResetState: textures, streams, indices
AlpyneDreams Jan 3, 2023
44d4804
[d3d8] Fixes for MSVC compiling
AlpyneDreams Jan 19, 2023
fa7f331
[build] GitHub: get D3D8 headers for MSVC
AlpyneDreams Jan 19, 2023
98c062a
[d3d8] Tentatively move Direct3DCreate8 to @5
AlpyneDreams Feb 1, 2023
28b352c
Use at least one BackBuffer in D3D8DeviceEx
WinterSnowfall Jan 23, 2023
317b475
Add memoryTrackTest & memory limit workarounds for Anito: Defend a La…
WinterSnowfall Jan 26, 2023
9baaddb
[d3d8] Misc formatting tweaks
AlpyneDreams Feb 23, 2023
c560660
[util] Disable direct buffer mapping for Red Faction
WinterSnowfall Feb 1, 2023
77ab2a7
[d3d8] Fix backbuffers never being cached
AlpyneDreams Feb 23, 2023
a66f50c
[d3d8] Ref rendertargets and depth stencils
AlpyneDreams Feb 23, 2023
a163321
[d3d8] Fix CreateStateBlock types
AlpyneDreams Feb 23, 2023
4d3bd8f
[d3d8] BeginStateBlock use type 0
AlpyneDreams Feb 23, 2023
903d927
[d3d8] Fix null pixel shaders not being rememered
AlpyneDreams Feb 23, 2023
8228a94
[d3d8] Cast null pixel shader to DWORD
AlpyneDreams Feb 24, 2023
4c5fd32
[d3d8] Hold on to rendertargets again
AlpyneDreams Feb 24, 2023
622a18c
[d3d8] Return D3D_OK if can't change SWVP
AlpyneDreams Feb 24, 2023
1dddc17
[d3d8] Properly cache depth stencil buffer
AlpyneDreams Feb 24, 2023
04a7ae8
[meta] Do not re-add current year in LICENSE
pchome Feb 23, 2023
1b3c6ba
[d3d8] Set/GetTexture: ref textures
AlpyneDreams Feb 24, 2023
6d3ae4e
[d3d8] Cleanup d3d8_main.cpp
AlpyneDreams Feb 26, 2023
c966a59
[d3d8] EndScene on Reset
AlpyneDreams Mar 4, 2023
5048c89
[build] Always build d3d9 if d3d8 is enabled
AlpyneDreams Mar 4, 2023
0047762
[misc] Actions: Only build d3d8 on MSVC
AlpyneDreams Mar 4, 2023
27819c1
[d3d8] Implement surface desc size
AlpyneDreams Mar 4, 2023
9b808ae
[d3d8] Make m_depthStencil ref private
AlpyneDreams Mar 5, 2023
d8779dc
[util] Enable apitraceMode for Motor City Online
WinterSnowfall Mar 26, 2023
19b8a94
[d3d8] Uncomment forwarding calls to SetCursorPosition
WinterSnowfall Mar 29, 2023
c7e4abd
[d3d8] Remove comments about cursor coords
AlpyneDreams Apr 15, 2023
a45567b
[util] Disable direct buffer mapping for Commandos 3 (#133)
WinterSnowfall Apr 15, 2023
961c5f5
[d3d8] Disable D3DLOCK_NOOVERWRITE
AlpyneDreams Apr 15, 2023
35462e8
[d3d8] Ignore Release calls on objects with 0 refCount
WinterSnowfall Apr 15, 2023
7787ba1
[d3d8] Adjust state block texture refcounts
WinterSnowfall Apr 15, 2023
5e83c48
[d3d8] Adjust texture and subresource refcounts
WinterSnowfall Apr 15, 2023
e214320
[d3d8] Adjust DS and RT refcounts
WinterSnowfall Apr 15, 2023
80b4602
[d3d8] Adjust VB, IB & backbuffer refcounts
WinterSnowfall Apr 15, 2023
9f89b6d
Revert "[d3d8] Disable D3DLOCK_NOOVERWRITE"
AlpyneDreams Apr 15, 2023
b18bdd6
[d3d8] DrawIndexedPrimitiveUP null stream 0 and indices
AlpyneDreams Apr 16, 2023
0e5b3c0
[d3d8] Store DEFAULT v/ibuffers in MANAGED
AlpyneDreams Apr 16, 2023
37f2338
[d3d8] Fix index buffers not being MANAGED
AlpyneDreams Apr 16, 2023
3ccdff7
[d3d8] Validate BackBufferCount in ResetState
AlpyneDreams Apr 19, 2023
391acea
[d3d8] Remove redundant usage checks
AlpyneDreams Apr 19, 2023
50680a4
[d3d8] Ref rendertargets and depth stencils
AlpyneDreams Apr 19, 2023
1dad443
[d3d8] Revert extra RT/DS refs for now
AlpyneDreams Apr 20, 2023
e0d8f74
[d3d8] Ref/release RT/DS only when changed
AlpyneDreams Apr 20, 2023
ce5b3fb
[d3d8] Keep ref to backbuffers and autodepthstencil
AlpyneDreams Apr 20, 2023
ce4cdc8
[d3d8] Get implicit surfaces directly from D3D9
AlpyneDreams Apr 20, 2023
dc69977
[d3d8] Reset d3d9 before ResetState
AlpyneDreams Apr 20, 2023
d7ee3da
[d3d8] Ref indices in GetIndices
AlpyneDreams Apr 20, 2023
a7a63e2
[d3d8] Call ForceEndScene before Reset
AlpyneDreams Apr 20, 2023
69054cb
[util] Remove superfluous allowDirectBufferMapping workarounds
WinterSnowfall Apr 17, 2023
545668d
[util] Add a buffer placement workaround for MCO
WinterSnowfall Apr 17, 2023
cb146a1
[util] Add a buffer placement workaround for Brigade E5
WinterSnowfall Apr 20, 2023
e4e6ed2
[util] Add a buffer placement workaround for Railroad Tycoon 3
WinterSnowfall Apr 20, 2023
4810374
[d3d8] Add managedBufferPlacement to dxvk.conf
AlpyneDreams Apr 22, 2023
d6b7652
[d3d8] Allow setting minimum size for managedBufferPlacement
AlpyneDreams Apr 22, 2023
81b7fe2
[d3d8] Set managedBufferPlacement for Supreme Ruler 2020
AlpyneDreams Apr 22, 2023
8366bd5
[d3d8] Fix bool values for managedBufferPlacement
AlpyneDreams Apr 22, 2023
5f7c4ef
[d3d8] Validate depth stencil formats
WinterSnowfall Mar 26, 2023
be93f68
[d3d8] Add forceVsDecl config option
AlpyneDreams Apr 26, 2023
b5d5a71
[d3d8] Set forceVsDecl for Pinball 2
AlpyneDreams Apr 26, 2023
a4bc55d
[d3d8] Fix missing enums on native
AlpyneDreams Apr 26, 2023
e7b640e
[d3d8] Clean up shader code
AlpyneDreams Apr 26, 2023
8024dce
[util] Add workarounds for SR2010 and Zwei: The Ilvard Insurrection
WinterSnowfall Apr 26, 2023
986be72
[d3d8] Cleanup comments and whitespace
AlpyneDreams May 6, 2023
f146993
[d3d8] Cleanup d3d8_device
AlpyneDreams May 6, 2023
5b24a89
[d3d8] Cleanup d3d8_shader
AlpyneDreams May 6, 2023
1faf0ee
[d3d8] Cleanup d3d8_interface
AlpyneDreams May 6, 2023
5ada6b2
[d3d8] Cleanup d3d8_blit
AlpyneDreams May 6, 2023
06d2795
[d3d8] Destroy state blocks on exit
AlpyneDreams May 6, 2023
e07cb9b
[d3d8] Fix extern/static issue on GCC
AlpyneDreams May 8, 2023
8f9592f
[d3d8] Fix extra refs to bridges and textures
AlpyneDreams May 8, 2023
23ae0c6
[d3d8] Mark state changes
AlpyneDreams Apr 20, 2023
2640bd0
[d3d8] Mark before D3D8-handled state changes
AlpyneDreams Apr 20, 2023
a5b8eea
[d3d8] Avoid more state changes
AlpyneDreams Apr 21, 2023
5cf3b48
[d3d8] Add basic D3D8Batcher
AlpyneDreams Apr 21, 2023
c901d75
[d3d8] Fix SetVertexShader not returning a value
AlpyneDreams Apr 21, 2023
78bb0b8
[d3d8] Basic index buffer batching
AlpyneDreams Apr 21, 2023
38c1ab8
[d3d8] Join tristrips with degenerate triangles
AlpyneDreams Apr 21, 2023
5151ea4
[d3d8] Batcher: handle SetIndices
AlpyneDreams Apr 22, 2023
b6e0dd8
[d3d8] Batcher GCC fixes
AlpyneDreams May 9, 2023
a062e46
[d3d8] Batcher code cleanup
AlpyneDreams May 9, 2023
35d9d36
[d3d8] Make batcher optional
AlpyneDreams May 9, 2023
2576fa0
[util] Add workarounds for NFS 3 and 4
WinterSnowfall May 4, 2023
79d04c4
[d3d8] Use batcher for NSF 3 and 4
AlpyneDreams May 9, 2023
f4f2ad7
[d3d8] Fix CI builds
AlpyneDreams May 9, 2023
1525b04
[d3d8] Fix steamrt builds
AlpyneDreams May 9, 2023
351c81a
[d3d8] Fix D3D8BatchBuffer::GetDesc
AlpyneDreams May 10, 2023
ea04785
[util] Config for IGI 2: Covert Strike
AlpyneDreams May 10, 2023
3c6862d
Update README.md
AlpyneDreams May 10, 2023
35e9ff1
[d3d8] Fixes for Treasure Planet: Battle at Procyon
AlpyneDreams May 18, 2023
5678628
[d3d8] Move d3d8 game configs to d3d8 section
AlpyneDreams Jun 19, 2023
e7993d1
Revert "[build] Always build d3d9 if d3d8 is enabled"
AlpyneDreams Mar 4, 2023
91ed0db
[d3d8] Remove stat collection from D3D8Batcher
AlpyneDreams Jul 3, 2023
9ebc7e1
[d3d8] Fix options initialization
AlpyneDreams Jul 3, 2023
6554732
[d3d8] Remove unimplemented option
AlpyneDreams Jul 3, 2023
374ce58
[d3d8] Remove render state tracking stuff
AlpyneDreams Jul 3, 2023
461f2cc
[d3d8] Fix bridge initialization
AlpyneDreams Jul 3, 2023
4efdd20
[build] GitHub actions build all dlls
AlpyneDreams Jul 3, 2023
fcd9f0e
[meta] Update LICENSE copyright date
AlpyneDreams Jul 3, 2023
151eed8
[d3d8] Remove d8vk-specific stuff
AlpyneDreams Jul 3, 2023
0ef65ff
[util] Rename apitraceMode config options (inline with upstream) (#167)
WinterSnowfall Jul 3, 2023
079b776
[d3d8] Cleanup minor things
AlpyneDreams Jul 4, 2023
ce81d03
[d3d8] Cleanup d3d8_include.h
AlpyneDreams Jul 4, 2023
5ef6c74
[d3d8] Remove unused includes
AlpyneDreams Jul 4, 2023
338a405
[d3d8] Add d3d8.sym
AlpyneDreams Jul 4, 2023
6f074b5
[d3d8] Native build: rename to libdxvk_d3d8
AlpyneDreams Jul 4, 2023
0bc96ee
[d3d8] Remove unnecessary std::move
AlpyneDreams Jul 4, 2023
7ef0c70
[d3d8] Rename D3D8InterfaceEx to D3D8Interface
AlpyneDreams Jul 4, 2023
b5e2b3e
[d3d8] Rename D3D8DeviceEx to D3D8Device
AlpyneDreams Jul 4, 2023
545ff69
[d3d8] Use non-extended IDirect3D9
AlpyneDreams Jul 4, 2023
96da71f
[d3d8] Move device functions to d3d8_device.cpp
AlpyneDreams Jul 4, 2023
d7ce55c
[d3d8] Forward calls to TestCooperativeLevel
WinterSnowfall Jul 4, 2023
094045d
[util] Remove the noExplicitFrontBuffer workarounds
WinterSnowfall Jul 3, 2023
82ad765
[d3d8] Fix redeclaration of GetInfo
AlpyneDreams Jul 4, 2023
b0c51a5
[d3d8] Adjust d3d8 device capabilities
WinterSnowfall Jul 4, 2023
994e9f3
[util] Various buffer placement workarounds
WinterSnowfall Jul 3, 2023
9ebed42
[d3d8] Format MinGW __CRT_UUID_DECL definition
AlpyneDreams Jul 15, 2023
b62901a
[d3d8] Fix meson after rebase
AlpyneDreams Jul 7, 2024
ec16540
[d3d8] More meson fixups
AlpyneDreams Jul 7, 2024
eb7294f
[d3d8] Inline some constexpr variables
AlpyneDreams Jul 7, 2024
6c1a29d
[d3d8] Minor whitespace nits
AlpyneDreams Jul 7, 2024
789c4a1
[d3d8] Ensure all references are cleared before d3d9 device reset
WinterSnowfall Jul 11, 2023
d422735
[d3d8] Remove extra ref on temporary blit surfaces
WinterSnowfall Jan 15, 2024
1a8b65d
[d3d8] Enable D3D8 compatibility for the D3D9 device
WinterSnowfall Jun 16, 2024
f5d4241
[d3d8] Update meson.build for native packaging support
flibitijibibo May 24, 2024
96e15bc
[d3d8] Yet more meson improvements
AlpyneDreams Jul 7, 2024
90be101
[d3d8] Cleanup comments in d3d8_batch.
AlpyneDreams Jul 7, 2024
1f98e8a
[d3d8] Minor style nits
AlpyneDreams Jul 7, 2024
b01adf7
[d3d8] Remove redundant inline constexpr on functions
AlpyneDreams Jul 7, 2024
ff598b8
[d3d8] Fix DLLEXPORT for native
AlpyneDreams Jul 7, 2024
d17ce53
[d3d8] Make some tables constexpr
AlpyneDreams Jul 7, 2024
1a2fbc1
[d3d8] More style nits
AlpyneDreams Jul 7, 2024
a2386cb
[d3d8] Don't explicitly end scene during device reset
WinterSnowfall Feb 20, 2024
137dbeb
[d3d8] Handle DEFAULT->MANAGED in CopyRects
WinterSnowfall Sep 7, 2023
f73a82e
[d3d8] Remove some uses of goto in CopyRects
AlpyneDreams Jul 7, 2024
5fdd98f
[d3d8] Use D3DPOOL_SCRATCH in CreateImageSurface
WinterSnowfall Mar 5, 2024
0baa014
Limiting V-Rally 3's framerate
simifor Sep 16, 2023
e9cfaf7
Consolidation of VRally3 entries
simifor Sep 17, 2023
d941bcd
[util] Remove workaround for D&D: ToEE
WinterSnowfall Jan 2, 2024
89048c4
[util] Add a workaround for Soldiers: Heroes of WWII
WinterSnowfall Jan 2, 2024
127354f
[util] Add a framecap for Cossacks II engine games
WinterSnowfall Feb 25, 2024
03fdbc2
[util] Remove managedBufferPlacement config options
WinterSnowfall Jan 2, 2024
0e30c1d
[util] Reinstate allowDirectBufferMapping config options
WinterSnowfall Jan 2, 2024
471aaad
[util] Enable cachedDynamicBuffers for several titles
WinterSnowfall Jan 3, 2024
050b479
[d3d8] Remove managedBufferPlacement workaround
WinterSnowfall Jan 2, 2024
8a18e13
[d3d8] Return S_FALSE if VCache queries are unsupported
WinterSnowfall May 25, 2024
2a74707
[d3d8] Tidy up D3DDEVINFO_VCACHE handling
AlpyneDreams Jul 7, 2024
58e986b
[d3d8] Validate depth stencil format use with CopyRects
WinterSnowfall Mar 7, 2024
28a7e65
[d3d8] Add a workaround for LotR: Fellowship of the Ring
WinterSnowfall May 6, 2024
dbd0794
[d3d8] Fix redundant check for vcache stuff
AlpyneDreams Jul 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/test-build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ jobs:
Write-Output "VSDEVCMD=${installationPath}\Common7\Tools\VsDevCmd.bat" `
| Out-File -FilePath "${Env:GITHUB_ENV}" -Append

- name: Download D3D8 SDK Headers
shell: pwsh
run: |
Invoke-WebRequest -URI https://raw.githubusercontent.com/NovaRain/DXSDK_Collection/master/DXSDK_Aug2007/Include/d3d8.h -OutFile include/d3d8.h
Invoke-WebRequest -URI https://raw.githubusercontent.com/NovaRain/DXSDK_Collection/master/DXSDK_Aug2007/Include/d3d8types.h -OutFile include/d3d8types.h
Invoke-WebRequest -URI https://raw.githubusercontent.com/NovaRain/DXSDK_Collection/master/DXSDK_Aug2007/Include/d3d8caps.h -OutFile include/d3d8caps.h

- name: Build MSVC x86
shell: pwsh
run: |
Expand Down
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Copyright (c) 2017 Philip Rebohle
Copyright (c) 2019 Joshua Ashton
Copyright (c) 2023 Jeffrey Ellison

zlib/libpng license

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DXVK

A Vulkan-based translation layer for Direct3D 9/10/11 which allows running 3D applications on Linux using Wine.
A Vulkan-based translation layer for Direct3D 8/9/10/11 which allows running 3D applications on Linux using Wine.

For the current status of the project, please refer to the [project wiki](https://github.com/doitsujin/dxvk/wiki).

Expand Down
26 changes: 26 additions & 0 deletions dxvk.conf
Original file line number Diff line number Diff line change
Expand Up @@ -709,3 +709,29 @@
# - True/False

# d3d9.countLosableResources = True

# Use NVIDIA Shadow Buffers
#
# Vendor behavior for GeForce3 and GeForce4 cards that allows
# sampling depth textures with non-normalized Z coordinates
# and applies hardware shadow filtering.
#
# Supported values:
# - True/False

# d3d8.useShadowBuffers = False


# MANAGED Buffer Placement
#
# Remap some DEFAULT pool vertex and index buffers to the MANAGED pool to improve
# performance by avoiding waiting for games that frequently lock (large) buffers.
#
# This implicitly disables direct buffer mapping. Some applications may need this option
# disabled for certain (smaller) buffers to keep from overwriting in-use buffer regions.
#
# Supported values:
# - True/False
# - Any non-negative integer - sets the minimum size in bytes for a buffer to be MANAGED

# d3d8.managedBufferPlacement = True
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
option('enable_dxgi', type : 'boolean', value : true, description: 'Build DXGI')
option('enable_d3d8', type : 'boolean', value : true, description: 'Build D3D8')
option('enable_d3d9', type : 'boolean', value : true, description: 'Build D3D9')
option('enable_d3d10', type : 'boolean', value : true, description: 'Build D3D10')
option('enable_d3d11', type : 'boolean', value : true, description: 'Build D3D11')
Expand Down
3 changes: 3 additions & 0 deletions src/d3d8/d3d8.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
LIBRARY D3D8.DLL
EXPORTS
Direct3DCreate8 @ 5
7 changes: 7 additions & 0 deletions src/d3d8/d3d8.sym
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
global:
Direct3DCreate8;

local:
*;
};
239 changes: 239 additions & 0 deletions src/d3d8/d3d8_batch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
#pragma once

#include "d3d8_include.h"
#include "d3d8_buffer.h"
#include "d3d8_format.h"

#include <vector>
#include <cstdint>
#include <climits>

namespace dxvk {

inline constexpr size_t D3DPT_COUNT = size_t(D3DPT_TRIANGLEFAN) + 1;
inline constexpr D3DPRIMITIVETYPE D3DPT_INVALID = D3DPRIMITIVETYPE(0);

// Vertex buffer that can handle many tiny locks while
// still maintaing the lock ordering of direct-mapped buffers.
class D3D8BatchBuffer final : public D3D8VertexBuffer {
public:
D3D8BatchBuffer(
D3D8Device* pDevice,
D3DPOOL Pool,
DWORD Usage,
UINT Length,
DWORD FVF)
: D3D8VertexBuffer(pDevice, nullptr, Pool, Usage)
, m_data(Length)
, m_fvf(FVF) {
}

HRESULT STDMETHODCALLTYPE Lock(
UINT OffsetToLock,
UINT SizeToLock,
BYTE** ppbData,
DWORD Flags) {
*ppbData = m_data.data() + OffsetToLock;
return D3D_OK;
}

HRESULT STDMETHODCALLTYPE Unlock() {
return D3D_OK;
}

HRESULT STDMETHODCALLTYPE GetDesc(D3DVERTEXBUFFER_DESC* pDesc) {
pDesc->Format = D3DFMT_VERTEXDATA;
pDesc->Type = D3DRTYPE_VERTEXBUFFER;
pDesc->Usage = m_usage;
pDesc->Pool = m_pool;
pDesc->Size = m_data.size();
pDesc->FVF = m_fvf;
return D3D_OK;
}

void STDMETHODCALLTYPE PreLoad() {
}

const void* GetPtr(UINT byteOffset = 0) const {
return m_data.data() + byteOffset;
}

UINT Size() const {
return m_data.size();
}

private:
std::vector<BYTE> m_data;
DWORD m_fvf;
};


// Main handler for batching D3D8 draw calls.
class D3D8Batcher {

struct Batch {
D3DPRIMITIVETYPE PrimitiveType = D3DPT_INVALID;
std::vector<uint16_t> Indices;
UINT Offset = 0;
UINT MinVertex = UINT_MAX;
UINT MaxVertex = 0;
UINT PrimitiveCount = 0;
UINT DrawCallCount = 0;
};

public:
D3D8Batcher(D3D8Device* pDevice8, Com<d3d9::IDirect3DDevice9>&& pDevice9)
: m_device8(pDevice8)
, m_device(std::move(pDevice9)) {
}

inline D3D8BatchBuffer* CreateVertexBuffer(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool) {
return ref(new D3D8BatchBuffer(m_device8, Pool, Usage, Length, FVF));
}

inline void StateChange() {
if (likely(m_batches.empty()))
return;
for (auto& draw : m_batches) {

if (draw.PrimitiveType == D3DPT_INVALID)
continue;

for (auto& index : draw.Indices)
index -= draw.MinVertex;

m_device->DrawIndexedPrimitiveUP(
d3d9::D3DPRIMITIVETYPE(draw.PrimitiveType),
0,
draw.MaxVertex - draw.MinVertex,
draw.PrimitiveCount,
draw.Indices.data(),
d3d9::D3DFMT_INDEX16,
m_stream->GetPtr(draw.MinVertex * m_stride),
m_stride);

m_device->SetStreamSource(0, D3D8VertexBuffer::GetD3D9Nullable(m_stream), 0, m_stride);
m_device->SetIndices(D3D8IndexBuffer::GetD3D9Nullable(m_indices));

draw.PrimitiveType = D3DPRIMITIVETYPE(0);
draw.Offset = 0;
draw.MinVertex = UINT_MAX;
draw.MaxVertex = 0;
draw.PrimitiveCount = 0;
draw.DrawCallCount = 0;
}
}

inline void EndFrame() {
// Nothing to be done.
}

inline HRESULT DrawPrimitive(
D3DPRIMITIVETYPE PrimitiveType,
UINT StartVertex,
UINT PrimitiveCount) {

// None of this linestrip or fan malarkey
D3DPRIMITIVETYPE batchedPrimType = PrimitiveType;
switch (PrimitiveType) {
case D3DPT_LINESTRIP: batchedPrimType = D3DPT_LINELIST; break;
case D3DPT_TRIANGLEFAN: batchedPrimType = D3DPT_TRIANGLELIST; break;
default: break;
}

Batch* batch = &m_batches[size_t(batchedPrimType)];
batch->PrimitiveType = batchedPrimType;

//UINT vertices = GetVertexCount8(PrimitiveType, PrimitiveCount);

switch (PrimitiveType) {
case D3DPT_POINTLIST:
batch->Indices.resize(batch->Offset + PrimitiveCount);
for (UINT i = 0; i < PrimitiveCount; i++)
batch->Indices[batch->Offset++] = (StartVertex + i);
break;
case D3DPT_LINELIST:
batch->Indices.resize(batch->Offset + PrimitiveCount * 2);
for (UINT i = 0; i < PrimitiveCount; i++) {
batch->Indices[batch->Offset++] = (StartVertex + i * 2 + 0);
batch->Indices[batch->Offset++] = (StartVertex + i * 2 + 1);
}
break;
case D3DPT_LINESTRIP:
batch->Indices.resize(batch->Offset + PrimitiveCount * 2);
for (UINT i = 0; i < PrimitiveCount; i++) {
batch->Indices[batch->Offset++] = (StartVertex + i + 0);
batch->Indices[batch->Offset++] = (StartVertex + i + 1);
}
break;
case D3DPT_TRIANGLELIST:
batch->Indices.resize(batch->Offset + PrimitiveCount * 3);
for (UINT i = 0; i < PrimitiveCount; i++) {
batch->Indices[batch->Offset++] = (StartVertex + i * 3 + 0);
batch->Indices[batch->Offset++] = (StartVertex + i * 3 + 1);
batch->Indices[batch->Offset++] = (StartVertex + i * 3 + 2);
}
break;
case D3DPT_TRIANGLESTRIP:
// Join with degenerate triangle
// 1 2 3, 3 4, 4 5 6
batch->Indices.resize(batch->Offset + PrimitiveCount + 2);
if (batch->Offset > 0) {
batch->Indices[batch->Offset + 1] = batch->Indices[batch->Offset-2];
batch->Indices[batch->Offset += 2] = StartVertex;
}
for (UINT i = 0; i < PrimitiveCount; i++) {
batch->Indices[batch->Offset++] = (StartVertex + i + 0);
}
break;
// 1 2 3 4 5 6 7 -> 1 2 3, 1 3 4, 1 4 5, 1 5 6, 1 6 7
case D3DPT_TRIANGLEFAN:
batch->Indices.resize(batch->Offset + PrimitiveCount * 3);
for (UINT i = 0; i < PrimitiveCount; i++) {
batch->Indices[batch->Offset++] = (StartVertex + 0);
batch->Indices[batch->Offset++] = (StartVertex + i + 1);
batch->Indices[batch->Offset++] = (StartVertex + i + 2);
}
break;
default:
return D3DERR_INVALIDCALL;
}
batch->MinVertex = std::min(batch->MinVertex, StartVertex);
if (!batch->Indices.empty())
batch->MaxVertex = std::max(batch->MaxVertex, UINT(batch->Indices.back() + 1));
batch->PrimitiveCount += PrimitiveCount;
batch->DrawCallCount++;
return D3D_OK;
}

inline void SetStream(UINT num, D3D8VertexBuffer* stream, UINT stride) {
if (unlikely(num != 0)) {
StateChange();
return;
}
if (unlikely(m_stream != stream || m_stride != stride)) {
StateChange();
m_stream = static_cast<D3D8BatchBuffer*>(stream);
m_stride = stride;
}
}

inline void SetIndices(D3D8IndexBuffer* indices, INT baseVertexIndex) {
if (m_indices != indices || m_baseVertexIndex != baseVertexIndex) {
StateChange();
m_indices = indices;
m_baseVertexIndex = baseVertexIndex;
}
}

private:
D3D8Device* m_device8;
Com<d3d9::IDirect3DDevice9> m_device;

D3D8BatchBuffer* m_stream = nullptr;
UINT m_stride = 0;
D3D8IndexBuffer* m_indices = nullptr;
INT m_baseVertexIndex = 0;
std::array<Batch, D3DPT_COUNT> m_batches;
};
}
Loading