1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 19:24:12 +01:00
Commit Graph

3097 Commits

Author SHA1 Message Date
Joshua Ashton
d1dc217d31 [d3d9] Fix readback for evictManagedOnUnlock 2020-02-23 16:59:33 +00:00
Joshua Ashton
0e353895fd [d3d9] Enumerate adapters by display
WPF expects us to return an adapter for every display attached otherwise
it decides to device reset every frame.

Closes #1459
2020-02-21 18:03:57 +00:00
Joshua Ashton
f095f6385e [d3d9] Initialize all backbuffers in swapchain creation
Otherwise they are garbage and undefined layout.

Fixes some validation errors in Lumino City #1462
2020-02-21 06:45:02 +00:00
Joshua Ashton
38838f7428 [d3d9] Synchronize present and wait for idle when invalidating a swapchain
Lumino City calls CreateAdditionalSwapchain instead of the regular device reset functions.

We were missing some needed synchronization here to make this work properly for this game.

Impacts #1462
2020-02-21 01:38:58 +00:00
Joshua Ashton
2408b881a2 [dxso] Use SSBOs for vertex constant buffers if we'd be outside of uniform range
Impacts #1375
2020-02-20 08:14:58 +01:00
Joshua Ashton
d11a07082c [d3d9] Remove unnecessary dirty flag change in CreateConstantBuffers 2020-02-20 08:14:58 +01:00
Joshua Ashton
512393e469 [d3d9] Refactor constant buffer creation 2020-02-20 08:14:58 +01:00
Joshua Ashton
f688889b41 [d3d9] Avoid setting cursor position if we are already at that position
Avoids an infinite loop where we trigger the cursor move window message which calls SetCursorPos and so on and so forth...

Closes #1400
2020-02-20 01:44:50 +00:00
Joshua Ashton
17166a8aeb [d3d9] Add equality operator overloads for POINT 2020-02-20 01:39:13 +00:00
Joshua Ashton
261a242486 [d3d9] Disallow GetFrontBufferData for anything but D3DPOOL_SYSTEMMEM
Fixes #1464
2020-02-19 18:05:50 +00:00
Joshua Ashton
74d23c22de [build] Use __CRT_UUID_DECL for uuid definitions
Closes #1463
2020-02-18 20:25:05 +01:00
Joshua Ashton
760a163fc5 [util] Disable discard for D&D Temple of Elemental Evil
This game uses D3DLOCK_DISCARD incorrectly
2020-02-18 17:01:41 +00:00
Joshua Ashton
8fabc25a38 [d3d9] Implement d3d9.allowDiscard 2020-02-18 16:53:51 +00:00
Joshua Ashton
6b85e6d3f1 Revert "[d3d9] Ignore D3DLOCK_DISCARD when partially locking buffers"
This reverts commit 50cf3a465b.
2020-02-18 16:50:39 +00:00
Joshua Ashton
378bdbdfb0 [d3d9] Remove repeated wrap state setting in Reset 2020-02-17 18:05:45 +00:00
Philip Rebohle
4cf3ef538c [d3d9] Fix A4R4G4B4 swizzle 2020-02-17 15:32:28 +00:00
Joshua Ashton
4405b51bf3 [dxso] Respect src modifiers in Texcrd for PS 1.4
`texcrd r4.xy, t4_dw.xyww`

Cross Racing Championship Extreme 2005 uses a writemask in texcrd as well as the _dw modifier on the src which we weren't respecting previously.

Closes #1450
2020-02-16 23:24:33 +00:00
Joshua Ashton
a6d554615e [d3d9] Avoid needless swizzle for A4R4G4B4
Should fix this d3d9 format working on Intel ANV

Impacts #1455
2020-02-16 22:54:28 +00:00
Joshua Ashton
50cf3a465b [d3d9] Ignore D3DLOCK_DISCARD when partially locking buffers
Fixes #1444
2020-02-15 03:10:00 +00:00
Joshua Ashton
7d3ec74b40 [d3d9] Don't perform clipping in FF if disabled
Avoids unnecessary matrix multiplications in the shader, given this isn't as cheap as it is for programmable.
2020-02-14 19:19:22 +00:00
Joshua Ashton
0c16cc7749 [d3d9] Perform FF vertex clipping in world space
Previously we were doing this in object space which is incorrect.

Closes #1446
2020-02-14 19:09:02 +00:00
Joshua Ashton
cad3b69e82 [d3d9] Fix likeliness in GetStreamSource 2020-02-14 17:21:52 +00:00
Joshua Ashton
2096a95262 [d3d9] Fix ColorFill using sampler views for partial extents
Closes #1434
2020-02-14 06:49:15 +01:00
Joshua Ashton
02c79d892c [d3d9] Try to create offscreen surfaces with render target usage 2020-02-14 06:49:15 +01:00
Joshua Ashton
1f5ddde411 [d3d9] Remove unused D3D9ViewSet structure 2020-02-14 06:49:15 +01:00
ryester27
dff2a4ea24 [util] Force 16:9 aspect ratio for Hyperdimension Neptunia U: Action Unleashed 2020-02-14 02:50:15 +00:00
Joshua Ashton
582fe899f8 [dxso] Implement TexBemL 2020-02-14 01:15:34 +00:00
Joshua Ashton
c7d5ce1c50 [d3d9] Fix incorrect type for luminance scale and offset in D3DTOP_BUMPENVMAPLUMINANCE 2020-02-14 01:10:26 +00:00
Joshua Ashton
ae68e3a5bc [d3d9] Defer managed texture uploads until PrepareDraw and when needed
This also caches shader masks used for hazard tracking.
2020-02-14 00:51:58 +00:00
Joshua Ashton
0ea510eb9b [util] Add clearAll helper to bitset 2020-02-14 00:51:58 +00:00
Joshua Ashton
6e9725a124 [d3d9] Use bitsets for bool subresource arrays
Also remove lockflag tracking and consolidate that to a bitset
2020-02-14 00:51:58 +00:00
Joshua Ashton
960d2bd158 [util] Add exchange helper to bitset 2020-02-14 00:51:58 +00:00
Joshua Ashton
cf6142e782 [d3d9] Don't expose formats with alpha as adapter formats
Impacts #1440
2020-02-14 00:46:14 +00:00
Joshua Ashton
acb3cda1dc [d3d9] Hold a private reference to FVF-generated vertex decls
Otherwise the device will never be able to be destroyed as there will be a circular dependency.

Closes #1417
2020-02-13 18:42:49 +00:00
Philip Rebohle
313d46984d
[dxbc] Fix memory semantics for atomic operations 2020-02-13 01:15:44 +01:00
Philip Rebohle
4aa6800e95
[d3d11] Validate subresource index in copy operations
Rocket League tries to copy five subresources of a texture that only
has one single array layer and one single mip map, which causes GPU
hangs on Nvidia drivers.
2020-02-13 00:39:55 +01:00
Philip Rebohle
f12ddfa4d3
[dxbc] Fix line tessellation factor ordering 2020-02-12 12:00:46 +01:00
Joshua Ashton
51903d8348 [d3d9] Genericise video format conversion 2020-02-10 18:27:35 +00:00
Philip Rebohle
7567486668 [d3d9] Handle invalid alpha ref correctly 2020-02-10 15:20:13 +00:00
Philip Rebohle
bf03fd8732 [d3d9] Implment fixed-function clipping 2020-02-10 07:32:22 +01:00
Joshua Ashton
ba8dad3958 [d3d9] Fix multiplication order in D3D9StateBlock::MultiplyStateTransform 2020-02-10 06:22:58 +00:00
Joshua Ashton
c42d44a4c3 [d3d9] Mark vertex blend dirty in MultiplyTransform if needed 2020-02-10 06:17:05 +00:00
Joshua Ashton
14203761d9 [d3d9] Reverse multiplication order in MultiplyTransform
Closes https://github.com/Joshua-Ashton/d9vk/issues/295
2020-02-10 06:16:12 +00:00
Joshua Ashton
afeb4814c7 [d3d9] Remove SRGB variant from Q8W8V8U8 2020-02-10 04:57:45 +00:00
Philip Rebohle
07fee4a0e5
[util] Disable VR for Subnautica 2020-02-09 09:05:52 +01:00
Joshua Ashton
310ab6da64 [d3d9] Implement D3DTOP_BUMPENVMAPLUMINANCE 2020-02-08 23:08:48 +00:00
Joshua Ashton
302aed256b [d3d9] Implement D3DTOP_BUMPENVMAP 2020-02-08 23:00:57 +00:00
Joshua Ashton
4291bc9dfb [d3d9] Reupload fixed func ps data if stage constant changes
Closes #1420
2020-02-08 16:33:47 +00:00
Philip Rebohle
4738d12d73
[util] Enable forced TGSM barriers for F1 2019
Fixes visual issues on RADV.
2020-02-08 00:48:45 +01:00
Philip Rebohle
76a6f6eab9
[dxbc] Add option to force memory barriers after shared memory stores 2020-02-08 00:48:42 +01:00
Joshua Ashton
2f8fbf9114 [d3d9] Use linear sampler for upscaling if extents don't match on Present 2020-02-07 18:53:47 +00:00
Philip Rebohle
c780ed5da3
[util] Enable invariant position for Saint's Row III / IV 2020-02-07 17:40:55 +01:00
Philip Rebohle
2435c6369c
[meta] Release 1.5.4 2020-02-07 01:02:22 +01:00
Joshua Ashton
b9474cf787 [d3d9] Return D3D_OK in CreateTexture even if AUTOGENMIPMAP flag is stripped
D3DOK_NOAUTOGEN is only returned when querying format support, the flag is stripped away silently in CreateTexture if it has to be.

Fixes #1409
2020-02-06 23:48:01 +00:00
Joshua Ashton
1f67602b98 [d3d9] Check correct sampler bitfield when applying/capturing sampler state 2020-02-06 22:37:50 +00:00
Philip Rebohle
8020803340
[util] Disable OpenVR for Raft 2020-02-06 20:48:21 +01:00
Philip Rebohle
88147e19d2 [d3d9] Simplify dirty check for shader constants 2020-02-06 17:58:15 +01:00
Philip Rebohle
aa70369671 [d3d9] Store copy of shader metadata in constant set
Reduces pointer chasing when updating shader constants.
2020-02-06 17:58:15 +01:00
Philip Rebohle
69b04c609a [dxso] Fix GCC warning for an unused variable 2020-02-06 17:50:28 +01:00
Philip Rebohle
2288dd924e [d3d9] Fix GCC warnings for unsigned->signed comparisons 2020-02-06 17:50:28 +01:00
Philip Rebohle
06809587e8 [d3d9] Don't arbitrarily set fog scale to 0
The Witcher 1 sets FOGSTART == FOGEND together with LINEAR fog mode, in
which case we previously set fog_scale to 0 and therefore incorrectly
override the pixel color with the fog color.

Fixes #1401.
2020-02-06 17:50:04 +01:00
Joshua Ashton
87dd8f0122 [d3d9] Validate blit regions are in range
Closes #1392
2020-02-04 23:45:32 +00:00
Joshua Ashton
92ee9c7ef1 [d3d9] Error on StretchRect when not D3DPOOL_DEFAULT 2020-02-04 22:37:44 +00:00
Joshua Ashton
08fc5342a9 [dxso] Initialize vPos in shaders if we have pixel fog
Fixes some fog related regressions since we deferred this
2020-02-04 21:43:16 +00:00
Philip Rebohle
ce51431860
[dxvk] Skip over adapters not supporting Vulkan 1.1
Even with a 1.1 instance it appears to be possible to retrieve 1.0
adapters, so we'll just ignore them.
2020-02-03 11:31:58 +01:00
František Zatloukal
976d3b5ee4 [util] Include ostream in util_rc_ptr.h 2020-01-31 15:17:18 +01:00
Joshua Ashton
1abacc947c [dxso] Apply projection before bumpmapping in TexBem
Also fixes us to use the correct stage id for TexBem matrix indices...

What a truly terrible API this is. This literally makes 0 sense.

This function needs a massive cleanup later too.

Closes #1387
2020-01-31 00:33:47 +00:00
Philip Rebohle
6a5d472e60
[meta] Release 1.5.3 2020-01-30 16:17:31 +01:00
Joshua Ashton
3196fbc759 [d3d9] Unbind fragment shader for ProcessVertices
Fixes validation errors and potential UB on some drivers
2020-01-29 21:43:12 +00:00
Joshua Ashton
201d508626 [dxso] Handle writemask in TexKill op
Turns out this actually applies to what is tested, despite docs saying otherwise and never ever seeing this before!

Fixes some broken ENB shaders which I assume have some manual hand edits because I can't get FXC to generate this code at all.
2020-01-29 17:22:38 +00:00
Philip Rebohle
3ab675c233 Revert "[util] Disable float emulation for Hat in Time"
Turns out this breaks some levels (e.g. Chapter 1 Act 3).
Performance impact seems minimal on RADV+ACO.

This reverts commit 6f93d3bf22.
2020-01-28 17:46:33 +00:00
Philip Rebohle
c560ec44b5 [d3d11] Re-introduce client API HUD item 2020-01-28 16:32:58 +00:00
Philip Rebohle
be16da37d7 [d3d11] Introduce COM interface to set and get API version
Allows us to identify DirectX 10 applications correctly.
2020-01-28 16:32:58 +00:00
Philip Rebohle
1e6ad0b372 [d3d9] Re-introduce client API HUD item 2020-01-28 16:32:58 +00:00
Philip Rebohle
38ad868214 [hud] Add parameter to allow placing HUD items 2020-01-28 16:32:58 +00:00
Philip Rebohle
588beb5b2f [hud] Don't initialize client API HUD item by default
Removes the client API property from the DXVK device as well.
Instead, client APIs should create the HUD item manually.
2020-01-28 16:32:58 +00:00
Philip Rebohle
ca4c03284f [dxvk] Don't oversubscribe memory heaps on UMA devices
Otherwise, we seem to suffer a major performance penalty
on setups with insufficient dedicated system memory.
2020-01-28 16:31:34 +00:00
Philip Rebohle
3beca254e2 [dxvk] Move UMA check to backend 2020-01-28 16:31:34 +00:00
Joshua Ashton
b1edf227f8 [d3d9] Enable depth bounds feature, if supported
Only expose it in format checks if the adapter supports the feature also
2020-01-28 01:51:04 +00:00
Joshua Ashton
6f93d3bf22 [util] Disable float emulation for Hat in Time
Squeezes out some extra performance in this title
2020-01-27 14:21:21 +01:00
Joshua Ashton
720cdf383e [d3d9] Use spec constants for bool constants 2020-01-27 14:21:21 +01:00
Joshua Ashton
a43223256e [d3d9] Fix GetTextureStageState using unmapped types
Closes #1378
2020-01-27 01:07:11 +00:00
Joshua Ashton
65f4437417 [dxso] Initialize vPos value at the start of the shader
Otherwise we can end up initializing it in a branch and that's no good.

Closes https://github.com/doitsujin/dxvk/issues/1294
2020-01-26 18:40:32 +00:00
Joshua Ashton
b4666ac044 [dxso] Count max constants after we pull out pre-defines 2020-01-26 18:13:45 +00:00
Philip Rebohle
c77a9e3bfe
[util] Unify Risen 1/2/3 app profiles 2020-01-25 12:10:05 +01:00
Philip Rebohle
fdb2b972e9
[util] Add more exe names to Gothic 3 app profile
Fixes #1372.
2020-01-25 12:10:05 +01:00
Joshua Ashton
9b486515fa [d3d9] Allow StretchRect BC -> BC format without stretch 2020-01-25 00:31:45 +00:00
Philip Rebohle
e242d7f312
[meta] Release 1.5.2 2020-01-25 00:32:25 +01:00
Philip Rebohle
5d2215e898 [d3d9] Don't try to blit to compressed images
Fixes Vulkan validation errors and potential driver crashes in
Dragon Age Origins.
2020-01-24 22:59:26 +00:00
Joshua Ashton
13792df4c5 [d3d9] Don't mark D3DUSAGE_AUTOGENMIPMAP as renderable
We can't access those mips via locking in D3D9 so it's a-okay! :)
2020-01-24 15:54:15 +00:00
Joshua Ashton
2004fba22c [util] Disable d3d9.allowDoNotWait for RTHDRIBL
This app goes into an infinite loop if it gets D3DERR_WASSTILLDRAWING and the perf penalty of blocking on GetRenderTargetData in other apps is too high!
2020-01-24 15:54:15 +00:00
Joshua Ashton
f804c6364d [d3d9] Implement d3d9.allowDoNotWait 2020-01-24 15:54:15 +00:00
Joshua Ashton
764cb5634f [d3d9] Unmark resources as dirty if they get discarded 2020-01-24 15:54:15 +00:00
Joshua Ashton
6fa28bf937 [d3d9] Don't block on GetRenderTargetData
Fixes perf in #1363
2020-01-24 15:54:15 +00:00
Philip Rebohle
7469f5d4a0
[util] Disable supportDFFormats for Gothic 3
See #1367.
2020-01-24 14:21:28 +01:00
Philip Rebohle
38a0d2c552
[d3d9] Don't check for sRGB formats when retrieving back buffer view
Turns out this is always false anyway.
2020-01-24 01:47:52 +01:00
Philip Rebohle
582b06a706 [d3d9] Rotate swap chain back buffers
Restores functionality removed in 81c3daa3d0.
2020-01-24 00:27:09 +00:00
Philip Rebohle
6a6af16195 [d3d9] Retrieve back buffer view from the D3D9Surface 2020-01-24 00:27:09 +00:00
Philip Rebohle
81c3daa3d0
[dxvk] Remove image renaming
Broken by design, has to be implemented by client APIs instead.
2020-01-23 22:21:45 +01:00
Florian Will
0b3f9718c9 [d3d9] Fix some off-by-one TSS types enum values
They are 0-based instead of 1-based, and therefore supposed to be
off-by-one compared to D3DTEXTURESTAGESTATETYPE, but three values in the
enum are actually off-by-two.

For me, this fixes some odd rail rendering in ZUSI 3.

Fixes: 7d0ddc4b
2020-01-23 17:26:51 +00:00
Joshua Ashton
792c74e1d9 [d3d9] Fix texture stage index in stateblocks
Fixes minimap transparency in FHX https://github.com/Joshua-Ashton/d9vk/issues/306
2020-01-23 02:19:43 +00:00
Joshua Ashton
9919ffe5ca [util] Add simple [] operator to our bitset 2020-01-23 02:05:09 +00:00
Joshua Ashton
7d0ddc4b3b [d3d9] Remap texture stage state types onto our own enum
Fits us nicely into a dword for captures while not exclusing D3DTSS_CONSTANT
2020-01-23 02:05:09 +00:00
Joshua Ashton
a1cad25a51 [d3d9] Remove unnecessary loops for some stateblocks applications 2020-01-23 02:05:09 +00:00
Philip Rebohle
21330497e0
[util] Add app profile for Entropia Universe
Fixes #1364 (again).
2020-01-23 01:31:57 +01:00
Philip Rebohle
9721938e57
[d3d11] Introduce d3d11.invariantPosition option
Apparently it's better to make app profiles than risk tanking
performance for all applications. Invariance rules in D3D11 are
undocumented so it's not clear what the correct solution is.
2020-01-23 01:28:19 +01:00
Philip Rebohle
11f08c7dea
[dxbc] Declare vertex positions as invariant
Otherwise, games relying on different vertex shaders to produce
the same numerical results may suffer from Z-fighting issues.

Fixes #1364.
2020-01-22 23:59:51 +01:00
Joshua Ashton
ff2c6a076f [d3d9] Fix opSelect condition vector size
Fixes invalid fixed function shaders
2020-01-22 22:54:27 +00:00
Joshua Ashton
7de15fe837 [util] Spoof AMD for Skyrim (nvapi) 2020-01-22 16:20:42 +00:00
Philip Rebohle
a57dc75247
[d3d11] Implicitly begin scoped queries in End if necessary
Matches (undocumented) D3D11 behaviour. Warriors Orochi 4 runs into
this because it does not begin some of its timestamp disjoint queries
before ending them and retrieving data.
2020-01-22 04:17:13 +01:00
Joshua Ashton
35a9934cde [d3d9] Make unbound textures return (0, 0, 0, 1) (fixed func)
Fixes sky in Ferentus Herrcot Xiones

https://github.com/Joshua-Ashton/d9vk/issues/306
2020-01-18 03:10:47 +00:00
Joshua Ashton
4810a5dc72 [dxso] Make unbound textures return (0, 0, 0, 1)
Matches native behaviour
2020-01-18 03:10:47 +00:00
Philip Rebohle
eed57ed6c4
[util] Enable d3d9.deferSurfaceCreation for a ton of weeb games 2020-01-17 18:29:15 +01:00
Philip Rebohle
caae5d18ed
[d3d9] Remove unused variable
Fixes a compiler warning.
2020-01-17 18:04:09 +01:00
Philip Rebohle
609856db35
[d3d9] Create front buffer 2020-01-17 18:04:09 +01:00
Philip Rebohle
f20a3c07fb [d3d9] Don't create sRGB views for non-sRGB compatible textures
Otherwise we end up creating views with VK_IMAGE_FORMAT_UNDEFINED.
2020-01-17 17:47:08 +01:00
Philip Rebohle
296aacb23e [d3d9] Return specific image view from GetSampleView
Lets us have pick the sRGB-ness of the view in one place. Needed
for the next patch.
2020-01-17 17:47:08 +01:00
Philip Rebohle
905d69e77b [d3d9] Don't pass format mapping to D3D9CommonTexture
Instead, infer it from the format. This is basically being done
already, however the mapping we pass in is not correct if the
image format is Unknown.
2020-01-17 17:47:08 +01:00
Philip Rebohle
7150d2b7fb [dxvk] Don't enable VK_KHR_descriptor_update_template
Core in Vulkan 1.1.
2020-01-17 17:46:59 +01:00
Philip Rebohle
4923bc20f7 [dxvk] Don't enable VK_KHR_shader_draw_parameters
Core in Vulkan 1.1.
2020-01-17 17:46:59 +01:00
Philip Rebohle
073669b7e7 [dxvk] Don't enable VK_KHR_maintenance1, VK_KHR_maintenance2
Core in Vulkan 1.1.
2020-01-17 17:46:59 +01:00
Philip Rebohle
60145f0167 [dxvk] Don't enable VK_KHR_dedicated_allocation, VK_KHR_get_memory_requirements2
Core in Vulkan 1.1.
2020-01-17 17:46:59 +01:00
Philip Rebohle
252ec9406d [dxvk] Don't enable VK_KHR_get_physical_device_properties2
Core in Vulkan 1.1.
2020-01-17 17:46:59 +01:00
Philip Rebohle
6690a31d8d [dxbc] Don't enable SPV_KHR_shader_draw_parameters
Core in SPIR-V 1.3.
2020-01-17 17:46:59 +01:00
Philip Rebohle
7e35a0687b [d3d9] Don't enable DrawParameters capability
Not used in D3D9 shaders.
2020-01-17 17:46:59 +01:00
Joshua Ashton
b954ab886f [d3d9] Implement GetFrontBufferData (currently with first backbuffer)
Fixes screenshots in ATi ToyShop demo
2020-01-17 06:01:48 +00:00
Joshua Ashton
e5df573292 [d3d9] Add AreFormatsSimilar helper 2020-01-17 05:55:47 +00:00
Joshua Ashton
9fce945b62 [d3d9] Don't create views if we are a null resource 2020-01-17 04:20:05 +00:00
Philip Rebohle
bafcaa0c07
[dxvk] don't try to fall back to Vulkan 1.0
Vulkan 1.1 came out in early 2018, everyone should be using a
compatible driver and ICD loader these days.
2020-01-16 19:48:10 +01:00
Philip Rebohle
eb37dfa8d2 [d3d9] Create multiple back buffers for GetBackBuffer API
Needed by Atelier Sophie.
2020-01-16 18:50:23 +01:00
Philip Rebohle
c911784bb8 [d3d9] Synchronize with presentation in D3D9SwapChainEx::Reset
Otherwise, the subsequent patches would break if Reset is called
while there's still a frame in flight.
2020-01-16 18:50:23 +01:00
Philip Rebohle
41a91cbae6 [dxvk] Implement image swapping 2020-01-16 18:50:23 +01:00
Philip Rebohle
5193e8ef24 [dxvk] Introduce DxvkPhysicalImage 2020-01-16 18:50:23 +01:00
Philip Rebohle
2c457e496a [dxvk] Register image views with the parent image
Needed for image renaming.
2020-01-16 18:50:23 +01:00
Philip Rebohle
8770a14743 [dxvk] Use small_vector to store image view format compatibility list
Avoids some memory allocations, but increases the object size slightly.
2020-01-16 18:50:23 +01:00
Philip Rebohle
70e52aa6f2 [dxvk] Factor out image view creation 2020-01-16 18:50:23 +01:00
Philip Rebohle
e4215252df [util] Add small_vector helper
A vector with a small fixed-size array, which changes to a dynamic
array as needed. Can be used to avoid memory allocations in some
scenarios.
2020-01-16 18:50:23 +01:00
Andrew Eikum
5706ec55e4 [dxgi] Don't check window validity in IDXGISwapchain::GetFullscreenState
This causes an error on exit in Jump King, which uses SharpDX.
2020-01-16 17:50:32 +01:00
Joshua Ashton
9e5e4c1cfc [d3d9] Don't mark for hazards if we aren't rendering to mip 0 2020-01-16 03:04:58 +00:00
Joshua Ashton
7c53a997ef [d3d9] Keep subresource views in subresources, defer creation until needed
Avoid creating a bunch of views that we probably don't need whenever a texture is created
2020-01-16 03:00:31 +00:00
Philip Rebohle
18450f4643
[d3d11] Lock immediate context when submitting presentation commands
Otherwise, a race condition occurs if a game submits rendering commands
at the same time as presenting the swap chain image. Only works if
multithreaded protection is enabled, but according to MSDN, it is
illegal to use DXGI commands and the immediate context in parallel.

Fixes stability issues in Tales of Vesperia.
2020-01-15 23:48:58 +01:00
Joshua Ashton
a7b4c29957 [dxso] Use m's id for bump matrix in TexBem
Fixes refractive windows in Vampire The Masquerade: Bloodlines

Was also a silly typo given my comment right above about it 🐸!
2020-01-15 18:04:04 +00:00
Joshua Ashton
64ece36349 [d3d9] Implement d3d9.forceSwapchainMSAA
Works good enough for some titles like Vampire The Masquerade: Bloodlines.
2020-01-11 02:34:37 +00:00
Joshua Ashton
3ebd4b28a3 [d3d9] Defer dialog mode swapchain recreation decision to Present
Avoids unnecessary swapchain recreations if the game calls SetDialogBoxMode multiple times per frame
2020-01-10 04:30:55 +00:00
Joshua Ashton
9647e449d2 [d3d9] Remove redundant logging from SetDialogBoxMode
This path doesn't error anyway...
2020-01-10 04:30:02 +00:00
Philip Rebohle
4308d9b4b3
[meta] Release 1.5.1 2020-01-09 20:10:58 +01:00
Philip Rebohle
79fcaa9fba [d3d9] Remove unused variable from D3D9DeviceEx::Clear
Fixes a compiler warning.
2020-01-09 18:06:58 +00:00
Philip Rebohle
cd00719122
[dxvk] Tweak number of pipeline compiler threads
Gives some 6-core and 8-core CPUs a bit more breathing room, while
also supporting up to 32 workers instead of just 16 to leverage
the new high core count Ryzen CPUs.
2020-01-09 18:04:25 +01:00
Joshua Ashton
47555f1dda [d3d9] Add GetSurfaceExtent helper 2020-01-09 03:29:58 +00:00
Joshua Ashton
cd58b147a1 [d3d9] Respect mip != 0 for Clear fastpath 2020-01-09 03:24:50 +00:00
Joshua Ashton
ebcab68822 [d3d9] Respect specific mip size for implicit viewport in SetRenderTarget
Closes #1295
2020-01-09 03:19:37 +00:00
Joshua Ashton
3cfc16ea34 [d3d11] Move shader stage and buffer slot calc to inside lambda
Take advantage of the fact that template permutations transfer into lambdas inside of them.
Removes some unnecessary captures.
2020-01-08 23:09:53 +01:00
Joshua Ashton
b738c4220b [d3d9] Scale depth bias value based on current format's r value 2020-01-08 19:38:18 +00:00
Joshua Ashton
2d7f4b1a2c [d3d9] Set depth bias values separately, optimize redundant rasterizer state changes 2020-01-08 19:38:18 +00:00
Philip Rebohle
b376417f20
[dxvk] Fix loading vkAcquireFullScreenExclusiveModeEXT etc.
We're not using those functions, but these are device functions, not
instance functions. vkGetPhysicalDeviceSurfacePresentModes2EXT appears
to be an instance function.

Found while investigating #1324.
2020-01-08 04:10:10 +01:00
Philip Rebohle
8b9c03ce76
[util] Improve Spinlock implementation
Addresses two potential issues:
- Our spinlocks are almost never contested, however the code generated
  is not ideal without the likely/unlikely hints.
- In the unlike event that a spinlock is in fact contested, we'd yield
  immediately, even though most of the time we'd only have to wait for
  a few hundred cycles at most.

Replacing our spinlocks with std::mutex is not an option due to much
higher locking overhead in the uncontested case; doing so reduces
performance significantly for the buffer slice and pipeline locks.
2020-01-07 17:28:33 +01:00
Joshua Ashton
9541aef0b8 [d3d9] Ensure D3DDISPLAYMODEEX we use to call the Ex funcs has its size set correctly 2020-01-06 04:14:02 +00:00
Joshua Ashton
61b6f8f297 [d3d9] Hook up GetAdapterDisplayMode to resp. adapter func
Fixes fullscreen at < native res in Vampire: The Masquerade Bloodlines 1/2
2020-01-06 04:07:02 +00:00
Joshua Ashton
91574993df [d3d9] Return current display mode in GetAdapterDisplayModeEx rather than last mode
Fixes fullscreen at < native res in Vampire: The Masquerade Bloodlines 1/2
2020-01-06 04:06:45 +00:00
Joshua Ashton
845ab2b5af [d3d9] Don't re-set dialogbox mode on swapchain Reset
There's no reason to do this now that we have no error path in SetDialogBoxMode...
2020-01-04 21:12:53 +00:00
Joshua Ashton
d53b3adaea [d3d9] Remove incorrect error returns SetDialogBoxMode
The Microsoft docs for this are incorrect based on my tests of all the described edge-cases.
https://docs.microsoft.com/en-us/windows/win32/api/d3d9/nf-d3d9-idirect3ddevice9-setdialogboxmode
2020-01-04 21:10:26 +00:00
Philip Rebohle
ae01bd8bd4 [dxgi] Ignore sync interval if PRESENT_TEST is used
Otherwise, the following sequence leads to the Vulkan
swap chain being recreated once per frame:

  swapchain->Present(0, DXGI_PRESENT_TEST);
  swapchain->Present(1, 0);

Found while investigating #1314.
2020-01-04 11:18:51 +01:00
Philip Rebohle
3db00a0f40 [d3d11] Increment transfer command counter when initializing UAV counter
Otherwise, we won't clear the counter before it is being used if there are
no other transfer commands recorded to the initializer command buffer.
2020-01-03 13:44:23 +01:00
Joshua Ashton
0343938c2e [util] Enable d3d9.forceSamplerTypeSpecConstants for Halo [CE]
The game uses incorrect sampler types in the shaders for glass rendering which breaks it on native + us if we don't spec-constantly chose the sampler type automagically.
2020-01-01 20:58:42 +00:00
Joshua Ashton
c024b89171 [dxso] Implement d3d9.forceSamplerTypeSpecConstants
This option makes us always use a spec constant to determine sampler type (instead of just in PS 1.x)
which works around a game bug in Halo CE where it gives cube textures to 2d/volume samplers
2020-01-01 20:56:05 +00:00
Philip Rebohle
694d6c7f77 [util] Improve ticket lock implementation
Atomic fetch-and-add on unlock is not needed since no other thread can
modify the serving counter after the calling thread acquired the lock.
May slightly improve performance in games relying on ID3D10Multithread.
2020-01-01 13:59:46 +01:00
Joshua Ashton
ff129abaf0 [d3d9] Fix crash when trying to present with a currently invalid presenter
Closes #1304
2019-12-28 01:27:18 +00:00
Joshua Ashton
0993f6f25d [dxso] Negate reflection in TexM3x3VSpec 2019-12-25 18:43:51 +00:00
Joshua Ashton
66fee8ff51 [dxso] Normalize eyeRay and normal before reflection in TexM3x3Spec 2019-12-25 18:36:34 +00:00
Joshua Ashton
e0b83b13b5 [dxso] Only track co-issue parent opcode rather than the full context
Tracking the full instruction ctx is slow and unnecessary
2019-12-25 18:00:46 +00:00
Joshua Ashton
724fe78ba1 [dxso] Don't emit a co-issue for CNDs parented to a CND
Closes #1309
2019-12-25 17:43:35 +00:00
Joshua Ashton
b4f2094c02 [d3d9] Enable bounds testing for D3DPOOL_SYSTEMMEM buffers
Improves performance in Halo CE.
2019-12-22 19:05:22 +00:00
Joshua Ashton
d39ff9020e [dxso] Perform saturate after bitshift modifier 2019-12-22 18:14:46 +00:00
Joshua Ashton
3ff9c4cc43 [dxso] Track and prioritize co-issued CNDs above their parent ops 2019-12-22 17:46:57 +00:00
Joshua Ashton
4d6fbacd3a [dxso] Keep track of the current instruction index in a decoding context 2019-12-22 17:44:30 +00:00
Joshua Ashton
abf74299e9 [dxso] Parse co-issue instruction modifier 2019-12-22 17:44:04 +00:00
Joshua Ashton
fb4d794412 [d3d9] Use VK_FORMAT_D24_UNORM_S8_UINT for D3DFMT_DF24
May improve performance in some instances
2019-12-22 01:46:50 +00:00
Joshua Ashton
05de0b20a0 [d3d9] Use VK_FORMAT_D24_UNORM_S8_UINT for D3DFMT_D24X8
May improve performance in some instances
2019-12-22 01:43:36 +00:00
Joshua Ashton
90ce37c8c9 [d3d9] Make ChangeReportedMemory actually atomic
Massive edge case that will never happen, but better to be safe than sorry.
Reduces the atomic ops too.
2019-12-20 18:07:35 +00:00
Joshua Ashton
fae99907da [util] Add get to bitset 2019-12-18 23:18:01 +00:00
Joshua Ashton
5cc0fd5c25 [d3d9] Simplify SetViewport
pViewport == nullptr is illegal
2019-12-18 23:18:01 +00:00
Joshua Ashton
bab56433cb [d3d9] Avoid rebinding scissor rects if the same one is re-set 2019-12-18 23:18:01 +00:00
Joshua Ashton
288a9dd547 [d3d9] Avoid rebinding viewports if the same one is re-set 2019-12-18 23:18:01 +00:00
Joshua Ashton
9ec0541b93 [d3d9] Still rebind viewport/scissor when setting the same RT
Closes #1290
2019-12-18 23:18:01 +00:00
Joshua Ashton
7b0723520a [d3d9] Add operator overloads for RECT 2019-12-18 23:18:01 +00:00
Joshua Ashton
777cd4cd64 [d3d9] Add operator overloads for D3DVIEWPORT9 2019-12-18 23:01:16 +00:00
Alessandro Toia
3c8fdc2863 Report gpu vendor as Nvidia for Star Wars Battlefront II 2019-12-18 17:38:24 +01:00
Philip Rebohle
31948cae8c [spirv] Allow specifying the SPIR-V version explicitly
We're going to use some SPIR-V 1.4 features for D3D11 if supported,
but 1.4 is not supported by all implementations.
2019-12-18 17:36:46 +01:00
Joshua Ashton
78e4816fc0 [d3d9] Avoid unnecessary state block constant bits when not SWVPing 2019-12-18 14:48:01 +01:00
Joshua Ashton
312905e8a3 [d3d9] Use new bitset helper + tzcnt for stateblocks 2019-12-18 14:48:01 +01:00
Joshua Ashton
b99b1d153a [util] Add bitset helper 2019-12-18 14:48:01 +01:00
Joshua Ashton
784abe5cf4 [d3d9] Move auto depth stencil creation to after swapchain creation
If the app specifies w == 0 and/or h == 0 then this will be filled in by then in the presentation params.

Impacts #1278
2019-12-18 00:09:55 +00:00
Joshua Ashton
009e772fe8 [d3d9] Remove initial device reset outside of constructor
Allows us to funnel hresults from that to the response of CreateDevice
2019-12-17 23:59:37 +00:00
Joshua Ashton
3b119c0be6 [d3d9] Log unavailable backbuffer format if encountered when resetting swapchain 2019-12-17 22:36:27 +00:00
Joshua Ashton
3abd30bb96 [d3d9] Fix return value for invalid backbuffer formats
This got changed when I saw that the auto depth stencil when set to an unavailable returns D3DERR_NOTAVAILABLE.
Turns out if the backbuffer is unavailable it returns D3DERR_INVALIDCALL...

Consistent...

Closes #1278
2019-12-17 22:36:27 +00:00
Philip Rebohle
a265af74ed
[hud] Respect dxvk.hud configuration option again
This was accidentally dropped during the HUD refactor. Fixes #1279.
2019-12-17 04:40:06 +01:00
Joshua Ashton
e527b963c4 [util] Handle undefined ratios in simplest ratio helper
Fixes division by zero error

Closes #1280
2019-12-17 03:16:56 +00:00
Joshua Ashton
91b5105db5 [d3d9] Move capture struct and enum to stateblock header
Makes more sense for it to be here.
2019-12-17 03:16:50 +00:00
Philip Rebohle
3cdae3ae1d
[meta] Release 1.5 2019-12-16 14:41:29 +01:00
Philip Rebohle
9be0bf95ca
[util] Defer D3D9 surface creation for Atelier Ryza 2019-12-16 14:41:29 +01:00
Joshie
54ed8f0bb0 [d3d9] Implement Direct3D9 Frontend (#1275)
Co-authored-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Co-authored-by: Robin Kertels <robin.kertels@gmail.com>
Co-authored-by: pchome <pchome@users.noreply.github.com>
Co-authored-by: Christopher Egert <cme3000@gmail.com>
Co-authored-by: Derek Lesho <dereklesho52@Gmail.com>
Co-authored-by: Luis Cáceres <lacaceres97@gmail.com>
Co-authored-by: Nelson Chen <crazysim@gmail.com>
Co-authored-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Co-authored-by: Riesi <riesi@opentrash.com>
Co-authored-by: gbMichelle <gbmichelle.dev@gmail.com>
2019-12-16 04:28:01 +01:00
Philip Rebohle
566fb84abd
[hud] Allocate vertex buffer in host-visible device memory if possible 2019-12-16 00:24:19 +01:00
Philip Rebohle
c6fb8fa5e8
[hud] Clean up HUD rendering
- Avoids rebinding the vertex buffer on every single draw.
- Avoids push constants. We could use MultiDrawIndirect in the future.
- Slightly reduces the vertex buffer size.
2019-12-16 00:03:21 +01:00
Philip Rebohle
13d2479ecf
[hud] Don't create uniform buffer
No longer used.
2019-12-15 23:17:23 +01:00
Philip Rebohle
9c6ff95bb6
[hud] Don't use vertex shader for scaling
Instead, do it on the CPU.
2019-12-15 23:13:59 +01:00
Philip Rebohle
aa40decc23
[d3d11] Don't present if the presenter has no swap chain.
Also fixes DXGI_PRESENT_TEST handling for zero-sized windows.
2019-12-15 11:38:57 +01:00
Philip Rebohle
2d0c9127f3
[vulkan] Don't create a swap chain if the window size is 0
This can actually happen on win32, and creating a zero-sized swap
chain is illegal.
2019-12-15 11:32:43 +01:00
Philip Rebohle
ae7189f9a4
[d3d11] Update HUD on CS thread
Otherwise, we may end up reading some bollocks since the CS thread
might not have finished processing the entire frame yet.
2019-12-13 15:02:45 +01:00
Philip Rebohle
2689204d74
[hud] Enable manual sRGB conversion for non-sRGB swap chains
We still blend in the wrong color space, but text should be a bit
more readable in some games now.
2019-12-13 14:03:00 +01:00
Philip Rebohle
08d5b4e0e7
[hud] Don't average the draw call count
Turns out this was a bad idea.
2019-12-13 13:14:23 +01:00
Philip Rebohle
ef99078fc4
[hud] Reduce update frequency of draw call display 2019-12-13 13:05:49 +01:00
Philip Rebohle
2c4879b58c
[hud] Reduce update frequency of queue submission display
Shows the maximum number of submissions encountered per frame
in the given time frame.
2019-12-13 13:01:44 +01:00
Philip Rebohle
3febca6863
[hud] Add colorful labels 2019-12-13 12:34:01 +01:00
Philip Rebohle
5da27a92f5
[hud] Fix letter spacing 2019-12-13 12:17:15 +01:00
Philip Rebohle
7a18cb1227
[dxvk] Remove unused memory stat counters 2019-12-13 12:08:36 +01:00
Philip Rebohle
ed69da0fff
[hud] Remove legacy code 2019-12-13 11:58:09 +01:00
Philip Rebohle
3415376984
[hud] Implement compiler activity display as a HUD item 2019-12-13 11:54:51 +01:00
Philip Rebohle
5d8ae8f988
[hud] Implement GPU load display as a HUD item 2019-12-13 11:54:51 +01:00
Philip Rebohle
936f22d2aa
[hud] Implement memory stats display as a HUD item 2019-12-13 11:54:50 +01:00
Philip Rebohle
3aff573bd4
[hud] Implement pipeline stat display as a HUD item 2019-12-13 11:54:26 +01:00
Philip Rebohle
3de8499697
[hud] Implement draw call stats display as a HUD item 2019-12-13 11:54:13 +01:00
Philip Rebohle
0f2610010b
[hud] Implement queue submission counter as a HUD item 2019-12-13 11:54:13 +01:00
Philip Rebohle
07a4504a9f
[hud] Implement frame time graph as a HUD item 2019-12-13 11:54:13 +01:00
Philip Rebohle
2d5f44a7ff
[hud] Implement FPS display as a HUD item 2019-12-13 11:54:13 +01:00
Philip Rebohle
0da5aac357
[hud] Implement Vulkan device info as a HUD item 2019-12-13 11:54:13 +01:00
Philip Rebohle
e4bc5c2aee
[hud] Implement client API info as a HUD item 2019-12-13 11:54:13 +01:00
Philip Rebohle
1c079a96e5
[hud] Implement DXVK version info as a HUD item 2019-12-13 11:54:13 +01:00
Philip Rebohle
6931f03120
[hud] Add new HUD item abstraction
Allows for a cleaner and more flexible implementation of new HUD elements.
The old implementation was not intended to support quite as many elements
as it does, and now there is some need for API-specific HUD elements.
2019-12-13 11:54:13 +01:00
Philip Rebohle
4346f82209
[hud] Don't pass DXVK context around in HUD modules 2019-12-13 11:54:13 +01:00
Philip Rebohle
8e587af0da
[dxvk] Add method to retrieve per-heap memory stats 2019-12-13 11:54:13 +01:00
Philip Rebohle
4fcf28f4dc
[util] Spoof Nvidia cards for Crysis 3
The game for some reason runs significantly slower in CPU-bound scenarios
when it recognizes an AMD GPU. On the other hand, there seems to be a small
performance hit on an actual Nvidia GPU (GTX 670) in GPU-bound scenarios when
doing this, but on most setups the tradeoff should be worth it.
2019-12-11 23:01:27 +01:00
Philip Rebohle
b9258c0c49
[dxvk] Separate gfx resource hazard checking and barrier emission
Otherwise, when performing three draws with the same storage buffers or
storage images bound, we don't emit a barrier between the 2nd and 3rd
draw since the tracking information gets cleared by the second draw.

Fixes #1262.
2019-12-11 13:45:57 +01:00
Joshua Ashton
f5dd509429 [spirv] Implement constbReplicant 2019-12-11 03:18:39 +01:00
Joshua Ashton
8b6dd0544e [spirv] Implement constvec4b32 2019-12-11 03:18:39 +01:00
Joshua Ashton
028c6198e4 [spirv] Implement opReflect 2019-12-11 03:18:39 +01:00
Joshua Ashton
3ce678b17d [spirv] Implement opExp 2019-12-11 03:18:39 +01:00
Joshua Ashton
fdbfb2c92d [spirv] Implement opInverse, opNormalize and opLength 2019-12-11 03:18:39 +01:00
Joshua Ashton
edf0661994 [spirv] Implement opTranspose 2019-12-11 03:18:39 +01:00
Joshua Ashton
e144c17363 [spirv] Implement constfReplicant helper 2019-12-11 03:18:39 +01:00
Joshua Ashton
7a956ef8c8 [dxvk] Expose ability to retrieve type from DxvkShaderKey 2019-12-11 03:18:39 +01:00
Joshua Ashton
7c8d03b3e1 [dxvk] Add helper to get size of memory/image in bytes 2019-12-11 03:18:39 +01:00
Philip Rebohle
3063d7fc7c [dxvk] Improve DxvkImageView::handle()
Should fix a silly compiler warning and improves code gen, which
is important since this is *the* most frequently called function
in the backend.
2019-12-11 03:18:39 +01:00
Joshua Ashton
d5d6ae4fe1 [dxvk] Add support for implicit samplers 2019-12-11 03:18:39 +01:00
Joshua Ashton
3fa8691033 [util] Implement simplest ratio helper 2019-12-11 03:18:39 +01:00
Joshua Ashton
16dd1249b7 [util] Add alignDown helper 2019-12-11 03:18:39 +01:00
Joshua Ashton
57b2c02528 [util] Implement lzcnt 2019-12-11 03:18:39 +01:00
Joshua Ashton
aef12f7ee3 [util] Add countof helper 2019-12-11 03:18:39 +01:00
Joshua Ashton
d4cad9055c [util] Implement a clamped version of ComObject, for D3D9
Satisfies a quirk in D3D9, solving an issue in SWTFU.
2019-12-11 03:18:39 +01:00
Joshua Ashton
511ed27733 [util] Add GetPrivateRefCount helper 2019-12-11 03:18:39 +01:00
Joshua Ashton
9280818a57 [util] Implement fclamp for fp special cases 2019-12-11 03:18:39 +01:00