Compare commits

...

3438 Commits

Author SHA1 Message Date
Blisto91 8d965359a5 [util] Set longMad for Watch_Dogs
Works around flickering on some objects such as the blue light arrow on lowering gates
2024-06-06 19:01:42 +02:00
Philip Rebohle fd978704fb [dxvk] Add dxvk.deviceFilter config option 2024-06-05 00:49:26 +02:00
Tiagoquix ee18aecb8a
[util] Add dxvk.maxChunkSize 1 for Origin Web Helper Service and Ubisoft Connect (UPlay) (#4047)
* Add dxvk.maxChunkSize 1 to Ubisoft Connect (UPlay)

* Add Origin Web Helper Service and fix Rockstar Games entries

* Revert Rockstar changes, improve Origin and Ubisoft
2024-06-02 20:08:52 +02:00
Blisto91 c2fd91f835 [util] Set longMad for Ghostbusters Remastered
Works around flickering on character faces
2024-06-02 11:10:13 +02:00
Tiagoquix 79eea564fb Add dxvk.maxChunkSize 1 to Origin 2024-05-31 23:46:26 +02:00
Robin Kertels 7df8017e46 [d3d9] FF: Apply transform flags count to generated texture coords
... and fix cases where projection doesn't get applied.
2024-05-27 20:52:32 +00:00
WinterSnowfall c98152683f [d3d9] Tweak VCache query results 2024-05-27 19:53:19 +02:00
Blisto91 890ad3f47f [CI] Update CI actions 2024-05-27 19:38:16 +02:00
Robin Kertels 60cfafe027 [d3d9] Fix strange type in dynamic vertex upload 2024-05-26 04:58:47 +00:00
Robin Kertels 889802887f [d3d9] Rework uploading dynamic sysmem buffers at draw time
... and handle mismatching vertex sizes and vertex strides.
2024-05-23 16:44:49 +02:00
WinterSnowfall a1ce690c5c [d3d9] Determine DF format support in the options parser 2024-05-23 16:37:09 +02:00
WinterSnowfall 07d007c642 [d3d9] Use customVendorId to determine the options vendorId 2024-05-23 16:37:09 +02:00
Danylo Piliaiev 58d8ea2d31 [d3d11,d3d9,util] Add a config option for reproducible VK output
It ensures that for the same D3D commands the output VK commands
don't change between runs.

Useful for comparative benchmarking, can negatively affect performance.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
2024-05-23 15:20:28 +02:00
Philip Rebohle 61bd62c327 [dxvk] Allow descriptor pool overallocation if supported 2024-05-23 14:27:28 +02:00
Philip Rebohle 7bc77b597e [dxvk] Enable VK_NV_descriptor_pool_overallocation if available 2024-05-23 14:27:28 +02:00
Simon McVittie 2ff2c826a5 [build] Generate pkg-config metadata to link to DXVK libraries
This allows dependent projects to query the version and location of DXVK
via the pkg-config interface.

The include directories aren't yet set, because the headers aren't
installed; that will follow in a subsequent commit.

The naming of these pkg-config files is based on proposed Fedora packages
for DXVK 2.0, and is not compatible with older Fedora packages for DXVK
1.x (which used the naming convention dxvk-native-d3d9 and so on).
Packagers can create symlinks such as dxvk-native-d3d9.pc -> dxvk-d3d9.pc
if they want to retain compatibility with older names.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-05-21 19:18:12 +00:00
Simon McVittie f9b4046223 [build] Install headers for native builds
When building a game that has been ported to Linux using DXVK Native,
these headers are necessary to provide the Direct3D and DXVK APIs.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-05-21 19:18:12 +00:00
Simon McVittie 83436a97f2 [meson] Set the stem of library names instead of the name_prefix
This is necessary for compatibility with Meson's pkg module, which
generates pkg-config metadata containing "-lNAME" where NAME is the
first argument to shared_library(). Changing the name_prefix parameter
would break that.

Conversely, including .dll or .so in the first parameter would also
break that, so remove the `+dll_ext` part (in practice this is not a
functional change, because `dll_ext` is always set to an empty string).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-05-21 19:18:12 +00:00
Ethan Lee e991bfa604 [ci] Use a tarball for the steamrt-sniper artifact.
Zips can't preserve the symlink, so make the .tar.gz package with package_native.sh and zip that up instead.
2024-05-21 19:18:12 +00:00
Ethan Lee f33453afbb [build] Add soversion to dxvk-native binaries 2024-05-21 19:18:12 +00:00
Robin Kertels 65dd3c7df3 [d3d9] Always enable STORAGE_BUFFER usage
Fixes a validation error. Drivers don't care about buffer usage bits anyway.
2024-05-21 20:32:13 +02:00
Robin Kertels dfc3776b24 [d3d9] FF: Fix a bunch of wine tests with FF texture coordinates 2024-05-21 20:32:13 +02:00
Philip Rebohle 3420cd78ac [dxvk] Use new Version helper to deal with driver version numbers 2024-05-20 18:30:36 +02:00
Philip Rebohle 4225f35034 [util] Add version helper class
Useful to decode, store and compare human-readable driver versions.
2024-05-20 18:30:36 +02:00
Philip Rebohle 2cb2f8694e [dxvk] Use VK_MAKE_API_VERSION instead of VK_MAKE_VERSION.
The old macro is deprecated.
2024-05-20 18:30:36 +02:00
Blisto91 c1f665f92b [util] Disable supportDFFormats for Prototype
Incorrect shadows on AMD & Intel
2024-05-18 19:31:07 +02:00
WinterSnowfall 20185a5309 [d3d9] Do not enable support for DF formats on Nvidia 2024-05-18 16:16:34 +00:00
Blisto91 0c2efda804 [meta] Add DXVK Native section to the readme 2024-05-16 10:57:35 +00:00
Blisto91 c7d61b2fc0 [native] Change DXVK_WSIDRIVER to DXVK_WSI_DRIVER 2024-05-16 10:57:35 +00:00
Ethan Lee 6259e86392 [meson] Use dependency() instead of find_library() for SDL2/GLFW detection.
Since we're not linking to the libraries anymore, it doesn't make much sense to
use find_library, and in fact we need to use dependency() in order to get the
right CFLAGS for includes, defines, etc, so use that instead.

As a result, we can remove the 'SDL2/' folders from the includes, making the SDL
includes more correct.
2024-05-13 13:18:03 +00:00
Ethan Lee d5d236a1e2 [wsi] Refactor platform system to support multiple WSI implementations 2024-05-13 13:18:03 +00:00
Ethan Lee 10b83d184b [native] Dynamically load SDL2/GLFW at runtime.
Removing these link-time dependencies is important for making a single binary that is compatible with either backend, regardless of whether or not each one is currently available to the program.
2024-05-13 13:18:03 +00:00
Ethan Lee 0f7c1f753a [wsi] Refactor the WSI backends to be implementations of a WsiDriver interface.
Rather than directly calling functions, the API now calls shared functions that call into a WsiDriver instance, which is allocated and implemented by the backend. Functionally this should be the same, it just has the extra allocation for the function table.

This prepares the WSI library for supporting multiple implementations in a single binary.
2024-05-13 13:18:03 +00:00
Ethan Lee 529129c332 [dxvk] Move getInstanceExtensions platform logic to wsi.
This ensures that all of the WSI backend logic is in one place rather than two.
2024-05-13 13:18:03 +00:00
Ethan Lee 4055a92856 [wsi] Add init/quit functions, integrate them into DxvkInstance.
This is preparation for loading/unloading WSI backends at runtime, which will be in an upcoming commit.
2024-05-13 13:18:03 +00:00
Blisto91 7bad17c1d1 [util] Set deviceLossOnFocusLoss for The Sims 3
Prevents the game black screening on alt-tab
2024-05-11 14:38:43 +02:00
Blisto91 6b76d70d9d [util] Enable d3d11.longMad for Guild Wars 2
Fixes invisibility effect flicker when invariantPosition is enabled
2024-05-09 00:47:13 +02:00
Philip Rebohle 611dc60018 [d3d9] Do not support cube textures with depth formats 2024-05-08 17:05:48 +00:00
WinterSnowfall b2789ab894 [d3d9] Validate DS format support during CheckDepthStencilMatch 2024-05-06 20:26:09 +00:00
Philip Rebohle ab715a8876 [d3d11] Implement better filtering when blitting video content
Unlike linear filtering this guarantees that we never read outside the source
region, and this also lets us perform color space conversion prior to filtering.
2024-05-03 16:23:17 +02:00
talkingerbil 1fb35b6d19
[dxgi] Initialize UMD version quad to a max signed int64 (#3985) 2024-05-03 16:22:58 +02:00
Rémi Bernon 4333ee872d [d3d11] Use nearest filter for ID3D11VideoContext scaling 2024-05-02 18:17:54 +02:00
Rémi Bernon b99d42c688 [d3d11] Implement VideoProcessorSetStreamSourceRect scaling 2024-05-02 18:17:54 +02:00
Blisto91 dacb8b434b [util] Add configs for Delta Force Xtreme 1 & 2
Prevents the games from black screening on Alt-Tab and helps big performance dips.
2024-05-01 14:08:03 +02:00
Philip Rebohle ea4cb84d8a [dxvk] Remove workaround for non-dynamic depth clip
Kind of pointless and everyone supports the required EDS3 subset anyway.
2024-04-29 17:43:40 +02:00
Philip Rebohle 65373792d2 [dxvk] Forward link flags when using shader identifiers
Fixes a long-standing bug that now causes validation errors.
2024-04-29 17:43:40 +02:00
Lierrmm 29253da356 feat: add H2M-Mod to config 2024-04-29 16:19:42 +02:00
Robin Kertels 79398b468d [util] Enable longMad for Red Faction Guerrila Remastered 2024-04-29 13:17:21 +02:00
Robin Kertels e7d14e97de [dxbc] Implement option to split up fma 2024-04-29 13:17:21 +02:00
Philip Rebohle c613078ba8 [dxvk] Bump internal version number
Potentially useful for drivers and tools to deal with the new pipeline
layout changes.
2024-04-26 19:54:52 +02:00
Philip Rebohle 2970645f33 [dxvk] Fix push constant compatibility for pipeline libraries
When linking pipelines, all pipeline libraries are required to declare
the exact same set of push constants, even for stages not part of the
respective libraries.

This invalidates all fossilize databases.
2024-04-26 19:54:52 +02:00
Philip Rebohle 462165da19 [util] Add Deck profile for Fallout 4
Should fix the FPS problem on Deck OLED.
2024-04-26 14:34:08 +02:00
Philip Rebohle 3f27a0ee58 [util] Add a way to define app profiles exclusive to Steam Deck 2024-04-26 14:34:08 +02:00
Katharine Chui aac3396671 [dxgi] unchain DxgiFactory::CreateSwapChain and CreateSwapChainForHwnd
similar to https://github.com/doitsujin/dxvk/pull/3966, avoid
chaining so that dxgi tools attempting to wrap swapchains don't
end up double wrapping

ref: https://github.com/SpecialKO/SpecialK/issues/168
2024-04-25 12:07:50 +02:00
Katharine Chui 92a43ebf65 [dxgi] unchain DxgiSwapChain::Present1 and Present
dxgi hooking tools might hook both, eg. https://github.com/SpecialKO/SpecialK/issues/167
2024-04-22 14:04:43 +02:00
Blisto91 8ba5256dc7 [util] Set deferSurfaceCreation for 9th Dawn II
OpenGL game that also spins up d3d9. Will black screen without deferSurfaceCreation when using dxvk
2024-04-22 04:48:56 +02:00
Philip Rebohle 2b70ba8f77 [dxbc] Do not emit OpImageQueryLevels for multisampled images 2024-04-19 13:55:31 +02:00
Philip Rebohle 9c66c4bf1d [build] Target SPIR-V 1.6 for built-in GLSL shaders
Silences a Mesa warning when the HUD is enabled.
2024-04-19 13:36:32 +02:00
Philip Rebohle 00872e9e4f [dxvk] Fix render target clears with format reinterpretation
With LOAD_OP_CLEAR, we cannot rely on the clear actually being performed
with the view format in mind. Use a vkCmdClearAttachment path instead.
2024-04-19 13:08:36 +02:00
Philip Rebohle 35157357dd [dxvk] Fix stencil discard being broken 2024-04-19 01:43:23 +02:00
Philip Rebohle 617ebf4e05 [dxbc] Take used components into account for PS inputs 2024-04-19 01:01:52 +02:00
Philip Rebohle c2489d5a45 [dxbc] Fix array register anaylsis with multiple dst operands 2024-04-19 01:01:52 +02:00
Philip Rebohle 6ef98c613f [dxvk] Re-enable maintenance4 feature
Sileces some validation errors.
2024-04-19 01:01:52 +02:00
Philip Rebohle 7441137a33 [dxbc] Ignore system value components when declaring inputs 2024-04-19 01:01:52 +02:00
WinterSnowfall 571948cfc0 [d3d9] Remove support for VERTEXSTATS queries 2024-04-13 19:11:00 +01:00
Martino Fontana 133f0794bc [util] Remove framerate limiter for Nier Replicant
Without mods, Nier Replicant runs faster when going above 60 FPS.
The game had an official patch that implemented a framerate limiter to prevent this. This limiter is terrible, because it's not a stable 60 FPS, but a weird 57-58 FPS. There's no way to disable this in-game, it has to be done by editing a config file or through a mod.

So, why remove the default frame limiter from DXVK?
- In the default case (a user plays the game as it is), it does nothing, since 57-58 is lower than 60.
- If a user is going out of their way to edit the config file, why would they assume that DXVK already provides a frame limiter? They are going to follow [a guide](https://www.pcgamingwiki.com/wiki/NieR_Replicant#Framerate_limited_to_57.7E58_FPS) that says to set up a frame limiter, it doesn't say "set up a frame limiter, unless you are using DXVK, in that case it's already there".
- They are using [Special K in order to use a mod to play at high refresh rates at normal speed](https://wiki.special-k.info/SpecialK/Custom/Replicant). In this case, DXVK's default limiter is harmful, since it is not documented that it's there by default.

Since this default limiter is useless in the first two cases and harmful in the third, I think it should be removed.
The alternative would be to document this (e.g. in PCGamingWiki), but the instructions wouldn't look pretty... "After following the instructions to use Special K in order to play at higher framerates at normal speed, if are using DXVK/Proton, also do these things to disable its default 60 FPS cap: [...]"

Especially because that the game isn't broken in the default case, I don't think DXVK should tamper with these things in a way that requires documentation to revert.

Tested Special K's mod to play at higher refresh rates on Linux.
2024-04-08 21:48:47 +02:00
Philip Rebohle 44695f9311 [dxvk] Adjust desciptor pool reset heuristic
Drastically limits the amount of descriptor memory we allocate in situations
where an application renders without presenting anything to a swap chain.

The new limit is a bit tight for some real-world use cases (e.g. Ashes of the Singularity),
but at worst we will start calling vkAllocateDescriptorSets once per set and draw.
2024-04-08 15:40:25 +02:00
Casey Bowman 49e9ea5f5a [dxgi] Force vendor ID change when XeSS is detected on an Intel GPU
Games using libxess.dll or wrapper modules will crash.
To work around this, we hide the Intel GPU's vendor ID to avoid using the
XeSS module.
2024-04-03 20:32:04 +02:00
Blisto91 198bd3a4b8 [d3d11] Remove missed Shared Keyedmutex warning
D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX is implemented.
2024-04-03 20:31:52 +02:00
Philip Rebohle f06c646315 [dxbc] Remove broken atomic counter subgroup optimization
This is not a legal optimization inside non-uniform control flow due
to Vulkan's extremely permissive convergence rules, and apparently
breaks on Nvidia as a result.

Mesa drivers already do the same thing internally anyway.
2024-04-03 14:55:43 +02:00
Philip Rebohle 855b2746b6 [util] Remove TRAHA Global config
This game apparently no longer exists.
2024-03-26 13:42:55 +01:00
Blisto91 28c7c09bf5 [dxgi] Remove useMonitorFallback option
QueryDisplayConfig optimization is now in Proton 9 Wine
2024-03-21 17:23:38 +01:00
Philip Rebohle 2742486540 [dxvk] Don't query color space support for null surfaces
Fixes a crash in games with the dxgi.deferSurfaceCreation workaround set.
Note that this potentially breaks HDR.
2024-03-21 15:32:48 +01:00
Philip Rebohle 037d0fa1ad [meta] Release 2.3.1 2024-03-20 13:48:30 +01:00
Philip Rebohle cbf51a7a25 [d3d11] Enable copy usage for typeless images as necessary 2024-03-20 13:30:31 +01:00
Philip Rebohle 70e34dc31c [dxvk] Support arbitrary source formats for color<->depth copies
Fixes rendering bugs in War Thunder.
2024-03-20 13:29:59 +01:00
Philip Rebohle c5aeb0f87a [dxvk] Get rid of separate depth shaders for shader-based copies
We can export both depth and color in a single shader instead.
2024-03-19 19:32:12 +01:00
Philip Rebohle a163082770 [dxvk] Align index buffer size to index size
Fixes validation errors in FFXIV.
2024-03-19 19:32:12 +01:00
Blisto91 2e1a19c7fd [util] Cap Dark Void to 60fps
Game crashes in certain places like specific cutscenes unless capped at 60fps.
2024-03-18 12:56:27 +01:00
Joshua Ashton 0beb18ef73 [d3d9] Wait for submission when calling ReturnUnderlyingResource 2024-03-16 19:11:11 +00:00
Joshua Ashton ef4428ab8c [d3d9] Improve ReturnUnderlyingResource stub for 9on12 2024-03-16 18:59:03 +00:00
Philip Rebohle 1085ba713e [dxgi] Implicitly set HDR color space for RGBA16_FLOAT swap chains 2024-03-16 18:56:41 +00:00
Philip Rebohle e857b09432 [dxgi] Change default behaviour of hideNvkGpu option 2024-03-15 22:48:57 +01:00
Kaitlyn 538f1d13d4 Fix UAV as well 2024-03-15 15:22:13 +01:00
Kaitlyn 783c9d4591 Fix MiscFlags check in GetDescFromResource 2024-03-15 15:22:13 +01:00
Kaitlyn 1a685b1c67 Implement D3D11DXGIDevice::EnqueueSetEvent 2024-03-15 13:47:28 +01:00
Robin Kertels 8b8be7c2bf [d3d9] Fix stream count in Reset 2024-03-10 17:12:22 +01:00
Billy Laws 0776d764a4
build: Support building for ARM64EC
When targeting ARM64EC, both __x86_64__ and _M_X86_64 are defined but
not all x86 intrinsics are present, treat EC as regular ARM64 so the
native intrinsics are used instead.
2024-03-09 05:43:46 +00:00
Robin Kertels 15ddadc4de [d3d9] Fix number of streams 2024-03-08 18:42:15 +01:00
Philip Rebohle 69a52b3da0 [dxbc] Do not emit depth compare for unsupported image types
Fixes invalid SPIR-V.
2024-03-07 16:11:23 +01:00
Philip Rebohle 707ad6f328 [spirv] Add OpConstantNull 2024-03-07 16:11:23 +01:00
Philip Rebohle 3a6992ea97 [dxbc] Enable depth compare types for 1D images
Used by Renderdoc internal shaders.
2024-03-07 16:11:23 +01:00
Robin Kertels 72c86b8229 [d3d9] Only unbind in EndScene if the game cleared the binding 2024-03-06 22:58:48 +01:00
Robin Kertels 85215b10d6 [d3d9] Respect vertex buffer offset when dynamically uploading geometry 2024-03-06 18:13:26 +01:00
Philip Rebohle fd3fbf6607 [dxvk] Remove old memory budget code
Obsolete since we removed the Nvidia HVV workaround for old drivers.

Closes #3877.
2024-03-06 15:48:34 +01:00
Minelelol 0a699fddb6 Update config.cpp
Insane Performance increase
2024-03-06 15:25:16 +01:00
Blisto91 afec5cce88 [util] Remove some unneeded built in configs
Dirt 5 does not crash without working ags anymore and Ethan Carter Redux also starts fine without a spoof.
This allows the built in AMD ags in Proton 9 to be used for these games.

The Hitman 3 config is redundant as it doesn't allow RT to be enabled without Nvapi anyway.
2024-03-06 15:24:54 +01:00
Ethan Lee 4b0e3111d1 meson: Check for bundled Vulkan/SPIR-V headers before adding them to the include list.
This feature requires Meson 0.58 or newer.
2024-03-06 15:21:15 +01:00
Philip Rebohle 0414bbe2d5 [dxgi] Add separate option to override vendor IDs for NVK 2024-03-06 14:46:21 +01:00
Robin Kertels 20490b678f [d3d9] Fix missing else brackets in ResetSwapchain 2024-03-06 12:08:45 +01:00
Blisto91 428c98bc63 [util] Disable countLosableResources for all d3d9 Supreme Ruler games
All the d3d9 Supreme ruler games have this issue.
2024-03-05 15:28:11 +01:00
Robin Kertels a0e39e94fa [d3d9] Use most recently used swapchain for GetFrontBufferData 2024-03-05 13:54:15 +00:00
Robin Kertels eaa732d0b3 [d3d9] Place GetFrontBufferData screenshot at window position 2024-03-05 13:54:15 +00:00
Robin Kertels 49b18f03fe [d3d9] Unbind buffers in EndScene & Reset 2024-03-05 13:52:51 +00:00
Philip Rebohle c9cea93b7b [dxbc] Use raw access chains for buffer loads and stores
Maps more or less perfectly to D3D raw and structured buffers.
2024-03-05 14:41:18 +01:00
Philip Rebohle 69d74a46a0 [dxbc] Remove emitRawBuffer{Load,Store}
And factor these into the callers. We need to preserve the raw
index and offset parameters to use raw access chains.
2024-03-05 14:41:18 +01:00
Philip Rebohle 94098aa97d [dxbc] Enable SPV_NV_raw_access_chains 2024-03-05 14:41:18 +01:00
Philip Rebohle c677ba9b3e [dxvk] Enable VK_NV_raw_access_chains if available 2024-03-05 14:41:18 +01:00
Philip Rebohle 77c7396ee1 [spirv] Add support for OpRawAccessChainNV 2024-03-05 14:41:18 +01:00
Philip Rebohle f07e5f9eaa [include] Update SPIR-V headers 2024-03-05 14:41:18 +01:00
Philip Rebohle d5c3011f54 [include] Update Vulkan headers 2024-03-05 14:41:18 +01:00
Blisto91 6b3b934471 [util] Clarify maxDeviceMemory and maxSharedMemory
This config often leads to confusion as people expect applications to honor the limit.
2024-03-02 20:41:19 +01:00
Philip Rebohle 9004c132ed [dxbc] Declare dynamically indexed UBOs with the maximum possible size
Fixes #3861.
2024-02-23 13:39:29 +01:00
Philip Rebohle 24d4c9c938 [util] Disable command lists for Granblue Fantasy Relink
The uses deferred contexts for rendering if driver command lists are enabled,
but when AMDAGS is loaded, it will also unconditionally use MultiDrawIndirect
functions. Since the AGS version in use does not support deferred contexts,
this breaks rendering, so we will have to force it into the immediate context
path.

Testing also shows slightly higher performance (~3-5%) with this path in
CPU-bound scenarios.
2024-02-22 16:07:24 +01:00
Philip Rebohle 5ded7d67f0 [d3d11] Implement UpdateSubresource bug if native command lists are disabled 2024-02-22 16:07:24 +01:00
Philip Rebohle 234f3ea071 [d3d11] Add option to hide native command list support 2024-02-22 16:07:24 +01:00
Robin Kertels c5a37d443a [d3d9] Handle null IBO when uploading data for draw 2024-02-20 13:04:01 -08:00
Robin Kertels f254afb4fb [util] Enable strict float emulation for Red River 2024-02-20 12:58:03 -08:00
Robin Kertels 39c19e9299 [d3d9] End scene on reset 2024-02-20 12:58:03 -08:00
Robin Kertels 738fd4f895 [d3d9] Don't actually unbind buffers 2024-02-20 12:58:03 -08:00
Philip Rebohle 9491b56beb util: Enable d3d11.ignoreGraphicsBarriers for Granblue Relink
Improves GPU-bound performance due to the game using PS UAVs.
2024-02-15 20:33:55 +01:00
Robin Kertels ab3593185f [d3d9] Fail GetRTData if src and dst have mismatching sizes
MySims tries to do this and needs this to fail,
otherwise mouse picking is off.
2024-02-06 11:02:43 +01:00
Robin Kertels e9a0fec5b3 [dxso] Clamp Exp when fast float emulation is enabled 2024-02-06 11:02:20 +01:00
Echo J fae78407a2 d3d9: Remove an unused variable
This fixes a gcc warning (originally reported by Saancreed)
2024-02-06 10:19:28 +01:00
Robin Kertels 5312ef1cf9 [d3d9] Upload DYNAMIC+SYSMEM vertex and index data for each draw 2024-02-05 13:13:18 +00:00
Robin Kertels 62d64bd63a [d3d9] Don't upload buffers before Up draws 2024-02-05 13:13:18 +00:00
Robin Kertels f83ba898af [dxvk] Use signed int for vertexOffset
BaseVertexIndex is signed in Vulkan, D3D11 & D3D9.
2024-02-05 13:13:18 +00:00
Ethan Lee 30f2b2df31 package-native.sh should force libdisplay-info subproject
This ensures that the script produces a build similar to the default steamrt build, even if libdisplay-info is available on the build system root.
2024-02-05 13:08:30 +01:00
Philip Rebohle 05cb963e22 [util] Set sync interval override for P3R 2024-02-02 17:30:13 +01:00
Philip Rebohle eb339bc7e4 [dxgi,d3d11] Move syncInterval override to DXGI swap chain
This way it also applies to D3D12 games.
2024-02-02 17:30:13 +01:00
Ethan Lee c423819e90 [meson] Only use the libdisplay-info subproject as a fallback 2024-01-30 20:48:40 +01:00
Tatsuyuki Ishi e2a46a347d [meta] Declare bool conversion operators as explicit
Non-explicit conversion operators in general can participate in very
surprising conversion chains. Explicit bool operator is a good place to
start with, because even with explicit they do get automatic contextual
conversion in a lot of places, e.g., if conditions.
2024-01-27 11:44:51 +01:00
Tatsuyuki Ishi afc6aa70fb [d3d11] Explicitly convert DxvkExt to bool in D3D11DeviceFeatures
When assigning to a BOOL (which is an uint in disguise) and using explicit
bool conversion operators (introduced in a latter commit) an explicit cast
is required.
2024-01-27 11:44:51 +01:00
Tatsuyuki Ishi 799aeff560 [dxvk] Fix incorrect comparison in DxvkSparsePageTable::updateMapping
m_mappings[page] was getting implicitly converted to bool.
2024-01-27 11:44:51 +01:00
Robin Kertels 2ca8fdf890 [util] Disable counting losable resources for Supreme Ruler Ultimate
The game is broken and leaks a state block.
2024-01-26 18:11:25 +00:00
Robin Kertels 0841f5faf4 [d3d9] Implement config option to disable rejecting reset 2024-01-26 18:11:25 +00:00
Ethan Lee 2334bbccb0 [native] Add a DECLARE_INTERFACE define for !CONST_VTABLE.
This helps avoid some compiler warnings on GCC in particular.
2024-01-26 17:48:44 +00:00
Robin Kertels 7d9864c077 [d3d9] Only enable ATOC when rendering to MS RT 2024-01-26 17:48:21 +00:00
Dean Beeler d4c5fc74e7
d3d11: Fix crash when srv is submitted to ClearUnorderedAccessViewUint
* The Settlers submits (possibly incorrectly) an SRV to ClearUnorderedAccessViewUint. The static_cast in the function does not translate correctly and crashes.

Native D3D11 behavior is to ignore the bad parameter entirely. It does not clear the SRV nor does it fault or even error with the DEBUG validator.
2024-01-23 16:01:12 +01:00
Tatsuyuki Ishi 6199776869 [build] Set filealign for MSVC builds
Useful if you want to run a MSVC build on Wine.
2024-01-23 15:45:42 +01:00
Tatsuyuki Ishi 6faf3c1acd [build] Don't pass unix compiler and link args to MSVC
clang-cl accepts both style of options but these will be generally meaningless:
- Static CRT is unnecessary.
- File alignment will be introduced in another commit.
- Wine has partial support for PDB backtrace so there is probably no need to
  insist on DWARF (which is unsupported by real MSVC anyway).
- MSVC doesn't have the weird stdcall ordinal naming convention that
  necessiates fixup and kill-at.
2024-01-23 15:45:42 +01:00
Tatsuyuki Ishi ab6bd8b17f [build] Recognize more MSVC-like compilers as MSVC
clang-cl has its own compiler id but supports MSVC argument conventions.
Use get_argument_syntax to recognize MSVC-like compilers generally.
2024-01-23 15:45:42 +01:00
Tatsuyuki Ishi 89267b62ad [build] Remove declspec UUID annotations
MIDL_INTERFACE already implies struct DECLSPEC_UUID.
2024-01-23 15:44:47 +01:00
Blisto91 34d8e65fd7 [util] cachedDynamicBuffers for Codename Panzers Phase One/Two
Helps CPU bound performance
2024-01-23 15:44:28 +01:00
Joshua Ashton 1568c263fb [d3d9] Only add unique modes to mode list 2024-01-19 16:28:22 +00:00
Joshua Ashton 0cd4165658 [d3d9] Add D3DDISPLAYMODEEX operator 2024-01-19 16:28:22 +00:00
Joshua Ashton 4b8e8bed6e [d3d9] Move operators out of dxvk namespace 2024-01-19 16:28:22 +00:00
r-a-sattarov ac78048c23 [util] Fix e2k build 2024-01-16 22:03:31 +01:00
Richard Yao 14560600a9 Micro-optimize locking in fences
When a fence has been missed, we can avoid locking *most* of the time
via the double-checked locking pattern. We still lock before a second
check in case the scheduler caused us to miss the fence. If the
scheduler did cause us to miss the fence, we can drop the lock prior to
executing the callback function, as a second micro-optimization.

Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
2024-01-15 12:42:19 +01:00
Blisto91 854e06d3f0 [util] Enable deviceLossOnFocusLoss for BF2 and BF2142
The ingame spawn and gear selection GUI can disappear from view unless this is set.
2024-01-14 22:25:43 +01:00
Blisto91 eb806952d8
[util] Set deviceLossOnFocusLoss for Assassin's Creed 2 (#3763)
Makes it not crash on alt tab using at least Proton. 
Windows will still have issues with alt tab.
2024-01-09 10:43:48 +01:00
Blisto91 a44dfabe26 [util] Set float emulation to Strict for UK Truck Simulator 1
Fixes black foliage
2024-01-09 10:42:52 +01:00
spiffeeroo 5e06cf9573 [util] Limit Sonic CD to 60 fps
Game engine physics/speed for Sonic CD is tied to frame rate so limit max frame rate to 60 fps. Otherwise, the game runs too quickly for high refresh rate monitors.
2024-01-02 19:05:44 +01:00
Blisto91 2cf590f636 [util] Enable cached vertex buffers for Kenshi
Improves the games performance when CPU bound.
2023-12-30 22:47:24 +01:00
Robin Kertels a7a63b37c3 [util] Fix incorrect config option name 2023-12-27 03:06:49 +01:00
Robin Kertels 9cde0b5798 [d3d9] Fix off-by-one when copying shader defined constants 2023-12-25 14:51:02 +00:00
Blisto91 adb33d3af1 [util] Hide Intel in Far Cry 3, 4 and Primal
Also unhides Nvidia in Primal as it has the same clear value rounding assumptions as Far Cry 3 and 4
2023-12-23 09:23:27 +01:00
Philip Rebohle 1b31aa5dbc [util] Enable hideIntegratedGraphics for Metro Exodus EE 2023-12-01 14:14:36 +01:00
Philip Rebohle 03c09ce15f [dxvk] Add option to skip integrated GPU adapters 2023-12-01 14:14:13 +01:00
Blisto91 91f7f43c35 [util] Don't spoof Nvidia on AMD GPUs in Hitman 3
Spoofing to Nvidia prevents ray tracing enablement on AMD and the game does not crash without ags anymore
2023-11-18 12:18:08 +01:00
Robin Kertels d998dee46e [d3d11] Lock context in KeyedMutex::ReleaseSync
Co-authored-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-11-16 15:43:07 +01:00
Philip Rebohle ea3149801f [d3d9] Return empty buffer slice for out-of-bounds offsets
Fixes #3715.
2023-11-14 10:54:54 -08:00
xpander69 1cb58b0732 [Util] two more executables to workaround Warhammer Online
Test server executables need the same VendorID to work around the rendering issues.
2023-11-14 12:23:50 +01:00
Philip Rebohle 2ed1778df9 [d3d11] Handle potential integer overflow when validating draw offsets
Apparently some games use -1 as an argument offset, which is nonsensical
and leads to issues.
2023-11-02 17:49:38 +01:00
Philip Rebohle a427d22cde [dxvk] Add Vulkan instance flag for D3D9 apps 2023-10-31 16:05:58 +01:00
Joshua Ashton 22c2abb9b7 [dxgi] Treat R16G16B16A16_FLOAT as 32bpp for display
HDR in Control (a patch released by a developer post-launch, not
actually in the game sadly) tries to set a video mode with
DXGI_FORMAT_R16G16B16A16_FLOAT.

This seemingly works on Windows, and based on FindClosestMode etc
documentaton, this seems required to work for any format that scanout
it supported for.

It's really not like the bpp is meaningful on Windows with the
distinction of 8bit and 10bit not working in GDI modes at all.
Nor does it end up actually setting anything on Linux/Deck where
modesets are emulated.

So, treat DXGI_FORMAT_R16G16B16A16_FLOAT as 32bpp so the
FindClosestMatchingMode and EnterFullscreenMode calls succeed.
2023-10-29 10:09:34 +01:00
Blisto91 f45911a28f [util] Disable allowDirectBufferMapping for SkyDrift
Works around a alt tab OOM crash
2023-10-23 14:52:44 +02:00
Blisto91 e00db24557 [util] Enable useMonitorFallback for Holocure
Temporary performance drop workaround until QueryDisplayConfig optimization is in Proton Wine.
2023-10-10 19:32:23 +02:00
Paul Gofman 552d2f0a6d [dxgi] Add useMonitorFallback option
And enable it for CP2077.
It is supposed to be dropped once QueryDisplayConfig optimization
is in Proton Wine.
2023-10-10 12:01:51 +02:00
WinterSnowfall 4d974685c9 [d3d9] Mark presenter for recreation on device reset with deferSurfaceCreation 2023-10-06 14:05:39 +02:00
Blisto91 f0ff0007dc [util] Enable cachedDynamicBuffers for Battlestations Midway
Helps performance dips that can happen in some areas
2023-10-06 14:05:04 +02:00
Robin Kertels 494f7fd38d [d3d9] Only set initial NeedsUpload for D3DPOOL_MANAGED textures 2023-09-19 13:25:12 -07:00
WinterSnowfall 0632da1935 [d3d9] Add a device compatibility mode for d3d8 2023-09-19 09:19:55 -07:00
Philip Rebohle 83dc4678df [util] Set maximum frame latency to 1 for Age of Empires 2 (2013)
Game seems to be doing something horrible on its own, literally impossible
to make it run smoothly. This at least seems to limit excursions to ±10ms
and fix the camera flinging back and forth when running the game through
Gamescope.
2023-09-14 16:50:30 +02:00
Paul Gofman f93cfbc26a [d3d11] Pass device directly to D3D11DXGIKeyedMutex 2023-09-13 14:29:25 -07:00
Philip Rebohle c113b791a1 [util] Enable 60 FPS lock for Aviary Attorney
This game (or nw.js) comes with a hard-coded frame rate limit that
behaves more like a random number generator which happens to average
out at around 16ms on a good day.

Fix this complete mess by enabling ours on top of that.
2023-09-08 03:04:02 +02:00
Ellie Hermaszewska 41191af3b1 A few more WinDef types in windows_base.h
These specific ones are used in MS's d3dx12 headers
2023-09-07 16:31:32 +02:00
Philip Rebohle 5828f0e2b9 Revert "[dxgi] Use VK_FORMAT_A8_UNORM if available"
This reverts commit 6a5ed02db3.

Native A8 breaks Crysis 2/3 Remastered for unknown reasons.
2023-09-07 03:58:39 +02:00
Philip Rebohle 80e075406b [meta] Release 2.3 2023-09-04 17:59:12 +02:00
Margen67 a53f0e8168 [util] Remove whitespace 2023-09-04 03:10:49 +02:00
Margen67 4705de5725 [util] Escape . 2023-09-04 03:10:49 +02:00
Robin Kertels 9e26964a96 [d3d9] Divide projected textures by w if ProjectedCount is 0 2023-09-03 18:08:47 -07:00
Blisto91 ce2f9f35ce [util] Hide AMD in Riders Republic
Works around crashing because of statically linked amd ags
2023-09-01 00:21:16 +02:00
Philip Rebohle a3fa9c26dc Revert "[d3d11] Implement DXGI_SWAP_EFFECT_SEQUENTIAL and FLIP_SEQUENTIAL"
This reverts commit 79f6239df3.

Some engines use SEQUENTIAL presentation despite not making use of it, and
sparse binding is much slower than expected on Nvidia drivers, which leads
to massive performance regressions across the board.
2023-09-01 00:15:09 +02:00
Joshua Ashton ff5507769a [wsi] Add proper values for SDR metadata fallbacks 2023-08-31 22:54:02 +01:00
WinterSnowfall 5c56fa0df4 [util] Enable deferSurfaceCreation for Drakensang 2023-08-30 18:02:02 +02:00
Tatsuyuki Ishi 7e10021eac Remove unused DxvkResource::waitIdle
Spinning-based wait idle is no longer used.
2023-08-29 11:05:42 +02:00
Joshua Ashton bbd1d84cd0 [dxgi] Set BitsPerColor to 10
For two reasons:
1) Some apps will only enable or attempt to enable HDR if BitsPerColor is >= 10.

2) Encouraging apps to create 10-bit swapchains for use in hardware dithering on Gamescope/Steam Deck and to have more precision thru scanout color transforms
2023-08-26 01:43:42 -07:00
Jens Peters 02db89ac30 [dxgi] Allow HDR on UE4/D3D11 when NVAPI is enabled 2023-08-24 21:21:29 -07:00
Philip Rebohle 92dc61f161 [d3d11] Fix up UAV clears for A8_UNORM 2023-08-24 13:12:07 +02:00
Philip Rebohle 6a5ed02db3 [dxgi] Use VK_FORMAT_A8_UNORM if available 2023-08-24 13:12:07 +02:00
Philip Rebohle 64828e2c6c [dxvk] Use vkCmdBindIndexBuffer2 if supported 2023-08-24 13:12:07 +02:00
Philip Rebohle a4f2a49a02 [dxvk] Add description for new image formats 2023-08-24 13:12:07 +02:00
Philip Rebohle aa41a7a351 [dxvk] Enable VK_KHR_maintenance5 if available. 2023-08-24 13:12:07 +02:00
Philip Rebohle fb71c08d8c [include] Update Vulkan headers. 2023-08-24 13:12:07 +02:00
Philip Rebohle 79f6239df3 [d3d11] Implement DXGI_SWAP_EFFECT_SEQUENTIAL and FLIP_SEQUENTIAL
Requires sparse since we have no other means to swap the backing image.
2023-08-24 13:00:35 +02:00
Philip Rebohle 53a68635b2 [dxvk] Optimize page table updates for images
Dramatically reduces overhead when binding full subresources.
2023-08-24 13:00:35 +02:00
Philip Rebohle 179c5ec998 [dxvk] Sort allocated memory pages for sparse allocator
This way, memory regions bound to consecutive pages are more likely
to end up in consecutive memory regions, which allows batching page
table updates more efficiently.
2023-08-24 13:00:35 +02:00
Philip Rebohle d6e0107e23 [dxvk] Ensure to submit sparse binding commands 2023-08-24 13:00:35 +02:00
Joshua Ashton 428ca9416d [d3d11] Implement synchronization on keyed mutexes
Co-authored-by: Paul Gofman <pgofman@codeweavers.com>
2023-08-23 16:50:52 +02:00
Joshua Ashton c26f40229a [vulkan] Query wine_vk{Acquire,Release}KeyedMutex
Non-standard functions, but exposed by winevulkan to support keyed mutexes.

Co-authored-by: Paul Gofman <pgofman@codeweavers.com>
2023-08-23 16:50:52 +02:00
Joshua Ashton 8226690298 [dxvk] Enable VK_KHR_win32_keyed_mutex
Co-authored-by: Paul Gofman <pgofman@codeweavers.com>
2023-08-23 16:50:52 +02:00
Joshua Ashton 138f727fbb [native] Add WAIT_* defines 2023-08-23 16:50:52 +02:00
Philip Rebohle c2cd129b89 [dxvk] Fix xfb counter buffer draw tracking 2023-08-23 13:44:35 +02:00
Philip Rebohle 915244c00c [d3d11] Fix various D3D10 interface queries 2023-08-23 01:06:04 +02:00
Blisto91 6fce094942 [util] Limit fps in Project: Snowblind
Player movement and animation can bug out at high fps like issues moving around objects and the players head detaching slightly when moving backwards.
Seems like it also helps some crash issues.
2023-08-21 01:43:24 +02:00
Robin Kertels 740ebec7ee [d3d9+dxso] Consider DMAP sampler in bit masks 2023-08-20 10:21:16 -07:00
Robin Kertels bcaaac4ad7 [d3d9] Handle sampling from DS_READONLY properly 2023-08-18 18:59:53 -07:00
Joshua Ashton 1130512db5 [dxgi] Add global HDR interop interface for NVAPI/AGS 2023-08-18 22:57:06 +01:00
Blisto91 143eb8c710 [meta] Document DXVK_CONFIG in readme 2023-08-16 12:57:42 +02:00
Philip Rebohle 4ae542e875 [util] Do not hide Nvidia GPUs from Ratchet & Clank
NVAPI is disabled now due to crashing issues in a wine-specific code
path within the game, but we still want it to detect the correct GPU
so that it doesn't complain about drivers and also allows users to
enable Raytracing.
2023-08-15 00:23:19 +02:00
Philip Rebohle 952c66fe2a [dxgi] Add options to hide Intel or AMD GPUs. 2023-08-14 20:12:02 +02:00
Philip Rebohle b6a7714e67 [dxgi,util] Rename dxgi.nvapiHack option to dxgi.hideNvidiaGpu 2023-08-14 19:21:16 +02:00
Etaash Mathamsetty 037669f715 [dxso] Don't assume 32 registers. 2023-08-13 20:34:38 +01:00
Robin Kertels 295a58afdf [d3d9] Check depth bounds test when deciding to bind DSV 2023-08-13 20:32:20 +01:00
Robin Kertels 0746a3b91a [d3d9] Don't resolve an image with 1 sample 2023-08-10 13:45:40 +02:00
Etaash Mathamsetty 429555a540 [dxgi] Fix behavior of GetWindowAssociation 2023-08-09 12:18:24 +02:00
Blisto91 dfcd7aedd8
[util] Limit Conflict Vietnam to 60fps (#3606)
Physics can bug out at higher fps making the character fly or get stuck when running up or down slopes.
2023-08-09 12:18:10 +02:00
gofman cbda22a040
[d3d11] Add stub IDXGIKeyedMutex interface. (#3601)
Partially based on a patch by Derek Lesho.

Co-authored-by: Paul Gofman <pgofman@codeweavers.com>
2023-08-07 17:23:32 +02:00
Georg Lehmann 549bd86f03 [d3d9] use strict float emulation for nvk
nvk supports nir_op_fmulz/ffmaz
2023-08-06 11:01:03 +01:00
WinterSnowfall b0b46fd075 [d3d9] Don't show/hide a software cursor 2023-08-02 01:51:19 +01:00
Joshua Ashton a62117cd13 build: Disable stdcall alias-ing and use kill-at
Disable stdcall aliasing and enable kill-at to ensure our exported
functions don't have the @8, @40, etc suffixes.

This still keeps `--enable-stdcall-fixup` as otherwise the linker can
get confused trying to find exports from the .def. This does not result
in aliases being added, just for them to be found to add to the export
table.

This also switches d3d11 to use the MinGW provided dxgi.lib for linking
and d3d10 to use the MinGW provided d3d11.lib for linking.
Unfortunately the .a's we output seem to still have the @blah that we
killed so we cannot use them for internal linkage since using kill-at.

Tested that what we get out of MinGW now is what we want with dllexp.

Supercedes: #3590

Exports

```
➜  build git:(master) ✗ winedump -j export src/dxgi/dxgi.dll
Contents of src/dxgi/dxgi.dll: 129505860 bytes

  Name:            DXGI.DLL
  Characteristics: 00000000
  TimeDateStamp:   64C97A2D Tue Aug  1 22:33:33 2023
  Version:         0.00
  Ordinal base:    9
  # of functions:  9
  # of Names:      5
Addresses of functions: 00423028
Addresses of name ordinals: 00423060
Addresses of names: 0042304C

  Entry Pt  Ordn  Name
  00007C17     9 CreateDXGIFactory
  00007BF3    10 CreateDXGIFactory1
  00007B62    11 CreateDXGIFactory2
  00007C3B    16 DXGIDeclareAdapterRemovalSupport
  00007CD8    17 DXGIGetDebugInterface1

Done dumping src/dxgi/dxgi.dll
```

```
➜  build git:(fix-stdcall-32-bit) winedump -j export src/d3d11/d3d11.dll
Contents of src/d3d11/d3d11.dll: 263021637 bytes

  Name:            D3D11.DLL
  Characteristics: 00000000
  TimeDateStamp:   64C97A2E Tue Aug  1 22:33:34 2023
  Version:         0.00
  Ordinal base:    18
  # of functions:  7
  # of Names:      4
Addresses of functions: 005E3028
Addresses of name ordinals: 005E3054
Addresses of names: 005E3044

  Entry Pt  Ordn  Name
  00020045    18 D3D11CoreCreateDevice
  000200AA    22 D3D11CreateDevice
  0002010E    23 D3D11CreateDeviceAndSwapChain
  0002025F    24 D3D11On12CreateDevice

Done dumping src/d3d11/d3d11.dll
```

Import of DXGI in D3D11

```
  offset 005e1014 dxgi.dll
  Hint/Name Table: 005E408C
  TimeDateStamp:   00000000 (Thu Jan  1 01:00:00 1970)
  ForwarderChain:  00000000
  First thunk RVA: 005E4300
   Thunk    Ordn  Name
  005e4300     4  CreateDXGIFactory1
```
2023-08-01 23:35:09 +01:00
pchome e598dcd77e
[util] Add DXVK_CONFIG to define additional options 2023-08-01 22:09:29 +02:00
Philip Rebohle 09857dcaa9 [dxvk] Dirty multisample state if sample mask export changes.
This affects Alpha-to-Coverage.
2023-08-01 18:07:47 +02:00
Philip Rebohle d66f8385c3 [dxvk] Disable alpha to coverage if sample mask is written
Matches D3D11 behaviour and fixes tree rendering in A Total War Saga: TROY.
2023-08-01 16:58:46 +02:00
Philip Rebohle 007e9f4c89 [dxvk] Check whether fragment shader exports sample mask 2023-08-01 16:27:23 +02:00
Philip Rebohle 9b019d26ac [dxgi] Forward IDXGIOutput::GetFrameStatistics to full-screen swap chain
Testing on Windows reveals that this function does not work with windowed
mode swap chains even in flip model.
2023-07-31 21:47:44 +02:00
Philip Rebohle 228615b639 [d3d11] Rework D3D11CoreCreateDevice
FiveM calls this directly and apparently our signature wasn't quite
what they expect it to be.
2023-07-31 13:13:48 +02:00
Ellie Hermaszewska dfbebba6b5
[native] Add CHAR and PCSTR to windows_base.h 2023-07-29 18:01:01 +01:00
Blisto91 4ed04268fd [build] Use new glslang name with fallback 2023-07-29 14:54:32 +02:00
Blisto91 4ed1474030 [meta] Move up Vulkan driver section in readme 2023-07-23 19:59:31 +02:00
Blisto91 13440a5d89 [dxvk] Clarify Vulkan 1.3 driver requirement in log 2023-07-23 19:59:31 +02:00
Blisto91 1daae75048 [util] Set Cached Dynamic Resources for d3d11 Vindictus
Co-authored-by: NorbertHarangozo <maszek.solutions@gmail.com>
2023-07-23 19:12:12 +02:00
Philip Rebohle b4d87eaac0 [dxbc] Fix constant texture offsets with 1D textures
Fixes #3572.
2023-07-22 17:37:37 +02:00
Philip Rebohle 1e11db98d0 [dxvk] Use separate mutex for completed chunk counter
Fixes a possible deadlock.
2023-07-21 21:45:50 +02:00
Philip Rebohle f689ddd838 [dxvk] Use dual queues for CS thread
Reduces lock contention since we can just swap out the entire queue
any time the worker thread runs out of stuff to do.
2023-07-21 21:21:34 +02:00
Philip Rebohle eed43c8524 [dxgi] Fix QPC time in frame statistics 2023-07-21 10:22:56 +02:00
Philip Rebohle d066fbbaed [d3d11] Set up line rasterization mode appropriately 2023-07-20 23:43:03 +02:00
Philip Rebohle a67c99943a [dxbc] Set output topology for GS and TES correctly 2023-07-20 23:43:03 +02:00
Philip Rebohle 5ece97f769 [dxvk] Add line rasterization mode to rasterization state 2023-07-20 23:43:03 +02:00
Philip Rebohle 228cd4c331 [dxvk] Enable VK_EXT_line_rasterization if supported. 2023-07-20 23:43:03 +02:00
Blisto91 98f3887680 [util] Cleanup a couple of example config options 2023-07-17 15:38:13 +02:00
Blisto91 3a9a70b5f0 [meta] Add Graphics Pipeline Library section to readme 2023-07-17 15:38:13 +02:00
Philip Rebohle 878da4984b [util] Disable single-use command lists for Ghost Recon Wildlands 2023-07-17 15:00:55 +02:00
Philip Rebohle c599f95e5d [d3d11] Do not cache GetCurrentProcess result
This is just a constant.
2023-07-16 21:16:16 +02:00
Paul Gofman 4893788d9b [d3d11] Fixup incorrect MiscFlags in D3D11Device::OpenSharedResourceGeneric()
So texture sharing works with vkd3d-proton before correcting flags
there.
2023-07-16 15:34:39 +02:00
Paul Gofman fc952a3ca3 [d3d11] Validate texture sharing parameters at texture creation 2023-07-16 15:34:39 +02:00
Paul Gofman 01ad79278b [d3d11] Support just one handle type in D3D11DXGIResource::{Get|Create}SharedHandle 2023-07-16 15:34:39 +02:00
Paul Gofman 48557886de [d3d11] Determine shared texture handle type through D3D11_RESOURCE_MISC_SHARED_NTHANDLE 2023-07-16 15:34:39 +02:00
Paul Gofman 8319793a98 [d3d11] Always close handle in D3D11CommonTexture::ExportImageInfo()
For KMT handle openKmtHandle() creates new handle, for NT handle
m_image->sharedHandle() gets duplicated handle from
vkGetMemoryWin32HandleKHR().
2023-07-16 15:34:39 +02:00
Blisto91 886268fcf9 [util] Remove Secret World Legends config 2023-07-16 15:26:46 +02:00
Hans-Kristian Arntzen 84e59fc9e5 [ci] Download glslangValidator.exe directly rather than using choco.
The choco package is extremely outdated and breaks now.
2023-07-16 15:25:21 +02:00
Blisto91 6be1f6d7bd [util] Limit fps in The Incredibles 2023-07-05 20:48:19 +02:00
Joshua Ashton 2f72115f91 [d3d9] Keep 1 presenter per swapchain window
Some apps such as level editors such as Hammer World Editor, some GUI apps/launchers etc use window overrides in presentation.

Previously we'd remake a new surface every time, which was incredibly slow making these apps basically unusable.

Now we keep one surface + swapchain + image views around per window/window override we have, along with the frame latency objs + frame counter.
(Obviously an app may present to multiple windows in a frame, so for frame latency purposes we track that per-window.
2023-07-04 16:44:31 +02:00
Alpyne 026aa49ef8 [util] replaceNaN: Align result
Otherwise _mm_store_ps can fail
2023-07-03 15:36:21 +02:00
Trevonn 3a368f4780 Bladestorm Nightmare - Game speed increases when above 60 FPS outside of missions
The game has 3 v-sync options but doesn't explain what they do.
0 = 60 FPS
1 = Monitor Refresh Rate
2 = 30 FPS

Framerate is capped at 60 in missions and then up to monitor refresh in the main menu and tavern area

This PR would provide a better default experience for people using option 1 with high refresh displays
2023-07-01 17:12:36 +02:00
Tatsuyuki Ishi 2ef41bdbf6 build: Switch symbols to DWARF 4
Since [1], Wine's supports and uses DWARF 4 as default. Make use of it, which
should fix inlined stacks and some other small details.

[1]: https://www.winehq.org/pipermail/wine-devel/2021-November/201333.html
2023-07-01 17:12:18 +02:00
Philip Rebohle 0f4458e173 [dxvk] Remove pending submission counter 2023-06-26 01:37:46 +01:00
Philip Rebohle ccb87d5ea9 [d3d9] Port flush heuristic from D3D11 2023-06-26 01:37:46 +01:00
Alpyne 022bf1d134 [d3d9] Allow changing API name for d3d8 2023-06-24 18:18:38 +01:00
Alpyne d6e7e3e780 [d3d9] Add DxvkD3D8Bridge for d3d8 interop 2023-06-24 17:58:49 +01:00
Blisto91 b77928b6fe [util] Fix Modern Warfare 2 Campaign Remastered config 2023-06-24 13:28:49 +02:00
Philip Rebohle 987df8a487 [util] Filter out internal private ref on object destruction
Closes #3531 for real this time.
2023-06-24 12:45:38 +02:00
Philip Rebohle a7278cdab1 [dxgi] Do not interact with other DXGI objects during swapchain destruction
This trips up Stalker Anomaly for some reason, but initializing an output
is not meaningful anyway in this situation since we either know the output
in question already, or we don't and it cannot be in a non-default state.

Closes #3531.
2023-06-24 12:38:10 +02:00
Joshua Ashton 3b3ebc9350 [d3d9] Rename some members to be clearer 2023-06-24 04:09:04 +01:00
Joshua Ashton 00ae118655 [d3d9] Don't use m_activeRTs in SetPixelShader
These are just textures, not surfaces.
2023-06-24 04:07:19 +01:00
Joshua Ashton 55be12daa5 Revert "[d3d9] Use m_activeRTs in BindFramebuffer"
This is only textures. Oops.

This reverts commit ff65599dba.
2023-06-24 04:06:24 +01:00
Joshua Ashton 0e36a07a93 [d3d9] Don't mark DS as hazardous if depth write is disabled 2023-06-24 03:55:16 +01:00
Joshua Ashton ff65599dba [d3d9] Use m_activeRTs in BindFramebuffer
Can roll in the anyColorWrites this way.
2023-06-24 03:42:54 +01:00
Joshua Ashton 6b60de2d31 [d3d9] Fix unbinding RTs
Fixes a regression with 8560efa3c7 in ND1.

Also more optimized.
2023-06-24 03:41:31 +01:00
Joshua Ashton 362743c1d6 [d3d9] Update DS hazards when PS shader masks change 2023-06-24 02:55:38 +01:00
Joshua Ashton 7f302fc350 [d3d9] Don't mark DS hazards if not used by shader 2023-06-24 02:53:14 +01:00
Philip Rebohle 8704ed7af6 [dxvk] Ignore some pipeline flags when ending render pass 2023-06-22 23:41:24 +02:00
Philip Rebohle 0895858901 [dxvk] Only decrement pending submission count for command submissions
Otherwise we'll underflow the integer and break the D3D9 flush heuristic.
2023-06-22 20:15:42 +02:00
Joshua Ashton 80b27f95bc [d3d9] Fix active hazards RT only being 4 bits 2023-06-22 16:37:09 +01:00
Joshua Ashton a791493d14 [d3d9] Don't rebind AlphaTest when changing RT if not necessary 2023-06-22 16:37:09 +01:00
Joshua Ashton c768196251 [d3d9] Compress hazard state going into CS
This can potentially happen per-draw so make it as small as possible.
2023-06-22 16:37:09 +01:00
Joshua Ashton 3625c5d481 [d3d9] Optimize DS active hazard check
There can only be one DS, so no need to loop over.
2023-06-22 16:37:09 +01:00
Philip Rebohle b3cbe36c08 [dxvk] Apply frame rate limit on presentation timeline
This may reduce latency as we no longer end up stalling subsequent
GPU submissions.
2023-06-22 16:17:03 +02:00
Philip Rebohle 166d90b04c [d3d11] Fix frame latency based on buffer count
We need to ignore the front buffer here since we synchronize after
presentation.
2023-06-22 16:16:30 +02:00
Robin Kertels 60b6e98529 [d3d9] Transition DS too if there's a feedback loop 2023-06-21 15:16:43 +01:00
Robin Kertels a20869fb93 [d3d9] Track textures in m_activeHazardsRT instead of RT
There's 21 textures and only 4 RTs.
Tracking the textures allows us to mask off the active texture bitfield
instead of the active render target one, potentially resulting in fewer iterations.
2023-06-21 15:16:43 +01:00
Philip Rebohle a287566c65 [dxgi] Implement frame statistics based on IDXGIVkSwapChain1 2023-06-21 15:16:37 +02:00
Philip Rebohle 28f48f9fdc [dxgi] Initialize output refresh counts with non-zero values
Matches Windows behaviour.
2023-06-21 15:16:37 +02:00
Philip Rebohle e02a800c33 [d3d11] Implement IDXGIVkSwapChain1 interface for D3D11 swap chain 2023-06-21 15:16:37 +02:00
Philip Rebohle d7fa39c4eb [util] Be more robust against timing weirdness when computing vblank count 2023-06-21 15:16:37 +02:00
Philip Rebohle d1e39be7e7 [dxgi] Add IDXGIVkSwapChain1 interface definition 2023-06-21 15:16:37 +02:00
Philip Rebohle 438c535fe7 [d3d11] Always release frame latency semaphore in Present 2023-06-21 15:16:37 +02:00
Philip Rebohle 7dbe4abb48 [d3d9] Use new presenter signal mechanism for frame pacing 2023-06-21 15:16:37 +02:00
Philip Rebohle e99bc591df [d3d11] Use new presenter signal mechanism for frame latency event 2023-06-21 15:16:37 +02:00
Philip Rebohle 08363edb05 [dxvk] Only synchronize with presents with FIFO present modes 2023-06-21 15:16:37 +02:00
Philip Rebohle 5d1196733b [dxvk] Implement waiting for specific present requests 2023-06-21 15:16:37 +02:00
Philip Rebohle ca3492570c [dxvk] Add functionality to wait for a given present operation 2023-06-21 15:16:37 +02:00
Philip Rebohle 215c4f8f6f [dxvk] Enable VK_KHR_present_id and VK_KHR_present_wait if supported 2023-06-21 15:16:37 +02:00
Robin Kertels 5a1ebfa4ee Revert "[d3d9] Only use direct buffer mapping for DYNAMIC buffers"
This reverts commit 1850819483.
2023-06-20 23:08:52 +01:00
Joshua Ashton 6f87ccdafc [d3d11] Use FORCE_UNORM depth bias representation for UNORM formats 2023-06-20 13:31:48 +01:00
Joshua Ashton b30a4f0cc7 [d3d9] Use FLOAT or FORCE_UNORM depth bias representation 2023-06-20 13:31:48 +01:00
Joshua Ashton 4e9853f608 [dxvk] Expose depth bias representation/exact controls 2023-06-20 13:31:48 +01:00
Joshua Ashton 5fbb0dd4ba [dxvk] Enable EXT_depth_bias_control 2023-06-20 13:31:48 +01:00
Joshua Ashton 77f6f2a84b [include] Bump Vulkan headers to v1.3.254 2023-06-20 13:31:48 +01:00
Alpyne 0b9acf3a25 [util] Add str::split
Used by d3d8
2023-06-20 13:31:17 +01:00
Timo Gurr 211d095ee4 [util] Limit STEINS;GATE ELITE to 60 fps
Intros, menu and ui animations are playing way too fast, also causing
input issues.
2023-06-20 13:27:52 +02:00
Trevonn 77e7e8bfba [util] Report NVIDIA for Star Wars Battlefront as it errors out on AMD 2023-06-20 13:23:52 +02:00
Alpyne 42a0264e69 [build] Fix libdisplay-info
See https://gitlab.freedesktop.org/JoshuaAshton/libdisplay-info/-/merge_requests/4
2023-06-19 21:14:03 +01:00
Alpyne 5d29140f74 [util] replaceNaN: Use unaligned SIMD _mm_loadu_ps
There is no good reason to expect games will have aligned the data they're passing in.
2023-06-19 21:13:37 +01:00
Alpyne 0236e780a7 [d3d9] Fix std::hex in D3D9CommonTexture 2023-06-19 21:02:10 +01:00
Alpyne 24dbcf8fd8 [dxso] Shared code for texbem and bem 2023-06-19 20:59:18 +01:00
Alpyne 404c984f9c [dxso] Implement bem instruction 2023-06-19 20:59:18 +01:00
Alpyne a79772322b [d3d9] Initialize m_mapFlags to 0
Can sometimes get weird default values in there.
2023-06-19 19:52:03 +01:00
Trevonn 36e6a7c2e5 [util] Set maxChunkSize to 1 for GOG and fix EA App exe name
Similar to the other launchers the VRAM goes 600MB+ to 100MB+
2023-06-16 16:28:31 +01:00
Trevonn c5ab5be48d [util] Set maxChunkSize to 1 for EA App
Reduces GPU VRAM usage of EADesktop.exe from 162MB to 6MB
2023-06-15 19:39:28 +01:00
Paul Gofman af9bd16b8d [dxvk] Always reference library in VR extension providers 2023-06-15 19:07:26 +02:00
Winter Snowfall 2c014fdb34 [util] Match on the GOG version of KoF XIII as well 2023-06-15 19:06:45 +02:00
Timo Gurr 6478c10a18 [util] Set maxChunkSize to 1 for Battle.net
Currently when Diablo 4 is running the Battle.net launcher it uses around
600MB of VRAM. Reducing the max chunk size to 1MB reduces the memory usage
to around 150MB.
2023-06-15 19:06:26 +02:00
Philip Rebohle 7388c243d2 [dxvk] Fix incorrect fullScreenExclusive feature check 2023-06-15 17:32:05 +02:00
Lilium bd575a4a46 [d3d11] implement 'clampNegativeLodBias' as a conf option 2023-06-14 20:22:27 +01:00
Lilium 3fce9886f5 [d3d9] implement 'clampNegativeLodBias' as a conf option 2023-06-14 20:22:27 +01:00
Lilium 5d134b877a [d3d9] implement 'samplerLodBias' as a conf option 2023-06-14 20:22:27 +01:00
Robin Kertels c75ed86909 [d3d9] Reset vertex & index buffer in Reset 2023-06-13 22:47:55 +01:00
Robin Kertels d1707026f9 [d3d9] Remove uninitialized device present params 2023-06-13 22:47:55 +01:00
Robin Kertels b8d36eeacc [d3d9] Fix losing auto depth stencil surface 2023-06-13 22:47:55 +01:00
Robin Kertels 8f740c53b4 [d3d9] Remove IsLosable
Redundant.
2023-06-13 22:47:55 +01:00
Robin Kertels 52ac271acb [d3d9] Reject Reset if there's any remaining DEFAULT resources 2023-06-13 14:15:18 +01:00
Robin Kertels a1a91dd766 [d3d9] Fix potential race when discarding systemmem textures 2023-06-11 16:57:17 +01:00
Robin Kertels 22f6246fd6 [util] Fix app profile grouping 2023-06-11 16:57:17 +01:00
Robin Kertels 9d6804e40a [util] Disable direct buffer mapping for Injustice 2023-06-11 16:57:17 +01:00
Robin Kertels 5fd025c513 [d3d9] Rename apitraceMode
It's not just used for apitrace and the new name
is more consistent with the D3D11 equivalent option.
2023-06-11 16:57:17 +01:00
Robin Kertels d9d6316609 [d3d9] Remove allowDiscard hack 2023-06-11 16:57:17 +01:00
Robin Kertels 9b877cf623 [util] Remove D&D - The Temple of Evil workaround
The game uses SWVP, so we don't need an app hack here.
2023-06-11 16:57:17 +01:00
Robin Kertels 2c3f2b9ad1 [d3d9] Ignore DISCARD after device loss 2023-06-11 16:57:17 +01:00
Robin Kertels 1850819483 [d3d9] Only use direct buffer mapping for DYNAMIC buffers
Tests show that buffers with just D3DUSAGE_WRITEONLY are uploaded on Unlock.
2023-06-11 16:57:17 +01:00
Robin Kertels 1db2e3a6ec [util] Re-enable direct buffer mapping for Dark Romance
The game uses SWVP, so we don't need the hack anymore.
2023-06-11 16:57:17 +01:00
Robin Kertels 2efd3f3698 [util] Re-enable direct buffer mapping for RE games
I cannot reproduce the stalls anymore.
2023-06-11 16:57:17 +01:00
Robin Kertels bbaf01d9e6 [d3d9] Force staging buffer mapping for pure SWVP devices 2023-06-11 16:57:17 +01:00
Robin Kertels 4a55047dde [d3d9] Forbid disabling SWVP on a pure SWVP device 2023-06-11 16:57:17 +01:00
Joshua Ashton 3fddc364ee [util] Fix UTF8 encodeTypedChar for 4 byte chars
Some flipped logic here...
2023-06-10 13:58:33 +02:00
Blisto91 f3fb5ba320 [util] Example config wording changes 2023-06-06 13:47:00 -07:00
Philip Rebohle 4d254b13be [dxgi] Unlock presenter lock early during presentation
If SetGammaControl and Present are called at the same time, we'll
otherwise have a deadlock due to reversed lock order.

Fixes #3458.
2023-06-05 17:02:15 +02:00
Joshua Ashton d241daa0b1 [util] Add app profile for Fallout 76 2023-06-05 03:00:53 +02:00
Eric Sullivan 2e70a2b07d [util] Set maxChunkSize to 1 for the Rockstar launcher and social club
Currently when Red Dead Redemption 2 is running the Rockstar launcher,
and social club each use over 600MB of VRAM. The root cause of this is
DXVK creating two memory pools of 256MB for read, and read/write resources.
Reducing the max chunk size to 1MB reduces the memory usage of each to
around 40MB.
2023-06-05 02:17:26 +02:00
Robin Kertels 52f04ca3d4 [d3d9] FF: Fix using wrong texCoord mask 2023-06-04 17:52:18 +01:00
Joshua Ashton c585ea251e [dxso] Respect all PS input elements for registers
Fixes shadows in Test Drive Unlimited 2.

Closes: #3469
2023-06-02 23:12:22 +02:00
Philip Rebohle ab00591297 [dxvk] Introduce dxvk.tearFree option
And replace the old frontend-specific options.
2023-06-01 17:48:51 +02:00
Philip Rebohle 85d52ccb88 [dxvk] Implement dynamic present mode switching
This way, we don't need to recreate the swap chain when the app switches
between vsync enabled and disabled. Currently only works when running
bleeding-edge Gamescope with ENABLE_GAMESCOPE_WSI=1.
2023-06-01 17:48:51 +02:00
Philip Rebohle e6be0cf996 [dxvk] Rework present mode selection for swap chains 2023-06-01 17:48:51 +02:00
Philip Rebohle 1728d9e89d [dxvk] Rework presenter creation to take a DxvkDevice
This way we can easily query available Vulkan features.
2023-06-01 17:48:51 +02:00
Philip Rebohle b1b0abdbbf [dxvk] Move presenter implementation to DXVK module 2023-06-01 17:48:51 +02:00
Philip Rebohle be875cd7e6 [dxvk] Enable VK_EXT_swapchain_maintenance1 and surface_maintenance1 2023-06-01 17:48:51 +02:00
Philip Rebohle 0543956ea0 [meta] Update Vulkan headers 2023-06-01 17:48:51 +02:00
Blisto91 e9e0949717 [meta] Clarify readme setup instructions 2023-05-31 12:58:28 +02:00
WinterSnowfall 8b6cbda6de [d3d9] Properly expose the MaxVertexBlendMatrixIndex capability 2023-05-30 23:56:26 +01:00
Robin Kertels 4b10846008 [dxso] Fix RT mask for SM1 2023-05-26 04:28:49 +01:00
Joshua Ashton e0654977c9 [d3d9] Stub out D3D9On12 interfaces
Closes: #3445
2023-05-24 14:36:45 +01:00
Joshua Ashton b5c18a02ae [d3d9] Optimize UpdateAnyColorWrites for 0th case
This is the most common
2023-05-24 14:21:30 +01:00
Joshua Ashton cafd104783 [d3d9] Pack RT bitmasks tightly
No need to waste a whole 32-bits for each entry here when we only have 4 possible RTs at a time.
2023-05-24 14:10:41 +01:00
Joshua Ashton 269bab2c34 [d3d9] Track if any color writes are enabled for an RT
Use this for determining whether to rebind FB and in checks, otherwise we can miss stuff for pure surface RTs
2023-05-24 14:05:13 +01:00
Joshua Ashton 075c0bf203 [d3d9] Use m_boundRTs for COLORWRITEENABLE checks
Also allows us to check for NULL RTs with this too and avoid extra work!
2023-05-24 13:42:42 +01:00
Joshua Ashton 8560efa3c7 [d3d9] Unbind RTs which are unwritten by a PS
Otherwise we can end up with feedback loops on RTs with a 0 color mask.

Closes: #3447
2023-05-24 13:40:17 +01:00
Blisto91 b9b2db510e [util] Limit fps for some Tomb Raider games 2023-05-24 14:31:38 +02:00
Lilium d5c6ae2e4d [dxvk] dxvk_adapter: implement macro to check for feature need in checkFeatureSupport 2023-05-24 11:53:34 +01:00
Lilium 633f6663a4 [dxvk] fix copy mistake in dxvk_adapter 2023-05-24 11:53:34 +01:00
Robin Kertels d2759c20ba [d3d9+d3d11] Remove DEVICE_LOCAL flag when forcing cached memory
Otherwise DXVK removes both flags at once
and we may end up with uncached memory.
2023-05-22 23:53:01 +02:00
Robin Kertels 1a2e724c16 [util] Enable apitrace mode for Tomb Raider Anniversary
... and Underworld.
2023-05-22 12:24:49 +02:00
Blisto91 6449f583f8 [util] Set dcSingleUseMode to false for SnowRunner 2023-05-21 16:05:41 +02:00
Joshua Ashton f2bb1d4b69 [d3d9] Add extended swapchain interfaces
Allows for controling colorspace, etc.
2023-05-19 19:26:27 +01:00
Joshua Ashton 495dc75ab2 [wsi] Pull out NormalizeDisplayMetadata 2023-05-19 19:26:27 +01:00
Paul Gofman 550e04c579 [dxgi] Preserve system monitor sort order in enumMonitors() 2023-05-19 18:17:40 +02:00
WinterSnowfall d4a7346198 [dxvk] Add configurable HUD opacity 2023-05-19 18:11:25 +02:00
Blisto91 99b367cdd6 [util] Set floatEmulation to Strict for Halo Online 2023-05-18 17:40:01 +01:00
Blisto91 65520fa18e [util] Fix BlazBlue Centralfiction config 2023-05-16 18:56:23 +02:00
Joshua Ashton f30376a1e4 [d3d11] Fix min luminance of HDR Metadata
This should be a multiply instead of a divide. Values are 1/10000th of a nit (0.0001 nit).
2023-05-13 21:16:29 +00:00
Philip Rebohle cae0a1cef3 [meta] Release 2.2 2023-05-12 11:26:07 +02:00
Philip Rebohle 14eb469005 [dxgi] Be more robust against monitor enumeration issues.
If there are monitors on the system that are not associated with
any adapter, enumerate all monitors for all adatpers. May solve
some issues if device filter options are used on multi-GPU systems.
2023-05-11 16:38:45 +02:00
Oleksii Bozhenko 80f7d2abd8 [d3d9] fix opCompositeExtract out of bound
Closes: https://github.com/doitsujin/dxvk/issues/3293

Signed-by: Oleksii Bozhenko <oleksii.bozhenko@globallogic.com>
2023-05-09 20:39:55 +00:00
Alpyne 2b09932d51 [d3d9] Fix crash if device is freed with bound textures 2023-05-09 00:12:35 +00:00
Robin Kertels bef2ef69ab [d3d9] Fix stupid variable name 2023-05-07 14:05:39 +02:00
Robin Kertels b08665c808 [d3d9] Fix compiler warning in Clear size check 2023-05-06 14:16:54 +01:00
Robin Kertels 96e22e7c67 [d3d9+util] Remove a bunch of redundant config options 2023-05-06 14:16:54 +01:00
Robin Kertels 5443a2f9f5 [d3d9] Don't swap buffers for SWAPEFFECT_COPY & DISCARD with 1 backbuffer 2023-05-06 14:16:54 +01:00
Paul Gofman 83a294285e [dxgi] Only enumerate outputs which belong to the adapter or associated iGPU 2023-05-05 16:44:51 +02:00
Robin Kertels 242ac20752 [d3d9] Release DC in fallback present path 2023-05-04 18:42:04 +02:00
Robin Kertels b357d16940 [util] Enable deviceLost for DC Universe Online and GTA IV 2023-05-03 13:04:00 +01:00
Robin Kertels b4366db398 [d3d9] Implement rudimentary device loss 2023-05-03 13:04:00 +01:00
Blisto91 b5f43063b1 [util] Spoof Nvidia for Modern Warfare 2 Campaign Remastered 2023-05-03 13:02:08 +01:00
Joshua Ashton f140d2de0d [d3d9] Handle swapchain OOM and other errors more gracefully
Supercedes: #2964
2023-05-03 12:59:02 +01:00
Aleksey Komarov 20356148af
include: Add few defines and types in windows.h for DXVK Native (#3307)
* windows: add define for ZeroMemory

* windows: add few *LP types, DUMMYUNIONNAME*, __C89_NAMELESSSTRUCTNAME

---------

Co-authored-by: Joshie <joshua@froggi.es>
2023-05-03 12:58:33 +01:00
Ellie Hermaszewska b81536458f
include: Implement some small utilities in native headers (#3361)
* Add QueryInterface template to IUnknown

As described here https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-queryinterface\(q\)\?source\=recommendations

* Implement DEFINE_ENUM_FLAG_OPERATORS

* Add REFCLSID to windows_base.h

This is used by the latest d3d12 headers for D3D12GetInterface
2023-05-03 12:39:51 +01:00
Robin Kertels 9ce1c4df0d [dxvk] Update tracked rtLayouts when changing image layout 2023-05-03 13:23:47 +02:00
Robin Kertels 860237e775 [d3d9] Skip 0x0 clears 2023-05-03 13:23:47 +02:00
Robin Kertels ceb3a7f8c6 [dxvk] Do direct FB resolve if resolve format is UNDEFINED
If the format is undefined, we use the format of each image
which is obviously also view compatible with the imge.
2023-05-03 13:23:47 +02:00
Robin Kertels a42643b235 [d3d9] Fall back to GDI blit for partial presents 2023-05-03 12:18:11 +01:00
Philip Rebohle 5c8ed491ab [dxvk] Rewrite thread wrapper
Addresses some issues raised in #3378.
2023-04-26 10:48:47 +02:00
Joshua Ashton b44c5bbd18 [dxgi] Fallback to P3 color primaries for HDR displays without chroma info in edid 2023-04-21 04:21:16 +01:00
mbriar 16d2a6045c [util] Switch Nioh deferSurfaceCreation from dxgi to d3d9
This game seems to behave similar to all the Tecmo Koei Atelier games
and not deferring surface creation for d3d9 prevents VRR from working on
X11.
2023-04-19 16:42:42 +02:00
mbriar 1971a5d187 [util] Also add d3d9.deferSurfaceCreation for Atelier Ryza 3
Reported to help with VRR, see https://github.com/ValveSoftware/Proton/issues/6648#issuecomment-1514394149
2023-04-19 16:42:42 +02:00
Philip Rebohle e074d83d0b [dxvk] Introduce GetContext method to retrieve immediate context.
Bypasses vtable hooks when retrieving the immediate context internally.
Remaining uses of GetImmediateContext are fine since those only interact
with public methods.
2023-04-18 12:42:24 +02:00
Robin Kertels 990a720525 [d3d9] Handle a bunch of texture converter edge cases 2023-04-16 09:18:30 +01:00
Rémi Bernon 0cf563d5df [dxgi] Leave current fullscreen mode when SetFullscreenState changes monitors
This fixes RiME not moving its window when output display is
changed in the game settings.
2023-04-14 00:41:18 +02:00
Florian Will 01dc9ddc7d [util] Add new "Zusi 3" exe filename
In addition to the legacy "ZusiSim.exe" executable, the recent 3.5
release added a 64-bit "ZusiSim.64.exe" executable. This is now the
default executable when launching the game in Steam. The game is
unplayable without this option, so update the regex for Zusi 3.

Fixes #3250.
2023-04-13 13:37:07 +02:00
oltolm 6b779206d9 remove unneeded definitions 2023-04-11 18:30:46 +02:00
Blisto91 8508633ba3 [util] Disable allowDirectBufferMapping for Dark Romance: Vampire in Love 2023-04-11 08:37:50 +01:00
Robin Kertels af0009c5de [d3d9] Use DxvkFormatInfo for video formats
And fix UYUY and YUY2 in the process.
2023-04-08 03:15:44 +01:00
Robin Kertels 31af522cbc [dxvk] Add VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM 2023-04-08 03:15:44 +01:00
Philip Rebohle d9a6b40ae3 [dxvk] Create and copy temporary image for resolves as necessary
Fixes #3337.
2023-04-06 21:04:56 +02:00
Tatsuyuki Ishi 6d14fffdbd [spirv] Declare defaulted copy and move constructor for SpirvCodeBuffer.
If a type has a destructor it will not get an implicit move constructor.

But if we declare a defaulted move constructor then we will get the copy
constructor deleted. So declare both to be defaulted.

Cuts 8.8% off shader translation time during loading in Overwatch 2.
2023-04-06 10:23:11 +02:00
Blisto91 3ce3209e3e [util] Set syncInterval to 1 for Crash Bandicoot N sane trilogy 2023-04-05 16:25:05 +01:00
Philip Rebohle f212cc8f7d [dxvk] Only enable dynamic MSAA state if sample shading is enabled
Otherwise, create a more specialized fragment output library on demand.
May help RADV since dynamic alpha-to-coverage triggers a less efficient
code path.
2023-04-04 17:34:07 +02:00
Philip Rebohle 306919047b [dxvk] Log driver name in addition to version
Fixes #3313.
2023-03-27 15:44:19 +02:00
Philip Rebohle 977669c613 [util] Enable cached dynamic vertex/index buffers in GTA V
Fixes #3311.
2023-03-25 22:40:43 +01:00
Zhiyi Zhang 631171cf45 [util] Disable nvapiHack for Tom Clancy's Ghost Recon Breakpoint.
Otherwise, it shows a DirectX error dialog and exits when using an NVIDIA GPU.
2023-03-25 22:38:07 +01:00
František Zatloukal 1a5afc77b1 [util] Include cstdint to fix compilation with GCC 13 2023-03-23 23:37:10 +01:00
Robin Kertels d11878e793 [d3d9] Only apply viewport zBias if minZ is below 0.5
Fixes Space Marine shadows.
Tests show that Windows D3D9 (Nvidia) works like that.
2023-03-23 03:52:08 +00:00
Philip Rebohle 4b74d1a97b [meta] Clarify file paths for install instructions
We got half a dozen issues about this in the past couple of weeks, and
it's quite frankly getting annoying, so just explain it in such a way
that everyone should understand it.
2023-03-23 02:05:42 +01:00
Blisto91 b0ed97e070 [util] Disable nvapiHack for Diablo 4 2023-03-22 17:10:18 +01:00
Philip Rebohle 3d5becaf6a [d3d11] Implement Acquire/ReleaseWrappedResource 2023-03-18 00:50:42 +01:00
Philip Rebohle 5595844f75 [dxvk] Add explicit buffer/image memory barrier methods
Useful for interop.
2023-03-18 00:50:42 +01:00
Philip Rebohle 9bdad71dc6 [d3d11] Implement CreateWrappedResource for D3D12 textures 2023-03-18 00:50:42 +01:00
Philip Rebohle 3c99314332 [d3d11] Implement CreateWrappedResource for D3D12 buffers 2023-03-18 00:50:42 +01:00
Philip Rebohle fa8cf50263 [dxvk] Implement functionality to import foreign buffers 2023-03-18 00:50:42 +01:00
Philip Rebohle 3f9d2269f6 [d3d11] Synchronize queue submissions for 11on12 devices as necessary
When the app explicitly calls Flush, Signal or Wait, we need to wait
for the submission to actually take place so that subsequent D3D12
submissions execute in the correct order.
2023-03-18 00:50:42 +01:00
Philip Rebohle 6432787ac3 [d3d11] Implement D3D11on12 device creation 2023-03-18 00:50:42 +01:00
Philip Rebohle da32453b42 [dxvk] Add submission feedback to command submissions 2023-03-16 20:59:43 +01:00
Philip Rebohle 27f3648a44 [dxvk] Check instance extensions for feature enablement as necessary 2023-03-16 20:59:43 +01:00
Philip Rebohle 35895ba05b [dxvk] Add callback to lock submission queue
Can be used to perform additional synchronization as necessary.
2023-03-16 20:59:43 +01:00
Philip Rebohle 56a8fa2e6f [dxvk] Implement functionality to import existing Vulkan device 2023-03-16 20:59:43 +01:00
Philip Rebohle d8f3a1c83d [dxvk] Rework device queue initialization 2023-03-16 20:59:43 +01:00
Philip Rebohle ef9d5048f3 [dxvk] Rework instance creation
Allows importing foreign Vulkan instances.
2023-03-16 20:59:43 +01:00
Philip Rebohle f50f5bc9bc [vulkan] Allow importing existing Vulkan dispatch tables 2023-03-16 20:59:43 +01:00
Philip Rebohle b06e82591e [include] Add definitions for D3D12 header 2023-03-16 20:59:43 +01:00
Philip Rebohle 687d32cac5 [dxvk] Fix memory reporting derp 2023-03-15 02:14:54 +01:00
WinterSnowfall 243c2f3cf5 [d3d9] remove support for the A1/X1R5G5B5 formats 2023-03-14 13:17:13 +00:00
Philip Rebohle af811656bb [meta] Update issue template 2023-03-13 17:54:34 +01:00
Philip Rebohle 05fb634f91 [util] Use __wine_dbg_output if available 2023-03-13 16:32:32 +01:00
Blisto91 3a123222e5 [util] Enable cached vertex buffers for SpellForce 3 2023-03-13 13:22:39 +01:00
Philip Rebohle 4faa598e09 [dxvk] Report memory used rather than allocated for heap properties
We can do this at least for DXVK's own memory allocations.
2023-03-12 13:59:47 +01:00
Philip Rebohle 6783123654 [dxgi] Use heap size to determine reservable memory
Budgets can change dynamically, so this should be more robust.
2023-03-12 13:59:17 +01:00
Robin Kertels d14dcf5d47 [d3d9] Fix redundant copy of SWVP VS consts
Fixes performance regression caused by state block changes.
2023-03-10 03:24:32 +00:00
Joshua Ashton 996acbe3f2 [d3d9] Refactor state blocks to allocate dynamically. 2023-03-07 23:24:01 +00:00
Blisto91 8ecd1b3b6b [util] enableDialogMode for Codename Panzers Phase One/Two 2023-03-07 22:51:23 +00:00
Philip Rebohle 7f21a6c491 [dxvk] Accumulate query data into query object
And do so when adding additional query handles, in order
to avoid allocating queries indefinitely if End is never
called, which Halo:MCC supposedly does.

Co-authored-by: Sam Edwards <CFSworks@gmail.com>
2023-03-06 12:35:22 +01:00
Philip Rebohle e430ff5cfd [dxvk] Use small_vector to store query handles. 2023-03-06 12:35:22 +01:00
Joshua Ashton 1acf885109 [dxvk] Call SDL_Vulkan_LoadLibrary in getInstanceExtensions for SDL WSI
Closes: #3275
2023-03-03 00:14:22 +00:00
Robin Kertels 1c6fc7b5b8 [d3d9] Clamp stage and type in [G,S]etTextureStageState
This is what happens on the Nvidia D3D9 driver.
Dawn of Magic 2 calls SetTextureStageState with a
stage > 7 and expects that to succeed.
2023-03-02 13:41:32 +00:00
Guy1524 5609c5e076
[util] Reduce maximum chunk size for WILD HEARTS.
Co-authored-by: Blisto91 <47954800+Blisto91@users.noreply.github.com>
2023-03-01 15:38:14 +01:00
Philip Rebohle 55e7cb1d54 [dxgi] Only log QueryInterface errors once 2023-03-01 13:25:56 +01:00
Philip Rebohle 4c78964679 [d3d9] Only log QueryInterface errors once 2023-03-01 13:25:56 +01:00
Philip Rebohle cc78276897 [d3d11] Only log QueryInterface errors once 2023-03-01 13:25:56 +01:00
Philip Rebohle aa92cf48f5 [util] Add function to cache QueryInterface errors 2023-03-01 13:25:56 +01:00
Philip Rebohle 81440340ac [d3d9,dxvk,util] Actually use dxvk::mutex 2023-03-01 13:03:43 +01:00
Philip Rebohle 2356d34f2e [d3d11] Create video context resources on demand
Saves another memory allocation that we will often not need.
2023-03-01 12:37:06 +01:00
Philip Rebohle f4b91817fe [dxvk] Create dummy sampler and buffer on demand
We only need the dummy buffer for transform feedback, all other cases
are handled by null descriptors. May save a memory allocation.
2023-03-01 12:10:48 +01:00
Philip Rebohle 2be0d6842e [dxvk] Add option to limit memory chunk size 2023-03-01 11:53:18 +01:00
Robin Kertels 0d28be4ab8 [d3d9] Fix capturing lights in state block 2023-02-23 13:15:17 +00:00
Blisto91 081181313e
[util] Limit Battle Fantasia Revisited Edition to 60fps (#3256) 2023-02-18 10:54:14 +01:00
TacoDeBoss caf31033d7
[util] Far Cry 2: Set VendorId to Nvidia, enable apitraceMode (#3241) 2023-02-07 12:14:48 +01:00
Paul Gofman 2263dcad95 [d3d11] Improve video processor caps query stubs 2023-01-31 13:39:09 +01:00
Jens Peters 41b1efd7ce [dxgi] Fix potential division by zero in log statement
Apparently 0/0 is legal and should be interpreted as 0/1.
2023-01-28 00:51:01 +01:00
Philip Rebohle c6111eaf61 [dxvk] Fix small_vector size
Kind of harmless since we're not using this much.
2023-01-27 05:27:49 +01:00
Philip Rebohle 2abc102d2c [meta] Release 2.1 2023-01-24 14:54:09 +01:00
Philip Rebohle 61d72eebc1 [dxgi,d3d9] Use global singleton for DXVK instances
No reason to have multiple of these around, and instance creation
is fairly expensive.
2023-01-23 17:17:56 +01:00
Philip Rebohle d4143429c4 [util] Add Singleton helper 2023-01-23 17:17:43 +01:00
Philip Rebohle 255ab1a63c [hud] Display more useful driver info in HUD
Vulkan versions are irrelevant anyway, not sure why we
ever displayed that in the first place.
2023-01-23 00:10:39 +01:00
Philip Rebohle 3128f4ea8e [dxgi] Implement IDXGIVkInteropFactory for DXGI factory 2023-01-22 20:04:39 +01:00
Philip Rebohle 0ee69fef00 [dxgi] Define IDXGIVkInteropFactory interface 2023-01-22 19:57:17 +01:00
Philip Rebohle 41ee092b97 [dxvk] Get rid of global timeline semaphore
Timeline semaphores are broken on 32-bit Proton, so just use the existing
command list binary semaphore to synchronize sparse binding operation.

This will introduce some additional graphics queue submissions around
sparse binding, but since that is basically unused it's not a concern.
2023-01-21 13:15:09 +01:00
Philip Rebohle d020f4451a [dxvk] Invalidate all v16 cache files
We were randomly writing bogus data in an irrecoverable way,
so in order to not cause any problems for users, invalidate
all caches created with this version.
2023-01-21 01:24:02 +01:00
Philip Rebohle 3d24560af7 [dxvk] Fix reading out-of-bounds memory in state cache
Fixes #3196, not to mention that this was god-awful code anyway.
2023-01-21 01:14:45 +01:00
Philip Rebohle 0af5ececa6 [dxvk] Also reset descriptor pool when only one pool is in use
This way we can often avoid allocating additional descriptor pools.
2023-01-20 15:23:25 +01:00
Philip Rebohle eacb8da9f7 [dxvk] Tweak descriptor pool numbers
Increases the descriptor pool size on 64-bit, but also makes
significantly better use of descriptor pool memory in situations
with very high draw counts and many UBO descriptor set updates.
2023-01-20 14:34:46 +01:00
Philip Rebohle 4d0d455895 [vulkan] Try loading winevulkan.dll before vulkan-1.dll
Should bypass issues with third-party overlays trying to hook Vulkan.
2023-01-18 18:10:57 +01:00
Philip Rebohle c6668ffbaa [dxvk] Drop shader module workaround for compute pipelines.
This was a bug in early Nvidia development drivers, but has been fixed since.
2023-01-18 15:56:00 +01:00
Blisto91 906b931e61 [util] Disable unmapping for BlazBlue Centralfiction 2023-01-17 20:49:26 +01:00
Philip Rebohle d7a4ddb5d0 [d3d11] Implement more accurate resource tracking on deferred contexts
Allows us to track chunks that access any given tracked resource more
accurately and flush as needed, e.g. if a staging buffer is written at
the start of a long command list.
2023-01-17 15:01:06 +01:00
Philip Rebohle cf5adb8b12 [d3d11] Improve flushing around deferred context submissions 2023-01-17 15:01:06 +01:00
Philip Rebohle 591e2df701 [d3d11] Consider flushing after each CS chunk
This way we will never end up with overly long command lists.
2023-01-17 15:01:06 +01:00
Philip Rebohle 2a3d7ee7dc [d3d11] Use new flush heuristic 2023-01-17 15:01:06 +01:00
Philip Rebohle f952418958 [d3d11] Determine pending commands based on sequence number
We get this for free and this allows us to query how many CS chunks
have been emitted since the last flush.
2023-01-17 15:01:06 +01:00
Philip Rebohle 0ac247c89c [util] Add helper class for common flush heuristic 2023-01-17 15:01:06 +01:00
Philip Rebohle 741cc493c6 [dxvk] Increase maximum number of command buffers in flight 2023-01-17 15:01:06 +01:00
Philip Rebohle f7aa310fdd [dxvk] Disable pipeline lifetime tracking for RADV
Seems like this is not needed on this driver, so let's just use
the fast path by default. Makes the current implementation work
with 32-bit games as well since caching does not work yet.
2023-01-17 14:02:38 +01:00
Philip Rebohle 421d7d9077 Revert "[vulkan] Use fence for acquiring a swap chain image"
Breaks things and we don't really need this right now anyway.
2023-01-16 23:16:38 +01:00
Philip Rebohle 599357721a [hud] Support HDR color spaces
Blending is broken if we need to do encoding in the shader, but we
cannot do much about that without changing the rendering process,
so this will have to do for now.
2023-01-16 18:04:18 +00:00
Philip Rebohle 0e503ce795 [vulkan] Log swap chain color space 2023-01-16 18:04:18 +00:00
Philip Rebohle 1482715fd1 [vulkan] Use fence for acquiring a swap chain image
In practice, drivers will block here anyway.
2023-01-16 16:20:56 +01:00
Joshua Ashton 132bc529c3 [dxgi] Only allow colorspace punting if we started in sRGB 2023-01-16 13:45:03 +01:00
Joshua Ashton 28ee6867be [dxgi] Expose only sRGB when enableHDR is disabled
Death Stranding: Director's Cut crashes if HDR was last enabled in-game and CheckColorSpaceSupport reports support for HDR but it is not globally enabled in DXGIOutput::GetDesc1's ColorSpace.

It seems safer to just lock HDR behind an option to avoid any teething issues like this. It sucks, but it also makes sense in a way.
2023-01-16 13:45:03 +01:00
Joshua Ashton bb75e214d6 [dxgi] Store top-level DxgiFactory in DxgiSwapChain
Can do this now that we tossed the old stuff that depended on the swapchain factory being resident in D3D11.
2023-01-16 13:45:03 +01:00
Joshua Ashton 9010f11adf [dxgi, d3d11] Remove support for legacy IWineDXGISwapChainFactory interface
vkd3d-proton 2.8 released last year with support for the new swapchain
interface.

No need to keep support for this legacy interface hanging around when
it complicates adding DxgiOptions support to the swapchain.
2023-01-16 13:45:03 +01:00
Philip Rebohle af05265cb6 [dxvk] Set thread priority for background workers
We accidentally lost this somehow.
2023-01-15 15:54:03 +01:00
Philip Rebohle 459758c6ff [d3d9] Don't set storage buffer usage unless necessary
This actually matters now to some degree.
2023-01-15 15:36:05 +01:00
Philip Rebohle d35bf455d9 [dxvk] Rename bindResourceBuffer to bindUniformBuffer 2023-01-15 15:36:05 +01:00
Philip Rebohle a8f9fdb21d [dxvk] Rearrange descriptor sets
This allows us not to unnecessarily dirty the FS UBO set when
changing tetxure bindings, leading to a cleaner separation.
2023-01-15 15:36:05 +01:00
Philip Rebohle 4a30933359 [dxvk] Add UBO set property to descriptor info
Used to explicitly propagate storage buffer bindings
to the respective UBO set.
2023-01-15 15:36:05 +01:00
Philip Rebohle 6f194b0e7b [d3d11] Bind UAV counter buffers as views 2023-01-15 15:36:05 +01:00
Philip Rebohle 82f500250f [hud] Bind data buffers as views 2023-01-15 15:36:05 +01:00
Philip Rebohle c347bd4d8b [dxvk] Allow creating buffer views with undefined format 2023-01-15 15:36:05 +01:00
Philip Rebohle 92de3f3f5f [d3d11] Add missing context locks 2023-01-14 18:40:41 +01:00
Philip Rebohle 1c2df54bdf [dxvk] Improve logging in case of memory errors 2023-01-14 03:39:55 +01:00
Philip Rebohle 2922b780c1 [dxvk] Properly handle bufferImageGranularity for images
Fixes validation errors about dedicated allocations being
bigger than the image's memory requirement on Nvidia.
2023-01-14 03:39:55 +01:00
Robin Kertels 97a91c816f [d3d9] Disable instancing for non-indexed draws 2023-01-13 21:58:41 +00:00
Philip Rebohle 3a84838ac4 [hud] Display approximate progress when compiling shaders 2023-01-13 16:43:27 +01:00
Philip Rebohle c978e62ec8 [dxvk] Implement better priority system for background shader compiles
Reduces the number of workers that perform background optimization,
which may reduce the performance impact when encountering a large
number of new pipelines at once.
2023-01-13 16:43:27 +01:00
Blisto91 cc9266edaa [util] Add config for Alien Rage
Reporting a GTX 295 puts us into the highest behind the scenes graphics settings preset bucket and prevents the shadow issue with `FloatingPointRenderTargets` set to false in the lower preset bucket.
NvapiHack needs to be disabled on Linux since the game pings it in the Windows system folder and want's the VendorId to match your GPU. Else the issue will still happen on Nvidia Linux
2023-01-13 14:15:54 +01:00
Philip Rebohle 070a340115 [dxvk] Remove path to look up optimized pipeline in cache
For some reason this sometimes takes several milliseconds, which
leads to noticeable stutter. Linking a pipeline is more consistent.
2023-01-13 11:40:01 +01:00
Philip Rebohle a22d70e184 [dxvk] Remove unused compileComputePipeline function 2023-01-12 17:35:05 +01:00
Philip Rebohle e5157a5360 [dxvk] Add pre-rasterization pipeline libraries to the state cache
This allows compiling tessellation or geometry shader pipelines
early while still using the pipeline library path.

Also removes compute shaders. Since API-provided compute shaders
are always compiled early, supporting them is no longer needed.
2023-01-11 11:48:16 +01:00
Philip Rebohle 28ae85b7ab [dxvk] Enable creating full pre-rasterization pipeline libraries 2023-01-11 11:48:16 +01:00
Philip Rebohle 17529101d5 [dxvk] Allow creating pipeline libraries with more than one shader 2023-01-11 11:48:16 +01:00
Philip Rebohle f9ff96d727 [dxvk] Implement checks for pre-raster pipeline library compatibility 2023-01-11 11:48:16 +01:00
Philip Rebohle b916dc04e5 [dxbc] Fill in patch vertex count info 2023-01-11 11:48:16 +01:00
Philip Rebohle 5e42230b95 [dxvk] Add patch vertex count to shader info struct 2023-01-11 11:48:16 +01:00
Philip Rebohle f76a7c285c [dxvk] Rework DxvkShaderPipelineLibrary to work with multiple shaders 2023-01-11 11:48:16 +01:00
Philip Rebohle 8011a40843 Revert "[dxbc] Handle dead code in shader binaries"
Apparently this regressed something, but the reporter who asked
for this fix in the first place did not specify what, so let's
just revert this and break the whole thing again until we get
something to actually work with.

This reverts commit 5115d80d51.
2023-01-10 20:37:22 +01:00
Philip Rebohle 8052347a22 [dxvk] Keep more empty system memory chunks alive 2023-01-10 03:42:37 +01:00
Philip Rebohle 0342a25e61 [d3d9,dxso] Add d3d9.forceSampleRateShading option 2023-01-09 18:35:02 +01:00
Philip Rebohle e426ec09a1 [d3d11,dxbc] Add d3d11.forceSampleRateShading option 2023-01-09 18:35:02 +01:00
Philip Rebohle 06fb93daf0 [dxvk] Only create state cache file on demand
If no pipelines are ever written to it, we should not create
the cache file in the first place.
2023-01-09 18:31:18 +01:00
Philip Rebohle 6a4fe06ac6 [dxvk] Fix incorrect flags for null fs pipeline layout 2023-01-09 18:31:18 +01:00
Joshua Ashton 5206d97710 [dxgi] Workaround UE4 DX11 + HDR crashes
Unreal Engine 4 titles use AGS/NVAPI to try and enable
HDR globally.
They can key this off IDXGIOutput::GetDesc1's ColorSpace
being HDR10.
Many of these UE4 games statically link against AGS.

This is a problem as when UE4 tries to enable HDR via AGS,
it does not check if AGSContext, and the display info etc
are nullptr unlike the rest of the code using AGS.
So we need to special-case UE4 titles to disable reporting a HDR
when they are in DX11 mode.

The simplest way to do this is to key off the fact that all
UE4 titles have an executable ending with "-Win64-Shipping".

We check if d3d12.dll is present, to determine what path in
UE4 we are on, as there are some games that ship both and support HDR.
(eg. The Dark Pictures: House of Ashes, 1281590)
Luckily for us, they only load d3d12.dll on the D3D12 render path
so we can key off that to force disable HDR only in D3D11.
2023-01-09 12:54:28 +00:00
Blisto91 3ed0a4fd43 [util] Set Secret World Legends launcher to SM 2 2023-01-08 10:47:04 +01:00
Beyley Thomas c11a63f5e5 [wsi] Add GLFW backend 2023-01-08 10:36:25 +01:00
Hunter Kvalevog 3491895960 [dxvk] Remove SDL dummy window
SDL >= 2.0.9 permits passing a nullptr window to
SDL_Vulkan_GetInstanceExtensions, so there's no
point in going though the work of creating a
window just to call this function.
2023-01-07 22:43:32 +00:00
Philip Rebohle 196fefec4c [dxvk] Enable dynamic multisample state if supported by the device
Eliminates stutter in situations where sample rate shading is used with MSAA.
2023-01-06 23:48:31 +01:00
Philip Rebohle f269cde749 [dxvk] Enable device features for dynamic multisample state 2023-01-06 23:48:31 +01:00
Philip Rebohle 4612113227 [meta] Update hopelessly outdated README entry 2023-01-06 23:48:14 +01:00
Philip Rebohle 389634f9b9 [d3d11] Fix D3D11Texture2D reference counting 2023-01-06 22:52:29 +01:00
Philip Rebohle 5115d80d51 [dxbc] Handle dead code in shader binaries
We should not emit any code when not inside a function.

Fixes #3154.
2023-01-06 20:49:13 +01:00
Joshua Ashton c10b53ed3e [dxgi] Add dxgi.enableHDR option 2023-01-06 17:27:38 +01:00
Joshua Ashton 3375cdf1fa [dxgi] Initialize DxgiOptions before DxgiMonitorInfo
Needed to we can access DxgiOptions inside of DxgiMonitorInfo for the dxgi.enableHDR property coming up in a future commit.
2023-01-06 17:27:38 +01:00
Joshua Ashton f25475d05e [dxgi] Normalize display metadata to something rational
Sometimes we can't get an EDID if things aren't plumbed fully, or some displays just have broken EDIDs.

This accounts for both of those cases by using some dummy data if we are missing information.

Fixes value reporting to match Windows on common displays such as LG OLEDs.
2023-01-06 17:27:38 +01:00
Joshua Ashton f453d6ee2a [dxgi] Implement DXGIOutput::GetDesc1's ColorSpace
Adds the ability to punt the global colorspace into HDR from SetColorSpace1.

We have no way of checking the actual Windows colorspace as the
only public method for this *is* DXGI which we are re-implementing.
So we just pick our color space based on the DXVK_HDR env var
and the punting from SetColorSpace1.

We might expand on this in future, but this is good enough for an
initial implementation.
2023-01-06 17:27:38 +01:00
Blisto91 dd660585c0 [meta] Remove current year from copyright notice 2023-01-06 16:48:04 +01:00
Joshua Ashton 4d2e90ceba [build] Bump libdisplay-info fork again 🐸
Bruh moment with MAX_PATH define between MinGW and Windows headers going on. Should have just PRed it from the start to avoid the churn :(
2023-01-06 11:29:50 +00:00
Joshua Ashton 421ac48007 [build] Bump libdisplay-info fork subproject to fix MSVC builds 2023-01-06 10:38:17 +00:00
Joshua Ashton fd34dba070 [build] Bump libdisplay-info fork
Should fix issues running under Windows with MinGW builds.
2023-01-06 10:08:52 +00:00
Robin Kertels f94b42f23f [d3d9] Dont use GenerateDrawInfo in DrawPrimitiveUp
This is confusing because it looks like a race condition
at first glance.
2022-12-30 19:29:34 +00:00
Philip Rebohle 12901b52f1 [dxvk] Split barriers with very large VkDependencyInfo structures
Works around an AMD driver bug. Fixes #3138.
2022-12-20 03:10:44 +01:00
Philip Rebohle f4f4f3647f [d3d11] Do not create storage image views with swizzle
This happens when a game uses A8_UNORM UAVs. Vulkan doesn't allow this,
and it's not meaningful for stores anyway, we'd need shader emulation.
2022-12-20 02:20:11 +01:00
Joshua Ashton c7be18cb26 [d3d11] Implement SetHDRMetadata 2022-12-19 22:15:18 +01:00
Joshua Ashton e5418a956a [vulkan] Add setHdrMetadata method to Presenter 2022-12-19 22:15:18 +01:00
Joshua Ashton 731bf84edd [dxvk] Enable VK_EXT_hdr_metadata 2022-12-19 22:15:18 +01:00
Joshua Ashton 4335eccae9 [dxvk] Enable VK_EXT_swapchain_colorspace 2022-12-19 22:15:18 +01:00
Joshua Ashton 33acf58ac7 [d3d11] Implement CheckColorSpaceSupport and SetColorSpace 2022-12-19 22:15:18 +01:00
Joshua Ashton 50054d4675 [vulkan] Add supportsColorSpace method to Presenter 2022-12-19 22:15:18 +01:00
Joshua Ashton fd661d587e [vulkan] Simplify args to Presenter GetSupported* methods 2022-12-19 22:15:18 +01:00
Robin Kertels 18b0ef697c [dxvk] Rework SetEventOnCompletion
* Create the waiter thread on demand
* Don't wake up the waiter thread every 10ms
  when no events are queued
* Wait on caller thread when hEvent = null
2022-12-16 17:37:19 +01:00
Philip Rebohle 6d4161cd6e [meta] Fix issues with build scripts if there are spaces in the path 2022-12-16 17:15:50 +01:00
Philip Rebohle c55c09368b [d3d11] Only store low 8 bits of stencil reference
Seems to match behaviour of the D3D11 runtime, in that OMGetDepthStencilState
will not retain the high bits.

Found by CME. Should fix #1784.
2022-12-11 19:51:57 +01:00
Blisto91 7b2024888e [util] disable unmapping for Final Fantasy XIV d3d9 2022-12-11 14:01:27 +01:00
Joshua Ashton c0d843c578 [wsi] Fix overwriting colorimetry info to NULL 2022-12-08 06:48:30 +00:00
bno1 858452a0bd [build] Fix submodule url for libdisplay-info 2022-12-06 22:53:49 +01:00
Philip Rebohle b838b65516 [d3d9] Correctly mask alpha reference push constant
We accidentally lost this during the rework, since the initial
implementation scaled the alpha ref value on the CPU.

Fixes #3123.
2022-12-06 21:25:55 +00:00
Blisto91 4a4d880130 [util] Set TRAHA Global to Intel vendor id 2022-12-04 23:06:59 +01:00
Robin Kertels 522909b165 [d3d9] Don't set NeedsReadback when dirtying mip maps
It's impossible to lock non 0 mips anyway.
2022-12-03 15:18:40 +00:00
Philip Rebohle 573be24269 [wsi] Fix crash when parsing EDID fails
If info is null then we shouldn't pass it around.

Also improve formatting a bit.
2022-12-02 00:23:38 +00:00
Philip Rebohle 9f70666777 [build] Allow standalone DXGI builds 2022-11-28 13:48:05 +01:00
Hans-Kristian Arntzen 42332f7fb8 [dxgi] Fix IDXGISwapchain::CheckColorSpaceSuport 2022-11-28 12:45:34 +01:00
wael 7644776f7a README: fix wine dll path 2022-11-26 13:05:15 +01:00
Philip Rebohle 57176e77ea [meta] Don't try to package setup script in a release tarball 2022-11-25 14:51:52 +01:00
Philip Rebohle 64cb1ad208 [meta] Remove setup script 2022-11-25 14:50:31 +01:00
Philip Rebohle 4f90d7bf5f [dxbc,d3d11] Don't access shex chunk if it is not defined 2022-11-25 12:45:32 +01:00
Joshua Ashton d01c9cb6d4 [wsi] Free edid info after parsing 2022-11-25 08:44:39 +00:00
Philip Rebohle ebd29007d4 [dxgi] Actually unlock monitor info
Fixes some deadlocks.
2022-11-21 20:24:15 +01:00
Philip Rebohle c6611dffa7 Revert "[dxbc] Move shex check to constructor"
Breaks stuff for unknown reasons.
2022-11-21 19:35:21 +01:00
Joshua Ashton f0a0e1b964 [dxgi] Report display metadata in IDXGIOutput6::GetDesc1 2022-11-21 17:26:53 +01:00
Joshua Ashton aa71e7e323 [dxgi] Cache display metadata + colorimetry in DXGI_VK_MONITOR_DATA 2022-11-21 17:26:53 +01:00
Joshua Ashton fabe4a85e3 [wsi] Add parseColorimetryInfo helper 2022-11-21 17:26:53 +01:00
Joshua Ashton ac10c75ca0 [build] Add Josh's libdisplay-info fork for parsing EDIDs
This will be used to parse static HDR metadata and chromaticity of the display.

Upstream currently has no Windows or MSVC support so use my fork for now.
2022-11-21 17:26:53 +01:00
Philip Rebohle 3b9235fe23 [util] Set max frame latency to 1 for Sonic Frontiers
Seems like the only reason this game passes QA is because there *was* no
QA. Seriously broken when GPU-bound even on Windows.
2022-11-21 17:18:01 +01:00
Robin Kertels 4796eb0b0d [d3d9] Implement capturing lights in state blocks 2022-11-21 16:06:49 +00:00
Robin Kertels 1a3b576d35 [util] Implement bit vector 2022-11-21 16:06:49 +00:00
Robin Kertels d0a10cc9f8 [d3d9] Handle DS texture uploads 2022-11-21 15:59:25 +00:00
Blisto91 2c53459f4c [util] disable floatControls for Bad Company 2 2022-11-21 13:13:57 +01:00
Robin Kertels dd7ec24269 [dxbc] Move shex check to constructor
Otherwise we dereference a null pointer when
accessing the DxbcProgramInfo.
2022-11-21 01:49:35 +01:00
Robin Kertels 3393c5f4ff [d3d9] Only upload mip 0 of managed automipgen textures 2022-11-19 17:34:02 +00:00
Philip Rebohle a130146f15 [dxvk] Remove dead enableRtOutputNanFixup option
Dead code since 2.0, not sure why this was still in here.
2022-11-18 22:31:54 +01:00
Joshua Ashton e037d24017 [util] Default initialize BitMask to 0
Found via an MSVC warning, may not fix anything, but good to do anyway.
2022-11-17 17:38:46 +01:00
Joshua Ashton 287412f746 [util] Cast _tzcnt_u64 to uint32_t
MSVC has _tzcnt_u64 return a uint64_t, which obviously, it can never return a number that big.
2022-11-17 17:38:46 +01:00
Joshua Ashton 69b1aa251d [wsi] Add getMonitorEdid function
What an unbelievable pain this is to do on Windows...

No-op on SDL2 right now, as there is nothing for that.
2022-11-17 17:38:16 +01:00
Blisto91 ad3c316d0c [util] Set Black Mesa customVendorId to Nvidia 2022-11-16 11:30:40 +01:00
Robin Kertels 785bc9738f [util] Disable DC Single Use Mode for Cardfight!! Vanguard Dear Days 2022-11-15 16:55:38 +01:00
Philip Rebohle 8f8a93696d [meta] Release 2.0 2022-11-10 13:55:39 +01:00
Robin Kertels 8a2e4ef481 [d3d9] Allow locking DEFAULT pool based on texture type 2022-11-10 13:37:52 +01:00
Philip Rebohle 82685ca4fc [meta] Explicitly use meson setup command
Fixes some deprecation warnings with Meson 0.64.
2022-11-10 13:26:31 +01:00
Blisto91 bc08cac220 [util] Enable apitraceMode for Sonic & All-Stars Racing Transformed 2022-11-09 19:22:14 +01:00
Christopher Egert e30b783505 d3d9: Use a different rvalue for depth bias on NV 2022-11-09 01:15:00 +00:00
Robin Kertels ecc2302389 [d3d9] Fix query reset counter underflow 2022-11-07 23:34:32 +00:00
Philip Rebohle 76e6b2764b [dxgi] Change CreateSwapChain to take a surface factory 2022-11-07 14:14:05 +01:00
Philip Rebohle 03dca539cb [vulkan,d3d9,d3d11] Move surface creation to swap chain implementation 2022-11-07 14:14:05 +01:00
Philip Rebohle 49cf0ecf54 [vulkan] Don't handle SURFACE_LOST in Vulkan presenter 2022-11-07 14:14:05 +01:00
Philip Rebohle 3a9e975a71 [dxgi] Implement DxgiSurfaceFactory 2022-11-07 14:14:05 +01:00
Philip Rebohle 1754b73ade [wsi] Change interface for surface creation
This temporarily breaks Win32 swap chains, but we're fine with that
since this will take some refactoring.
2022-11-07 14:14:05 +01:00
Philip Rebohle bd87e19de1 [dxgi] Introduce IDXGIVkSurfaceFactory 2022-11-07 14:14:05 +01:00
Robin Kertels d8933ca175 [d3d9] Only do one allocation for all texture subresources 2022-11-06 19:35:03 +00:00
Blisto91 145c1ce127 [util] Limit fps to 60 for some WayForward games 2022-11-06 15:32:28 +01:00
Robin Kertels 4fb7acc64e [d3d9] Implement converter for W11V11U10 2022-11-06 02:55:29 +00:00
Vlad 40a4908a2a Support for MW:R H1-Mod 2022-11-05 16:07:16 +01:00
Blisto91 e1eec9b359 [util] Set Fallout 3 to Nvidia vendor id 2022-11-05 16:07:04 +01:00
Robin Kertels 892f676605 [util] Disable direct buffer mapping for Dragon Age Origins 2022-11-02 16:12:28 +01:00
Philip Rebohle 0b9f785bc5 [dxvk] Remove broken memory budget logic for UMA systems
All heaps on an UMA systems are by definition device-local, so this
just leads to unnecessary issues.
2022-11-01 12:48:03 +01:00
Adam Jereczek 0462454d2b
Fix for saving vertex shader constants with a StateBlock
Co-authored-by: aroztkow <aneta.roztkowska@intel.com>
2022-10-31 18:16:15 +00:00
Robin Kertels 0fc5c84e7b [d3d9] Don't advertise support for MS INTZ format 2022-10-30 21:50:44 +00:00
Georg Lehmann bc31ebe151 [d3d9] Fix OptimizeLayout with feedback loop usage.
We kind of need dcc on GFX8/9.
2022-10-29 11:21:55 +02:00
Konstantin Kharlamov cd21cd7fa3 setup_dxvk.sh: install with reflinks if supported
Some filesystems, such as XFS and BTRFS, may perform a lightweight copy
with CoW. This is most useful for rarely changing content, and the
usecase of installing DXVK is one of such usecases, as library files are
usually not modified (might be removed, but it's not modification).

So make use of it whenever supported.
2022-10-25 03:46:31 +02:00
Winter Snowfall f84f992d44 [util] Also enable workaround for the "mod load exe" of ToEE 2022-10-25 03:45:53 +02:00
iczero 6335f065c3 Ensure setup_dxvk.sh works with spaces in basedir 2022-10-25 03:45:23 +02:00
Robin Kertels 9c22a58543 [d3d9] Disable locking non-dynamic default textures 2022-10-24 20:55:00 +01:00
Robin Kertels d771f7cf8f [d3d9] Remove dead fields 2022-10-24 20:55:00 +01:00
Philip Rebohle 494e01b353 [d3d9] Avoid querying environment variables on shader creation 2022-10-24 18:01:48 +02:00
Philip Rebohle b055c2daea [d3d11] Avoid querying environment variables on shader creation 2022-10-24 17:58:57 +02:00
Philip Rebohle fea86ef116 [dxvk] Use dynamic depth clip enable for linked pipelines if supported
This way we won't have to compile any vertex shader pipelines twice.
2022-10-24 16:39:24 +02:00
Philip Rebohle 8e7ea899d2 [dxvk] Enable VK_EXT_extended_dynamic_state_3 if available 2022-10-24 16:39:24 +02:00
Philip Rebohle 859de7e828 [dxvk] Always enable depth clip feature if supported 2022-10-24 16:39:24 +02:00
Philip Rebohle a6ede3e0c2 [meta] Update Vulkan headers to 1.3.231 2022-10-24 16:39:24 +02:00
Georg Lehmann ae764333f4 [build] Use glslang with --depfile to rebuild on header changes 2022-10-21 17:04:47 +02:00
Georg Lehmann 2653628041 [build] Always use glslang with --quiet
We depend on a new enough glslang anyway.
2022-10-21 17:04:47 +02:00
Paul Gofman e311f25287 [dxgi] Store device pointer in DxgiSwapChainDispatcher 2022-10-20 19:05:19 +02:00
Philip Rebohle 53a0c3726c [dxvk] Don't crash immediately on pipeline library compile error
Things will blow up down the line but there's no good reason to crash
immediately. Also ignore returned pipeline on error so we'll always
return null.
2022-10-18 00:07:41 +02:00
Philip Rebohle 69d7af42a4 [dxgi] Change swap chain interface to better map to D3D12 needs 2022-10-16 16:38:29 +02:00
Philip Rebohle d7ac21b6c7 [dxgi] Use new DXVK swap chain factory if available 2022-10-16 16:38:29 +02:00
Philip Rebohle aca67f64da [d3d11] Implement IDXGIVkSwapChainFactory for D3D11 2022-10-16 16:38:29 +02:00
Philip Rebohle 580dd5cf4a [dxgi] Add swap chain factory interface definition 2022-10-16 16:38:29 +02:00
Joshua Ashton fc3d04c1c9 [meta] Fix opt_strip in package-native.sh 2022-10-15 18:25:19 +01:00
Joshua Ashton be9687f396 [meta] Fix --dev-build on package-native.sh
Re-add the suffix to the build dir.
2022-10-15 18:18:52 +01:00
Joshua Ashton d83e184afd [d3d10] Enable native builds
This started working at some point... may as well!
2022-10-15 18:17:29 +01:00
Joshua Ashton eea77b845f [meta] Add CI for native builds in Steam Runtime Sniper 2022-10-15 18:11:34 +01:00
Joshua Ashton 2484dac34a [meta] Add package-native.sh 2022-10-15 18:11:34 +01:00
Joshua Ashton 1157b235cc [build] Specify static libgcc/stdc++ on native
We don't have any interfaces that rely on the c++ abi. Makes our builds more portable.

Means that our builds in Sniper can be used on games that are still forcing the old C++03 string abi.
2022-10-15 19:10:57 +02:00
Joshua Ashton 1d3decf100 [build] Add version scripts for native builds
FEX would like clean symbols for experimenting with making thunks down the line.

We also just shouldn't be exporting a bunch of random crap -- sadly -fvisibility=hidden doesn't help with a bunch of stuff :(

For reference, RADV also does this.
2022-10-15 19:10:57 +02:00
Joshua Ashton 25798f6fe1 [build] Set name_prefix to `libdxvk_` for native builds
Less rude and nicer than just d3d9.so.
Matches old DXVK native behaviour too.
2022-10-15 19:10:57 +02:00
Christophe f1578b8ed3
[meta] Factorize history and contributors sections using schema 0.8.1 2022-10-15 17:24:44 +01:00
Joshua Ashton 3b90f5a77f [util] Enable apitrace mode for Hammer World Editor 2022-10-15 17:21:29 +01:00
Jens Peters c54eac7d61 [build] Update github actions
Use github-checkout v3, github-upload-artifact-action v3 and joshua-ashton-gcc-problem-matcher v2.
Fixes Node.js 12 deprecation warning.
2022-10-14 09:32:51 +01:00
Robin Kertels 4bcabe8d46 [d3d9] Return 0 if any vertex decl element can't be represented as fvf 2022-10-12 23:07:23 +01:00
Robin Kertels 7090105573 [d3d9] Remove declaration fvf mapping log spam 2022-10-12 23:07:23 +01:00
Robin Kertels 2b964f0c67 [d3d9] Make MapD3DDeclToFvf more readable
All branches return, so we might as well
give it a bit more room to breath.
2022-10-12 23:07:23 +01:00
Philip Rebohle bd7d2aac71 [dxgi] Get rid of NotifyModeChange method
Was only used for the FPS limiter.
2022-10-07 13:25:56 +02:00
Vinjul1704 038ed23a5d [util] Force SM1 for the Escape from Tarkov launcher 2022-10-06 21:32:19 +02:00
Joshua Ashton fa45e5838e [util] Fix tzcnt on ARM64 + Clang
This needed brackets around this conditional.
2022-10-05 19:01:05 +01:00
Philip Rebohle ab622760a0 [dxbc] Emit new block only after emitting switch instruction
Otherwise emitting the OpSwitch will reset the block ID, which
is not desireable. Fixes #2975.
2022-10-04 21:00:50 +02:00
Blisto91 f8bd19f210 [util] Cap Sonic Adventure 2 to 60 fps 2022-09-30 19:14:59 -02:30
Adam Jereczek b2ad25755a
[d3d9] Fix for missing restriction check in ProcessVertices
Co-authored-by: aroztkow <aneta.roztkowska@intel.com>
2022-09-28 12:10:41 -02:30
Joshua Ashton 49854dbfba [d3d9] Saturate viewport depth range
Viewport depth range in D3D9 is clamped at 0-1, same as OpenGL.

Drivers like RADV, etc support VK_EXT_depth_range_unrestricted,
which makes the regular UB of this actually work -- which isn't what
we want.

We also don't enable VK_EXT_depth_range_unrestricted, so we shouldn't
be setting depth ranges outside of the 0-1 bounds anyway.

Closes: #2960
2022-09-27 18:58:40 -02:30
Georg Lehmann 50857537d6 [d3d9] Use D32 not D32_S8 when upgrading formats without stencil aspect. 2022-09-27 18:58:32 +01:00
Georg Lehmann a9bdea72e9 [d3d9] Clamp Dref to [0.0, 1.0] if the texture is emulated UNORM 2022-09-26 21:39:51 +01:00
Georg Lehmann 6fe96d7d82 [dxso] Support clamping Dref. 2022-09-26 21:39:51 +01:00
Georg Lehmann 5684e29718 [d3d9] Track if a texture is upgraded to D32f 2022-09-26 21:39:51 +01:00
Georg Lehmann 6188ffa23a [d3d9] Add a config option for D24 -> D32 2022-09-26 21:39:51 +01:00
Georg Lehmann 7552cfe62a [dxso] Always lower projection 2022-09-26 21:39:51 +01:00
Philip Rebohle f1f8d45fcd [dxvk] Rework allocation logic for large resources
This may reduce internal fragmentation with very large resources.

We previously changed behaviour to not do this in order to reduce memory
pressure in the average case, however by trying to suballocate from existing
chunks and falling back to a dedicated allocation on failure, rather than
allocating a new chunk, we can mostly avoid that situation.
2022-09-24 17:06:00 +02:00
Philip Rebohle 15588004b4 [dxvk] Bump memory chunk size to 256 MiB. 2022-09-24 17:06:00 +02:00
Joshua Ashton f2950953e0 [d3d9] Avoid depth degenerate viewports 2022-09-23 13:26:50 +01:00
Joshua Ashton d221bb7a9c [d3d9] Add ID3D9VkInteropDevice
Provides access to the device and instance handles
as well as the queue that is used for rendering.
2022-09-22 17:58:54 +01:00
Joshua Ashton e976218e17 [d3d9] Make GetDXVKDevice return a const Rc reference
Avoids some useless reffing.
2022-09-22 17:58:54 +01:00
Joshua Ashton ac13112619 [d3d9] Add ID3D9VkInteropTexture
Provides access to the backing resource of a D3D9 texture.
2022-09-22 17:58:54 +01:00
Joshua Ashton ae2465079e [d3d9] Add ID3D9VkInteropInterface
Allows getting the VkInstance handle from a IDirect3D9 interface,
as well as VkPhysicalDevices from adapter ordinals.
2022-09-22 17:58:54 +01:00
Joshua Ashton 1451032b83
[d3d9] Minor cleanups in vertex declaration code (#2950) 2022-09-22 09:46:51 +00:00
Krzysztof Dobrowolski 1e1ef8f1bd
[d3d9] Fix for missing mapping of VertexElements declarations to FVF bits
When Vertex declaration is created by CreateVertexDeclaration
and SetFVF is not called then GetFVF returns 0.
This code change implements mapping of D3D declarations to FVF mask
and sets it if FVF was not set previously.
2022-09-22 08:41:40 +00:00
Michał Pyrzowski 82ebc29e18
[dxso] Fix for illegal OpCompositeConstruct while translating Crs opcode
During the translation of the Crs opcode to SPIR-V there is an assumption that the result type is a composite type. This is not always true. If the result is a scalar type the translation adds an OpCompositeConstruct with a scalar result type. This is a spec violation.

This change checks if the result type is a composite type and does not add the OpCompositeConstruct in case of scalar types.
2022-09-21 10:47:16 +00:00
Robin Kertels 5c22e2fbda [util] Enable GTA IV config for Episodes from Liberty City 2022-09-19 15:11:01 +01:00
Robin Kertels c759fb45aa [util] Disable DF support for pretty mirrors in GTA IV 2022-09-19 15:11:01 +01:00
Robin Kertels 5962be44c6 [dxso] Define color inputs as centroids on SM3 too 2022-09-19 15:10:43 +01:00
Philip Rebohle c4c1d413db [meta] Update default config file 2022-09-19 16:09:48 +02:00
Philip Rebohle a14ce8d1b0 [d3d11] Enable ROV support if corresponding Vulkan features are supported 2022-09-19 15:44:23 +02:00
Philip Rebohle 35a84053b5 [dxbc] Implement rasterizer ordered views 2022-09-19 15:44:23 +02:00
Philip Rebohle 8ca5edeacd [dxbc] Decode rasterizer ordered flag for UAVs 2022-09-19 15:44:23 +02:00
Philip Rebohle 9532126f7c [dxvk] Enable VK_EXT_fragment_shader_interlock 2022-09-19 15:44:23 +02:00
Philip Rebohle 0bb0c1e646 [util] Enable ignoreGraphicsBarriers for FFXV
Massively improves performance when VXAO is enabled.
2022-09-19 15:43:45 +02:00
Philip Rebohle 2a7706ba53 [dxbc] Do not enable SPV_KHR_shader_float_controls
This is core in Vulkan 1.2 and SPIR-V 1.5.
2022-09-18 02:27:03 +02:00
Philip Rebohle 9fa587e13c [dxgi] Always use swap chain-local present count for frame statistics
Doesn't appear to match Windows behaviour, but there may be scenarios
when we can't query the current monitor. Statistics still need to be
consistent in this case.

See #2933.
2022-09-17 05:01:36 +02:00
Philip Rebohle 5b6b9923ab [dxbc] Write point size in vertex shaders
Silences some validation errors when point rendering is enabled.
2022-09-17 01:52:19 +02:00
Philip Rebohle d93568f1a9 [dxbc] Don't emit built-in position as a block variable
This is no longer needed for interface matching.
2022-09-17 01:52:19 +02:00
xpander69 07094ac4f9 [util] Remove fps cap from Warhammer Online
This is a bit embarrassing. Added this config few days ago to counter the animation breakages, but now Return of Reckoning devs patched the executable on their side to cap the framerate by default. So the workaround is not needed anymore.
2022-09-16 21:32:49 +01:00
Philip Rebohle 4fb6c200d7 [d3d9] Use precise matrix-vector operations to compute vertex position 2022-09-16 20:04:01 +01:00
Philip Rebohle b56ec10deb [d3d9] Add helpers for precise matrix-vector products 2022-09-16 20:04:01 +01:00
Philip Rebohle 3a63c7cb31 [dxvk] Hide some more format compatibility validation errors 2022-09-16 17:24:33 +02:00
Philip Rebohle 67bd2b5e76 [dxgi] Report swap chain frame statistics 2022-09-16 12:49:42 +02:00
Philip Rebohle fe3fc82d8e [dxgi] Handle mode changes for frame statistics 2022-09-16 12:49:42 +02:00
Philip Rebohle faaa6bf1df [dxgi] Promote output stored in swap chain to IDXGIOutput1 2022-09-16 12:49:42 +02:00
Philip Rebohle 57af9e8760 [dxgi] Estimate vblank count for frame statistics 2022-09-16 12:49:42 +02:00
Philip Rebohle c56a9b5a3f [dxgi] Implement WaitForVBlank using new sleep helper
Not very accurate, but probably good enough if the display
refresh rate is known.
2022-09-16 12:49:42 +02:00
Philip Rebohle 3543673c5c [util] Add helper to compute display refresh related stuff 2022-09-16 12:49:42 +02:00
Philip Rebohle e019edc8c3 [util] Add helper to get time point from raw counter value 2022-09-16 12:49:42 +02:00
Philip Rebohle c1ab09a048 [util] Move platform-specific sleep code to dedicated helper class 2022-09-16 12:49:42 +02:00
Joshua Ashton 000a647c56 [d3d11] Store D3D11DeviceContextState as private ref
Avoids a circular dependency
2022-09-16 12:49:10 +02:00
Joshua Ashton a69c65265a [d3d11] Store context predication query as private ref 2022-09-16 12:49:10 +02:00
Joshua Ashton 9e4877be81 [d3d11] Store SoTarget buffer as a private ref 2022-09-16 12:49:10 +02:00
Joshua Ashton b40935a48d [d3d11] Store context state ID buffers as private refs 2022-09-16 12:49:10 +02:00
Joshua Ashton ca38cebe0b [d3d11] Store private refs for IA layout 2022-09-16 12:49:10 +02:00
Joshua Ashton 9545281542 [d3d11] Store private refs for VB + IB bindings 2022-09-16 12:49:10 +02:00
Joshua Ashton 9bfe46ac50 [d3d11] Store private refs for srv and rtv bindings 2022-09-16 12:49:10 +02:00
Joshua Ashton 2419226456 [d3d11] Store private refs for constant buffer bindings 2022-09-16 12:49:10 +02:00
Joshua Ashton 8758bcedae [d3d11] Store private refs to context shaders 2022-09-16 12:49:10 +02:00
Joshua Ashton 699d56e35d [d3d11] Handle nullptr RasterizerState in ApplyRasterizerSampleCount
This broke as of a637134c56 is causing a crash in the BGFX d3d11 samples.
2022-09-16 11:40:36 +02:00
Joshua Ashton 3a6f8fa413 [d3d11] Assign ForcedSampleCount to correct value in ApplyRasterizerSampleCount
ForcedSampleCount was never being respected as it would always be replaced with 1 as it was being assigned to the wrong variable.

This was also probably causing a bunch of redundant CS work as it was changing state that was dirty checked.
2022-09-16 11:40:36 +02:00
Philip Rebohle 1c33d8be1f [dxgi] Fix return value of ChangeDisplayMode 2022-09-15 15:35:54 +02:00
Paul Gofman 10d6e15646 [d3d9] Do not set window size and position when restoring from fullscreen state
Closes #2920.
2022-09-15 09:33:24 +01:00
Krzysztof Dobrowolski 19b76825d0 [d3d9] Fix for missing restriction check in UpdateSurface.
The spec of IDirect3DDevice9::UpdateSurface contains the following restriction:
- Neither surface can be created with multisampling.
  The only valid flag for both surfaces is D3DMULTISAMPLE_NONE.

This commit adds this check and returns D3DERR_INVALIDCALL
when source or destination surfaces are multisampled.
2022-09-15 09:32:31 +01:00
Blisto91 2890f690f6 [meta] remove --with-d3d10 from readme 2022-09-14 18:04:36 +02:00
Georg Lehmann 18a801de84 [dxso] Use a * (y - x) + x for lerp.
Fixes Alice: Madness Returns.
2022-09-13 23:10:11 +01:00
Rhys Perry 63ca34bb29 [dxbc] Fix forceVolatileTgsmAccess for stores
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
2022-09-13 21:41:59 +02:00
Joshua Ashton 68c528d345 [util] Implement bitmask iterator on non-x86 platforms 2022-09-13 20:11:17 +01:00
Joshua Ashton 2218462ff2 [util] Implement spin on ARM64 2022-09-13 20:11:17 +01:00
Joshua Ashton 57cee691b3 [util] Implement replaceNaN for non-x86 platforms 2022-09-13 20:11:17 +01:00
Joshua Ashton 2d8e14fcf4 [util] Implement bcmpeq for non-x86 platforms 2022-09-13 20:11:17 +01:00
Joshua Ashton c3093b546e [util] Implement tzcnt for non-x86 platforms 2022-09-13 20:11:17 +01:00
Joshua Ashton 466026632d [util] Only include x86 intrinsics headers on x86 2022-09-13 20:11:17 +01:00
Joshua Ashton 736f91fad1 [util] Add macro to determine CPU arch 2022-09-13 20:11:17 +01:00
Philip Rebohle 21a521361e [spirv] Remove OpKill helper
This is deprecated, so make sure we never accidentally
use it in the future.
2022-09-13 15:30:13 +02:00
Philip Rebohle af208ceb9e [dxbc] Optimize write pattern for TGSM initialization
Reduces bank conflicts.
2022-09-12 22:33:40 +02:00
Philip Rebohle 05f36fd97b [dxbc] Only use workgroup scope in compute shaders
Turns out that global barriers can be used in graphics shaders.
2022-09-12 22:05:39 +02:00
Philip Rebohle 0502a0464f [dxbc] Fix broken barrier around TGSM init code 2022-09-12 22:05:39 +02:00
Philip Rebohle 944a945822 [dxvk] Fix validation error on FS resolve path 2022-09-12 18:59:58 +02:00
Philip Rebohle d9466eb2b9 [dxvk] Get rid of immutable sampler for resolve operations 2022-09-12 18:59:58 +02:00
Riesi 26c8f46b6b [util] Limit King Of Fighters XIII to 60 FPS
Game speed is tied to FPS
fixes #2647
2022-09-12 18:53:42 +02:00
Blisto91 e05e063df0 [util] Enable memoryTrackTest for SiN Episodes Emergence 2022-09-12 18:37:30 +02:00
Philip Rebohle eda366662c [dxbc] Handle workgroup-coherent UAVs more efficiently
Some drivers don't handle the workgroup scope on stores and loads properly,
so let's just do the availability and visibility operation on barriers.
2022-09-12 18:19:02 +02:00
Philip Rebohle 8842af2ad6 [dxvk] Get rid of sampler for pack operations 2022-09-12 14:20:30 +02:00
Philip Rebohle 8dc9400045 [d3d11] Report D3D11_FORMAT_SUPPORT2_SHAREABLE appropriately 2022-09-11 16:40:02 +02:00
Philip Rebohle 299fc4c4cf [d3d11] Determine shared resources tier more accurately 2022-09-11 16:40:02 +02:00
Philip Rebohle 443cb658f7 [dxvk] Clean up DxvkImage::canShareImage 2022-09-11 16:40:02 +02:00
Philip Rebohle 0123e844b2 [dxvk] Move getFormatLimits back to DxvkAdapter 2022-09-11 16:40:02 +02:00
Philip Rebohle c0fdf1449c [dxvk] Allow querying external memory features for image formats 2022-09-11 16:40:02 +02:00
Philip Rebohle 3a636f6094 [dxvk] Introduce DxvkFormatQuery 2022-09-11 16:40:02 +02:00
Joshua Ashton ce47bf4264 [build] Disable some dumb clang warnings 2022-09-10 21:46:07 +00:00
Joshua Ashton 10bb285f2e [d3d9] Remove unused dstExtent + friends in GetRenderTargetData 2022-09-10 21:46:07 +00:00
Joshua Ashton 935541bcb0 [util] Make math types have implicit copy assignments
We define implicit copy constructors, should also define implicit copy assignments.
2022-09-10 21:46:07 +00:00
Joshua Ashton 99e01d64f7 [dxso] Make fallthrough for extra params explicit 2022-09-10 21:46:07 +00:00
Joshua Ashton 9adc6f2d3e [d3d11] Remove unused this capture in UnbindResources 2022-09-10 21:46:07 +00:00
Joshua Ashton a3727ebd42 [d3d11] Fix UNKNOWN enum in video view dimension switch cases 2022-09-10 21:46:07 +00:00
Joshua Ashton f9bd1a5d79 [build] Enable warning_level 2
Compiles cleanly with GCC 12
2022-09-10 21:27:04 +00:00
Joshua Ashton 64d88c684d [dxbc] Explicitly cast down to VkAccessFlags when assinging binding.access
Otherwise both halves of the terniary are differing types causing a warning.
2022-09-10 21:27:04 +00:00
Joshua Ashton aa06e71dee [d3d11] Remove useless const qualifiers on IsYCbCr and NeedsCopy return values 2022-09-10 21:27:04 +00:00
Joshua Ashton ce5e7ad427 [d3d11] Remove MaxAnisotropy < 0 check
This type is unsigned, this is impossible.
2022-09-10 21:27:04 +00:00
Joshua Ashton b0ac267fd5 [d3d9] Explicitly cast to D3DRENDERSTATETYPE in ColorWriteIndex
Need this to silence warnings after doing some arithmetic on an enum.
2022-09-10 21:27:04 +00:00
Joshua Ashton f42df87937 [dxvk] Remove useless const qualifier on getColorAttachmentIndex return type
This does nothing.
2022-09-10 21:27:04 +00:00
Joshua Ashton ec6ad90f22 [dxvk] Fix value type in QueueItem
This was being truncated from uint64_t -> uint32_t then stored in a uint64_t which seems unintentional...
2022-09-10 22:55:58 +02:00
Philip Rebohle cbbc4a595e [meta] Update issue template 2022-09-10 21:21:54 +02:00
Philip Rebohle ccfb986e72 [dxbc] Rework TGSM workaround 2022-09-10 14:27:13 +02:00
Philip Rebohle 8176101228 [dxbc] Enable Vulkan memory model 2022-09-10 14:27:13 +02:00
Philip Rebohle 68cfc84329 [dxvk] Enable vulkanMemoryModel feature 2022-09-10 14:27:13 +02:00
Philip Rebohle 0b891a93b2 [spirv] Add support for memory operands on load/store operations 2022-09-10 14:27:13 +02:00
Philip Rebohle d564be68d6 [spirv] Handle availability and visibility image operands 2022-09-10 14:27:13 +02:00
Philip Rebohle 0f9a042952 [d3d11] Report Tiled Resources Tier 3 again
Partially reverts df5756c9a5.

Turns out that WARP does this, so we might as well expose it too.
2022-09-10 14:26:50 +02:00
xpander69 2ec25f588f Cap Warhammer Online to 100 FPS
Animations break with 100+ FPS. Engine Limitation. WAR-64.exe is affected by this. WAR.exe is capped to 100 by default.
2022-09-10 13:02:47 +02:00
Georg Lehmann bd5d9d90c9 [d3d9] Use xor to swap bit in depth mask. 2022-09-10 04:16:30 +00:00
Georg Lehmann 1bc6f9660a [d3d9] Force D3DTADDRESS_CLAMP for cubes. 2022-09-10 04:16:30 +00:00
Philip Rebohle 5babb29922 [d3d11] Set host stage and access bits for staging resources
We don't need this for resources that we'll never read back from.
2022-09-08 19:26:55 +02:00
Philip Rebohle 4b8387c9b1 [d3d9] Set host stage and access bits for image staging buffers
This is already being done for buffers.
2022-09-08 19:26:55 +02:00
Philip Rebohle 044e2e9dff [dxvk] Defer host barriers until the end of the current command buffer 2022-09-08 19:26:55 +02:00
Philip Rebohle 72de8a1dc1 [dxvk] Destroy command list fences
Fixes a validation error.
2022-09-08 19:26:33 +02:00
Philip Rebohle 912b06f37c [meta] Bump MinGW version requirement to 10.0 in README 2022-09-08 12:09:11 +02:00
Robin Kertels 2b16134b64 [util] Enable d3d9.memoryTrackTest for The Ship 2022-09-07 21:05:48 +02:00
Joshua Ashton 1ea48558e5 [wsi] Fix return value of setMonitorDisplayMode 2022-09-07 21:05:20 +02:00
Joshua Ashton 846db795f8 [dxvk] Link against dl for native builds
Fixes build under Steam Runtime Sniper
2022-09-07 17:02:54 +01:00
Philip Rebohle 9964e4a632 [d3d11] Clean up resource validation around tiled resources 2022-09-05 07:51:08 +02:00
Philip Rebohle df5756c9a5 [d3d11] Do not report Tiled Resources Tier 3
Neither Nvidia nor AMD drivers report Tier 3 support on Windows,
so this is likely a D3D11 runtime limitation, even though the
API could technically support it.
2022-09-05 07:51:08 +02:00
Philip Rebohle b12e4fc59f [dxvk] Check whether SparseResidency capability is used in a shader 2022-09-05 07:51:08 +02:00
Philip Rebohle 02600706fe [d3d11] Enable Conservative Rasterization Tier 3
Mostly to bring this in line with vkd3d-proton.
2022-09-05 07:27:00 +02:00
Philip Rebohle d14d70af05 [dxvk] Check whether FragmentFullyCoveredEXT capability is used in a shader 2022-09-05 07:26:23 +02:00
Philip Rebohle 3401964ee2 [dxbc] Implement support for SV_InnerCoverage 2022-09-05 07:21:47 +02:00
Philip Rebohle bd912212b5 [d3d11] Adjust preferred mapping modes for default images 2022-09-05 05:52:55 +02:00
Philip Rebohle fdcbdeb28f [d3d11] Implement dirty trackig for default-mapped images
Avoids GPU synchronization when using WriteToSubresource,
and also reduces bandwidth.
2022-09-05 05:52:55 +02:00
Philip Rebohle 40ffac72d9 [d3d11] Introduce methods for dirty region tracking for mapped images 2022-09-05 05:52:55 +02:00
Philip Rebohle 1bed39f266 [d3d11] Rework ReadFromSubresource and WriteToSubresource
Mainly changes the code to use existing helpers where possible, and
adds support for planar images, which was previously completely broken
for these functions.
2022-09-05 04:32:01 +02:00
Philip Rebohle ca833082b5 [d3d11] Fix broken image readback for mapped default images 2022-09-05 04:31:13 +02:00
Philip Rebohle e9851bee86 [dxvk] Introduce per-aspect version of computeImageDataSize 2022-09-05 04:31:13 +02:00
Philip Rebohle 957d99ed8d [dxvk] Fix broken layer handling in packImageData 2022-09-05 03:39:23 +02:00
Philip Rebohle d42df37257 [meta] Clean up obsolete feature levels in Vulkan profile 2022-09-04 18:28:27 +02:00
Philip Rebohle e8c1a8e734 [dxbc] Clean up support check for R32 reads without format 2022-09-04 18:28:27 +02:00
Philip Rebohle 6d9353f4e9 [d3d11] Don't depend on variableMultisampleRate feature 2022-09-04 18:28:27 +02:00
Philip Rebohle 882072e134 [d3d11] Move maximum feature level check to D3D11DeviceFeatures 2022-09-04 18:28:27 +02:00
Philip Rebohle c082e7f0a9 [d3d11] Add convenience query for Conservative Rasterization tier 2022-09-04 18:28:27 +02:00
Philip Rebohle 59dd2d54cd [d3d11] Add convenience query for Tiled Resources tier 2022-09-04 18:28:27 +02:00
Philip Rebohle 0e70398d4e [d3d11] Use D3D11DeviceFeatures in CheckFeatureSupport 2022-09-04 18:28:27 +02:00
Philip Rebohle 71d6e8f849 [d3d11] Introduce D3D11DeviceFeatures 2022-09-04 18:28:27 +02:00
Philip Rebohle 5490aa936b [d3d11] Rework D3D11 feature enablement
Rather than enabling based on requested feature levels, always enable
all supported features that we might use, and report the maximum
feature level based on that.

This fixes an issue in CreateDeviceContextState which may raise the
device feature level, and another issue wherein the feature level
override is ignored if tiled resources are not supported.
2022-09-04 18:28:27 +02:00
Philip Rebohle c4516c5b04 [dxvk] Improve behaviour when variableMultisampleRate is not supported 2022-09-04 18:28:27 +02:00
Philip Rebohle 8d9d9912ff [dxvk] Remove extension info from DXVK device 2022-09-04 18:28:27 +02:00
Philip Rebohle ff6a6e2d37 [d3d11] Use new pseudo-features where applicable 2022-09-04 18:28:27 +02:00
Philip Rebohle 51e0a56243 [dxvk] Use new pseudo-features where applicable 2022-09-04 18:28:27 +02:00
Philip Rebohle 019ebeeaf7 [dxvk] Introduce pseudo-features for extensions with no feature struct
Makes it easier to keep track of supported extensions.
2022-09-04 18:28:27 +02:00
Philip Rebohle 1b66b8c9f3 [dxvk] Go back to fence-based command list synchronization
Timeline semaphores are too unreliable on 32-bit Proton builds.
2022-09-04 18:23:11 +02:00
Philip Rebohle 439043ddb4 [d3d11] Do not implicitly stall waitable swap chains 2022-09-02 14:33:11 +02:00
Philip Rebohle 17320776f0 [dxgi] Duplicate frame latency handle
Apps can call CloseHandle on this.
2022-09-02 14:25:12 +02:00
Philip Rebohle 11ef172c79 [util] Add stubs for DuplicateHandle and GetCurrentProcess 2022-09-02 14:25:12 +02:00
Philip Rebohle 2659cfc674 [native] Add defines for DuplicateHandle flags 2022-09-02 14:25:12 +02:00
Philip Rebohle fa743f162b [dxvk] Don't create queues with QUEUE_FAMILY_IGNORED
We accidentally broke drivers which don't support sparse.

Closes #2891.
Closes #2890.

Reported-by: mykhailo.skorokhodov@globallogic.com
2022-09-02 11:07:09 +02:00
Joshua Ashton 36f523bbf5 [vulkan] Fix loading libvulkan natively 2022-09-01 04:37:43 +02:00
Joshua Ashton b05ae33273 [util] Return null if HMODULE is nullptr in GetProcAddress compat
dlsym with NULL will try to find the symbol from anything currently
loaded.
2022-09-01 04:37:43 +02:00
Jens Peters 4fc5ba66ed [util] Add missing feature level in example config 2022-09-01 04:36:02 +02:00
Philip Rebohle 735349bf1b [dxvk] Fix barrier typo 2022-09-01 03:35:58 +02:00
Philip Rebohle 097d3edd05 [dxvk] Create debug messenger if DXVK_DEBUG=validation is set 2022-09-01 00:25:10 +02:00
Philip Rebohle 2f39ae792a [dxvk] Change DXVK_PERF_EVENTS environment variable to DXVK_DEBUG 2022-09-01 00:25:10 +02:00
Philip Rebohle f8781e1c4c [vulkan] Add missing VK_EXT_debug_utils entry points 2022-09-01 00:25:10 +02:00
Philip Rebohle 321338af00 [dxvk] Remove unused m_device member from DxvkBuffer 2022-09-01 00:07:23 +02:00
Philip Rebohle 7b4925dc45 [dxvk] Fix potential sparse allocator lifetime issues 2022-08-31 23:48:46 +02:00
Philip Rebohle c3c6dbf669 [dxvk] Fix potential buffer lifetime issues 2022-08-31 23:48:34 +02:00
Philip Rebohle a11fb568b9 [tests] Remove D3D9 tests 2022-08-31 17:01:22 +02:00
Philip Rebohle 632e26f687 [tests] Remove D3D11 and DXGI tests 2022-08-31 16:43:55 +02:00
Philip Rebohle 2b6a903ad9 [tests] Remove DXBC tests 2022-08-31 16:26:37 +02:00
Philip Rebohle e882a7f8ba [d3d11] Implement extended shader interface 2022-08-31 16:25:44 +02:00
Philip Rebohle 610472e658 [d3d11] Introduce ID3D11VkExtShader 2022-08-31 16:25:44 +02:00
Philip Rebohle 354b88d178 [dxvk] Add shader method to retrieve raw code 2022-08-31 16:25:44 +02:00
WinterSnowfall 3e0031cefe [util] Add a maxAvailableMemory limit for Heroes of Annihilated Empires 2022-08-30 13:21:29 +02:00
Philip Rebohle 5e33374fd2 [meta] Remove shaderStorageImage*WithoutFormat capabilities from profile
We no longer use these.
2022-08-30 13:20:50 +02:00
Philip Rebohle 399ba71387 [meta] Add profile for D3D11 FL12_0 2022-08-30 13:18:15 +02:00
Philip Rebohle 788d80cfe7 [meta] Fix some trailing comma warnings in Vulkan profile 2022-08-30 13:17:52 +02:00
Christophe 575367461c Add VKDK profiles file to express Vulkan requirements 2022-08-30 12:54:45 +02:00
Georg Lehmann b96947107a [build] Remove dead lib_d3dcompiler_43.
Fixes MSVC build.
2022-08-30 10:16:18 +01:00
Philip Rebohle c72c6ec6ed [d3d10] Remove d3d10.dll and d3d10_1.dll
These are incomplete and are already not being used anyway,
so just drop them.
2022-08-30 02:42:03 +02:00
Philip Rebohle 8395033f4a [meta] Remove d3d10 options from setup script 2022-08-30 02:42:03 +02:00
Joshua Ashton c49b1ee390 [d3d9] Use SetStateTexture in Reset
Fixes m_activeTextures not getting updated
2022-08-29 10:16:21 +00:00
Blisto91 7ebd359941 [util] correct maxFeatureLevel to 12_0 in example config 2022-08-27 22:02:35 +02:00
Krzysztof Bogacki 2fa628fce6 [build] Remove vulkan-1.lib 2022-08-27 20:18:06 +01:00
Joshua Ashton 86efa46fcf [dxvk] Throw DxvkError if we failed to load vulkan library 2022-08-27 19:32:03 +02:00
Joshua Ashton 286ab017da [vulkan] Add valid method to LibraryLoader 2022-08-27 19:32:03 +02:00
Joshua Ashton 482a7e433b [vulkan] Make LibraryLoader dynamically load vulkan-1
This makes LibraryLoader actually load the library and moves ownership
of GetInstanceProcAddr into it, which means we pass through the
loaders into their parents to grab stuff.
2022-08-27 19:32:03 +02:00
Joshua Ashton f6fcbb7127 [util] Rename CloseLibrary to FreeLibrary in win32 compat headers
Typo...
2022-08-27 19:32:03 +02:00
Robin Kertels bfd47ec876 [d3d9] Try to match either top or bottom mips in UpdateTexture 2022-08-26 20:56:42 +01:00
Joshua Ashton a29896642c [native] Bump DirectX headers
For _mingw_unicode for D3DCompiler
2022-08-26 19:52:26 +02:00
Joshua Ashton 2f3b3e64b4 [native] Add extra definitions needed for D3DCompiler 2022-08-26 19:52:26 +02:00
Philip Rebohle 91bdc8d06c [d3d11] Expose feature level 12_0 2022-08-26 05:53:03 +02:00
Philip Rebohle 91ff6d68e1 [d3d11] Expose support for tiled resources 2022-08-26 05:53:03 +02:00
Philip Rebohle 790da79512 [d3d11] Implement min/max filters 2022-08-26 05:53:03 +02:00
Philip Rebohle 0a222aaaf0 [d3d11] Implement CopyTiles and UpdateTiles 2022-08-26 05:53:03 +02:00
Philip Rebohle ca41bb4ea4 [d3d11] Implement CopyTileMappings 2022-08-26 05:53:03 +02:00
Philip Rebohle ff2ff37696 [d3d11] Implement UpdateTileMappings 2022-08-26 05:53:03 +02:00
Philip Rebohle 5130638ebe [d3d11] Implement ResizeTilePool 2022-08-26 05:53:03 +02:00
Philip Rebohle e8f59bfd7c [d3d11] Implement tile pool creation 2022-08-26 05:53:03 +02:00
Philip Rebohle 0cd67cb98a [d3d11] Implement tiled image creation 2022-08-26 05:53:03 +02:00
Philip Rebohle 0637fdf82e [d3d11] Implement tiled buffer creation 2022-08-26 05:53:03 +02:00
Philip Rebohle 7f856b545a [d3d11] Implement format feature check for tiled resources 2022-08-26 05:53:03 +02:00
Philip Rebohle ca0dedd213 [d3d11] Implement multisampling support check for tiled resources 2022-08-26 05:53:03 +02:00
Philip Rebohle 3f7093325b [d3d11] Implement GetResourceTiling 2022-08-26 05:53:03 +02:00
Philip Rebohle f97660e210 [d3d11] Implement TiledResourceBarrier 2022-08-26 05:53:03 +02:00
Philip Rebohle 626ccef43b [d3d11] Enable sparse features if supported by the device 2022-08-26 05:53:03 +02:00
Philip Rebohle eaa5d16616 [dxbc] Use texel buffers for raw/structured buffers with sparse feedback 2022-08-26 05:53:03 +02:00
Philip Rebohle 336aafcdf7 [dxbc] Explicitly store whether a resource is a raw SSBO 2022-08-26 05:53:03 +02:00
Philip Rebohle d6613f50c5 [dxbc] Implement ld for buffers with sparse feedback 2022-08-26 05:53:03 +02:00
Philip Rebohle e58f9a5e99 [dxbc] Implement ld for images with sparse feedback 2022-08-26 05:53:03 +02:00
Philip Rebohle db3b2e23fb [dxbc] Implement ld_uav_typed with sparse feedback 2022-08-26 05:53:03 +02:00
Philip Rebohle 0faba649da [dxbc] Implement sample operations with sparse feedback 2022-08-26 05:53:03 +02:00
Philip Rebohle d5b68b3642 [dxbc] Implement gather operations with sparse feedback 2022-08-26 05:53:03 +02:00
Philip Rebohle 614024873d [dxbc] Implement CheckAccessFullyMapped instruction 2022-08-26 05:53:03 +02:00
Philip Rebohle eb8a238d6f [dxbc] Add definitions for sparse feedback instructions 2022-08-26 05:53:03 +02:00
Philip Rebohle 70158fa9cf [spirv] Add support for sparse image opcodes 2022-08-26 05:53:03 +02:00
Philip Rebohle 2329c71b6f [dxvk] Implement sampler reduction mode 2022-08-26 05:53:03 +02:00
Philip Rebohle 43b19f773c [dxvk] Introduce initSparseImage 2022-08-26 05:53:03 +02:00
Philip Rebohle fc0d952edb [dxvk] Introduce copySparsePages{To,From}Buffer 2022-08-26 05:53:03 +02:00
Philip Rebohle d5348a0cf0 [dxvk] Introduce updatePageTable 2022-08-26 05:53:03 +02:00
Philip Rebohle 12d2f8a9d4 [dxvk] Expose sparse binding operations as part of the command list 2022-08-26 05:53:03 +02:00
Philip Rebohle 2615af7664 [dxvk] Submit sparse binding operations alongside command buffers 2022-08-26 05:53:03 +02:00
Philip Rebohle d3b6502a17 [dxvk] Introduce DxvkSparseBindSubmission 2022-08-26 05:53:03 +02:00
Philip Rebohle 3057f6a51b [dxvk] Add structures for sparse binding operations 2022-08-26 05:53:03 +02:00
Philip Rebohle f9db4921e0 [dxvk] Implement sparse memory allocator 2022-08-26 05:53:03 +02:00
Philip Rebohle 6f216f9df4 [dxvk] Do not discard sparse buffers
This would only blow up.
2022-08-26 05:53:03 +02:00
Philip Rebohle dd54de4d97 [dxvk] Introduce DxvkPagedResource 2022-08-26 05:53:03 +02:00
Philip Rebohle 2d124b811b [dxvk] Implement sparse image creation 2022-08-26 05:53:03 +02:00
Philip Rebohle f7c255de2a [dxvk] Implement sparse buffer creation 2022-08-26 05:53:03 +02:00
Philip Rebohle bc3affc264 [dxvk] Add functionality to query sparse metadata 2022-08-26 05:53:03 +02:00
Philip Rebohle e923cc5b69 [dxvk] Change emitGraphicsBarrier to specify a dependency 2022-08-26 05:53:03 +02:00
Philip Rebohle 388288114a [dxvk] Find a sparse binding queue 2022-08-26 05:53:03 +02:00
Philip Rebohle 71c9c4a5cc [dxvk] Log sparse features 2022-08-26 05:53:03 +02:00
Philip Rebohle 6e6d64b83e [dxvk] Remove redundant error message 2022-08-26 05:53:03 +02:00
Philip Rebohle 3ee808afd6 [dxvk] Make memory object of an image publicly accessible 2022-08-26 05:53:03 +02:00
Philip Rebohle edc74f4c8b [d3d11] Handle D3D11_FEATURE_D3D11_OPTIONS5 2022-08-26 05:15:28 +02:00
Philip Rebohle 9b4e53cee2 [d3d11] Handle D3D11_FEATURE_SHADER_CACHE 2022-08-26 05:15:28 +02:00
Philip Rebohle 9420391dce [d3d11] Adjust reported resource sharing caps 2022-08-26 05:15:28 +02:00
Philip Rebohle f521a342d0 [d3d11] Report marker support appropriately 2022-08-26 05:15:28 +02:00
Blisto91 8f24093864 [util] cap MGS V Ground Zeroes vram at 4095 2022-08-26 03:52:02 +02:00
Philip Rebohle a2a21cb4d3 [dxvk] Clean up internal memory allocation API 2022-08-25 18:23:02 +02:00
Philip Rebohle 5117210c93 [dxvk] Fix fb resolve barriers
No idea how that ended up broken *this* badly.
2022-08-25 02:25:23 +02:00
Philip Rebohle 559fa50f54 [d3d11] Introduce d3d11.enableContextLock option 2022-08-24 12:27:02 +02:00
Philip Rebohle 86bdda70b4 [d3d11] Move D3D10Multithread instance to immediate context
Deferred contexts do not support this.
2022-08-24 12:15:35 +02:00
Georg Lehmann 87b1f9fa2d [dxso] Fix write mask for nrm 2022-08-23 00:38:04 +02:00
Blisto91 372a27fad2 [util] remove allowDoNotWait from example config 2022-08-22 22:09:44 +02:00
Philip Rebohle 17959640c3 [dxvk] Work around vkWaitSemaphore incorrectly returning with VK_TIMEOUT 2022-08-22 20:30:16 +02:00
Philip Rebohle 07a1045ffb [dxvk] Add context methods for submission splitting 2022-08-22 15:44:00 +02:00
Philip Rebohle 6f2ff2562d [dxvk] Support splitting command lists into multipe submissions 2022-08-22 15:43:23 +02:00
Philip Rebohle e378be826e [dxvk] Use DxvkCommandPool 2022-08-22 14:40:41 +02:00
Philip Rebohle c3a721f562 [dxvk] Introduce DxvkCommandPool 2022-08-22 14:14:25 +02:00
Philip Rebohle def93fd18b [dxvk] Introduce DxvkCommandSubmissionInfo 2022-08-22 14:14:25 +02:00
Philip Rebohle d367fac64e [dxvk] Rework queue submission helper
We want this to be less verbose and smarter about when to perform
submissions for when we introduce the ability to split a command
list into multiple submissions.
2022-08-22 14:14:25 +02:00
Philip Rebohle f88239719c [dxvk] Explicitly mark execution command buffer as used
We can omit the execution command buffer in some circumstances,
and for the sparse resource changes we need to track this in
order to be able to merge consecutive sparse binding calls.

We only need to do this on action commands with observable side effects
as long as the backend still properly resets those command buffers.
All draw commands are implcitly covered by cmdBeginRendering.
2022-08-22 12:36:59 +02:00
Philip Rebohle dd0d611d4d [dxvk] Reintroduce binary semaphore for transfer <-> graphics sync
The global timeline semaphore does not work here since we could be
signaling it from two different queues at the same time, or out of
order.
2022-08-22 05:52:28 +02:00
Philip Rebohle 3d6b687e41 [dxbc] Remove useless lambda 2022-08-22 05:21:49 +02:00
Robin Kertels a8b578b2a2 [d3d9] Fix crash when auto generating mip maps for unmappable textures 2022-08-22 01:48:35 +01:00
Philip Rebohle 3c38bdbd0e [dxvk] Initialize DxvkSubmitInfo properly
We don't use the semaphore value here, but it shouldn't
contain undefined data.
2022-08-22 02:00:10 +02:00
Philip Rebohle f385b4bb47 [dxvk] Use global timeline semaphore for command list synchronization
Replaces the old fence mechanism and also makes it easier to
synchronize across queues.
2022-08-22 00:40:07 +02:00
Philip Rebohle cff9056915 [dxvk] Always enable timeline semaphore feature 2022-08-22 00:40:07 +02:00
Philip Rebohle 11ef1084d0 [dxvk] Rename semaphore stuff in command list code 2022-08-22 00:08:42 +02:00
Philip Rebohle 23c3960f65 [dxvk] Store WSI semaphore pair directly with the command list 2022-08-22 00:07:15 +02:00
Philip Rebohle 85aa0a0ecb [dxvk] Fix meson issue for native builds 2022-08-21 23:22:43 +02:00
Philip Rebohle 9feed43abf [meta] Add README entry about submodules 2022-08-21 22:54:21 +02:00
Philip Rebohle c1448d31fa [meta] Use SPIRV-Headers repository as a submodule 2022-08-21 22:54:21 +02:00
Philip Rebohle aa554f1166 [meta] Use Vulkan-Headers repository as a submodule 2022-08-21 22:54:21 +02:00
Joshua Ashton c258eb05d2 [build] Enable building natively for non-Windows
Yipee 🥳🎉

RIP DXVK Native
2022-08-21 22:37:13 +02:00
Joshua Ashton 9dad1aadbe [build] Set SDL2 WSI env vars and defines on native builds 2022-08-21 22:37:13 +02:00
Joshua Ashton 801d97806d [d3d11] Stub out OpenSharedResourceGeneric on non-Windows 2022-08-21 22:37:13 +02:00
Joshua Ashton be33ccbce9 [dxgi] Revert 538b132490
This breaks things for 32-bit, but it really shouldn't. My hypothesis currently is that the .lib generated is bogus, but the exports in the actual DLL are correct.
2022-08-21 20:28:40 +00:00
Joshua Ashton a4261ddd14 [dxgi] Use high_resolution_clock get_counter instead of QPC for SyncQPCTime
Abstracts this across platforms
2022-08-21 22:24:06 +02:00
Joshua Ashton 9610e29a65 [util] Implement get_frequency + get_counter on non-Windows platforms 2022-08-21 22:24:06 +02:00
Joshua Ashton 8921f62539 [util] Rename getFrequency, getCounter -> get_frequency, get_counter
To be consistent with STL naming conventions
2022-08-21 22:24:06 +02:00
Joshua Ashton 1c1dba4624
[util] Implement thread set_priority on non-Windows platforms 2022-08-21 22:17:33 +02:00
Joshua Ashton 97350d6c35 [dxvk] Support for SDL2 WSI 2022-08-21 22:07:18 +02:00
Joshua Ashton 5787d9ee04 [dxvk] Check platform before building openvr + openxr cpps 2022-08-21 22:07:18 +02:00
Joshua Ashton e6fb3e1509 [wsi] Add SDL2 implementation 2022-08-21 22:07:18 +02:00
Joshua Ashton 191d54e210 [build] Don't build D3D10 on non-Windows platforms
Not supported due to d3dcompiler schenanigans
2022-08-21 22:03:45 +02:00
Joshua Ashton baba2e3c09 [d3d11] Use dxgi_dep instead of lib_dxgi
Fixes building on native.
2022-08-21 22:03:45 +02:00
Joshua Ashton baa88d8cf1 [d3d11] Don't check for apitrace on non-Windows platforms 2022-08-21 22:03:45 +02:00
Joshua Ashton a5db9d22f1 [dxvk] Disable VrInstance and DxvkXrProvider on native builds
If/when we want to support VR on native builds, we can deal with that then.
2022-08-21 22:03:45 +02:00
Joshua Ashton 8b7e0bc2fd [dxgi] Include win32 compat headers where applicable 2022-08-21 21:40:55 +02:00
Joshua Ashton 968bdccbef [d3d9] Include win32 compat headers where applicable 2022-08-21 21:40:55 +02:00
Joshua Ashton a554a6d60d [d3d11] Include win32 compat headers where applicable 2022-08-21 21:40:55 +02:00
Joshua Ashton ba8868be24 [util] Add win32 compat header
Header of misc. stubs and re-implementations.
2022-08-21 21:40:55 +02:00
Joshua Ashton ad386305ff [d3d9] Correct DLLEXPORT for native builds 2022-08-21 21:36:50 +02:00
Joshua Ashton f0f4258be3 [dxgi] Correct DLLEXPORT for native builds 2022-08-21 21:36:50 +02:00
Joshua Ashton 538b132490 [dxgi] Don't declspec dllexport on MinGW builds
Fixes ordinal exporting on MinGW on 32-bit builds.
Mirrors this D3D9 commit here: 904d3e6c90
2022-08-21 21:36:50 +02:00
Joshua Ashton 4a113c39d3 [d3d11] Remove compat definitions for older MinGW
These conflict with native builds, and have existed for a long time now.
2022-08-21 21:35:24 +02:00
Joshua Ashton fad6f764ea [dxgi] Remove unused DEVMODE variable 2022-08-21 21:35:09 +02:00
Joshua Ashton e51c196ee9 [dxgi] Remove MonitorEnumProc and MonitorEnumInfo
Not used anymore, replaced by WSI abstraction.
2022-08-21 21:35:09 +02:00
Joshua Ashton 915ec4acc2 [dxvk] Remove WIN32 check for handle type in DxvkSharedHandleInfo
The initial implementation if-deffed this, but it doesn't need to be.
2022-08-21 21:34:39 +02:00
Joshua Ashton 38cd2f7290 [dxvk] Remove WIN32 check for handle type in DxvkFenceCreateInfo
On other platforms we always have a HANDLE and will return through a HANDLE anyway.

When we implement this on Linux, we can just add an `int fd` to the union and it can use that, and return it out as a HANDLE.
2022-08-21 21:34:39 +02:00
Joshua Ashton 0e4e9355cb [d3d9] Ifdef out code for enumerating adapters by attached displays 2022-08-21 19:29:05 +00:00
Joshua Ashton bf99127ee3 [d3d9] Stub out cursor code on non-Windows platforms 2022-08-21 19:29:05 +00:00
Joshua Ashton c6c8acb000 [d3d9] Use wsi's isWindow in LeaveFullscreenMode 2022-08-21 19:29:05 +00:00
Joshua Ashton 5f9df1f6e3 [d3d9] Remove leftover GetWindowRect
This is already done for us.
2022-08-21 19:29:05 +00:00
Joshua Ashton 1c679edbfb [d3d9] Use topath helpers in shader code 2022-08-21 21:28:04 +02:00
Joshua Ashton 0a203095d6 [d3d11] Use topath helper in shader code 2022-08-21 21:28:04 +02:00
Joshua Ashton 9d64982b23 [dxvk] Use path_string for getCacheFileName 2022-08-21 21:28:04 +02:00
Joshua Ashton 9509ec1144 [util] Define platform path_string type 2022-08-21 21:28:04 +02:00
Joshua Ashton eda3ba6372 [vulkan] Toss obsolete fullscreen exclusive hack
Wine never had support for VK_EXT_exclusive_fullscreen and Proton since dropped support for it now that Doom External does not require it.
2022-08-21 21:26:28 +02:00
Joshua Ashton 5c2a748d96 [util] Rename always_inline to force_inline
This conflicts with other libraries using the always_inline attribute in GCC as it defines it with the same name.
2022-08-21 21:25:54 +02:00
Joshua Ashton 0dc3200951 [vulkan] Re-enable VK_USE_PLATFORM_WIN32_KHR everywhere
My initial idea was to if-def out the other extensions, but that's messy, so we just provide the needed types in the native headers now.
2022-08-21 19:31:33 +01:00
Joshua Ashton 91a5123ad0 [native] Add SDL2 native headers
Not included by DXVK at all, but used by external applications.
2022-08-21 19:31:33 +01:00
Joshua Ashton e969f49cee [native] Add DirectX headers submodule
Adds DirectX headers for use when building DXVK
natively for Linux.

These use the substitute Windows headers I made.

These are a minimal set of DirectX specific headers that are compatible with the substitute Windows headers I made.

For any license concerns please see the README in the submodule.
2022-08-21 19:31:33 +01:00
Joshua Ashton 92698be09a [native] Add substitute Windows headers
Adds substutite Windows headers for use when building DXVK
natively for Linux.

The main one being windows_base.h which has all of the definitions.

It supports stuff like __uuidof using some template nonsense too.
2022-08-21 19:31:33 +01:00
Philip Rebohle 1c35fbb33c [util] Fix strlcpy compiler warning 2022-08-21 01:48:29 +01:00
Kassin Dornelles f80347d9a9 [util] Remove RE:REV2 and RE5 workarounds
There's no real impact, it doesn't fix stuttering (for non-GPL drivers) and since GPL got merged this is not needed anymore
2022-08-21 01:52:39 +02:00
Joshua Ashton 16ff9b48cd [dxgi] Enumerate interlaced modes if requested 2022-08-20 20:27:07 +02:00
Joshua Ashton af802fbff8 [util] Delete util_monitor
No longer used, replaced by new wsi interface
2022-08-20 20:27:07 +02:00
Joshua Ashton f3992658a4 [d3d9] Remove unused util_monitor include 2022-08-20 20:27:07 +02:00
Joshua Ashton 69eba93764 [d3d9] Make window proc code use new wsi interface 2022-08-20 20:27:07 +02:00
Joshua Ashton 9690b2a9e4 [d3d9] Make adapter code use new wsi abstraction 2022-08-20 20:27:07 +02:00
Joshua Ashton dac7e38f4b [d3d9] Make swapchain use new wsi abstraction 2022-08-20 20:27:07 +02:00
Joshua Ashton 654b517057 [d3d9] Add helpers for new WSI interface 2022-08-20 20:27:07 +02:00
Joshua Ashton bc8e75fdfa [dxgi] Make adapter code use new wsi interface 2022-08-20 20:27:07 +02:00
Joshua Ashton 59b943cf12 [dxgi] Remove unused util_monitor include 2022-08-20 20:27:07 +02:00
Joshua Ashton 21744198e0 [dxgi] Make swapchain use new wsi interface 2022-08-20 20:27:07 +02:00
Joshua Ashton e13a9f9cf6 [dxgi] Make output code use new wsi interface 2022-08-20 20:27:07 +02:00
Joshua Ashton 71a630801e [dxgi] Add helpers for new wsi interface 2022-08-20 20:27:07 +02:00
Joshua Ashton 9f9c93dcbd [d3d11] Use new wsi interface 2022-08-20 20:27:07 +02:00
Joshua Ashton 4f80ffd830 [vulkan] Use surface creation from wsi interface 2022-08-20 20:27:07 +02:00
Joshua Ashton 86b603b8f9 [dxvk] Link against new wsi lib 2022-08-20 20:27:07 +02:00
Joshua Ashton 4b0f13d351 [build] Set dxvk_wsi and defines for Windows 2022-08-20 20:27:07 +02:00
Joshua Ashton b875d49c85 [wsi] Move DxvkWindowState to wsi platform header 2022-08-20 20:27:07 +02:00
Joshua Ashton efa6523e3e [wsi] Implement wsi interface for Windows 2022-08-20 20:27:07 +02:00
Joshua Ashton 050e5b327c [wsi] Define wsi interface 2022-08-20 20:27:07 +02:00
Philip Rebohle 76ee76d6da [d3d9,dxso] Use DemoteToHelperInvocation for alpha test
May enable additional compiler optimizations.
2022-08-19 14:49:18 +00:00
Philip Rebohle 2d92679cd1 [dxso] Remove fallback path for discards 2022-08-19 13:36:54 +00:00
Philip Rebohle 165648017e [dxbc] Remove fallback path for discards 2022-08-19 13:36:54 +00:00
Philip Rebohle ea4e0bc470 [d3d9,d3d11] Require shaderDemoteToHelperInvocation feature 2022-08-19 13:36:54 +00:00
Georg Lehmann 155944c2b4 [dxso] normalize 0 to 0 with strict float emulation 2022-08-19 13:36:14 +00:00
Philip Rebohle 85cc87e42a
[d3d9] Fix invalid shader in fixed-function alpha test 2022-08-18 17:08:59 +02:00
Philip Rebohle 658d824ddd
[d3d11] Silence log spam for invalid image operations 2022-08-18 14:48:29 +02:00
Philip Rebohle 4869b0defa
[dxvk] Fix race condition requestCompileShader 2022-08-18 02:57:45 +02:00
Philip Rebohle a695644fea [d3d9] Remove alphaTestWiggleRoom option 2022-08-18 00:10:39 +02:00
Philip Rebohle 5a3cb5ad3e [d3d9] Adjust alpha test precision based on render target format
More or less matches what Nvidia's D3D9 driver does on Turing.
2022-08-18 00:10:39 +02:00
Philip Rebohle 47fa3824dc [d3d9] Re-implement alpha test to support configurable accuracy
The current implementation always uses 12 bits of accuracy.
2022-08-18 00:10:39 +02:00
Philip Rebohle 2c713a34c9 [d3d9,dxso] Factor out common alpha test code 2022-08-18 00:10:39 +02:00
Philip Rebohle 3806bd44d8
[dxvk] Change descriptor info to take only one shader stage
And fix the binding index -> descriptor mapping.
This affects D3D9 since the spec constant change.
2022-08-17 22:40:58 +02:00
Philip Rebohle 3c2fc41e4c [d3d9] Re-bind framebuffer if RT hazards change
Otherwise we never set the feedback loop bits in the backend.
2022-08-17 18:36:30 +00:00
Philip Rebohle 7ddfcfeb20
[tests] Also log D3D11_FEATURE_FORMAT_SUPPORT2 in format tester 2022-08-17 15:56:02 +02:00
Philip Rebohle 52314ba4fd
[dxvk] Do not log storage image features that we no longer enable 2022-08-17 15:39:03 +02:00
Philip Rebohle 5e394b5554
[dxvk] Remove old format support queries 2022-08-17 15:39:03 +02:00
Philip Rebohle 80fc1d8b25
[d3d9] Use new format support queries 2022-08-17 15:39:03 +02:00
Philip Rebohle 13152088d4
[dxgi] Use new format support queries to initialize format table 2022-08-17 15:39:03 +02:00
Philip Rebohle 4aeb397ba3
[d3d11] Use new format support queries to check D3D11 format support 2022-08-17 15:39:03 +02:00
Philip Rebohle 099c70c2bd
[d3d11] Use new format support queries in resource creation 2022-08-17 15:26:03 +02:00
Philip Rebohle 3717922381
[d3d11,dxbc] Rework check for TypedUAVLoadAdditionalFormats 2022-08-17 15:26:03 +02:00
Philip Rebohle 653a98f01b
[dxvk] Use new format support queries 2022-08-17 15:26:03 +02:00
Philip Rebohle cc8010fb7c
[dxvk] Add format feature queries to DxvkDevice 2022-08-17 15:20:13 +02:00
Philip Rebohle 61025c0079
[dxvk] Don't disable frame rate limiter if vsync is enabled
This only works if we know the actual refresh rate of the display.
However, in a wine virtual desktop or with proton's fshack, this
is often not the case, so we'd see a 60 Hz mode on a high-refresh
rate display and never actually enable the limiter.
2022-08-17 01:53:24 +02:00
Riesi 04bc1bac73 [util] Limit Beyond Good and Evil FPS to 60
UI breaks on higher FPS
2022-08-16 19:11:41 +02:00
Philip Rebohle e0af668f6c
[dxvk] Use DxvkBindingLayoutObjects for set lookup directly
Avoids pointer dereferencing on a really hot code path. This is also
safe since there's a 1:1 mapping between the VkPipelineLayout and the
given ovbject type.
2022-08-16 15:35:57 +02:00
Philip Rebohle 9f9324c421
[dxvk] Use existing bit mask iterator for descriptor set allocation 2022-08-16 15:24:39 +02:00
Joshua Ashton 084969135b [d3d9] Only set feedback loop usage on textures, not plain surfaces 2022-08-16 12:33:17 +00:00
Joshua Ashton cf9e217e7b [util] Support for fps limiter on non-Windows platforms
Defaults to a sleep granularity of 0.5ms, which is slightly on the cautious side.

Calls through to std::this_thread::sleep_for directly, which calls through to nanosleep.
2022-08-16 14:32:07 +02:00
Joshua Ashton d1e2b89282 [util] Use chrono literal for ms in fps limiter 2022-08-16 14:32:07 +02:00
Joshua Ashton 5fcc9a1bd1 [util] Move platform specific sleep to own function in fps limiter 2022-08-16 14:32:07 +02:00
Joshua Ashton 05a5b82f59 [util] Move sleep granularity getting to own function 2022-08-16 14:32:07 +02:00
Joshua Ashton b885883e06 [util] Rename NtTimerDuration to TimerDuration 2022-08-16 14:32:07 +02:00
Joshua Ashton a78aab147e [d3d9] Add feedback loop usage for DS 2022-08-16 10:39:06 +00:00
Joshua Ashton 870dd18f92 [d3d9] Set VK_IMAGE_USAGE_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT for render targets
Closes: #2825
2022-08-16 08:43:52 +00:00
Joshua Ashton 6baaa3a5f2 [d3d9] New window proc code on multiple platforms 2022-08-14 17:22:58 +00:00
Joshua Ashton 7506f65801 [d3d9] Move window proc handling code to own file 2022-08-14 17:18:10 +00:00
Robin Kertels de8d2b37bb [d3d9] FF: Don't change flatShadingMask for outputs 2022-08-13 14:38:57 +01:00
Robin Kertels 46cb05ce45 [d3d9+util] Always ignore D3DLOCK_DONOTWAIT
We only ever stall when locking a texture that was
previously used with GetRenderTargetData or
GetFrontBufferData. Games are known to break
if locking those textures doesn't succeed.
2022-08-12 14:18:13 +01:00
Philip Rebohle 67614917c3
[meta] Update README on shader compiler threads 2022-08-11 20:20:59 +02:00
Philip Rebohle 0d33d063ca
[dxvk] Remove device LUID workaround
winevulkan properly supports this now.
2022-08-11 16:01:53 +02:00
Philip Rebohle 673797c36a
[dxvk] Fix hang on exit with high priority queue
No idea why I'm not seeing hangs on my end, but this is definitely a bug.
2022-08-11 14:00:57 +02:00
Philip Rebohle 715b5119e6
[dxvk] Fix check in DxvkShaderPipelineLibrary::compilePipeline
Since we destroy pipelines on 32-bit we should just make sure this
doesn't get executed unnecessarily.
2022-08-11 13:43:38 +02:00
Philip Rebohle a4848201f8
[dxvk] Update buffer views in commitGraphicsBarriers
Otherwise we might end up accessing stale buffer slices, since this
happens before descriptor updates. This is not needed for compute.

Also fix weird indentation while we're at it.
2022-08-11 13:13:02 +02:00
Philip Rebohle 9bd0040a90
[d3d9] Request high-priority shader compiles as necessary 2022-08-11 12:39:28 +02:00
Philip Rebohle d3ab905621
[d3d11] Request high-priority shader compiles as necessary
This can reduce stutter in case shaders are needed immediately while
background threads are still busy compiling a different set of shaders.
2022-08-11 12:39:28 +02:00
Philip Rebohle c3a53127d7
[dxvk] Add high-priority queue for shader compiles
As well as an API to queue shaders as high priority.
2022-08-11 12:39:28 +02:00
Philip Rebohle f09f11aad0
[dxvk] Track pipeline library compile for each shader 2022-08-11 12:39:25 +02:00
Robin Kertels b5b74116fa [d3d9] Fix rare hang when waiting for staging buffer markers 2022-08-11 12:37:28 +02:00
Robin Kertels 5cdee45387 [util] Disable direct buffer mapping for GHWT
The game ends up discarding a 11MB buffer which causes it
to run out of address space and crash. Disabling direct buffer
mapping makes it use staging buffers and the staging buffer
limit saves the day.
2022-08-11 04:36:01 +01:00
Philip Rebohle 85c278f515
[dxvk] Don't try to merge buffer ranges in barrier list
Too slow, doesn't work most of the time anyway.
2022-08-11 00:38:49 +02:00
Philip Rebohle 4c7da80c14
[dxvk] Simplify barrier image and buffer slice implementations
Pre-process the given ranges so that compare and merge
operations become both simpler and faster.
2022-08-11 00:29:31 +02:00
Philip Rebohle 8aae9c85bb
[dxvk] Optimize barrier hash table lookup
Using a prime as the table size is technically better, but that
integer division kind of hurts when we're spamming look-ups.
2022-08-10 23:08:28 +02:00
Philip Rebohle ad020c23f9
[dxvk] Optimize barrier logic
The is*Dirty methods can exit early if the resource to check
is only used for reading. Only call get*Access to check for
write-after-write scenarios.
2022-08-10 20:47:52 +02:00
Philip Rebohle 11fbcd3131
[dxvk] Rework compute barrier handling to use common functions
Cleans up code a bit and should technically even make things a bit
more efficient.
2022-08-10 19:28:35 +02:00
Philip Rebohle 01014c1a2b
[dxvk] Rework checkGfx*Barrier methods 2022-08-10 19:28:35 +02:00
Philip Rebohle 9a6c378f3d
[dxvk] Only use one descriptor set for compute shaders
Simplifies things a bit and avoids redundant sets in the pipeline layout.
2022-08-10 19:28:32 +02:00
Philip Rebohle 02f653fdd2 [d3d9] Limit amount of staging memory in flight 2022-08-10 17:31:55 +02:00
Robin Kertels 9d981ec1a8 [dxvk] Introduce DxvkMarker
Co-authored-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-08-10 17:31:55 +02:00
Robin Kertels 8feabc653e [d3d9] Do implicit flush after uploading textures or buffers 2022-08-10 17:31:55 +02:00
Robin Kertels f031ce44cf [util] Set lower memory limits for Guitar Hero WT 2022-08-10 17:31:55 +02:00
Philip Rebohle 67f937111d
[dxvk] Remove shrinkNvidiaHVVHeap workaround
No longer needed.
2022-08-10 16:39:58 +02:00
Philip Rebohle 3edb0ef114
[d3d11] Ensure that all required inputs are defined by input layout 2022-08-10 14:12:39 +02:00
Philip Rebohle 5540df955c
[dxbc] Rework semantic name matching 2022-08-10 14:11:47 +02:00
Philip Rebohle ec0c377cf8
[dxvk] Disable maintenance4 feature
We don't *really* need it (although some of the guarantees are nice to
have). For some reason, this completely destroys GPU-bound performance
on AMDVLK and AMD's Windows driver.
2022-08-10 01:04:38 +02:00
Paul Gofman 59441b1ff5 [dxgi] Also support use after free in IDXGISwapChain::SetFullscreenState() 2022-08-09 23:10:50 +02:00
Joshua Ashton 8580bb32ca [vulkan] Only define VK_USE_PLATFORM_WIN32_KHR on Windows 2022-08-09 14:16:50 +01:00
Joshua Ashton 50018de483 [util] Use topath helper for fstreams 2022-08-09 14:16:50 +01:00
Joshua Ashton 5de058e14a [util] Introduce topath helper
Manages converting strings to the right type for paths per-platform
2022-08-09 14:16:50 +01:00
Joshua Ashton d9000485ea [util] Add stubs for shared resources on other platforms 2022-08-09 14:16:50 +01:00
Joshua Ashton 8c3a44cac4 [util] Add stubs for GDI functions on other platforms 2022-08-09 14:16:50 +01:00
Philip Rebohle ab1d629961 [dxvk] Implement lifetime tracking for graphics pipelines 2022-08-09 13:40:58 +02:00
Philip Rebohle 764de6ff82 [dxvk] Add use counter to pipeline libraries
And destroy Vulkan pipeline objects once the counter reaches zero.
2022-08-09 13:40:58 +02:00
Philip Rebohle 1f9db49727 [dxvk] Change member order in pipeline manager
Ensures that pipelines are destroyed before pipeline libraries.
2022-08-09 13:40:58 +02:00
Philip Rebohle b97dba3712 [dxvk] Use shader module identifier for subsequent pipeline libary compiles
Should further reduce the hit we take from destroying pipeline libraries.
2022-08-09 13:40:58 +02:00
Philip Rebohle 4bc2d713fb [dxvk] Destroy shader pipeline libraries after initial compile on 32-bit
This alone saves ~700 MiB of address space in the Resident Evil 6 main
menu on Nvidia.
2022-08-09 13:40:58 +02:00
Philip Rebohle 915b03ba7b [dxvk] Add option to control pipeline lifetime tracking 2022-08-09 13:40:58 +02:00
Philip Rebohle eddbe73ba4
[dxbc] Fix off-by-one error for primitive vertex counts
Not sure if it's even possible to use this, but this was clearly a bug.
2022-08-09 03:19:59 +02:00
Philip Rebohle d6253aeae6
[dxvk] Order descriptors by type and binding
Reduces the number of unique descriptor set layouts further,
which may help with descriptor pool usage, and also makes
branching more predictable for the CPU.
2022-08-09 03:19:59 +02:00
Robin Kertels 1fcd5dc0af [d3d9] Unmap stored shader bytecode 2022-08-08 23:15:21 +01:00
Robin Kertels 49e9ba2ca7 [d3d9] Move d3d9 bytecode into D3D9Shader
This reduces the amount of times we copy the bytecode
and actually frees it when the game frees the associated shader.
2022-08-08 23:15:21 +01:00
Robin Kertels 1628b9e63a [d3d9] Add 64bit implementation for D3D9MemoryAllocator
This just uses malloc & free but allows us to use
the same code for D3D9 shader bytecode on 64 bit builds.
2022-08-08 23:15:21 +01:00
Robin Kertels 01fb40423d [d3d9] Remove some dead debug code
Oops.
2022-08-08 23:15:21 +01:00
Robin Kertels 36d8bb77a5 [d3d9] Fix synchronization in UpdateTextureFromBuffer 2022-08-08 23:14:30 +01:00
Robin Kertels ac1e44f120 [d3d9] Fix typo 2022-08-08 23:14:30 +01:00
Derek Lesho 57dcf73a54 d3d11: Fix shared textures that export both NT and KMT handles.
We should always create the DxvkImage with the KMT handle type, so that the call later to openKmtHandle succeeds.  Also, don't free sharedHandle when exporting an NT handle.
2022-08-08 23:31:01 +02:00
Philip Rebohle 0ad7a08c49
[dxvk] Get rid of some old debug code for compute pipelines 2022-08-08 18:58:22 +02:00
Philip Rebohle c392308e6f
[dxvk] Fix spec constant selector test for compute shaders
This isn't supported on compute.
2022-08-08 18:54:11 +02:00
Philip Rebohle 7789fd53ff [d3d9] Use new flat shading state for fixed-function pipelines 2022-08-08 13:34:59 +02:00
Philip Rebohle 8f1024c094 [d3d9] Use new flat shading state for DXSO shaders 2022-08-08 13:34:59 +02:00
Philip Rebohle dfdb729476 [dxvk] Add SPIR-V pass to decorate variables as flat on demand 2022-08-08 13:34:59 +02:00
Philip Rebohle a84beae112 [dxvk] Add flat shading field to pipeline state 2022-08-08 13:34:59 +02:00
Philip Rebohle 0adf64f085 [dxvk] Add flat shading parameter to rasterizer state 2022-08-08 13:34:59 +02:00
Joshua Ashton 4f0c217633 [d3d9] Fix recording MultiplyTransform 2022-08-08 03:53:25 +01:00
Philip Rebohle 43df6cfa45
[dxvk] Fix indentation
Thanks, VSCode.
2022-08-08 04:50:50 +02:00
Philip Rebohle 2b2c44aa99
[dxvk] Move image view cookie to DxvkResource 2022-08-07 21:24:57 +02:00
Philip Rebohle 4831909656
[d3d9] Enable apitrace mode for The Witcher 2022-08-07 20:04:37 +02:00
Philip Rebohle a74f8da7b7
[d3d11] Use bindVertexBufferRange whenever possible 2022-08-07 19:03:51 +02:00
Philip Rebohle 97f0d1dfb8
[d3d11] Use bindIndexBufferRange whenever possible 2022-08-07 19:03:51 +02:00
Philip Rebohle 35dde3e1b9
[d3d11] Change how resourece binding treats null resources 2022-08-07 19:03:51 +02:00
Philip Rebohle 897e7816f0
[d3d11] Don't return undefined slices from GetBufferSlice
Instead, return a slice with length zero.
2022-08-07 19:03:51 +02:00
Philip Rebohle 08b9b0eb44
[dxvk] Introduce bindVertexBufferRange and bindIndexBufferRange 2022-08-07 19:03:51 +02:00
Philip Rebohle 26d46e7f80
[dxvk] Handle bound buffers with zero size in the backend 2022-08-07 18:45:17 +02:00
Philip Rebohle d314bee86d
[d3d11] Fix bad signature of various BindToContext methods 2022-08-07 18:44:47 +02:00
Philip Rebohle 45a1587b88
[d3d11] Fix some possible constant buffer binding bugs 2022-08-07 18:44:47 +02:00
Philip Rebohle 2e6a2f1be3
[dxvk] Make shader stage parameter in bindShader a template parameter 2022-08-07 18:44:44 +02:00
Philip Rebohle 29a2cb9a5e
[d3d9,d3d11] Make GetShaderStage functions constexpr 2022-08-07 18:44:44 +02:00
Philip Rebohle 12c2d24d5c
[dxvk] Remove bindResourceView method 2022-08-07 17:59:20 +02:00
Philip Rebohle 69b15b7fe6
[dxvk] Use new resource view binding methods in swapchain blitter 2022-08-07 17:59:20 +02:00
Philip Rebohle eebcfcf973
[hud] Use new resource view binding methods 2022-08-07 17:59:20 +02:00
Philip Rebohle 1c1958be44
[d3d9] Use new resource view binding methods 2022-08-07 17:59:20 +02:00
Philip Rebohle 28ecf8268d
[d3d11] Use new resource view binding methods 2022-08-07 17:59:20 +02:00
Philip Rebohle 317850e16f
[dxvk] Introduce bindResourceImageView and bindResourceBufferView methods 2022-08-07 17:59:20 +02:00
Philip Rebohle 88bdf2b592
[dxvk] Use vertex extent from vertex binding info
Computing this at runtime is fairly expensive, so try to avoid.
2022-08-07 17:58:19 +02:00
Philip Rebohle 6bcb0a0d61
[d3d11] Compute vertex extent in CreateInputLayout 2022-08-07 17:58:19 +02:00
Philip Rebohle 64169316e6
[d3d9] Compute vertex extent in BindInputLayout 2022-08-07 17:58:19 +02:00
Philip Rebohle bb8a87196f
[dxvk] Add vertex extent to vertex binding info 2022-08-07 17:58:19 +02:00
Robin Kertels ddb528cc8e [d3d9] Change texture before updating fetch4 2022-08-07 00:56:38 +01:00
Blisto91 7b28bbae11 [util] Disable unmapping for Saints Row 2 2022-08-06 21:13:32 +01:00
Georg Lehmann 135b8a0e53 [dxso] Setup spec ubo for pixel shaders 2022-08-06 12:35:23 +02:00
Georg Lehmann 6589966fce [d3d9] Fix FF VS fog with GPL 2022-08-06 12:35:23 +02:00
Joshua Ashton 65da0da954 [d3d9] Support for graphics pipeline libraries 2022-08-06 01:20:22 +00:00
Joshua Ashton 9108f8c76c [d3d9] Clean up fetch4 handling 2022-08-06 01:35:43 +01:00
Joshua Ashton 8c9601b4cd [d3d9] Remove generalHazards option
Move everything into MarkRenderHazard.

We are doing a big bump for driver support anyway, no reason to keep this around. Old drivers can take the perf penalty.
2022-08-06 01:33:30 +01:00
Joshua Ashton 63d582a6e7 [d3d9] Use VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_EXT for hazards if available 2022-08-06 01:33:30 +01:00
Joshua Ashton 90abd993d4 [d3d9] Pass feedback loop aspect mask to backend 2022-08-06 01:33:30 +01:00
Joshua Ashton 8d070e54a1 [d3d9] Enable extAttachmentFeedbackLoopLayout feature if available 2022-08-06 01:33:30 +01:00
Joshua Ashton 31d17efb48 [dxvk] Add feedback loop aspect flags to bindRenderTargets 2022-08-06 01:33:30 +01:00
Joshua Ashton dff514c924 [dxvk] Add hazard tracking to fragment output state
We need this to set the right pipeline bits for supporting attachment feedback loops on some vendors.
2022-08-06 01:33:30 +01:00
Joshua Ashton 43f53f3c0e [dxvk] Enable VK_EXT_attachment_feedback_loop_layout if available 2022-08-06 01:33:30 +01:00
Joshua Ashton 49b76fdd07 [dxvk] Support feedback loop layout in pickLayout 2022-08-06 01:33:30 +01:00
Joshua Ashton 9cf5c648d3 [vulkan] Add feedback loop layout to getWritableAspectsForLayout 2022-08-06 01:33:30 +01:00
Joshua Ashton 3c4e85d630 [meta] Update Vulkan headers to 1.3.224 2022-08-06 01:33:30 +01:00
Philip Rebohle e7b7299ec1
[dxvk] Also consider built-ins declared via OpMemberDecorate
Otherwise we'll miss D3D11 shaders. Oops...
2022-08-06 02:28:39 +02:00
Philip Rebohle 4d9c09b5e7
[dxvk] Don't use pipeline libraries for VS that doesn't export position 2022-08-06 02:09:55 +02:00
Philip Rebohle 3aa786fb6f
[dxvk] Get rid of MaxNumActiveBindings
This only existed due to the binding mask, which we removed with
the null descriptor rework. We can basically support an unlimited
number of descriptors now.
2022-08-06 01:53:08 +02:00
Philip Rebohle b950102233
[dxvk] Don't use MaxNumActiveBindings for descriptor updates 2022-08-06 01:44:56 +02:00
Philip Rebohle 6fba4c47fe
[dxvk] Don't use MaxNumActiveBindings when creating descriptor set layouts 2022-08-06 01:37:17 +02:00
Philip Rebohle 2fe61675bf
[dxvk] Use existing bit mask iterator when updating descriptor sets
And clean up the code a little.
2022-08-05 21:43:11 +02:00
Robin Kertels 9e1ecec79f [d3d9] Disable fetch4 when binding an incompatible texture
Fixes lighting in Spider-Man: Shattered Dimensions.
2022-08-05 19:33:32 +01:00
Philip Rebohle d498551a23 [dxso] Add bit selectors to D3D9ShaderSpecConstantManager
Avoids doing double bitfield extractions which isn't
optimized right now.
2022-08-05 19:31:02 +01:00
Joshua Ashton 9619377723 [dxso] Convert opIEqual 1 -> opINotEqual 0
Better chance of getting optimized
2022-08-05 19:31:02 +01:00
Joshua Ashton b2cbf198e4 [d3d9, dxso] Refactor spec constants to use a bitfield layout
This allows us to use the same information to dump into a push constant for unoptimized pipelines.
2022-08-05 19:31:02 +01:00
Joshua Ashton 438ae5cdfc [dxso] Fix getting sampler type of vertex textures
Fixes: c7afe0dd23
2022-08-05 19:31:02 +01:00
Philip Rebohle 7e237b33b7
[d3d11] Track highest bound unordered access view 2022-08-05 14:13:25 +02:00
Philip Rebohle 934caa3fd7
[d3d11] Track highest bound vertex buffer 2022-08-05 14:13:25 +02:00
Philip Rebohle 3dbd9d8659
[d3d11] Track highest bound sampler 2022-08-05 14:13:25 +02:00
Philip Rebohle 6c372e40f6
[d3d11] Track highest bound shader resource 2022-08-05 14:13:24 +02:00
Philip Rebohle 5dd2b20940
[d3d11] Track highest bound constant buffer 2022-08-05 14:13:24 +02:00
Philip Rebohle 18c4ca8e92
[d3d11] Introduce D3D11MaxUsedBindings
And use it in ResetCommandListState, in order to avoid redundant state changes.
2022-08-05 14:13:24 +02:00
Philip Rebohle ebbb77518a
[d3d11] Clean up after performing video blit
Otherwise, with the upcoming clear/restore optimizations,
we'd possibly leave some resources bound.
2022-08-05 14:13:24 +02:00
Philip Rebohle 9f07bc6532
[d3d11] Refactor shader state 2022-08-05 14:13:24 +02:00
Philip Rebohle 95ab1465ab
[d3d11] Add reset method to more context state 2022-08-05 14:13:24 +02:00
Philip Rebohle 4e1f6e5efd
[d3d11] Refactor unordered access view and output merger state 2022-08-05 14:13:24 +02:00
Philip Rebohle 8383423fbe
[d3d11] Refactor sampler state 2022-08-05 14:13:24 +02:00
Philip Rebohle 1b4cb66dc3
[d3d11] Refactor shader resource state 2022-08-05 14:13:24 +02:00
Philip Rebohle 33e169e85f
[d3d11] Refactor constant buffer state 2022-08-05 14:13:24 +02:00
Philip Rebohle 7685a86494
[d3d11] Change state restoring behaviour in SwapDeviceContextState 2022-08-05 14:13:24 +02:00
Philip Rebohle c7d9201303
[d3d11] Change state clearing behaviour around deferred contexts
Resetting command list state at the end of each D3D11 command list,
as well as before ExecuteCommandList, will allow us to track which
state needs to be reset, which may save us a significant amount of
CPU work.
2022-08-05 14:13:24 +02:00
Philip Rebohle 91fc0a8688
[d3d11] Rename and factor out some state clearing methods 2022-08-05 14:13:21 +02:00
Philip Rebohle 211ad0efcc
[dxvk] Always use init barrier set for initial transition in initImage
This allows us to batch image initialization barriers better.
2022-08-05 12:46:41 +02:00
Philip Rebohle 0f94971193
[d3d11,d3d9] Lock context/device in EndFrame
Fixes #2787.
2022-08-05 12:10:03 +02:00
Philip Rebohle 37a2b02558
[d3d11] Fix compiler error on GCC 10.3 2022-08-04 18:42:13 +02:00
Philip Rebohle 67c11e63e6
[dxvk] Remove old resource binding methods 2022-08-04 13:43:36 +02:00
Philip Rebohle 37337dd4a6
[dxvk] Use new binding methods for swapchain blitter 2022-08-04 13:43:36 +02:00
Philip Rebohle 77e7c7c6b8
[hud] Use new binding methods for HUD rendering 2022-08-04 13:43:36 +02:00
Philip Rebohle 9d967f2fed
[d3d11] Use new binding methods in video context 2022-08-04 13:43:36 +02:00
Philip Rebohle e49524fcb0
[d3d11] Move GetType and GetContextFlags to D3D11CommonContext 2022-08-04 13:43:36 +02:00
Philip Rebohle 1d2d712dfb
[d3d11] Move d3d11_context_common.* -> d3d11_context.* 2022-08-04 13:43:36 +02:00
Philip Rebohle 30b1cac0ae
[d3d11] Remove old D3D11DeviceContext class 2022-08-04 13:43:36 +02:00
Philip Rebohle 20df9fc899
[d3d11] Move all remaining context code to D3D11CommonContext 2022-08-04 13:43:36 +02:00
Philip Rebohle a3ed84c0c1
[d3d11] Move remaining D3D11DeviceContext members to D3D11CommonContext 2022-08-04 13:43:36 +02:00
Philip Rebohle b20bfe763e
[d3d11] Move D3D10Multithread instance to D3D11CommonContext 2022-08-04 13:43:36 +02:00
Philip Rebohle 9a2d8878ef
[d3d11] Move Track*SequenceNumber methods to D3D11CommonContext 2022-08-04 13:43:36 +02:00
Philip Rebohle 532b3a6add
[d3d11] Move EmitCs and related methods to D3D11CommonContext 2022-08-04 13:43:36 +02:00
Philip Rebohle e0ea272c0d
[d3d11] Move misc methods to D3D11CommonContext 2022-08-04 13:43:36 +02:00
Philip Rebohle 9e916edef9
[d3d11] Move Draw* and Dispatch* methods to D3D11CommonContext 2022-08-04 13:43:36 +02:00
Philip Rebohle 1d87af062c
[d3d11] Move ResolveSubresource to D3D11CommonContext 2022-08-04 13:43:36 +02:00
Philip Rebohle 17c318864e
[d3d11] Move Apply* methods to D3D11CommonContext 2022-08-04 13:43:36 +02:00
Philip Rebohle 7c82ed35b2
[d3d11] Move internal resource update methods to D3D11CommonContext 2022-08-04 13:43:36 +02:00
Philip Rebohle 956bad5e84
[d3d11] Move GenerateMips to D3D11CommonContext 2022-08-04 13:43:36 +02:00
Philip Rebohle 751d7467df
[d3d11] Move Clear* methods to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle 50942cd2d9
[d3d11] Move Copy* methods to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle 163af1309d
[d3d11] Move SetPredication to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle b8b5662461
[d3d11] Move Discard* methods to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle efea51c254
[d3d11] Move SO* methods to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle 4d498851a8
[d3d11] Move RS* methods to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle 1ef9d5389b
[d3d11] Move ClearState and RestoreState to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle f664e87749
[d3d11] Move CSSetUnorderedAccessViews to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle 159eed825f
[d3d11] Move *SetSamplers methods to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle 3af5b3ba7b
[d3d11] Move *SetShaderResources methods to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle bfaa21dccc
[d3d11] Move *SetConstantBuffers methods to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle 26ac57f688
[d3d11] Move *SetShader methods to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle e0ee06a279
[d3d11] Move IA* functions to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle 77c032da5c
[d3d11] Move OM* functions to D3D11CommonContext
We can get rid of the immediate context overload as well
since we can just directly call FlushImplicit here.
2022-08-04 13:43:35 +02:00
Philip Rebohle 5a45677a39
[d3d11] Add hazard tracking methods to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle 43661abbfc
[d3d11] Add binding methods to D3D11CommonContext
Uses mutable lambdas to avoid redundant ref counting on immediate contexts.
2022-08-04 13:43:35 +02:00
Philip Rebohle a7c25a01f2
[d3d11] Move D3D11DeviceContextExt to D3D11CommonContext
Will be needed for both EmitCs and TrackSequenceNumber functions.
2022-08-04 13:43:35 +02:00
Philip Rebohle 3f5f731c42
[d3d11] Move D3D11UserDefinedAnnotation member to D3D11CommonContext
This needs to be temlpated because we'll be moving EmitCs to the
common implementation as well, and make EmitCsChunk non-virtual.
2022-08-04 13:43:35 +02:00
Philip Rebohle 10345d0063
[d3d11] Move QueryInterface to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle 4af974768a
[d3d11] Refactor D3D11UserDefinedAnnotation 2022-08-04 13:43:35 +02:00
Philip Rebohle 3ead348b82
[d3d11] Move UpdateSubresource code to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle e4204f76e6
[d3d11] Introduce D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle 0315997fcd
[d3d9] Use mutable lambdas to avoid some redundant ref counting 2022-08-04 13:43:35 +02:00
Philip Rebohle f10be7bc85
[dxvk] Add binding methods that take rvalue references
The goal here is to replace the old methods entirely.
2022-08-04 13:43:32 +02:00
Georg Lehmann 8e37949a71 [util] Use raw tzcnt for BitMask iterator
Dereferencing an end iterator is UB, so we don't have to care about the 0
case.
2022-08-03 22:34:21 +02:00
Philip Rebohle fc7e934854
[util] Always inline Rc::decRef and Rc::incRef
GCC feels the need to generate functions with two instructions for some
reason. Doesn't meaningfully change performance, but makes profiling a
lot easier in some instances.
2022-08-03 15:15:11 +02:00
Joshua Ashton ac2d3e952d [util] Set m_size in small_vector::resize
Turns out this has been broken since it was added, meaning
isViewCompatible has always returned false putting us down slow paths
for UAV clears + copies for the past two years.
2022-08-02 23:54:23 +02:00
Philip Rebohle c1cb4d9d18
[dxvk] Add feature check for external semaphores 2022-08-02 14:37:31 +02:00
Rosen Penev 08424ccb2e
[d3d9] Add missing vector header
Fixes compilation under MSYS2's clang backend.
2022-08-02 13:10:12 +02:00
Joshua Ashton 715493cd75 [d3d10] Mark D3D10ShaderReflection classes as final
Fixes warnings about calling delete on non-final inherited objects.
2022-08-02 13:09:34 +02:00
Philip Rebohle 5256d5e2f6
[dxvk] Fix minor edge cases when parsing floats in config file 2022-08-01 20:24:31 +02:00
Philip Rebohle 727fd7ac33
[d3d11] Add option to control sampler LOD bias 2022-08-01 13:15:09 +02:00
Philip Rebohle 9671055538
[util] Support parsing floating point arguments 2022-08-01 12:05:43 +02:00
pchome 8db2eb51fa [d3d9] fix ordinal values in the DEF file 2022-07-31 14:57:58 +01:00
Philip Rebohle 54f989b2e6 [dxso] Introduce getSpecConstantBufferSlot 2022-07-31 02:10:37 +01:00
Philip Rebohle a2ef99b95c [d3d9] Generalize D3D9ConstantBuffer constructor 2022-07-31 02:10:37 +01:00
Philip Rebohle 00eaec1619
[dxvk] Use normalized state to look up optimized graphics pipelines
We can't normalize all state at the time it is bound, e.g. disabling
unused blend state before render targets are known. By looking up
pipelines using normalized state we ensure that our VkPipelines are
actually unique.

Based on my testing this only affects a small number of pipelines in
most games (anywhere from 0 to a couple dozen), with some outliers
like The Witcher 1, where a third of the pipelines are redundant due
to stale render state.
2022-07-31 02:53:20 +02:00
Philip Rebohle db786cda6c
[dxvk] Remove old code to process specialization constants
We barely use spec constants anymore, so a much simpler solution will do.
2022-07-31 02:53:20 +02:00
Philip Rebohle b2969f628f
[dxvk] Introduce DxvkGraphicsPipelineDynamicState 2022-07-31 02:53:20 +02:00
Philip Rebohle 63420c0cd7
[dxvk] Introduce DxvkGraphicsPipelineShaderState
And factor out a bunch of related code.
2022-07-31 02:53:20 +02:00
Philip Rebohle 30fa9df868
[dxvk] Introduce DxvkGraphicsPipelineSpecConstantState 2022-07-31 02:53:20 +02:00
Philip Rebohle 32c2d91961
[dxvk] Make DxvkShaderModuleCreateInfo usable with lookup tables 2022-07-31 02:53:20 +02:00
Philip Rebohle 9cb0d6d610
[dxvk] Make fragment shader state usable with lookup tables 2022-07-31 02:53:20 +02:00
Philip Rebohle 97ab6a313b
[dxvk] Make pre-rasterization state usable with lookup tables 2022-07-31 02:53:20 +02:00
Philip Rebohle 0a15146746
[dxvk] Use unordered map to look up base pipelines
No reason to use a linear list here. The object is always locked
when we access this list, so we don't need the lock-free one here.
2022-07-31 02:53:20 +02:00
Philip Rebohle 0eaad2eb5b [dxso] Don't create shader object for redundant PS permutations 2022-07-30 22:15:41 +01:00
Joshua Ashton 76ddd2a35a [build] Use current_source_dir instead of source_root
source_root is deprecated and doesn't work if we are used in a subproject
2022-07-30 21:28:09 +02:00
Joshua Ashton 297759be4e [build] Initial reworkings for non-Windows platform support in Meson 2022-07-30 21:28:09 +02:00
Philip Rebohle 8d72b8e820
[dxvk] Reject pipelines that set unused spec constants 2022-07-30 21:24:15 +02:00
Philip Rebohle 54f9eaf13c
[dxvk] Don't spam log messages when pipeline state validation fails 2022-07-30 21:17:21 +02:00
Philip Rebohle 4d8b75c8fb
[d3d9] Fix spec constant derp 2022-07-30 20:38:58 +02:00
Philip Rebohle 10e6d0ef8a
[dxvk] Don't redundantly reset spec constant values
No longer needed.
2022-07-30 20:38:04 +02:00
Philip Rebohle ec7de66419 [util] Use transcodeString in tows and fromws helpers 2022-07-30 20:30:32 +02:00
Philip Rebohle 1c08725acd [util] Use transcodeString in createDirectory function 2022-07-30 20:30:32 +02:00
Philip Rebohle 65070bd765 [util] Use transcodeString in setThreadName function 2022-07-30 20:30:32 +02:00
Philip Rebohle bb3c0b9707 [dxgi] Use transcodeString to convert adapter name 2022-07-30 20:30:32 +02:00
Philip Rebohle 200df73ba7 [util] Implement utility functions for string conversion 2022-07-30 20:30:32 +02:00
Robin Kertels bad7d4690b [d3d9] Handle very large Up draws 2022-07-30 20:29:31 +02:00
Philip Rebohle 2782afaf8a
[dxvk] Inline pushConstants method
No reason not to.
2022-07-30 17:52:55 +02:00
Philip Rebohle 94ca65d587
[dxvk] Ignore spec constants that are not used by the current pipeline
May reduce the number of pipeline permutations.
2022-07-30 17:42:46 +02:00
Philip Rebohle 47794b661e
[dxvk] Only pass requried spec constants when compiling compute pipelines 2022-07-30 16:00:28 +02:00
Philip Rebohle b90f8819c6
[dxvk] Only pass required spec constants when compiling graphics pipelines 2022-07-30 15:54:38 +02:00
Philip Rebohle 80a58f000a
[dxvk] Generate bit mask of used spec constants in DxvkShader
This way we can more accurately track which constants are used, and not
pass any unnecessary data at compile time. We can extend this in the
future to also skip unused constants for pipeline lookups.

Also, any spec constant with the ID of MaxNumSpecConstants will be treated
as a spec constant selector. If the shader uses this constant, it is assumed
that it does not access any other spec constants if the value of this constant
is 0. This will allow shaders with spec constants to be used with pipeline
libraries.
2022-07-30 15:46:47 +02:00
Joshua Ashton 753aede1fc [d3d9] Correct comment about ProjectionType 2022-07-30 12:34:18 +00:00
Joshua Ashton 1d1f0c7e7e [d3d9] Document D3D9SpecConstantId 2022-07-30 12:30:33 +00:00
Robin Kertels ea76bfd019 [d3d9] Unmap unused resources 2022-07-29 13:14:33 +01:00
Robin Kertels b4f432f1de [util] Implement LRU list 2022-07-29 13:14:33 +01:00
Robin Kertels 6ca6554452 [d3d9] Use memory mapped files for textures 2022-07-29 13:14:33 +01:00
Robin Kertels d598fd3156 [d3d9] Add HUD item for unmappable memory 2022-07-29 13:14:33 +01:00
Robin Kertels c3dbb6429f [d3d9] Implement memory allocator for memory mapped files 2022-07-29 13:14:33 +01:00
Robin Kertels 08ad6583ea [d3d9] Only set upload bit for managed textures
Otherwise D3DPOOL_DEFAULT can hit the draw time late
upload path.
2022-07-29 13:14:33 +01:00
Robin Kertels ba4d95c5fc [d3d9] Remove direct upload path
And remove some tracking that will no longer be necessary.
2022-07-29 13:14:33 +01:00
Robin Kertels 45c1d7911e [d3d9] Remove evictManagedOnUnlock
This is annoying to maintain and hopefully won't be necessary anymore.
2022-07-29 13:14:33 +01:00
Robin Kertels 116feca6af [d3d9] Handle unbound textures in fixed function shaders 2022-07-28 14:56:28 +00:00
Philip Rebohle 6c5f73ac26
[dxvk] Reintroduce VkPhysicalDeviceIDProperties
We need this to get the device LUID. Wine does not fill in the
LUID properties in VkPhysicalDeviceVulkan11Properties right now.

Fixes DLSS not working, as well as other potential issues.
2022-07-26 22:38:33 +02:00
Joshua Ashton 6425d2368b [build] Use arch-mingw-github-action v8
Fixes generated version info.
2022-07-26 18:49:22 +01:00
Philip Rebohle 5fe04eb6ac
[dxvk] Fix weird indentation
how did this happen
2022-07-26 02:40:30 +02:00
Blisto91 b06140af47 [util] set maxFrameLatency to 1 for YS Origin 2022-07-25 16:20:28 +02:00
Philip Rebohle 08da6d8ca4
[dxbc] Bound-check mip level for resinfo instruction 2022-07-25 15:58:55 +02:00
Krzysztof Dobrowolski abf5ed154f [dxvk] Add Direct3D9ForceHybridEnumeration empty export function. 2022-07-25 12:04:27 +00:00
Philip Rebohle b67d5c8c1d
[util] Correctly mark flag register as clobbered 2022-07-24 17:30:54 +02:00
Philip Rebohle 41ec5d2c52
[dxvk] Avoid bsf instruction
It's very slow compared to tzcnt on some CPUs, and we have a working fallback.
2022-07-24 15:24:00 +02:00
Philip Rebohle 9cd0473544
[util] Set ignoreGraphicsBarriers option for Stray 2022-07-23 21:21:22 +02:00
Philip Rebohle 9d8484f2e9
[dxvk] Use synchronization2 functions for timestamp queries
Again not really making use of the new stage flags, but might as well
call the function. Oversight from earlier changes.
2022-07-23 15:32:59 +02:00
Blisto91 cb291f29a1 [util] enable alphaTestWiggleRoom for Ninja Blade 2022-07-23 13:02:53 +00:00
Blisto91 f2d4455cdf [util] enable dialog mode for NFS 3 modern patch 2022-07-22 19:47:44 +02:00
Derek Lesho 8fefb099d7 [d3d11] Add support for shared ID3D11Fence resources 2022-07-21 23:39:31 +02:00
Derek Lesho a3548f8043 [dxvk] Add shared handle access to DxvkFence 2022-07-21 23:39:31 +02:00
Derek Lesho a8e573b9b8 [dxvk] Enable VK_KHR_external_semaphore_win32 if available 2022-07-21 23:39:31 +02:00
Philip Rebohle dcd2c4847b
[d3d11] Implement ID3D11Fence
No interop support just yet.

Co-authored-by: Derek Lesho <dlesho@codeweavers.com>
2022-07-21 02:15:16 +02:00
Philip Rebohle 05a827703b
[dxvk] Add fence support to command list
Co-authored-by: Derek Lesho <dlesho@codeweavers.com>
2022-07-21 02:14:59 +02:00
Philip Rebohle 4167e1b887
[dxvk] Refactor queue submission info
Co-authored-by: Derek Lesho <dlesho@codeweavers.com>
2022-07-21 02:14:59 +02:00
Philip Rebohle 446ec07f3b
[dxvk] Add DxvkFence
Co-authored-by: Derek Lesho <dlesho@codeweavers.com>
2022-07-21 02:14:59 +02:00
Philip Rebohle a40724aaf8
[dxvk] Add timeline semaphore entry points
Co-authored-by: Derek Lesho <dlesho@codeweavers.com>
2022-07-21 02:14:53 +02:00
Philip Rebohle ec813e036c
[dxbc] Fix UAV write test
We broke this during the null descriptor refactor. Also make it so that
we don't generate conditionals when there's nothing to test.
2022-07-20 22:56:32 +02:00
Philip Rebohle 779f8b39cd
[spirv] Track currently active block ID 2022-07-20 22:38:03 +02:00
Philip Rebohle a178c57aea
[dxvk] Remove barrier argument from render target transition functions
We're always using the same barrier set anyway.
2022-07-20 16:57:27 +02:00
Philip Rebohle 16eae7adde
[dxvk] Allow resetting the state cache using the DXVK_STATE_CACHE env var 2022-07-20 13:58:50 +02:00
Kassin Dornelles 75d0b1af96 [util] Remove Resident Evil 6 workaround
It's actually making things worse, so better use the default path
2022-07-20 12:00:13 +02:00
Philip Rebohle 2d93760002
[dxvk] Clarify feature enablement
And fall back to robustImageAccess if robustImageAccess2 is not supported.
Not what we want, but better than nothing.
2022-07-19 19:08:58 +02:00
Philip Rebohle fc796abede
[dxvk] Bump engine version reported to the Vulkan driver
Might help with Fossilize stuff.
2022-07-19 15:27:18 +02:00
Philip Rebohle 0ba741b7d2
[dxvk] Use copy_commands2 functions for buffer <-> image copies 2022-07-19 15:16:54 +02:00
Philip Rebohle 23846ad577
[dxvk] Use copy_commands2 functions for image copies 2022-07-19 15:16:54 +02:00
Philip Rebohle dc1d82deff
[dxvk] Use copy_commands2 functions for buffer copies 2022-07-19 15:16:54 +02:00
Philip Rebohle f39d49772d
[dxvk] Use copy_commands2 functions for image resolves
Same idea as with blits, don't expose VkImageResolve2.
2022-07-19 14:10:47 +02:00
Philip Rebohle ff81323228
[dxvk] Use copy_commands2 functions for image blits
Don't expose VkImageBlit2 to client APIs since we can't easily
support pNext chains, so just convert the struct internally.
2022-07-19 13:53:28 +02:00
Philip Rebohle 563b1d7801
[dxvk] Add entry points for copy_commands2 2022-07-19 13:49:01 +02:00
Philip Rebohle 330ff8fa48
[dxvk] Use synchronization2 functions for queue submissions 2022-07-19 02:27:31 +02:00
Philip Rebohle 0c79882e84
[dxvk] Use synchronization2 functions for events 2022-07-19 02:27:31 +02:00
Philip Rebohle adb906b18c
[dxvk] Use synchronization2 functions for barriers
We don't really use the new stage/access flags yet, and I'm not sure
whether we will move to them since the benefits seem rather limited.
However, using the functions means we can bypass a lot of internal
translation inside some Vulkan drivers.
2022-07-19 02:27:31 +02:00
Philip Rebohle 0d65142136
[dxvk] Add entry points for new synchronization API 2022-07-18 22:49:49 +02:00
Philip Rebohle 17205f5353
[dxvk] Fix formatting in barrier function 2022-07-18 22:49:47 +02:00
Blisto91 e28b268351 [util] Enable disableMsaa option for Mary Skelter 2 2022-07-18 22:17:13 +02:00
Philip Rebohle e6df48fa3e
[dxvk] Fix a derp 2022-07-18 14:53:29 +02:00
Philip Rebohle a76b5693f3
[dxvk] Clean up remaining object creation code 2022-07-18 14:52:12 +02:00
Philip Rebohle 9ebeb8e502
[dxvk] Clean up instance creation code a bit 2022-07-18 14:51:40 +02:00
Philip Rebohle a1ace8ef21
[dxvk] Clean up misc. code 2022-07-18 14:51:26 +02:00
Philip Rebohle 37f31ae1e7
[dxvk] Clean up more code around object creation in meta passes 2022-07-18 14:50:29 +02:00
Philip Rebohle fc461d0e27
[dxvk] Clean up some swapchain creation code 2022-07-18 14:49:28 +02:00
Philip Rebohle 04f43f0d2c
[dxvk] Clean up sampler creation code 2022-07-18 14:36:08 +02:00
Philip Rebohle 6276d5503c
[ðxvk] Clean up some device creation code 2022-07-18 14:31:09 +02:00
Philip Rebohle d29d403c67
[dxvk] Clean up buffer and buffer view creation code 2022-07-18 14:21:23 +02:00
Philip Rebohle 0b11995dea
[dxvk] Clean up image and image view creation code
Someone was dunk while setting pNext to VK_NULL_HANDLE instead of nullptr.
2022-07-18 14:19:06 +02:00
Philip Rebohle 8d1b9eca5d
[dxvk] Fix blending with A8 render targets 2022-07-17 17:06:42 +02:00
Philip Rebohle f15466a2c5
[dxvk] Remove remaining built-in specialization constants 2022-07-17 17:06:42 +02:00
Philip Rebohle 0f16a8f70d
[dxbc] Remove output mapping code 2022-07-17 17:06:42 +02:00
Philip Rebohle 568aae8667
[dxvk] Use SPIR-V pass to swizzle FS outputs instead of spec constants 2022-07-17 17:06:42 +02:00
Philip Rebohle c401167161
[dxvk] Introduce SPIR-V pass to inject render target swizzles 2022-07-17 17:06:40 +02:00
Leopard1907 48ac9b27e4 eveonline-dx12_workaround
Launcher probes feature level 12_1, if it fails to probe it DX12 option in launcher stays greyed out, doesn't let user enable DX12.
2022-07-17 13:51:40 +02:00
Philip Rebohle d898eff3be
[dxvk] Don't remove private inpurs from interface list in SPIR-V 1.4+
And if we have to, exit after one iteration since otherwise our iterator
gets invalidated.
2022-07-17 03:57:05 +02:00
Philip Rebohle ff39819086
[dxvk] Merge methods to bind a compute pipeline
There is no workload in practice where the same shader will be used
multiple times with different spec constants, so there is no good
reason to have two dirty flags or to split lookup and binding.
2022-07-17 00:09:30 +02:00
Philip Rebohle a1c3df7750
[dxvk] Always pre-compile compute shaders
We didn't initially do this because the pipeline library code
unconditionally used pNext chains to pass shader code. However,
shader module creation has since been refactored, and now there
is no good reason not to compile compute shaders immediately.

Also fix the stat counter while we're at it.
2022-07-16 23:42:46 +02:00
Philip Rebohle 8747c0f105
[dxvk] Remove unused method from graphics pipeline code 2022-07-16 23:17:06 +02:00
Philip Rebohle 6e8598846d
[dxvk] Allow mutable commands to be recorded into CS chunks 2022-07-16 20:19:46 +02:00
Philip Rebohle 39dd25e972
[dxvk] Unconditionally call updateDynamicState
And optimize that instead. The previous check would always succeed anyway
since we'd set unused dynamic states to dirty, which is necessary for us
to update that state once it's actually used by a pipeline.
2022-07-16 14:47:54 +02:00
Philip Rebohle dadc1bc8ff
[dxvk] Add dirty tracking for dynamic depth-stencil state
Significantly reduces the number of API calls and potentially
context rolls when switching between different base pipelines.
2022-07-16 13:27:55 +02:00
Philip Rebohle 2fabc90f46
[dxvk] Add fast path for rasterizer state comparison 2022-07-16 13:21:58 +02:00
Philip Rebohle e2340d7224
[dxvk] Fix dual-source blending with multiple bound render targets
We can't write to more than one render target, so zero out the write
mask. Also, normalize blend state for disabled render targets for
good measure.
2022-07-15 23:51:04 +02:00
Philip Rebohle 9e7b93b55b
[dxvk] Fix infinite recursion caused by rebase derp 2022-07-15 19:32:03 +02:00
Philip Rebohle 661a8cd258
[dxvk] Be consistent about enabling dynamic blend constants 2022-07-15 17:25:39 +02:00
Philip Rebohle 46a596dd84
[dxvk] Normalize vertex input state using vertex shader input mask
Filters out unused bindings and attributes when creating Vulkan pipelines.
2022-07-15 17:25:39 +02:00
Philip Rebohle 2fee959515
[dxvk] Bump state cache format to v15 2022-07-15 17:25:39 +02:00
Philip Rebohle 35fad0aa6c
[dxvk] Use dynamic vertex strides whenever possible
May reduce the number of pipeline permutations, as well as the overhead
of the bindVertexBuffer call.
2022-07-15 17:25:39 +02:00
Philip Rebohle fc525d5b70
[dxvk] Optimize format lookup for simple formats 2022-07-15 17:25:34 +02:00
Philip Rebohle cdf22a4086
[dxvk] Rename imageFormatInfo -> lookupFormatInfo 2022-07-15 17:25:13 +02:00
Philip Rebohle 5c4b44c97c
[dxvk] Correctly detect viewport index or layer exports in DxvkShader 2022-07-15 16:12:03 +02:00
Philip Rebohle c3af42356f
[dxbc] Enable SPIR-V 1.6 2022-07-15 16:10:16 +02:00
Philip Rebohle e5c45d4ce0
[dxbc] Use StorageBuffer storage class instead of BufferBlock 2022-07-15 16:10:16 +02:00
Philip Rebohle 320534cb34
[spirv] Automatically track interface variables 2022-07-15 16:10:16 +02:00
Philip Rebohle 10c5c17bc1
[meta] Build meta shaders against Vulkan 1.2
Silences some validation errors regarding layer export.
2022-07-15 16:10:16 +02:00
Philip Rebohle 5ecd11fbd0
[meta] Update SPIR-V headers 2022-07-15 16:10:16 +02:00
Philip Rebohle 686df3ec1b
[dxvk] Don't set scissor and viewport count for meta pipelines
Oversight from when we changed these to be unconditionally dynamic.
Fixes a bunch of validation errors.
2022-07-15 16:07:31 +02:00
Philip Rebohle b59571ab22
[dxvk] Explicitly initialize null descriptor structs
There's a weird rule that requires null buffer descriptors to specify
VK_WHOLE_SIZE. Silences a bunch of validation errors in God of War.
2022-07-15 15:59:54 +02:00
Philip Rebohle 0f6ba59f16
[dxvk] Normalize dynamic depth-stencil state based on bound attachment
We already do the same for monolothic pipelines. SpellForce 3 tries
to write depth with a read-only layout, which is a bad idea.
2022-07-14 22:25:59 +02:00
Philip Rebohle b00d7f35f5
[dxvk] Mark more pipeline state as dynamic for base pipelines
Otherwise we might never set depth bias and friends.
2022-07-14 21:51:57 +02:00
Philip Rebohle 70a71237cf
[dxvk] Always initialize dynamic depth/stencil state
Spec says we must set any dynamic state before making a draw call, there
doesn't seem to be an exception if we don't enable depth or stencil tests.
2022-07-14 21:45:22 +02:00
Philip Rebohle 0b59af996a
[dxvk] Use dynamic depth bias enable for base pipelines
This is always supported in Vulkan 1.3.
2022-07-14 21:35:28 +02:00
Philip Rebohle d6d7d5137b
[dxvk] Drop VK_EXT_4444_formats
These formats are core in Vulkan 1.3 and all relevant drivers support them.
2022-07-14 21:21:34 +02:00
Philip Rebohle f60bdcbcbf
[dxvk] Replace VK_EXT_shader_demote_to_helper_invocation with core feature 2022-07-14 21:21:34 +02:00
Philip Rebohle 13425eb39b
[dxvk] Replace VK_EXT_pipeline_creation_cache_control with core feature 2022-07-14 21:21:34 +02:00
Philip Rebohle 7677db3371
[dxvk] Replace VK_EXT_extended_dynamic_state with core feature 2022-07-14 21:21:34 +02:00
Philip Rebohle 3cfc3e7714
[dxvk] Replace VK_KHR_dynamic_rendering with core feature 2022-07-14 21:21:34 +02:00
Philip Rebohle e79a2e8dfa
[dxvk] Enable Vulkan 1.3 feature structs 2022-07-14 21:21:34 +02:00
Philip Rebohle 1dd3f24b43
[dxbc] Drop workarounds for unsupported drivers 2022-07-14 21:21:34 +02:00
Philip Rebohle 223a4fd186
[d3d9] Always assume RADV has fast mulz support
All supported Mesa version support this.
2022-07-14 21:21:34 +02:00
Philip Rebohle 81b89cf31d
[dxvk] Simplify Nvidia HVV workaround
We no longer support 465 series drivers, so the check was obsolete.
2022-07-14 21:21:34 +02:00
Philip Rebohle 131af0d677
[dxvk] Replace VK_KHR_driver_properties with core feature 2022-07-14 21:21:34 +02:00
Philip Rebohle 78c5ef88bc
[dxvk] Replace VK_KHR_shader_float_controls with core feature 2022-07-14 21:21:34 +02:00
Philip Rebohle 000e3cb960
[dxvk] Replace VK_KHR_image_format_list with core feature 2022-07-14 21:21:34 +02:00
Philip Rebohle 956f293a69
[dxvk] Replace VK_KHR_depth_stencil_resolve with core feature 2022-07-14 21:21:34 +02:00
Philip Rebohle b701dd497f
[dxvk] Drop VK_KHR_create_renderpass2 2022-07-14 21:21:34 +02:00
Philip Rebohle d657a526ae
[dxvk] Replace VK_EXT_shader_viewport_index_layer with core features
And enable them optionally in the backend, since we use this for meta
operations.
2022-07-14 21:21:34 +02:00
Philip Rebohle afdaba6caf
[dxvk] Replace VK_KHR_buffer_device_address with core feature 2022-07-14 21:21:34 +02:00
Philip Rebohle 0b47297b7d
[dxvk] Replace VK_EXT_host_query_reset with core feature
And make it a hard requirement in the backend. We no longer support
the old fallback path for queries anyway.
2022-07-14 21:21:34 +02:00
Philip Rebohle f07ba07ad8
[dxvk] Replace VK_KHR_draw_indirect_count with core feature
And enable it optionally in the backend, since we provide the functionality.
2022-07-14 21:21:34 +02:00
Philip Rebohle eee4ac1e91
[dxvk] Replace VK_KHR_sampler_mirror_clamp_to_edge with core features
And make it a hard requirement. We're not checking for feature support
anyway and all relevant drivers support this feature anyway.
2022-07-14 21:21:34 +02:00
Philip Rebohle 73f313f904
[dxvk] Enable Vulkan 1.2 feature structs 2022-07-14 21:21:34 +02:00
Philip Rebohle 2774a04195
[dxvk] Use VkPhysicalDeviceVulkan11{Features,Properties} where appropriate 2022-07-14 21:21:34 +02:00
Philip Rebohle fd15795a0b
[dxvk] Require Vulkan 1.3 adapter 2022-07-14 21:21:34 +02:00
Philip Rebohle 6ac5ca3bff [d3d9] Use existing staging buffer implementation for managed uploads 2022-07-14 18:22:23 +02:00
Philip Rebohle f07a6e160c [d3d9] Rework UP buffer allocation 2022-07-14 18:22:23 +02:00
Joshua Ashton e884413c49 [dxvk] Don't synchronize device if going for DLL shutdown
All our other threads have been destroyed and we can no longer synchronize with them properly.

Co-authored-by: Paul Gofman <pgofman@codeweavers.com>
2022-07-14 17:04:52 +02:00
Georg Lehmann 5ae5476d71 [d3d9] Make reported sample counts consistent with DecodeMultiSampleType behavior. 2022-07-14 15:32:42 +01:00
Philip Rebohle 9e110cd3e5 [d3d9] Fix up unsupported sample counts 2022-07-14 14:58:58 +01:00
Philip Rebohle 74a8bfb774 [d3d9] Remove CreateConstantBuffer method 2022-07-14 15:55:08 +02:00
Philip Rebohle 4635c72e95 [d3d9] Use generic constant buffers for SWVP 2022-07-14 15:55:08 +02:00
Philip Rebohle 08c3c45853 [d3d9] Use generic constant buffer implementation 2022-07-14 15:55:08 +02:00
Philip Rebohle e8d5ce94ea [d3d9] Introduce D3D9ConstantBuffer 2022-07-14 15:55:08 +02:00
Philip Rebohle bcd2be0698
[d3d11] Fix subtle bug in constant buffer rebinding
Previously, if the app called SetConstantBuffers1 with a non-zero
offset and a full UBO range, and then SetConstantBuffers with the
same buffer, we would not rebind that buffer at offset zero.
2022-07-14 15:14:25 +02:00
Philip Rebohle aef2eb14df
[dxvk] Use BindConstantBufferRange for SetConstantBuffers1 if possible
Reduces ref counting overhead in the few games that use this.
2022-07-14 15:14:21 +02:00
Philip Rebohle ce3eae59a9
[dxvk] Introduce bindResourceBufferRange 2022-07-14 14:56:13 +02:00
Philip Rebohle 57445227ac
[d3d11] Fix render target validation (again)
This behaviour is rather obscure and undocumented, but testing shows
that DSV <-> RTV mismatches are allowed under some circumstances.

Fixes #2555.
2022-07-14 12:39:14 +02:00
Robin Kertels ce48b57f94
[d3d9] Allow POOL_SCRATCH targets in GetFrontBufferData 2022-07-13 14:01:12 +02:00
Blisto91 64d2260656
[d3d9] add D3DFMT_UNKNOWN to windowed BackBufferFormat 2022-07-13 13:03:05 +02:00
Philip Rebohle 95995041b0
[d3d9] Explicitly check for Unknown in CheckDeviceFormatConversion 2022-07-13 12:35:33 +02:00
Robin Kertels 10b174b52c [d3d9] Fix barriers with staging buffers 2022-07-12 21:16:32 +01:00
Philip Rebohle bd68f05c9b
[dxvk] Make emitRenderTargetReadbackBarrier more generic
And also remove the redundant pipeline barrier.
2022-07-12 17:29:11 +02:00
Philip Rebohle 5ff6f3a2ca
[dxvk] Fix graphics UAV barriers
We broke this when replacing gfxBarriers with execBarriers,
since starting a render pass instance clears queued up barriers.
2022-07-12 14:26:52 +02:00
Philip Rebohle 59475fb053
[dxvk] Remove cull mode and front face from pipeline state
And bump state cache version to v14.
2022-07-12 12:07:25 +02:00
Philip Rebohle d3c8d21047
[dxvk] Make cull mode and front face dynamic state 2022-07-12 12:03:05 +02:00
Philip Rebohle 18d4a87333
[dxvk] Add pipeline flag for rasterizer discard 2022-07-12 11:42:24 +02:00
Philip Rebohle 77891d71db
[d3d11] Fix unused variable warning 2022-07-12 11:39:56 +02:00
Philip Rebohle f99a833f51
[d3d11] Remove d3d11.constantBufferRangeCheck option 2022-07-12 02:11:39 +02:00
Philip Rebohle e8f48c71ab
[dxvk] Always enable robustBufferAccess2 feature
And respect the required alignments when creating buffers.
2022-07-12 02:11:32 +02:00
Philip Rebohle 6f5ae58ccc
[dxvk] Remove dummy resources that are no longer needed 2022-07-12 01:54:22 +02:00
Philip Rebohle 6482898167
[dxvk] Mark VK_KHR_create_renderpass_2 as required
Dependency of VK_KHR_dynamic_rendering.
2022-07-12 00:54:24 +02:00
Philip Rebohle 379c2e545e
[util] Work around silly compiler warnings on GCC 12.1
No, we're not actually reading 64 bytes from a 1-byte area.
2022-07-11 19:24:09 +02:00
Philip Rebohle 52038b2f83
[dxvk] Ignore state cache for pipelines that can be fast linked 2022-07-11 16:23:14 +02:00
Philip Rebohle ca52c5a67f
[dxvk] Don't read or create state cache file if state cache is disabled 2022-07-11 01:19:09 +02:00
Philip Rebohle 00cfee9d17
[d3d11] Ignore OMSetRenderTargets calls with incompatible view sizes
Fixes #2701.
2022-07-10 15:17:00 +02:00
Matej Dian 1b89394aa0
[util] Enable cached dynamic resources for DayZ (#2709) 2022-07-09 15:51:04 +02:00
Philip Rebohle 2832083fe5
[dxvk] Properly log pipeline state on error 2022-07-09 13:53:20 +02:00
Philip Rebohle c6168179bd
[dxvk] Re-add render target format validation
This was lost during the state cache and render target state rework.
2022-07-09 13:44:52 +02:00
Philip Rebohle 021aff1fc0
[dxvk] Support fomatting more Vulkan enum names 2022-07-09 13:41:07 +02:00
Philip Rebohle 02aa1736f5
[dxvk] Try to create cached optimized pipeline whenever possible 2022-07-09 13:41:07 +02:00
Philip Rebohle df1908f7bf
[dxvk] Support creating shader stage infos with module identifiers 2022-07-09 13:41:07 +02:00
Philip Rebohle 52cc0a366e
[dxvk] Query shader module identifiers from shader pipeline libraries 2022-07-09 13:41:07 +02:00
Philip Rebohle 331c790592
[dxvk] Enable VK_EXT_shader_module_identifier if supported 2022-07-09 13:41:07 +02:00
Philip Rebohle 04545ab00a
[dxvk] Enable VK_EXT_pipeline_creation_cache_control if supported 2022-07-09 13:41:07 +02:00
Philip Rebohle f4fd8c6c65
[dxvk] Remove in-memory pipeline cache
Doesn't really do much and only prevents Nvidia's disk cache
from working on 515.49.06 drivers.
2022-07-09 13:41:07 +02:00
Philip Rebohle 645886db8d
[hud] Display pipeline library count in HUD 2022-07-09 13:41:07 +02:00
Philip Rebohle 3552983084
[dxvk] Add stat counter for pipeline libraries 2022-07-09 13:41:07 +02:00
Philip Rebohle 4535fdc336
[dxvk] Pass pipeline manager to pipeline library constructor 2022-07-09 13:41:07 +02:00
Philip Rebohle 498444f1a8
[dxvk] Reuse linked base pipelines if possible
No reason to create identical pipelines multiple times.
2022-07-09 13:41:07 +02:00
Philip Rebohle 5562ff4472
[dxvk] Remove pipeline compile timing
Meaningless now.
2022-07-09 13:41:07 +02:00
Philip Rebohle 5d340e48b4
[dxvk] Improve pipeline state logging 2022-07-09 13:41:07 +02:00
Philip Rebohle 5e1569593a
[dxvk] Create full pipeline layout with INDEPENDENT_SETS_BIT
And use it to link pipelines as well as descriptor binding.
Should fix issues related to descriptors.
2022-07-09 13:41:07 +02:00
Philip Rebohle b51d7a3cc0
[dxvk] Update descriptor sets after binding pipeline 2022-07-09 13:41:07 +02:00
Philip Rebohle 6256ab2a19
[dxvk] Use pipeline libraries to link base pipelines if possible 2022-07-09 13:41:07 +02:00
Philip Rebohle 7f9a04fd59
[dxvk] Don't keep pipeline locked when building optimized variant
Only lock when creating base variant, otherwise we'll have stutter.
2022-07-09 01:53:52 +02:00
Philip Rebohle cc1575e8b7
[dxvk] Compile optimized graphics pipelines on worker threads if necessary 2022-07-09 01:53:52 +02:00
Philip Rebohle b50ed2ceca
[dxvk] Deal with multiple pipeline handles for graphics pipeline instances
Also make the handles atomic since worker threads may access them when
compiling optimized pipeline variants.
2022-07-09 01:53:51 +02:00
Philip Rebohle 90454438b2
[dxvk] Introduce distinction between base and optimized pipelines
We need to know what kind of pipeline we're binding in order to apply
the correct dynamic state.
2022-07-09 01:53:51 +02:00
Philip Rebohle e01ffc02a8
[dxvk] Add more dynamic state to DxvkCommandList 2022-07-09 01:53:51 +02:00
Philip Rebohle a683ecd525
[dxvk] Create pipeline library for null shader 2022-07-09 01:53:51 +02:00
Philip Rebohle a0d1ef7f61
[dxvk] Handle null shader in DxvkShaderPipelineLibrary 2022-07-09 01:53:51 +02:00
Philip Rebohle 2cb9ceba1d
[dxvk] Simplify pipeline instance data 2022-07-09 01:53:51 +02:00
Philip Rebohle a72bf02374
[dxvk] Pass VS and FS libraries to graphics pipelines 2022-07-09 01:53:51 +02:00
Philip Rebohle cb56e16a4b
[dxvk] Use precompiled compute pipelines whenever possible 2022-07-09 01:53:51 +02:00
Philip Rebohle 6265b5b809
[dxvk] Use new shader stage info objects in DxvkShaderPipelineLibrary
Avoids crashing on drivers which do not support NULL modules for compute
pipelines and just reduces the amount of code by a small amount.
2022-07-09 01:53:51 +02:00
Philip Rebohle e6470b6d10
[dxvk] Rework DxvkShaderModule into DxvkShaderStageInfo
Separates the whole thing from DxvkShader instances so that we
can use this in other places too. Only creates a shader module
if necessary for the given pipeline or device.
2022-07-09 01:53:51 +02:00
Philip Rebohle 5019ce4b9c
[dxvk] Compile pipeline libraries in registerShader if supported 2022-07-09 01:53:51 +02:00
Philip Rebohle a49333cd87
[dxvk] Add pass to check whether a shader has spec constants
Pipeline libraries cannot be used for shaders with user spec constants.
2022-07-09 01:53:51 +02:00
Philip Rebohle a6b0783a51
[dxvk] Add config option for graphics pipeline library enablement 2022-07-09 01:53:51 +02:00
Philip Rebohle 06c084616f
[dxvk] Clean up graphics and compute pipeline constructors 2022-07-09 01:53:51 +02:00
Philip Rebohle f2f1f86500
[dxvk] Use new worker thread system in state cache 2022-07-09 01:53:51 +02:00
Philip Rebohle 02e6a212bb
[dxvk] Introduce new pipeline manager worker thread system 2022-07-09 01:53:51 +02:00
Philip Rebohle 1c573a7fd5
[dxvk] Rework state cache object creation 2022-07-09 01:53:51 +02:00
Philip Rebohle 8b645f8563
[dxvk] Rework DxvkPipelineCache 2022-07-09 01:53:51 +02:00
Philip Rebohle dbcd0333d9
[dxvk] Implement shader-based pipeline libraries 2022-07-09 01:53:51 +02:00
Philip Rebohle 30c25ee1f0
[dxvk] Add way to create partial pipeline layouts 2022-07-09 01:53:51 +02:00
Philip Rebohle 3b10efbc30
[dxvk] Implement fragment output pipeline libraries 2022-07-09 01:53:51 +02:00
Philip Rebohle 578c136239
[dxvk] Implement vertex input pipeline libraries 2022-07-09 01:53:51 +02:00
Philip Rebohle 47ac5f49cb
[dxvk] Factor out fragment shader state setup 2022-07-09 01:53:51 +02:00
Philip Rebohle 33067f2a23
[dxvk] Factor out pre-rasterization state setup 2022-07-09 01:53:51 +02:00
Philip Rebohle 08e0e4181b
[dxvk] Factor out fragment output state setup 2022-07-09 01:53:51 +02:00
Philip Rebohle 1e56f2b7a0
[dxvk] Factor out vertex input state setup 2022-07-09 01:53:51 +02:00
Philip Rebohle 6c756c2dbe
[dxvk] Add check whether graphics pipeline libraries can be used 2022-07-09 01:53:51 +02:00
Philip Rebohle d6afe36592
[dxvk] Enable VK_EXT_graphics_pipeline_library if supported 2022-07-09 01:53:51 +02:00
Philip Rebohle 97f2d81b25
[meta] Update Vulkan headers to 1.3.219 2022-07-09 01:53:51 +02:00
Joshua Ashton 2bd062f9d6 [util] Implement LUID helpers for non-Windows platforms Initial commit 2022-07-09 01:14:18 +02:00
Blisto91 3733590756
[util] disable allowDoNotWait for Port Royale 3 (#2668) 2022-07-09 01:00:21 +02:00
Philip Rebohle 21ca9b91d0
[dxvk] Mark VK_EXT_extended_dynamic_state as required
The device feature is already required anyway.
2022-07-08 23:44:05 +02:00
Philip Rebohle fcadaec129
[dxvk] Store clear values inside render pass ops
The previous model was designed around vkCmdBeginRenderPass, which was
somewhat clunky regarding attachment clears. This is no longer needed.
2022-07-07 16:16:51 +02:00
Philip Rebohle d71e85785c
[dxvk] Drop barrier before renderPassBindFramebuffer
Not necessary since that function emits barriers anyway.
2022-07-07 16:16:51 +02:00
Philip Rebohle 0c5773dbb9
[dxvk] Emit smarter post-renderpass barriers
Allows folding the old post-renderpass barrier into the same pipeline
barrier call as layout transitions from prepareImage or from starting
another render pass, thus reducing the overall number of pipeline
barriers. Also no longer uses VK_PIPELINE_STAGE_ALL_COMMANDS_BIT.
2022-07-07 16:16:50 +02:00
Philip Rebohle 67d35ecc8d
[dxvk] Introduce DxvkGlobalPipelineBarrier 2022-07-07 16:16:50 +02:00
Philip Rebohle 95f7aae3e6
[dxvk] Remove viewport state from graphics pipelines
And bump state cache version to v13.
2022-07-07 16:16:50 +02:00
Philip Rebohle 4b82a05e05
[dxvk] Enable and use dynamic viewport and scissor rect count 2022-07-07 16:16:50 +02:00
Philip Rebohle b34421b055
[dxvk] Always enable extendedDynamicState feature 2022-07-07 16:16:50 +02:00
Philip Rebohle f19607c11e
[dxvk] Use dynamic rendering directly for partial image view clears 2022-07-07 16:16:50 +02:00
Philip Rebohle f57a6d485b
[dxvk] Use dynamic rendering directly for render target clears 2022-07-07 16:16:50 +02:00
Philip Rebohle 605fef10b4
[dxvk] Fix render target readback barrier
Dynamic rendering does not allow barriers within a render
pass instance, so we have to actually stop rendering.
2022-07-07 16:16:50 +02:00
Philip Rebohle e8f3d9b040
[dxvk] Remove render pass and framebuffer objects 2022-07-07 16:16:50 +02:00
Philip Rebohle e3a63d4faa
[dxvk] Bump state cache version to v12
And remove its reliance on the old render pass format struct.
2022-07-07 16:16:50 +02:00
Philip Rebohle 39a2b1cb7a
[dxvk] Remove support for state cache versions older than v8
We could technically keep supporting this with Dynamic Rendering, but
it's a huge amount of work and there's no good reason to do so.
2022-07-07 16:16:50 +02:00
Philip Rebohle 343eba693d
[dxvk] Use dynamic rendering for regular graphics pipelines
For now, just do whatever we were previously doing for render passes,
but explicitly.
2022-07-07 16:16:50 +02:00
Philip Rebohle 5b6a598ed6
[dxvk] Use dynamic rendering for resolve operations 2022-07-07 16:16:50 +02:00
Philip Rebohle 96e102beff
[dxvk] Use dynamic rendering for copies
Significantly reworks framebuffer copies as well. We'll no longer
create dummy samplers to work around glslang versions not supporting
texture descriptors without samplers, and copyImageFb was cleaned
up to factor out the part where a temporary image is created.
2022-07-07 16:16:50 +02:00
Philip Rebohle a450c88c72
[dxvk] Use dynamic rendering for blits and mip generation 2022-07-07 16:16:50 +02:00
Philip Rebohle d5cc50f73f
[dxvk] Add dynamic rendering commands to DxvkCommandList 2022-07-07 16:16:50 +02:00
Philip Rebohle 38cf16a5be
[dxvk] Enable and require VK_KHR_dynamic_rendering 2022-07-07 16:16:44 +02:00
Trevonn 4a0a9d6286 [util] Limit Dead Space to 60fps and fix vsync
https://www.pcgamingwiki.com/wiki/Dead_Space#Issues_fixed

The game has mouse acceleration and physics issues above 60 FPS.

Also the game locks to 30 FPS using the built-in vsync. 
Setting presentInterval to 1 blocks this and the game continues to run at 60 FPS
2022-07-07 14:19:20 +01:00
Georg Lehmann 913129d3b6 [d3d9] Add an config option to disable non seamless cube maps. 2022-07-07 14:18:49 +01:00
Georg Lehmann cd8e2360f4 [d3d9] Use non seamless samplers if supported. 2022-07-07 14:18:49 +01:00
Georg Lehmann 0015a34498 [dxvk] Enable VK_EXT_non_seamless_cube_map if requested. 2022-07-07 14:18:49 +01:00
Georg Lehmann f2b1805d7e [dxvk] Allow non seamless samplers. 2022-07-07 14:18:49 +01:00
Georg Lehmann e9ac543627 [include] Update Vulkan headers to 1.3.217. 2022-07-07 14:18:49 +01:00
WinterSnowfall 03ac577577 [util] Add workaround to fix missing sun & light shafts in Beyond Good And Evil 2022-07-07 14:17:52 +01:00
Philip Rebohle 593c6e3fe8
[dxvk] Remove spec constant ID mapping from pipeline layouts
No longer needed.
2022-07-05 13:03:18 +02:00
Philip Rebohle 8d413e2d09
[dxvk] Fix opening state cache files for writing
operator bool() only checks if errors have occured in previous writes,
so we'd be missing out on the first cache entry written.
2022-07-03 15:38:42 +02:00
Philip Rebohle 7c4d602863
[dxvk] Change spec constant IDs
We no longer support per-resource spec constants, so there is no good
reason not to use a 1:1 mapping for user-defined constants.
2022-07-03 13:41:06 +02:00
Philip Rebohle 2e73e46799
[dxvk] Do not remap spec constant IDs when compiling shaders
No longer needed since we don't emit per-binding constants anymore.
2022-07-03 13:41:06 +02:00
Philip Rebohle a637134c56
[d3d11,dxbc] Use push constant instead of spec constant for rasterizer sample count 2022-07-03 13:41:06 +02:00
Philip Rebohle 87e2d70448
[dxbc] Remove bound spec constants from shader code 2022-07-03 13:41:06 +02:00
Philip Rebohle 8abb5ffc77
[dxvk] Remove binding mask from pipeline state 2022-07-03 13:41:06 +02:00
Philip Rebohle 54eaa444a2
[dxvk] Use null descriptors for unbound resources 2022-07-03 13:41:06 +02:00
Philip Rebohle 3349f2d80e
[dxvk] Use custom spec constant for swap chain blitter 2022-07-03 13:41:06 +02:00
Philip Rebohle 185331df9c
[d3d11] Don't use spec constants for video blitter
Store required info in the UBO instead.
2022-07-03 13:41:06 +02:00
Philip Rebohle c7afe0dd23
[dxso] Use new bit mask spec constant to determine whether textures are bound 2022-07-03 13:41:06 +02:00
Philip Rebohle 735e741681
[d3d9] Add spec constant for null samplers
And rework the way spec constants are updated.
2022-07-03 13:41:06 +02:00
Philip Rebohle 186dc29384
[d3d9] Remove bound spec constants from fixed-function shaders
Texture stages are disabled anyway when textures are unbound,
so we will never hit the unbound case.
2022-07-03 13:41:06 +02:00
Philip Rebohle 8f03c3a419
[dxvk] Don't check binding mask when processing barriers 2022-07-03 13:41:06 +02:00
Philip Rebohle 2e7e9eac7a
[dxvk] Require EXT_robustness2 and the null descriptor feature 2022-07-03 13:41:03 +02:00
Blisto91 f95f541852
[util] Limit Bionic Commando to 60fps (#2685) 2022-07-02 16:51:04 +02:00
Blisto91 98dcd722ea
[util] Add workaround for Garden Warfare 2 (#2700) 2022-07-02 16:50:12 +02:00
Philip Rebohle e406484b84
[d3d9] Don't use VK_RESOLVE_MODE_AVERAGE_BIT_KHR for stencil resolves
Doesn't work, always write sample zero instead.
2022-07-02 16:48:10 +02:00
Philip Rebohle 76ba03398d
[d3d9,dxso] Fix push constant validation errors
Derp.
2022-07-01 18:06:47 +02:00
Philip Rebohle e81094533b
[dxvk] Fix gamma texture bind point 2022-06-30 20:49:43 +02:00
Philip Rebohle 1296890083
[dxvk] Remove error logging from updateResourceBindings
It's not super useful to emit log messages in the hottest code path, and
for some reason GCC compiles some stringstream initialization code into
those parts of the function that are unconditionally executed.
2022-06-28 14:35:58 +02:00
Philip Rebohle 0e38b11569
[dxvk] Rework DxvkResource lifetime tracking
Reduces the number of atomic operations required for lifetime tracking by
using a single 64-bit integer for usage tracking and reference counting.
2022-06-28 14:35:58 +02:00
Philip Rebohle 8d1d3d66e0
[dxvk] Optimize descriptor set binding further 2022-06-28 14:35:58 +02:00
Philip Rebohle db07861518
[dxvk] Remove old pipeline layout implementation 2022-06-28 14:35:58 +02:00
Philip Rebohle c67481b904
[hud] Add HUD item for descriptor stats 2022-06-28 14:35:58 +02:00
Philip Rebohle d4a3b823a2
[dxvk] Add stat counters for descriptor sets and pools 2022-06-28 14:35:58 +02:00
Philip Rebohle 758ba5a80d
[dxvk] Inline all frequently-used binding methods 2022-06-28 14:35:58 +02:00
Philip Rebohle d4d87123b4
[dxvk] Add safety mechanism to submit large descriptor pools 2022-06-28 14:35:58 +02:00
Philip Rebohle cfc06405d2
[dxvk] Recycle Vulkan descriptor pools as well
Reduces the number of expensive reallocations when large descriptor
pools get reset and repopulated.
2022-06-28 14:35:58 +02:00
Philip Rebohle eea5c9f0da
[dxvk] Rename new descriptor pool implementation to DxvkDescriptorPool 2022-06-28 14:35:58 +02:00
Philip Rebohle 6aeed40af2
[dxvk] Remove old descriptor pool implementation 2022-06-28 14:35:58 +02:00
Philip Rebohle af418dcffd
[dxvk] Fix pipeline invalidation
We need to update descriptors and other graphics state when changing
between compute and graphics. This happened to work by chance since
any real-world app binds a new set of shaders around mode switches
anyway, but it could theoretically happen that we wouldn't update
descriptor sets on the first draw after a dispatch.
2022-06-28 14:35:58 +02:00
Philip Rebohle a27448bc76
[dxvk] Bind consecutive descriptor sets in one go
Most of the time we'll be able to bind all sets in one iteration. Binding
sets is expected to be cheap in the driver, but we should avoid unnecessary
function call overhead for this frequently called function.
2022-06-28 14:35:58 +02:00
Philip Rebohle e2b7522034
[dxvk] Use persistent descriptor pool for regular descriptor sets 2022-06-28 14:35:57 +02:00
Philip Rebohle f4e9b76515
[dxvk] Add descriptor pool tracking to command list 2022-06-28 14:35:57 +02:00
Philip Rebohle 9b0b1edf74
[dxvk] Introduce persistent descriptor pool 2022-06-28 14:35:57 +02:00
Philip Rebohle 7e42939a4a
[d3d11] Call endFrame at the end of each frame 2022-06-28 14:35:57 +02:00
Philip Rebohle acf70501d2
[d3d9] Call endFrame at the end of each frame 2022-06-28 14:35:57 +02:00
Philip Rebohle 5610b3a742
[dxvk] Introduce endFrame method 2022-06-28 14:35:57 +02:00
Philip Rebohle ab0c15ea54
[dxvk] Introduce DxvkContextType 2022-06-28 14:35:57 +02:00
Philip Rebohle 8dde72da06
[dxvk] Do not allocate descriptor set space for dynamic UBOs 2022-06-28 14:35:57 +02:00
Philip Rebohle f34d1c886a
[dxvk] Only use descriptor update templates in 32-bit builds 2022-06-28 14:35:57 +02:00
Philip Rebohle 15cf130369
[dxvk] Optimize descriptor set binding further 2022-06-28 14:35:57 +02:00
Philip Rebohle f9e6d8e23a
[dxvk] Remove old resource update code 2022-06-28 14:35:57 +02:00
Philip Rebohle 219853aa9f
[dxvk] Rework dirty descriptor state tracking 2022-06-28 14:35:57 +02:00
Philip Rebohle db85de8c91
[dxvk] Add method to query shader stages that can access a buffer 2022-06-28 14:35:45 +02:00
Philip Rebohle 893183a7cc
[dxvk] Remove old pipeline layout from pipeline objects 2022-06-28 14:34:09 +02:00
Philip Rebohle 9be454fd3e
[dxvk] Use new pipeline layout for barrier tracking and other things 2022-06-28 14:34:07 +02:00
Philip Rebohle d5e53d3271
[dxvk] Add resource binding code using new pipeline layouts 2022-06-28 14:32:31 +02:00
Philip Rebohle ef55a7c2a0
[dxvk] Add method to create shader module using new binding layout 2022-06-28 14:32:31 +02:00
Philip Rebohle d65ceb82cf
[dxvk] Rework binding ID patching 2022-06-28 14:32:31 +02:00
Philip Rebohle 955e0cca62
[dxvk] Use native integer size for DxvkBindingSet
May make things a tad faster in 64-bit applications.
2022-06-28 14:32:31 +02:00
Philip Rebohle 16eba45987
[dxvk] Implement 64-bit tzcnt 2022-06-28 14:32:31 +02:00
Philip Rebohle 038ee0416d
[dxvk] Add setRange method to DxvkBindingSet 2022-06-28 14:32:31 +02:00
Philip Rebohle ec5ea71174
[dxvk] Store and create pipeline layout objects in pipeline manager
This should help avoid a lot of duplication.
2022-06-28 14:32:31 +02:00
Philip Rebohle 79ecd4e94a
[dxbc] Pass new binding info struct to shaders 2022-06-28 14:32:31 +02:00
Philip Rebohle cb57c2f7fb
[d3d11] Pass new binding info struct to video processor shader 2022-06-28 14:32:31 +02:00
Philip Rebohle e795f3f33a
[dxso] Pass new binding info struct to shaders 2022-06-28 14:32:31 +02:00
Philip Rebohle ecbada30f5
[d3d9] Pass new binding info struct to fixed-function shaders 2022-06-28 14:32:31 +02:00
Philip Rebohle 5edd8e92a8
[d3d9] Pass new binding info struct to various helper shaders 2022-06-28 14:32:31 +02:00
Philip Rebohle 7b8b50bca6
[hud] Pass new shader binding info struct to HUD shaders 2022-06-28 14:32:31 +02:00
Philip Rebohle 89dadc8453
[dxvk] Pass new shader binding info struct to swapchain blit shaders 2022-06-28 14:32:31 +02:00
Philip Rebohle 70a95d9085
[dxvk] Add DxvkBindingLayout to DxvkShader class
Supposed to replace the old descriptor model eventually.
2022-06-28 14:32:31 +02:00
Philip Rebohle 53519e2bd5
[dxvk] Remove old resource binding methods 2022-06-28 14:32:30 +02:00
Philip Rebohle 4cc559d690
[d3d9] Pass shader stage when binding shader resources 2022-06-28 14:32:30 +02:00
Philip Rebohle 0fb1227792
[d3d9] Pass shader stage when binding format conversion resources 2022-06-28 14:32:30 +02:00
Philip Rebohle d05864cbcb
[d3d11] Pass shader stage for binding video processor resources 2022-06-28 14:32:30 +02:00
Philip Rebohle a1bbc77c04
[d3d11] Pass shader stage for binding resources in context methods 2022-06-28 14:32:30 +02:00
Philip Rebohle ce0a2f08f0
[hud] Pass shader stage when binding HUD shader resources 2022-06-28 14:32:30 +02:00
Philip Rebohle fe03327ecd
[dxvk] Pass shader stage when binding HUD resources 2022-06-28 14:32:30 +02:00
Philip Rebohle 10eabb34da
[dxvk] Add shader stage parameter to binding methods 2022-06-28 14:32:30 +02:00
Philip Rebohle 3751edbe0c
[dxvk] Introduce DxvkBindingLayout and related classes
This is intended to replace the legacy DxvkPipelineLayout, and can support
multiple descriptor sets.
2022-06-28 14:32:30 +02:00
Philip Rebohle 67d03aabd0
[dxvk] Make recycler a ring buffer
Ensures that recycled objects actually get reused soon. Somewhat
important for memory efficiency in descriptor pools.
2022-06-28 14:32:30 +02:00
Philip Rebohle 384a665700
[dxvk] Optimize util::pipelineStages 2022-06-28 14:31:52 +02:00
Justin Kim 972de7c9fb
converting flags from VkShaderStageFlags to VkPipelineStageFlags in commitGraphicsBarriers (#2696) 2022-06-28 13:09:14 +02:00
Federico Dossena dee36be20d
Added config for A Way Out (#2694) 2022-06-25 11:17:42 +02:00
pchome 27163a6a29 [util] Fix built-in config options loging 2022-06-22 18:21:31 +02:00
Blisto91 661f8b5b56 [util] Add Forged Alliance Forever to Supreme Commander 2022-06-20 11:59:40 +01:00
Robin Kertels bd29fbd95d [util] Enable sampler type spec constants for SWTOR
Co-authored-by: Blisto91 <47954800+Blisto91@users.noreply.github.com>
2022-06-13 21:34:28 +01:00
Blisto91 968f0cdbc3 [util] Strict float emulation for Supreme Commander 2022-06-12 20:16:56 +01:00
Robin Kertels 4f56e72d56 [util] Enable strict float emulation for Sonic Adventure 2 2022-06-11 01:31:48 +02:00
Georg Lehmann 2e4caa4c14 [util] Stop using deprecated std::iterator. 2022-06-09 22:07:52 +02:00
Philip Rebohle 9e5c61bf88
[dxvk] Create state cache threads on demand 2022-06-07 11:46:06 +02:00
Andrew Eikum 279b4b7ec2 [d3d9] Defer surface creation if no HWND is given to device
Planetary Annihilation: TITANS creates a device with a NULL HWND and
requires it to succeed.
2022-06-03 13:07:43 +00:00
Philip Rebohle c596738205
[hud] Fix incorrect array length for VS resources 2022-06-02 19:57:22 +02:00
Blisto91 1862e4dc8d [util] Report Nvidia VendorId for Myst V
Game was made before ATI Technologies was bought by AMD and so doesn't recognize AMD as a GPU vendor, which for some reason makes it bug out.
It also works when it sees the word "Radeon" in the device description, which is why this issue doesn't show on amdvlk or wined3d.
2022-06-02 15:11:17 +02:00
Mike Lothian de0f81fcdc [spirv] Add utility include
This fixes a compile issue with GCC 12.1

FAILED: src/spirv/libspirv.a.p/spirv_compression.cpp.obj
i686-w64-mingw32-g++ -Isrc/spirv/libspirv.a.p -Isrc/spirv -I../dxvk-9999/src/spirv -I../dxvk-9999/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++17 -O0 -DNOMINMAX -D_WIN32_WINNT=0xa00 -msse -msse2 -msse3 -mfpmath=sse -Wimplicit-fallthrough -O3 -march=native -pipe -flto=16 -mno-avx -MD -MQ src/spirv/libspirv.a.p/spirv_compression.cpp.obj -MF src/spirv/libspirv.a.p/spirv_compression.cpp.obj.d -o src/spirv/libspirv.a.p/spirv_compression.cpp.obj -c ../dxvk-9999/src/spirv/spirv_compression.cpp
In file included from ../dxvk-9999/src/spirv/../util/util_flags.h:5,
                 from ../dxvk-9999/src/spirv/spirv_include.h:7,
                 from ../dxvk-9999/src/spirv/spirv_instruction.h:6,
                 from ../dxvk-9999/src/spirv/spirv_code_buffer.h:8,
                 from ../dxvk-9999/src/spirv/spirv_compression.h:5,
                 from ../dxvk-9999/src/spirv/spirv_compression.cpp:1:
../dxvk-9999/src/spirv/../util/util_bit.h:300:33: warning: ‘template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator’ is deprecated [-Wdeprecated-declarations]
  300 |     class iterator: public std::iterator<std::input_iterator_tag,
      |                                 ^~~~~~~~
In file included from /usr/lib/gcc/i686-w64-mingw32/12.1.0/include/g++-v12/bits/stl_algobase.h:65,
                 from /usr/lib/gcc/i686-w64-mingw32/12.1.0/include/g++-v12/vector:60,
                 from ../dxvk-9999/src/spirv/spirv_compression.h:3:
/usr/lib/gcc/i686-w64-mingw32/12.1.0/include/g++-v12/bits/stl_iterator_base_types.h:127:34: note: declared here
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~
../dxvk-9999/src/spirv/spirv_code_buffer.h: In member function ‘size_t dxvk::SpirvCodeBuffer::endInsertion()’:
../dxvk-9999/src/spirv/spirv_code_buffer.h:214:19: error: ‘exchange’ is not a member of ‘std’
  214 |       return std::exchange(m_ptr, m_code.size());
      |                   ^~~~~~~~

Signed-off-by: Mike Lothian <mike@fireburn.co.uk>
2022-06-02 15:10:53 +02:00
Philip Rebohle 5d0273f520
[dxvk] Remove interpolation decorations for replaced shader inputs 2022-06-01 14:11:09 +02:00
Philip Rebohle 6d3ba1b7d7
[dxvk] Perform validation on render pass formats read from state cache 2022-06-01 14:11:09 +02:00
Philip Rebohle 80e125a130
[dxvk] Perform more extensive validation on pipeline state vectors 2022-06-01 14:11:06 +02:00
Blisto91 4ff7687dea [util] Force SM1 for the Halo CE SPV3 launcher 2022-05-31 15:45:23 +02:00
Robin Kertels 7bcf3e1062
[util] Force SM1 for the Warhammer ROR Launcher (#2579)
Co-authored-by: Philip Rebohle <25567304+doitsujin@users.noreply.github.com>
2022-05-31 15:19:30 +02:00
Winter Snowfall 8c96830752
Add d3d9.deferSurfaceCreation workaround for Scrapland (Remastered) (#2574) 2022-05-31 15:17:31 +02:00
noneistaken 93eb86aa3e Blend HUD text shadow and center correctly
This fixes incorrect blending between HUD text, which would cause a narrow transparent gap between the text center and border/shadow that is visible at large text sizes.
2022-05-30 18:23:19 +02:00
Masanori Kakura 0678d80e89 [meta] Update Meson requirement (>=0.49) in README 2022-05-25 18:44:49 +02:00
Zhiyi Zhang 8147844aef [dxgi] Return DXGI_ERROR_INVALID_CALL for invalid IDXGIAdapter3::RegisterVideoMemoryBudgetChangeNotificationEvent() parameters
According to wine tests 14237e321b

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
2022-05-25 18:44:20 +02:00
WinterSnowfall 51e56c0420 [util] Enforce a maxAvailableMemory limit for Majesty 2 2022-05-23 07:54:37 +00:00
Paul Gofman cc11bb8240 [d3d9] Don't adjust window position and size in windowed mode. 2022-05-23 07:53:13 +00:00
Paul Gofman cde0fbe7b0 [util] Enable d3d9.deferSurfaceCreation for Small Radios Big Televisions 2022-05-19 02:51:41 +00:00
Joshua Ashton 5b7406fed5 [d3d9] Fix crash when using StretchRect with NULL rts 2022-05-10 02:02:35 +01:00
pchome 15fa310bb4 [build] Bump required meson version to >=0.49 2022-05-01 18:37:39 +02:00
Philip Rebohle 6ddd0cfe0a
[d3d11] Do not add UINT formats to all UAV format lists
Analogous to vkd3d-proton changes. Allows drivers to use compression more
frequently.
2022-04-25 17:37:10 +02:00
Philip Rebohle a85f7c48a5
[d3d11] Make ClearUnorderedAccessViewUINT fallback more generic 2022-04-25 17:34:45 +02:00
Philip Rebohle 304d0549d5
[dxbc] Implement range check for private array reads
We already do this for stores.
2022-04-21 18:06:41 +02:00
Robin Kertels 3004026db8 [d3d9] Only bind RT if we actually write to it
The alternative render path for shadow maps in Dead Space relies on this.
2022-04-20 00:58:17 +01:00
Robin Kertels bdafa16e39 [d3d9] Only bind depth buffer if the depth or stencil test is enabled 2022-04-20 00:58:17 +01:00
Joshua Ashton d6cbd99141 [util] Add missing include to thread.h 2022-04-19 18:14:58 +01:00
Joshua Ashton 08e2ec6c98 [util] Implement env helpers on non-Windows platforms 2022-04-19 17:08:17 +01:00
Joshua Ashton 147f3738f9 [d3d9] Use strlcpy helper 2022-04-19 17:08:17 +01:00
Joshua Ashton dc6b7fa4a7 [util] Add strlcpy helper
strncpy is not safe.
2022-04-19 17:08:17 +01:00
Joshua Ashton 9ee0f51870 [util] Implement thread helpers on non-Windows platforms 2022-04-19 17:08:06 +01:00
Robin Kertels 9302d33ac7 [d3d9+util] Enable invariant position by default 2022-04-18 12:40:46 +01:00
Philip Rebohle 35e8f4676b [dxvk] Remove old shader creation code 2022-04-18 13:20:16 +02:00
Philip Rebohle a731f5daae [d3d11] Use new DxvkShader constructor for video shaders 2022-04-18 13:20:16 +02:00
Philip Rebohle 69817a84dc [d3d11] Use new DxvkShaderCreateInfo struct to retrieve shader info 2022-04-18 13:20:16 +02:00
Philip Rebohle 427f51eda7 [d3d9] Use new DxvkShader constructor for format conversion 2022-04-18 13:20:16 +02:00
Philip Rebohle 98ec79f6fa [d3d9] Use new DxvkShader constructor for SWVP emulation 2022-04-18 13:20:16 +02:00
Philip Rebohle ab95b61e44 [d3d9] Use new DxvkShader constructor for fixed-function shaders 2022-04-18 13:20:16 +02:00
Philip Rebohle 10bab0c182 [dxso] Use new DxvkShader constructor 2022-04-18 13:20:16 +02:00
Philip Rebohle 8993560cde [dxbc] Use new DxvkShader constructor 2022-04-18 13:20:16 +02:00
Philip Rebohle 81d88a484d [dxvk] Use new DxvkShader constructor for HUD shaders 2022-04-18 13:20:16 +02:00
Philip Rebohle 62e706a6bb [dxvk] Use new DxvkShader constructor for swap chain shaders 2022-04-18 13:20:16 +02:00
Philip Rebohle d0b52f3ac5 [dxvk] Use new DxvkShaderCreateInfo struct to retrieve shader info 2022-04-18 13:20:16 +02:00
Philip Rebohle b0db58f098 [dxvk] Introduce new way to create DxvkShader objects 2022-04-18 13:20:16 +02:00
Philip Rebohle 736f743ae4
[spirv] Implement faster in-memory compression for shaders
Seems to be anything up to 3x as fast to decode than the previous code,
with the compression ratio being slightly worse. Encoding seems faster
as well.
2022-04-11 02:55:12 +02:00
Blisto91 727ba89670 [util] remove allowLockFlagReadonly from conf 2022-04-09 19:44:50 +02:00
Blisto91 2e68b33abd [util] correct enableDebugUtils conf to default False 2022-04-09 19:44:50 +02:00
Blisto91 3672375bc1 [util] Use cached constant buffers for Armored Warfare 2022-04-09 15:19:49 +02:00
Robin Kertels 42c66c410e [d3d9] Calculate slice alignment when uploading straight from the mapping buffer 2022-04-06 18:52:58 +00:00
Paul Gofman 957a305ca8 [d3d9] Ignore multiple app activation window messages. 2022-04-06 18:51:50 +00:00
Paul Gofman b0ed9e30ce [d3d9] Filter window messages when processing WM_ACTIVATEAPP. 2022-04-06 18:51:50 +00:00
Robin Kertels ce87bec412 [util] Force sampler type spec const for Star Wars TFU2
The game tries to binda  2D texture to a slot that is declared
as a 3D texture in the shader. This causes one particle effect
to be completely black because DXVK does not bind the texture
2022-04-05 22:37:04 +00:00
Philip Rebohle 95a3413949
[util] Fix typo in app profiles
Accidentally broke everything.
2022-03-31 18:01:52 +02:00
Philip Rebohle e07157fe72
[d3d11] Only apply anisotropy override to linear samplers
Mirrors D3D9, more or less.
2022-03-30 14:37:33 +02:00
Philip Rebohle e7e7fa231c
[dxvk] GPU query reset path
Require VK_EXT_host_query_reset instead. This fallback path is
untested nowadays and too slow to be useful.
2022-03-30 13:32:18 +02:00
Robin Kertels 6a80b51dc3 [meta] Move apitrace guide over to dxvk repo 2022-03-29 21:33:08 +00:00
Georg Lehmann f0ccd8fe2e [util] Limit Limbo to 60 fps
Fixes: #2564
2022-03-28 21:39:28 +02:00
Derek Lesho d11f0ac77b [d3d11] Always export correct shared handle type from ::GetSharedHandle and ::CreateSharedHandle
Before we just assumed that the calls here would match the corresponding flag value (D3D11_RESOURCE_MISC_SHARED -> ::GetSharedHandle, D3D11_RESOURCE_MISC_SHARED_NTHANDLE -> ::CreateSharedHandle), but it turns out that its possible to set both flags and use both methods.  Now we always tell Vulkan to export a KMT handle if D3D11_RESOURCE_MISC_SHARED is present, and use openKmtHandle to get an NT handle when needed.
2022-03-28 21:38:42 +02:00
Philip Rebohle 1c3736da8c
[dxvk] Filter out unnecessary access flags when recording barriers
Rationale is as follows:
- srcAccess never needs to contain read flags, since any memory being
  read must have been made visible before by a write operation
- dstAccess is only relevant if srcAccess contains a write, because
  reads alone cannot modify memory and thus do not require making the
  same memory available again. An exception are layout transitions.

Doesn't really change performance in anything as far as I can tell, but
we avoid some unnecessary UBO cache flushes in compute-heavy scenarios.
2022-03-28 10:45:29 +02:00
Philip Rebohle ebdaf90fdc
[util] Enable d3d9.deferSurfaceCreation for Atelier Sophie 2
2022 and K-T are still using D3D9 for video stuff.
2022-03-28 04:37:02 +02:00
Philip Rebohle a72463c5af
[meta] Release 1.10.1 2022-03-26 12:44:25 +01:00
Philip Rebohle b4efaa4ef0
[util] Enable cached constant buffers for Frostpunk
Massively improves CPU-bound performance.
2022-03-26 12:44:25 +01:00
Robin Kertels 4e34c29c56 [d3d9] Disable culling when the app passes an invalid value 2022-03-25 17:13:12 +01:00
Philip Rebohle 991a11617a
[util] Enable d3d9.deferSurfaceCreation for Stranger of Paradise FFO
Reportedly required for VRR to work. Game still doesn't work here.
2022-03-25 16:36:17 +01:00
Philip Rebohle 0db26a0456
[dxbc] Actually do the skip range check thing properly
Turns out the first attempt only worked because my test case didn't
do any dynamically indexed stores at all, but broke everything else.
Oops.
2022-03-24 12:53:29 +01:00
Philip Rebohle 3ecd13cec2
[dxbc] Only emit temp array range check for dynamically indexed stores
Generates less code and makes things slightly more readable.
2022-03-24 12:47:40 +01:00
Philip Rebohle c590736fec
[dxbc] Generate smallest possible vectors for local arrays
FXC is buggy and always emits vec4 in the array declaration,
so we'll have to analyze the used components ourselves.
2022-03-24 12:47:40 +01:00
Robin Kertels b2f22d5719 [d3d9] UpdateTexture: Handle automatic mip gen properly 2022-03-24 02:31:42 +00:00
Philip Rebohle 119c1ececb
[util] Set frame latency to 1 for God of War
Frame pacing is horrible otherwise, as of the 1.0.9 update.
2022-03-24 03:05:29 +01:00
Philip Rebohle 6b8e8afd5b
[dxvk] Zero-initialize newly allocated buffer slices on creation
Fixes random flicker in God of War. Since patch 1.0.9, the game's lighting
system relies on MAP_DISCARD returning a zero-initialized memory slices for
its constant buffers, or some lights would get skipped in various compute
passes. Changing the memset to e.g. write 0xFF instead of 0 shows this issue.
2022-03-24 02:46:25 +01:00
Philip Rebohle e440fa26ab
[dxbc] Handle fallthrough around default properly 2022-03-23 15:32:45 +01:00
Philip Rebohle 8823e4bb3d
[dxgi] Work around swapchain use-after-free bugs
Affects Divinity: Original Sin Enhanced Edition. Requires Wine hack to
delay memory deallocation to not crash during resolution changes.
2022-03-23 15:09:39 +01:00
Philip Rebohle 586948df1e
[d3d11] Get strong reference to swap chain in swap chain back buffers 2022-03-22 19:48:13 +01:00
Philip Rebohle 42edb62df8
[d3d11] Use smart pointer for swap chain back buffer 2022-03-22 19:28:49 +01:00
Philip Rebohle b015cf0bb2
[dxbc] Support switch-case fallthrough
Apparently this is a thing in Shader Model 4, although FXC cannot emit it.
2022-03-22 17:32:43 +01:00
Philip Rebohle 0d54f7161c
[util] Enable cached dynamic resources for AC3 and AC4
Without it, AC3 chugs along at 40 FPS on my 5950X.
2022-03-19 20:12:20 +01:00
Oleg Kuznetsov b36ca2c758 [d3d9] Fix Visual Studio build to resolve 'operator !=' is ambiguous error for RECT 2022-03-17 11:35:19 +01:00
Oleg Kuznetsov 5156994440 [dxvk] Add a config option to enable debug utils in addition to DXVK_PERF_EVENTS=1 2022-03-17 11:35:19 +01:00
Joshua Ashton cf1cee04b8 [d3d11] Register annotation interfaces with D3D9
Some apps try use the D3DPERF_ functions for debug markers/annotations.

This utilizes the DXVK_RegisterAnnotation hidden functions to share the interfaces.

Co-authored-by: Oleg Kuznetsov <okouznetsov@nvidia.com>
2022-03-17 11:35:19 +01:00
Joshua Ashton 937a60c882 [d3d9] Add hidden exports for registering annotations
Adds DXVK_RegisterAnnotation at ordinal 28257 and DXVK_UnRegisterAnnotation at ordinal 28258.
2022-03-17 11:35:19 +01:00
Joshua Ashton 787a979514 [d3d9] Implement D3D9UserDefinedAnnotation 2022-03-17 11:35:19 +01:00
Joshua Ashton 47b1ab52ce [d3d9] Implement D3D9GlobalAnnotationList 2022-03-17 11:35:19 +01:00
Joshua Ashton 5d54d79865 [d3d11] Use IDXVKUserDefinedAnnotation 2022-03-17 11:35:19 +01:00
Joshua Ashton a010397f34 [util] Move DecodeD3DColor to util
This will be used in the D3D11UserDefinedAnnotation implementation to handle PIX calls which contain a color.
2022-03-17 11:35:19 +01:00
Joshua Ashton d5d5c1a8bc [dxvk] Define IDXVKUserDefinedAnnotation
Something common to share for perf markers between D3D9 and D3D11.

Inherits from the public D3D11 interface.
2022-03-17 11:35:19 +01:00
Joshua Ashton 0bc972697b [d3d11] Fix D3D11UserDefinedAnnotation declaration
Mark it as final too.
2022-03-17 11:35:19 +01:00
Georg Lehmann 2550cff149 [build] Cleanup build system.
No changes except dropping support for msvc before 15.3.
2022-03-17 01:38:58 +00:00
Georg Lehmann f1efc9dc9f [dxso] Emit spirv OpCross if we can. 2022-03-16 19:13:09 +00:00
Georg Lehmann 630fee59fc [dxso] Implement zerowins for Lerp.
Fixes #2545.
2022-03-16 19:13:09 +00:00
Joshua Ashton 1f88ee595f [d3d9] Don't expose D32 format
Not supported anywhere except REF device it seems... *sigh*

Supercedes: #2547
2022-03-16 19:11:16 +00:00
Philip Rebohle 4f8da62c34
[dxvk] Fix color write mask normalization
Previously we'd set too many bits by accident here. Also, we should
not modify partial write masks to include unnecessary bits. Only do
this if we can actually promote to a full write mask for consistency.
2022-03-16 19:31:37 +01:00
Liam Middlebrook f92c6ae859 [dxgi] Add DXVK_ENABLE_NVAPI envvar
Add a new environment variable DXVK_ENABLE_NVAPI as an environment-level
override for 'nvapiHack'. This will allow for DLSS (and other
NvAPI-backed features) to be available without the user manually writing
a configuration file, allowing for more seamless integration with
Proton's launch script.
2022-03-16 13:06:25 +01:00
Robin Kertels 115385d1d9 [d3d9] Update buffer seq number in FlushBuffer
How did I miss this?!
2022-03-15 01:24:54 +00:00
Robin Kertels 5f4fc56226 [d3d9] Update texture sequence number AFTER using it 2022-03-13 17:13:00 +00:00
Robin Kertels a6357a254d [d3d9] Fix CS thread synchronization for directly mapped buffers 2022-03-13 17:13:00 +00:00
Philip Rebohle 9eb2393d44
[dxvk] Normalize color write masks for non-RGBA formats 2022-03-13 16:24:53 +01:00
Philip Rebohle 4c429f044f
[util] Add another weeb game to the list of workarounds
Sophie is apparently D3D9 an we already have Lydie and Suelle in there,
so it's just this on missing from that series.
2022-03-13 05:38:06 +01:00
Philip Rebohle caa83247d9
[d3d9] Mark backend image as shared for shared resources
Otherwise, the backend may not transition the image to the correct
layout after each submission.
2022-03-13 02:32:56 +01:00
Robin Kertels bd1a2aa5a1 [dxvk] Force dedicated allocation for exportable images
The Nvidia driver does not set prefers-/requiresDedicatedAllocation
for exportable images on its own.

This makes DXVK ignore the dedicated allocation struct ptr
which also contains VkExportMemoryAllocateInfo or
VkImportMemoryWin32HandleInfoKHR.
2022-03-13 00:43:41 +01:00
Philip Rebohle 59e3c96976
[d3d9] Fix texture formats that can be exported 2022-03-12 22:24:05 +01:00
Derek Lesho 1d1d8adee6
[d3d9] Fix shared handle check for exporting images
Co-authored-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-03-12 21:35:42 +01:00
Philip Rebohle c87660480d
[d3d11] Reimplement R11G11B10 UAV clears without R32 views 2022-03-12 16:23:42 +01:00
Philip Rebohle ee28f145dc
[d3d11] Explicitly handle R32-compatible UAV formats 2022-03-12 16:23:39 +01:00
Derek Lesho 6640cc350c
[d3d9] Add support for shared IDirect3DTexture9 resources. 2022-03-12 16:23:06 +01:00
Derek Lesho 48046e009c
[d3d11] Add support for shared ID3D11Texture2D resources. 2022-03-12 16:23:06 +01:00
Derek Lesho f9d94c82a5
[util] Add helpers for shared resource metadata access. 2022-03-12 16:23:06 +01:00
Derek Lesho 02d3e0d31f
[dxvk] Add shared handle access to DxvkImage memory.
Based off preliminary work from Josh.
2022-03-12 16:23:06 +01:00
Derek Lesho b5014401e7
[dxvk] Enable VK_KHR_EXTERNAL_MEMORY_WIN32 if available. 2022-03-12 16:23:03 +01:00
Philip Rebohle 5d4c8a6b51 [dxso] Fix ExpP instruction on Shader Model 2+ 2022-03-11 22:44:18 +00:00
Joshua Ashton 7151fbd598 [dxvk] Use new [[fallthrough]] attribute 2022-03-10 00:47:38 +01:00
Joshua Ashton b96f65be31 [dxbc] Use new [[fallthrough]] attribute 2022-03-10 00:47:38 +01:00
Joshua Ashton 63bd41f785 [d3d11] Add fallthrough comment to PickFormats
Silences a warning
2022-03-10 00:47:38 +01:00
Joshua Ashton dc6c350cf2 [d3d9] Add fallthrough comment to SetRenderState
Silences a warning
2022-03-10 00:47:38 +01:00
Joshua Ashton f4ab14cafa [dxso] Fix potential fallthrough in RasterizerOut 2022-03-10 00:47:38 +01:00
Joshua Ashton a5b0f2898a [dxso] Fix ExpP fallthrough 2022-03-10 00:47:38 +01:00
Joshua Ashton b2d96ee087 [d3d9] Fix fallthroughs in PickFormats 2022-03-10 00:47:38 +01:00
Joshua Ashton e9b0d5d716 [build] Enable -Wimplicit-fallthrough
I got bit by this in D3D9.
2022-03-10 00:47:38 +01:00
Joshua Ashton 53b9a723ac [d3d9] Set initial dirty state flags
We had a bug where initial state values caused the data to not get sent to the backend.

Let's fix that going forward and dirty everything we possibly can on device creation.
2022-03-09 23:33:12 +00:00
Joshua Ashton d4d4f0ca18 [d3d9] Fix default initialization of some state values
If we end up being the same as what we are, we don't dirty initially.
2022-03-09 23:33:08 +00:00
Philip Rebohle 89b1f025eb
[d3d10] Forward OpenSharedResource to D3D11 implementation
Trivial since the requested IID is passed by the application.
2022-03-04 19:13:30 +01:00
Philip Rebohle 23eead9e99
[meta] Release 1.10 2022-03-04 17:15:51 +01:00
Philip Rebohle b774d4dbea
[meta] Update README 2022-03-04 16:32:33 +01:00
Oschowa bb178baaf1 [util] Enable cached vertex and index buffers for The Evil Within
Large performance win.
2022-03-04 02:19:17 +01:00
Philip Rebohle f14bccc8c3
[util] Use CPU-cached constant buffers for Anno 1800
Sigh.
2022-03-03 17:33:14 +01:00
Philip Rebohle 1b196c24a4
[dxvk] Invalidate buffer in clearBuffer if possible 2022-03-01 21:39:35 +01:00
Philip Rebohle 4c0df63e2d
[meta] Update example configuration file 2022-02-28 23:39:55 +01:00
Philip Rebohle 5822a8de9f
[util] Enable cached vertex and index buffers for FFXIV
Fixes some weird performance issues on the Garlemald map. Doesn't seem
to affect performance in other areas.
2022-02-28 23:33:27 +01:00
Philip Rebohle 2bceeff5f2
[d3d11] Replace apitrace mode option with something more granular
And enable it only for vertex and index buffers in Nier Replicant.
2022-02-28 22:44:10 +01:00
Robin Kertels b42c07253e [d3d9] Fix sysmem readback 2022-02-24 07:49:55 +00:00
Robin Kertels a81c653b42 [d3d9] Fix synchronization after readback 2022-02-22 21:49:28 +00:00
Philip Rebohle a37cd46491
[util] Set maxDynamicImageBufferSize for Total War: Warhammer III
Massively increases performance since the game otherwise keeps
uploading a huge 48 MiB texture in every frame.
2022-02-22 05:48:25 +01:00
Philip Rebohle 603828951c
[meta] Update example config file 2022-02-22 05:32:16 +01:00
Philip Rebohle dbd4dad095
[d3d11] Introduce d3d11.maxDynamicImageBufferSize option 2022-02-22 05:31:27 +01:00
Philip Rebohle 33cf522647
[d3d11] Use appropriate memory types for directly mapped images 2022-02-22 05:31:20 +01:00
Philip Rebohle 177e70949c
[d3d11] Apply apitrace mode to image upload buffers 2022-02-22 01:30:43 +01:00
Robin Kertels 29d8812709 [d3d9] Don't set NeedsReadback for POOL_SYSMEM textures
... or in SetRenderTarget because we always do readback for render targets.
2022-02-21 13:43:04 +00:00
Robin Kertels b163a99bde [d3d9] Clean up texture locking
We had two code paths that largely did the same.
2022-02-21 00:08:41 +00:00
Robin Kertels dde83717f1 [d3d9] Rename WrittenByGPU to NeedsReadback 2022-02-21 00:08:41 +00:00
Robin Kertels 40444c1f50 [d3d9] Unify texture uploads 2022-02-21 00:08:41 +00:00
Robin Kertels 8b9db26536 [util] Add computeMipLevelOffset 2022-02-21 00:08:41 +00:00
Philip Rebohle 22b8d7a4d3
[tests] Allow includes when compiling HLSL shaders 2022-02-20 21:37:09 +01:00
Philip Rebohle 49e5357a87
[hud] Greatly simplify frame time graph rendering 2022-02-20 15:58:29 +01:00
Philip Rebohle 0709c5f5c7
[hud] Greatly simplify text rendering in the HUD 2022-02-20 15:58:29 +01:00
Philip Rebohle 8ce83cabca
[dxvk] Only mark transfer buffers as transient
Otherwise we may accidentally catch things like uniform buffers as well.
2022-02-20 15:58:26 +01:00
Joshua Ashton ccecc664ab [meta] Bump arch-mingw-github-action to v7 2022-02-20 03:39:08 +00:00
Robin Kertels fd23dcef64 [d3d9] Disable direct buffer mapping for RE games 2022-02-20 03:30:03 +00:00
Robin Kertels cf4c5c3422 [d3d9] Add option to disable direct buffer mapping 2022-02-20 03:30:03 +00:00
Robin Kertels 6d71eea516 [d3d9] Store buffer map mode in D3D9CommonBuffer 2022-02-20 03:30:03 +00:00
Robin Kertels 97ae14b6a0 [d3d9] Synchronize only to given sequence number in WaitForResources 2022-02-20 03:29:31 +00:00
Robin Kertels 917a8d00a2 [d3d9] Track last staging resource usage with a sequence number 2022-02-20 03:29:31 +00:00
Robin Kertels c12cd1952c [d3d9] Handle different mip chain lengths in UpdateTexture 2022-02-20 03:29:04 +00:00
Philip Rebohle 80f744549f
[dxvk] Get rid of spinlock when allocating GPU events
This is not performance-critical
2022-02-20 01:16:04 +01:00
Philip Rebohle 0ade12dc83
[dxvk] Use lock-free list for render pass instances
And replace the spin lock with a regular mutex.
2022-02-20 00:04:06 +01:00
Philip Rebohle 477cb617ac
[dxvk] Use lock-free list for compute pipeline lookup 2022-02-19 17:36:42 +01:00
Philip Rebohle 67e2ee1b26
[dxvk] Use lock-free list for graphics pipeline lookup
And use a proper mutex if we do have to synchronize,
so that we can avoid busy-waits.
2022-02-19 17:36:42 +01:00
Philip Rebohle a4fe43462c
[dxvk] Introduce lock-free list 2022-02-19 17:36:39 +01:00
Philip Rebohle c9750f6657
[dxvk] Don't use spinlocks for CS chunk pool
No reason to anymore since SRWLocks are fast enough here.
2022-02-19 16:57:09 +01:00
Philip Rebohle 520d62903a
[dxvk] Remove null check when setting vertex stride
Move the responsibility to the front-end instead.
2022-02-19 13:29:59 +01:00
Philip Rebohle 8e11630370
[d3d11] Set zero stride when binding null vertex buffer 2022-02-19 13:20:36 +01:00
Philip Rebohle 146fbd492f
[dxvk] Free existing staging buffer before creating a new one 2022-02-18 18:13:28 +01:00
Philip Rebohle 17a1b0ad44
[d3d11] Consider empty CS chunks when tracking resources
Avoids deadlocks if we track multiple resources and flush in between.
2022-02-18 14:21:53 +01:00
Philip Rebohle 9af3dce304
[dxvk] Track buffer as used in initBuffer
Git ate my commit when I was testing something...
2022-02-17 23:42:31 +01:00
Philip Rebohle 6ae5488157
[d3d9] Use initBuffer method 2022-02-17 20:58:31 +01:00
Philip Rebohle 18a960a1e1
[d3d11] Use initBuffer method 2022-02-17 20:58:31 +01:00
Philip Rebohle 080aa1a989
[dxvk] Add initBuffer method 2022-02-17 20:58:31 +01:00
Philip Rebohle f7e021f791
[dxvk] Add command buffer parameter to cmdFillBuffer 2022-02-17 20:58:31 +01:00
Philip Rebohle 102bceb30c
[dxvk] Remove unused clear methods 2022-02-17 20:58:31 +01:00
Philip Rebohle 752f98cf00
[d3d9] Use initImage to clear uninitialized image resources 2022-02-17 20:58:31 +01:00
Philip Rebohle 6d0e5dfd21
[d3d11] Use initImage to clear uninitialized image resources 2022-02-17 20:58:31 +01:00
Philip Rebohle 464c6810b3
[dxvk] Repurpose initImage method
This is now supposed to clear images of any type, and only to be
used for resource initialization after creation.
2022-02-17 20:58:31 +01:00
Philip Rebohle 34fd16b8f2
[d3d11] Add implicit flush after tracking sequence numbers
Flushing early when using a tracked resource may reduce stalls.
2022-02-16 20:49:00 +01:00
Philip Rebohle 2dfdc5ac3b
[d3d11] Enable stall tracking for timestamp queries
Because games are dumb and don't understand that the GPU doesn't
work synchronously with the render thread.
2022-02-16 19:59:11 +01:00
Philip Rebohle d45f5a8d79
[d3d11] Handle subresource field in copy/move operations
Derp.
2022-02-15 13:00:10 +01:00
Philip Rebohle e70f9f92a6
[util] Enable apitrace mode for Nier Replicant
Game is broken and reads back dynamic vertex/index buffers over PCI-E.
2022-02-14 09:20:41 +01:00
Philip Rebohle 4e464327ef
[util] Bump maxImplicitDiscardSize for Quantum Break
Otherwise we're synchronizing and frame times are garbage.
2022-02-14 04:21:46 +01:00
Philip Rebohle e1b3bc45ce
[d3d11] Add d3d11.maxImplicitDiscardSize option 2022-02-14 04:17:56 +01:00
Philip Rebohle 63bf928ab5
[hud] Display GPU synchronization in HUD 2022-02-14 03:28:45 +01:00
Philip Rebohle 4d9b464f7c
[d3d9] Use new waitForResource method 2022-02-14 03:15:47 +01:00
Philip Rebohle 2f80f8847e
[d3d11] Use new waitForResource method 2022-02-14 03:15:47 +01:00
Philip Rebohle 0c99b17081
[dxvk] Introduce DxvkDevice::waitForResource
Blocks on the queue thread's condition variable instead of busy-waiting,
and tracks synchronization with new stat counters. Cleanup is rearranged
to minimize delays before signals and resources are notified.
2022-02-14 03:15:47 +01:00
Philip Rebohle 25ebf94873
[dxvk] Display barrier count in draw call HUD item 2022-02-14 01:10:15 +01:00
Philip Rebohle 316e252a27
[dxvk] Add stat counter for pipeline barriers 2022-02-14 01:08:55 +01:00
Philip Rebohle b5078a7ec0
[dxvk] Reduce context staging buffer size to 4 MiB
Same idea as before, just create a temporary buffer for larger resources.

This can avoid frequent Vulkan memory allocations and deallocations since
many small buffers are more likely to fit into a single memory chunk than
a small number of large buffers, thus reducing the overall memory footprint.
2022-02-14 01:01:34 +01:00
Philip Rebohle 08ecd49c66
[dxvk] Don't suballocate large staging buffer allocations
Otherwise we'll risk wasting almost half the staging buffer memory.
Creating a temporary buffer is cheap enough, so just do that.
2022-02-14 01:00:48 +01:00
Philip Rebohle b9201db554
[dxvk] Remove unused trimStagingBuffers method 2022-02-13 02:08:20 +01:00
Philip Rebohle 95b7e6c030
[dxvk] Rework HUD font texture initialization
We really shouldn't need a separate context for this.
2022-02-13 02:08:20 +01:00
Philip Rebohle 425fce9200
[dxvk] Introduce transient memory flag for staging buffers
Potentially reduces fragmentation by putting short-lived staging buffers
and sysmem resources created by the application into different memory pools.
2022-02-13 02:08:20 +01:00
Philip Rebohle 9d4be00fa7
[dxvk] Allow large sysmem allocations on 64-bit platforms again
Since we frequently discard staging buffers now, having larger chunks
is actually beneficial again.
2022-02-13 02:08:20 +01:00
Philip Rebohle d262bebd90
[dxvk] Remove DxvkStagingDataAlloc
Unused and overly clunky.
2022-02-13 02:08:20 +01:00
Philip Rebohle 8518572d13
[dxvk] Use DxvkStagingBuffer in DxvkContext 2022-02-13 02:08:20 +01:00
Philip Rebohle 1b88bc624a
[dxvk] Remove unused updateImage function 2022-02-13 02:08:20 +01:00
Philip Rebohle 3b833988fe
[dxvk] Use staging buffer for gamma ramp uploads 2022-02-13 02:08:19 +01:00
Philip Rebohle 80c5b61e26
[d3d11] Use DxvkStagingBuffer in D3D11DeviceContext 2022-02-13 02:08:19 +01:00
Philip Rebohle 0bc19472e8
[dxvk] Introduce DxvkStagingBuffer 2022-02-13 02:08:19 +01:00
Philip Rebohle 82518de4b4
[dxvk] Discard buffer slice in copyBuffer if possible 2022-02-13 02:08:19 +01:00
Philip Rebohle 5e763853e5
[dxvk] Introduce tryInvalidateDeviceLocalBuffer 2022-02-13 02:08:19 +01:00
Philip Rebohle 6a3de28f94
[dxvk] Repurpose updateBuffer
Only allow it for very small updates where scheduling a copy command would
likely be slower. Some drivers have special paths for tiny updates.
2022-02-13 02:08:19 +01:00
Philip Rebohle a03c038f03
[d3d9] Exit early in ProcessVertices if the vertex count is 0
We don't want to pass a zero-sized copy to the backend.
2022-02-13 02:08:19 +01:00
Philip Rebohle 26381fd5df
[d3d11] Only use updateBuffer for very small buffer updates
Otherwise we may end up with significant copy overhead on the CS thread.
2022-02-13 02:08:19 +01:00
Philip Rebohle ac9ed96457
[hud] Add HUD item to show CS thread stats 2022-02-13 02:07:48 +01:00
Philip Rebohle b02496a8f4
[dxvk] Add CS thread stat counters 2022-02-13 02:07:48 +01:00
Philip Rebohle d96c5a1076
[dxvk] Store DXVK device inside DxvkCsThread object 2022-02-13 02:07:48 +01:00
Philip Rebohle 52666a33c6
[dxvk] Expose a way to increment stat counters
In case the counters come from external sources.
2022-02-13 02:07:45 +01:00
Philip Rebohle b6121c84aa
[d3d11] Avoid GPU synchronization on mapping images when possible 2022-02-11 18:17:35 +01:00
Philip Rebohle 3f16de157b
[d3d11] Avoid GPU synchronization on mapping buffers when possible 2022-02-11 18:17:35 +01:00
Philip Rebohle c82b504e52
[d3d11] Further simplify D3D11DeferredContextMapEntry
And no longer create a strong reference to the given resource.
2022-02-11 18:17:35 +01:00
Philip Rebohle 2dcdd20517
[d3d11] Change D3D11ResourceRef constructor to be more useful 2022-02-11 18:17:35 +01:00
Philip Rebohle 0364a79eb0
[d3d11] Optimize Unmap on immediate contexts 2022-02-11 18:17:35 +01:00
Philip Rebohle 5a6711ed1d
[d3d11] Synchronize only to given sequence number in WaitForResources
Avoids costly thread synchronization when mapping staging resources
for reading, as well as some other scenarios.
2022-02-11 18:17:35 +01:00
Philip Rebohle afe1840c74
[d3d11] Track resources when dispatching Cubin shaders as well 2022-02-11 18:17:35 +01:00
Philip Rebohle bb16734a43
[d3d11] Implement sequence number tracking on deferred contexts 2022-02-11 18:17:35 +01:00
Philip Rebohle 2eeb7295c8
[d3d11] Increment sequence number when submitting command lists
This does not do any tracking on deferred contexts just yet.
2022-02-11 18:17:35 +01:00
Philip Rebohle d33dac569c
[d3d11] Track last staging resource usage with a sequence number 2022-02-11 18:17:35 +01:00
Philip Rebohle 55a6b80919
[d3d11] Add method to query D3D11 resource dimension from texture 2022-02-11 18:17:35 +01:00
Philip Rebohle d870b6ff38
[d3d11] Store ID3D11Resource interface in D3D11CommonTexture
Going full circle here, but it's actually useful now.
2022-02-11 18:17:35 +01:00
Philip Rebohle 9c32beccdc
[d3d11] Store buffer map mode in D3D11Buffer
Matches what we do for textures, and makes it so that we don't
have to dereference the resource pointer to figure this out.
2022-02-11 18:17:35 +01:00
Philip Rebohle 2db56fa160
[d3d11] Add D3D11ResourceRef
Implements private ref counting for arbitrary resource types.
2022-02-11 18:17:35 +01:00
Philip Rebohle 391c9e13ca
[d3d11] Add ResourceAddRef/ReleasePrivate with known resource type 2022-02-11 18:17:35 +01:00
Philip Rebohle 6b91b87dba
[dxvk] Reorganize DxvkBuffer data structure
Should hopefully reduce CPU cache conflicts.
2022-02-11 18:17:34 +01:00
Philip Rebohle 37f3d9208b
[dxvk] Introduce sequence numbers for CS submissions 2022-02-11 18:17:34 +01:00
Philip Rebohle bc137fdf37
[util] Enable apitrace mode for AoE2 Definitive Edition
Fixes #2491.
2022-02-11 18:15:46 +01:00
Georg Lehmann 939040b178 [build] Avoid meson warning.
WARNING: You should add the boolean check kwarg to the run_command call.
         It currently defaults to false,
         but it will default to true in future releases of meson.

Stupid change, stupid warning, stupid fix.
2022-02-10 15:18:25 +01:00
Krzysztof Bogacki 4f3bb3df12 [build] Use MSBuild backend on Windows CI
Also merge Prepare and Build steps to prevent environment variable leaks and apply some minor formatting changes.
2022-02-09 13:29:24 +01:00
Philip Rebohle 6c862b63a2
[d3d11] Optimize UpdateSubresource for small buffer updates
Some games use UpdateSubresource to upload constant buffers in
between draws, so this path should be as fast as possible.

Also fixes a potential issue when using D3D11_COPY_NO_OVERWRITE
on deferred contexts, since the Map requirements don't hold here.
2022-02-07 16:14:02 +01:00
Philip Rebohle b746e1352b
[d3d11] Implement suballocation from staging buffer for small updates 2022-02-07 16:14:01 +01:00
Philip Rebohle 7cf78a2c75
[d3d11] Fix confusing code in deferred context Map
This did work, but we shouldn't use an object that was already moved.
2022-02-07 16:14:01 +01:00
Philip Rebohle e4dbd1e337
[d3d11] Remove unused parameters from deferred context Map functions 2022-02-07 16:13:58 +01:00
Krzysztof Bogacki b5d7b42e65 [d3d11] Add D3D11On12CreateDevice stub 2022-02-07 03:21:43 +01:00
Philip Rebohle 2673d74270
[dxvk] Add version fixup for proprietary Intel drivers 2022-02-02 14:56:59 +01:00
Philip Rebohle badc53b1bb
[dxvk] Rework driver version fixup to use driver ID instead of vendor ID 2022-02-02 14:56:55 +01:00
Georg Lehmann 58909e4582 [dxvk] Fix MSVC build. 2022-02-01 18:50:00 +00:00
Krzysztof Bogacki c50a650b13 [build] MSVC CI 2022-02-01 18:50:00 +00:00
Robin Kertels b220c8989b [d3d9] Only enable FETCH4 for single channel formats 2022-01-28 21:34:18 +00:00
Robin Kertels 5b39f0307e [d3d11] Add FL12+ enum names 2022-01-27 19:42:14 +01:00
Philip Rebohle 1216466be7
[meta] Release 1.9.4 2022-01-24 15:08:49 +01:00
Philip Rebohle b4e4eca99f
[dxvk] Remove options to disable OpenVR/XR support
No longer needed since we no longer load vrclient.so into the game's
process just to query extensions.
2022-01-24 14:50:04 +01:00
Georg Lehmann 4e6db51230 [d3d9] Fix float emulation detection.
ffs
2022-01-21 16:08:00 +01:00
Georg Lehmann 14df2f7251 [d3d9] Enable strict float emulation by default for new radv. 2022-01-20 23:47:41 +00:00
Philip Rebohle a268de51e3
[dxvk] Don't shrink HVV heap if it's the main video memory heap
May fix issues on RBAR-enabled Nvidia systems.
2022-01-16 02:47:51 +01:00
Philip Rebohle 703cc78cc0
[util] Disable NVAPI hack for God of War
Needed for DLSS support.
2022-01-14 15:21:49 +01:00
Philip Rebohle 42c06ceb51
[util] Enable performance options for God of War 2022-01-14 13:16:06 +01:00
Philip Rebohle 08c7bab431
[dxvk] Reduce maximum size of multi-slice buffers 2022-01-13 18:40:27 +01:00
Philip Rebohle 71e7faef69
[dxvk] Reduce size up to which device-local buffers can be invalidated 2022-01-13 18:39:31 +01:00
Philip Rebohle db2e32ede6
[dxvk] Be smarter about which chunks to free
Freeing all empty chunks immediately may cause issues if an app constantly
allocates and frees a small number of resources that don't fit into any
existing chunk, so try to keep one around. Aggressively free everything
under memory pressure if necessary.
2022-01-13 18:39:31 +01:00
Philip Rebohle 15ab07ab94
[dxvk] Replace allocation priority with allocation flags 2022-01-13 18:39:31 +01:00
Philip Rebohle d34bbdb58e
[dxvk] Free empty memory chunks 2022-01-13 18:22:44 +01:00
Philip Rebohle e6442d64be
[dxvk] Display allocated memory in HUD again 2022-01-13 18:22:44 +01:00
Philip Rebohle a70a35406e
[meta] Release 1.9.3 2022-01-11 13:28:28 +01:00
Georg Lehmann f5744284eb [d3d9] Dirty FF vertex shader if any D3D9VertexDeclFlags change.
The vertex shader depends on all of these in some way.
2022-01-10 22:06:15 +00:00
Christopher Egert b1a6cbad7f [d3d9] Update FFVS when D3DFVF_PSIZE is specified.
This fixes #2387
2022-01-10 20:05:41 +00:00
Robin Kertels 4cdee69bc9 [d3d9] Always upload all managed texture mips after AddDirtyBox call
Co-authored-by: Paul Gofman <gofmanp@gmail.com>
2022-01-10 18:55:08 +00:00
Philip Rebohle b53c3057e1
[dxgi] Fix refresh rate filtering in FindClosestMatchingMode
We need to operate on the pre-filtered list, or otherwise we may run into
problems where not all refresh rates are supported for all display modes.
2022-01-10 14:45:19 +01:00
dosse91 55c4aba4d0 Added config for James Cameron's Avatar (DX9) 2022-01-10 14:40:53 +01:00
Joshua Ashton 14f93d7d17 [build] Update arch-mingw-github-action to v6 2022-01-10 11:44:59 +00:00
Joshua Ashton ecd7b67069 [d3d11] Lock context before EmitCs for annotations 2021-12-21 03:09:08 +01:00
Philip Rebohle 3bfad1e70e
[dxvk] Explicitly intiialize framebuffer info 2021-12-20 23:47:50 +01:00
Supreeeme 34774f4ea4 Enabled strict float emulation for BlazBlue Centralfiction 2021-12-15 09:44:22 +00:00
Robin Kertels c13395db97 [util] Enable strict float emulation for a bunch of games
... that are known to be broken without it.
2021-12-05 16:49:19 +00:00
Robin Kertels 6c17b8801c [d3d9] Add strict option to float emulation setting 2021-12-05 16:49:19 +00:00
Robin Kertels eb9dfcedbd [util] Move toLower transform to function 2021-12-05 16:49:19 +00:00
Philip Rebohle 11f8b8ba44 [dxso] Handle multiplication by zero when emitting clip distances 2021-12-05 16:49:19 +00:00
Philip Rebohle 337360cdc6 [dxso] Handle multiplication by zero in TexM*Tex instructions 2021-12-05 16:49:19 +00:00
Philip Rebohle a9515d3530 [dxso] Handle multiplication by zero in matrix ALU instructions 2021-12-05 16:49:19 +00:00
Philip Rebohle 8063e27c08 [dxso] Handle multiplication by zero in cross product 2021-12-05 16:49:19 +00:00
Philip Rebohle 7b2b8ceff3 [dxso] Handle multiplication by zero in dst instruction 2021-12-05 16:49:19 +00:00
Philip Rebohle ebc5326ed5 [dxso] Correctly handle multiplication by zero 2021-12-05 16:49:19 +00:00
Robin Kertels 804eca9cad [d3d9] Respect shader defined constants for HWVP/PS buffer binding range 2021-11-30 01:57:22 +00:00
Robin Kertels ce1c66d7dc [dxso] Omit relative constant range check when possible
We can just rely on robustness2 when it's supported.
2021-11-30 01:57:22 +00:00
Robin Kertels 0061139652 [d3d9] Copy shader defined constants into SWVP UBO
Co-authored-by: Christopher Egert <cme3000@gmail.com>
Co-authored-by: Georg Lehmann <dadschoorse@gmail.com>
2021-11-30 01:57:22 +00:00
Robin Kertels 39039f9ac8 [dxso+d3d9] Clean up texture slots 2021-11-30 01:57:22 +00:00
Paul Gofman b672c07a93 [d3d9] Send WM_ACTIVATEAPP messsage on WM_SIZE. 2021-11-30 01:48:24 +00:00
Philip Rebohle 1abd205216
[d3d11] Compute image data layout for unmapped textures
We sometimes need this information when uploading image data. Fixes #2380.
2021-11-29 16:55:35 +01:00
Philip Rebohle b6cd6aaecc
[d3d11] Fix depth aspect not being applied to some D16_UNORM views 2021-11-29 15:39:41 +01:00
Georg Lehmann 1fff48f509 [meta] Be clearer about mingw threading support 2021-11-29 00:31:38 +01:00
Georg Lehmann 97f03127e9 [dxso] Remove empty dxso_helpers.h 2021-11-25 21:50:59 +00:00
Georg Lehmann c2a66c043a [dxvk] Remove empty dxvk_main 2021-11-25 21:50:59 +00:00
Georg Lehmann 12249fd330 [dxso] Fix constant buffer debug names 2021-11-11 23:54:05 +00:00
Joshua Ashton 4c0eee89e4 [d3d9] Use clamped LOD for creating new views 2021-11-11 23:53:38 +00:00
Joshua Ashton c22dcdbaa3 [d3d9] Clamp LOD in calls to SetLOD
MSDN says this is clamped and returns the clamped value.

Closes: #1869
2021-11-11 23:52:35 +00:00
Joshua Ashton 5d4b7db9e6 [d3d9] Fix = alignent in CreateView 2021-11-11 23:51:59 +00:00
Philip Rebohle 06eb52387a
[meta] Fix configuration sample 2021-11-10 17:01:24 +01:00
Philip Rebohle 2abe2132a6
[dxvk] Implement framebuffer cache
Reduces the number of object allocations per frame.
2021-11-09 18:09:50 +01:00
Philip Rebohle a987b729a7
[dxvk] Introduce DxvkFramebufferKey
Can be used to cache framebuffer objects.
2021-11-09 17:49:22 +01:00
Philip Rebohle 2527ea45b9
[dxvk] Refactor framebuffer creation 2021-11-09 16:37:33 +01:00
Philip Rebohle f1aad6cb7b
[dxvk] Remove frame buffer from context state 2021-11-09 16:37:33 +01:00
Philip Rebohle 5b725205ef
[dxvk] Introduce DxvkFramebufferInfo
Stores all info that is currently held by the DxvkFramebuffer class,
but is not heap-allocated and will not create an actual framebuffer
object.
2021-11-09 16:37:31 +01:00
Philip Rebohle 1fd037cf29
[dxvk] Fix load aspect mask in render pass creation 2021-11-05 16:09:05 +01:00
Philip Rebohle 552b29ca0c
[include] Update Vulkan headers to 1.2.197. 2021-11-03 14:11:23 +01:00
Philip Rebohle 4c88335f66
[util] Shrink Nvidia HVV heap for Final Fantasy XIV
Fixes #2210.
2021-11-03 13:27:39 +01:00
Philip Rebohle 778aee0372
[dxvk] Rework Nvidia HVV option 2021-11-02 00:52:25 +01:00
Joshua Ashton 8912c7adb0 [d3d9] Fix long driver/device names not being null terminated
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-22 02:58:53 +00:00
Joshua Ashton 409a6f5c3f [d3d11] Use atomics for NVX handles
Primarily to make DXVK native happy, but also much cleaner.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-22 03:15:03 +02:00
Georg Lehmann b163503f7c [dxso] Respect SM2+ sampler source swizzle. 2021-10-20 17:43:52 +00:00
Robin Kertels 79a20c463f [util] Enable apitrace mode for Crysis 3 Remastered 2021-10-18 18:23:58 +02:00
Robin Kertels 7f89fe1406 [d3d9+utils] Remove swvp hack 2021-10-15 10:54:18 +01:00
Robin Kertels 530f87f158 [d3d9+dxso] Rely on robustness for unset HW VS & PS constants 2021-10-15 10:54:18 +01:00
Robin Kertels 869f75895c [d3d9+dxso] Switch constant buffer order 2021-10-15 10:54:18 +01:00
Robin Kertels 791d533a1d [d3d9+dxso] Rely on robustness for unset SWVP constants 2021-10-15 10:54:18 +01:00
Robin Kertels 01f633289b [d3d9] Use mapped slice when locking POOL_DEFAULT textures
Fixes an issue where the game would end up using the wrong
buffer slice if it previously mapped the same texture with DISCARD.

Fixes #2329
2021-10-15 10:46:40 +01:00
Philip Rebohle 3e64e1b3f5
[dxvk] Explicitly stop state cache worker threads on device destruction
Otherwise, the workers may access objects that are being destroyed an
app thread.
2021-10-08 00:54:59 +02:00
Paul Gofman 24eb875f02 [dxgi] Return success from DxgiSwapChain::Present1() if window is destroyed 2021-10-07 20:34:37 +02:00
oltolm 1ef4e60b69 [dxvk] fix barrier tracking code 2021-10-06 02:59:31 +02:00
TotalCaesar659 581f09696e Update URL to HTTPS 2021-10-01 15:57:50 +02:00
Philip Rebohle ec18532ed4
[dxvk] Use new barrier tracking for images 2021-10-01 15:52:41 +02:00
Philip Rebohle 30bc137f9c
[dxvk] Use new barrier tracking for buffers 2021-10-01 15:52:41 +02:00
Philip Rebohle 195b7d7155
[dxvk] Add fast versioned hash table for barrier tracking 2021-10-01 15:52:41 +02:00
Philip Rebohle 714ca48271
[dxvk] Work around device creation failure with CUDA interop extensions 2021-10-01 15:43:19 +02:00
Philip Rebohle b36fa75d1d
[dxvk] Disable CUDA interop extensions on 32-bit builds 2021-10-01 15:32:40 +02:00
Philip Rebohle 8225891751
[dxvk] Fix copy-paste mistake when enabling bufferDeviceAddress feature 2021-10-01 15:32:40 +02:00
Philip Rebohle aa4b7c9f92
[dxvk] Rework 32-bit check 2021-10-01 14:18:42 +02:00
Philip Rebohle 7193962381
[d3d11] Enable VK_KHR_buffer_device_address if necessary
Just enabling the extension doesn't necessarily do anything.
2021-10-01 14:12:17 +02:00
Philip Rebohle 1fefdf2ab6
[dxvk] Add VK_KHR_buffer_device_address extension info 2021-10-01 14:12:17 +02:00
Robin Kertels c8341e4be3 [d3d9] Fix lenient clears 2021-09-28 21:14:02 +01:00
Robin Kertels c4449faf5a [d3d9] Don't clamp clears to the size of RT 0 2021-09-27 21:57:15 +01:00
Robin Kertels 29ee1a74e6 Revert "[d3d9] Avoid depth degenerate viewports"
This reverts commit 78d22cc7a5.
2021-09-27 14:55:49 +01:00
Robin Kertels d799b44d91 [dxso] Ensure pow base is >= 0 in LIT 2021-09-26 22:33:01 +01:00
Robin Kertels 2735988fa2 [d3d11] Only use cube arrays for regular cubemap views when enabled 2021-09-26 23:17:16 +02:00
Adam Moss 86148ec070
[d3d11,dxvk] Implement DXVK pieces required for DX11 DLSS support
Notably, fairly generic functions to create/launch/destroy Cuda kernels,
and methods to fetch GPU virtual addresses and handles for DX11 resources.

Note: Requires some corresponding dxvk-nvapi changes for DLSS to
be initialized successfully.
2021-09-24 15:10:07 +02:00
Philip Rebohle 3a712b766e
[dxvk] Introduce accessMemory for barrier tracking 2021-09-24 15:07:59 +02:00
Philip Rebohle b79ce7af8a
[meta] Release 1.9.2 2021-09-20 15:07:25 +02:00
Philip Rebohle 9eb83c187c [util] Make bool and tristate options case-insensitive 2021-09-19 19:21:49 +02:00
Philip Rebohle dd7ffbc803
[d3d11] Also validate draw buffer for DispatchIndirect
Oversight.
2021-09-12 16:18:25 +02:00
Philip Rebohle de7fb51e64
[d3d11] Validate indirect draw buffer size
Otherwise, if the draw parameter offset is out of bounds, we
may hang the GPU.

Fixes #2286.
2021-09-12 01:23:04 +02:00
Adam Moss 3c7e5c9300 Update Vulkan headers to v182 2021-09-11 15:00:45 +02:00
Georg Lehmann 827c7a892c [util] Replace countof with std::size 2021-09-10 11:58:46 +01:00
Philip Rebohle 5f9d5f1053
[dxvk] Fix IgnoreWriteAfterWritw check for indirect dispatches 2021-09-10 02:50:52 +02:00
Philip Rebohle 2f01df82d2
[dxbc] Fix invalid NonReadable/NonWritable decorations 2021-09-09 19:35:51 +02:00
Philip Rebohle 5db76784bd
[dxbc] Accurately determine access flags for UAVs 2021-09-09 15:53:02 +02:00
Philip Rebohle c9f7ccc7f9
[dxvk] Fix hazard detection for shader resources 2021-09-09 14:58:04 +02:00
Philip Rebohle 67391a7bb0
[d3d11] Introduce d3d11.ignoreGraphicsBarriers option 2021-09-09 14:28:25 +02:00
Philip Rebohle 5109000747
[dxvk] Add IgnoreGraphicsBarriers flag 2021-09-09 14:28:25 +02:00
Philip Rebohle fe68b43335
[dxvk] Deduplicate buffer and image slices in barrier array
Fixes some major performance issues when dealing with many
consecutive dispatch calls.
2021-09-09 14:24:55 +02:00
Vincent Grande f0e9700f34
[d3d10] Add missing include 2021-09-03 12:54:50 +02:00
Philip Rebohle c0a7143d1b
[vulkan] Fix missing include
Fixes #2269.
2021-09-02 16:34:55 +02:00
pingubot 69588b02fe
Update config.cpp (#2256) 2021-08-27 13:10:24 +02:00
Georg Lehmann b498040f7d [d3d9] Disable explicit front buffer for Fantasy Grounds 2021-08-26 09:26:10 +01:00
tayarani 2786bbda64
Fix DxvkShaderConstData garbage pointer for default constructor 2021-08-25 02:20:26 +02:00
Mahdi Tayarani ae881981f9 Fix raw() accessor on the Flags class
The current implementation has a bug where it casts the underlying
int type to a uint32_t. The is incorrect for enums like DxvkShaderFlag
which are based on uint64_t.
2021-08-24 22:23:20 +02:00
Georg Lehmann 4b50d24231 [util] Force 60 fps for Sine Mora EX 2021-08-24 19:42:55 +02:00
Georg Lehmann ed70f9a07c [d3d9] Support unsupported formats in LockRect 2021-08-23 17:38:50 +01:00
Georg Lehmann 82d40f5bba [d3d9] Return a pointer in GetUnsupportedFormatInfo 2021-08-23 17:38:50 +01:00
Philip Rebohle fa4f40a0e6
[dxvk] Remove transform feedback self-dependency from render passes
Fixes a whole bunch of validaton errors since this was technically invalid.
2021-08-23 17:35:58 +02:00
Philip Rebohle 2f5c7562c2
[dxvk] Track transform feedback counter hazards properly
If we avoid needlessly pausing and resuming transform feedback with the
same counters, we can use existing barrier tracking to insert counter
barriers without requiring an invalid render pass self-dependency.
2021-08-23 17:35:58 +02:00
Georg Lehmann 04474b761b [d3d9] Brain-dead gamma ramp validation 2021-08-23 15:41:59 +01:00
Georg Lehmann 3fc1f2cecb [util] Fix MSVC build 2021-08-23 15:41:31 +01:00
Philip Rebohle 50c6974f3a [dxso] Fix gradient instructions for cube maps
We need 3 components in that case. Based on MSDN documentation, texldd
does not support 3D textures so there's no need to worry about those.

Fixes validation errors in Payday.
2021-08-23 13:50:54 +01:00
Alejandro Bringas Martinez d48b33bf95 Fix poor performance in Homefront The Revolution
in certain places when displaying "wide open" and at long range it has a very poor performance of 35-45fps, but with this option it goes up to a stable 60fps on my GTX1060 6Gb
2021-08-19 13:40:05 +02:00
Georg Lehmann 41d0fcff95 [d3d9] Disable projection for PS 1.4 2021-08-19 01:47:42 -07:00
Robin Kertels 956b23c9e9 [d3d9] Use correct pitch to calculate buffer offset 2021-08-18 13:31:00 -07:00
Robin Kertels 97e91b6c0f [d3d9] Respect pitch alignment in GetFrontBufferData 2021-08-18 13:31:00 -07:00
Joshua Ashton 3718cee9eb [d3d9] Clean up texture type tracking
Additionally stops leaky pipelines on PS 1.x shaders from partial mask updates.
2021-08-17 07:02:56 -07:00
Joshua Ashton 64852f05c3 [d3d9] Track fixed function sampler bitfields
Cleans some stuff up a little bit and makes FF draws faster when this gets incorrectly invalidated.
2021-08-17 07:02:56 -07:00
Joshua Ashton c6a4c41d20 [d3d9] Batch texture unbinding 2021-08-17 07:02:56 -07:00
Joshua Ashton a346949304
[d3d9] Remove needless locks in SetTexture and SetSamplerState 2021-08-16 19:09:16 +01:00
Georg Lehmann 789e19d2ac [dxbc] Use BitMask helper 2021-08-16 08:49:46 -07:00
Georg Lehmann b13260c689 [d3d11] Use BitMask helper 2021-08-16 08:49:46 -07:00
Georg Lehmann 6103e3c800 [d3d9] Use BitMask helper 2021-08-16 08:49:46 -07:00
Georg Lehmann b037fc8882 [dxvk] Use BitMask helper 2021-08-16 08:49:46 -07:00
Philip Rebohle ffc351f2f5 [util] Introduce BitMask helper 2021-08-16 08:49:46 -07:00
Joshua Ashton 64f417d6e6 [util] Add bsf helper
For when we know we aren't going to put in a mask of 0, we can use this and get better codegen.
2021-08-16 08:49:46 -07:00
Joshua Ashton b09b912797
[d3d9] Fix unbinding textures
Closes: #2236
2021-08-16 15:33:49 +01:00
Georg Lehmann a75cf2f39d [d3d9] Fix parital DS clears with full RT clear 2021-08-15 19:00:47 +00:00
Georg Lehmann a2330b89d2 [dxso] Implement TexDepth 2021-08-12 02:17:16 +00:00
Joshua Ashton 7acbd0f4e1
[d3d9] Expose D3DPMISCCAPS_CLIPTLVERTS
Matches what we actually do and fixes a Wine test
2021-08-11 12:44:28 +01:00
Joshua Ashton a6156856e5 [d3d9] Don't check for NULL pViewport
This cannot be NULL.
2021-08-11 11:44:09 +00:00
Joshua Ashton 78d22cc7a5 [d3d9] Avoid depth degenerate viewports 2021-08-11 11:44:09 +00:00
Joshua Ashton 5f4f4d57df
[d3d9] Fix initial mapping of images written by GPU 2021-08-11 12:14:17 +01:00
Joshua Ashton 679d703efc [d3d9] Fix upload race with default image mapping
Fixes a Wine test
2021-08-11 11:53:17 +02:00
Robin Kertels 60a7047550 [d3d9] Fix D3DLOCK_READONLY handling with evictManagedOnUnlock 2021-08-11 07:35:39 +00:00
Joshua Ashton 2c8099adf1
[d3d9] Use Texture2D for CommonTexture resolution
Using the generic texture type was a nice idea in theory, but some compilers did not give it a vtable as it was abstract, resulting in a crash here.
2021-08-11 04:25:29 +01:00
Joshua Ashton ab7fc42f2f
[d3d9] Fix stateblock refcounting 2021-08-11 01:38:50 +01:00
Joshua Ashton a1f0bb99ee
[d3d9] Cleanup D3D9DeviceEx members 2021-08-11 01:38:34 +01:00
Joshua Ashton 5e48035e99
[d3d9] Only bind textures if they are used by the shader 2021-08-11 01:08:13 +01:00
Joshua Ashton c0c1565cba [d3d9, dxso] Alias color and depth samplers and improve tracking
Takes me from 340 -> 460fps in A Hat in Time's main menu when CPU bound.
2021-08-10 23:46:03 +00:00
Joshua Ashton 3f78bde928 [d3d9] Optimize GetCommonTexture 2021-08-10 23:46:03 +00:00
Joshua Ashton 85468a5526 [d3d9] Add extra brackets to fetch4 filter check 2021-08-09 22:54:19 +00:00
Joshua Ashton 674f008e23 [d3d9] Use m_activeTexture mask for SRGB check 2021-08-09 22:54:19 +00:00
Joshua Ashton 1823a098a1 [d3d9] Clean up SetStateSamplerState 2021-08-09 22:54:19 +00:00
Joshua Ashton ea4aa87336 [d3d9] Add unlikelies to rare vendor hacks 2021-08-09 22:54:19 +00:00
Georg Lehmann 1ea79cf136 [d3d9] Only respect relevant bits of D3DRS_STENCILREF 2021-08-09 22:54:06 +00:00
Joshua Ashton 79cf2e875f [dxvk] Avoid needless refcount in updateFramebuffer
Avoids a needless refcount
2021-08-09 15:23:59 +02:00
Joshua Ashton a35f2af5e5 [dxvk] Remove needless refcount in updateTransformFeedbackBuffers 2021-08-09 15:23:59 +02:00
Joshua Ashton 4edaade185 [dxvk] Avoid needless refcount in copyImageFb 2021-08-09 15:23:59 +02:00
Georg Lehmann 8844dc2091 [dxgi] Downgrade format fall back warnings to info 2021-08-09 13:17:43 +02:00
Georg Lehmann b55784acc6 [dxvk] Downgrade missing OpenVR warning to info 2021-08-09 13:17:43 +02:00
Georg Lehmann 152a08191c [d3d9] Downgrade format fall back warnings to info 2021-08-09 13:17:43 +02:00
Joshua Ashton abba425ed0 [d3d9] Optimize MarkTextureBindingDirty with tzcnt loop of m_activeTextures 2021-08-09 09:54:12 +00:00
Joshua Ashton 242b7b6d9c [d3d9, dxso] Remove AlphaTestEnable spec constant
Go based on the func we already have. Avoids wasting a spec const.
2021-08-09 09:52:07 +00:00
Georg Lehmann ada463badc [d3d9] Mark mips as dirty on Clear if needed 2021-08-08 10:27:43 +00:00
Georg Lehmann 92deba0310 [d3d9] Implement D3DTOP_BLENDTEXTUREALPHAPM 2021-08-08 10:12:40 +00:00
Georg Lehmann 9162aa5fdf [d3d9] Captured NULL vertex declarations are not applied 2021-08-08 08:50:00 +00:00
Georg Lehmann 28a07ef445 [d3d9] Validate vertex declaration on draws 2021-08-08 08:50:00 +00:00
Georg Lehmann 8c0003552c [d3d9] Reject depth stencil StrechRect during an active scene 2021-08-08 08:50:00 +00:00
Georg Lehmann 09e5939502 [d3d9] Reject 2 BeginScene + EndScene without Begin 2021-08-08 08:50:00 +00:00
Georg Lehmann 6071e998fd [d3d9] Handle invalid modes in Device::Reset 2021-08-08 08:50:00 +00:00
Georg Lehmann 64c4eea922 [d3d9] Mark texture dirty on SetLod 2021-08-08 02:28:44 +00:00
Georg Lehmann 26516dc904 [d3d9] Fix ColorFill with OffscreenPlainSurface 2021-08-08 02:15:06 +00:00
Joshua Ashton fd50eae5c2 [d3d9] Optimize framebuffer binding with RT mask 2021-08-08 02:14:11 +00:00
Joshua Ashton 2f22c1b53d [d3d9] Optimize clears with rt mask and better ref tracking 2021-08-08 02:14:11 +00:00
Joshua Ashton 072d3a039e [d3d9] Track bound RTs
This also improves active RT hazard tracking by also accounting for NULL
2021-08-08 02:14:11 +00:00
Joshua Ashton e0f9ebf695 [d3d9] Common buffer header cleanups and docs 2021-08-08 02:14:11 +00:00
Joshua Ashton ee11e1af58 [d3d9] Minor buffer code-style cleanups 2021-08-08 02:14:11 +00:00
Joshua Ashton b1b1524737 [d3d9] Adapter cleanups 2021-08-08 02:14:11 +00:00
Joshua Ashton da411c8a48 [d3d9] Move m_lod after m_subresources 2021-08-08 02:14:11 +00:00
Joshua Ashton 4a569918c0 [d3d9] Track NULL state per-subresource 2021-08-08 02:14:11 +00:00
Joshua Ashton d6bc355782 [d3d9] Fix code-style of D3D9Subresource and inline 2021-08-08 02:14:11 +00:00
Joshua Ashton f4ce795fe7 [d3d9] Do a little packing of subresource members 2021-08-08 02:14:11 +00:00
Joshua Ashton d922e261e8 [d3d9] Make D3D9_COMMON_TEXTURE_DESC smaller 2021-08-08 02:14:11 +00:00
Joshua Ashton 3592d7b48f [d3d9] Return const buffer references in D3D9CommonBuffer
Avoids some needless refcounting
2021-08-08 02:14:11 +00:00
Joshua Ashton fb7035f16a [d3d9] Remove D3D9CommonBuffer::GetDesc
We already have ::Desc()
2021-08-08 02:14:11 +00:00
Joshua Ashton 750639d3b6 [d3d9] Return const view references in D3D9Subresource 2021-08-08 02:14:11 +00:00
Joshua Ashton 3cbac8923f [d3d9] Return const refs for image/buffers + format mapping in CommonTexture
Avoids needless Rc ref counts and copies of that fairly large structure.
2021-08-08 02:14:11 +00:00
Georg Lehmann 23873cbb57 [d3d9] Disable primitive restart 2021-08-08 02:05:27 +00:00
Georg Lehmann fdc2e2e78f [d3d9] Fix NEVER alpha testing 2021-08-07 21:54:30 +00:00
Georg Lehmann be3c248c8b [d3d9] Don't mark mips as dirty when the texture doesn't have automatic mips 2021-08-07 21:53:34 +00:00
Georg Lehmann 973678e6bf [d3d9] Only look at the last bit for D3DSAMP_SRGBTEXTURE 2021-08-07 13:09:13 +00:00
Georg Lehmann a1fbcf35de [d3d9] Ignore clear with Count == 0 and non-NULL rect 2021-08-06 18:54:17 +00:00
Philip Rebohle 546bd6f462
[dxbc] Fix swizzles in lod instruction
Fixes #1764.
2021-08-05 22:57:58 +02:00
Philip Rebohle 97ef8a6fb3
[dxvk] Remove Win32 fence
Replaced with CallbackFence.
2021-08-05 22:57:58 +02:00
Philip Rebohle 56395c9bc8
[d3d11] Re-implement frame latency events using Win32 semaphore
Matches native DXGI behaviour more accurately, and fixes a hang in
Shin Megami Tensei 3.
2021-08-05 22:57:58 +02:00
Philip Rebohle 4c222ec557
[d3d11] Use callback fence to signal Flush1 event 2021-08-05 22:57:58 +02:00
Philip Rebohle 893da94fb3
[util] Introduce CallbackFence 2021-08-05 22:57:58 +02:00
Georg Lehmann 5844315853 [dxso] Implement DxsoOpcode::Sgn 2021-08-05 20:55:54 +00:00
Georg Lehmann c5ab87f353 [spirv] Add opFSign 2021-08-05 20:55:54 +00:00
Paul Gofman 52fac82a45 [dxvk] Also initialize view formats when creating DxvkImage for existing VkImage. 2021-08-03 00:47:33 +02:00
Robin Kertels 7873bebaf2 [d3d9] Only check range overlap if the buffer is not directly mapped 2021-07-28 16:57:02 +00:00
Philip Rebohle d10e1ed3c0
[meta] Release 1.9.1 2021-07-26 15:45:33 +02:00
Joshua Ashton b8a4b85c48
[d3d9] Fix clearing render targets on device reset 2021-07-26 14:35:48 +02:00
Georg Lehmann a9c185d01a [build] Enable strict dwarf2 debug symbols for Wine back traces 2021-07-25 18:18:14 +02:00
Robin Kertels b4e6f81cb5 [d3d9] Respect aligned pitch when using initial data 2021-07-24 19:41:59 +00:00
Robin Lange a58feaa16e [build] Disable shallow cloning in GitHub actions
This fixes the HUD not showing the full DXVK version when using builds from GitHub actions.

Explanation:
By default, the "checkout" step only clones the repository with a depth of 1. This causes `git describe` to fail in Meson, causing it to fall back to the project version number instead.
2021-07-23 14:13:54 +00:00
Robin Kertels 6ba3d2f9d4 [d3d9] Set correct usage flags for large temporary staging buffers 2021-07-23 13:36:21 +00:00
Robin Kertels fa279eb8ad [d3d9] Ignore NO_DIRTY_UPDATE for POOL_DEFAULT resources
Respecting it breaks Senren Banka because we never upload the texture.
2021-07-23 13:36:21 +00:00
Robin Kertels 584e1515b1 [d3d9] Fix pitch when copying straight from mapping buffer 2021-07-23 13:36:21 +00:00
Robin Kertels 34101dcf26 [d3d9] Fix UpdateTexture extent
Same as 5f1629f2cb
2021-07-23 13:36:21 +00:00
Robin Kertels 5037e49646 [util] Merge GTA IV configs
The app config system can not handle more than one entry
per exe name, so the enableUMA one disabled the NVAPI
workaround.
2021-07-21 15:08:23 +02:00
Philip Rebohle 11bbc07ea1
[dxvk] Support destination pitch in packImageData 2021-07-19 16:54:56 +02:00
Joshua Ashton d3112c320b [d3d9] Add dirty texture tracking
Reduces overhead from re-binding and unnecessary binding (srgb changes) in L4D2.

I go from about 750 -> 850-900 fps in c1m2_streets with this change.
2021-07-14 20:38:49 +00:00
Robin Kertels 8eeff90e0a [d3d9] Only use staging buffers for uploads once we've stalled on the resource 2021-07-14 19:26:25 +00:00
Robin Kertels b83261b759 [d3d9] Adjust waiting in LockBuffer to staging buffer upload
Now that we're uploading using a staging buffer,
we don't need to wait for non default buffers.

We should also respect READONLY for WRITEONLY buffers
(yes, it sounds dumb) because Nostale relies on that.
2021-07-14 19:26:25 +00:00
Robin Kertels ed24c17d53 [d3d9] Validate srcRect and dstPoint in UpdateSurface 2021-07-14 18:33:38 +00:00
Georg Lehmann b3b2f0921c [d3d9] Never init pSharedHandle.
This parameter has three different meanings if it's non NULL:
- if Pool is D3DPOOL_SYSTEMMEM it's a host pointer for inital data
- if it points to a nullptr it's a output handle
- if it's a pointer to non NULL pointer it's an import handle
2021-07-14 15:29:46 +00:00
Robin Kertels 5f1629f2cb [d3d9] Fix FlushImage extent for smaller mip maps 2021-07-10 16:23:56 +00:00
Robin Kertels 9f0775b1ac [d3d9] Always use cached memory for texture mapping buffers
We read from that memory when uploading the texture.
Fixes performance in Oblivion.
2021-07-08 21:42:12 +00:00
Joshua Ashton c7f8267f98 [d3d9] Fix NV12 conversion
Froggy is the right color now
2021-07-08 22:36:59 -07:00
Joshua Ashton ad524a4a52 [tests] Add d3d9_bc_update_surface test 2021-07-08 22:24:44 -07:00
Philip Rebohle e23792ef91
[d3d11] Fix handling sRGB UAV images 2021-07-07 16:00:12 +02:00
Joshua Ashton f9034007ac [util] Fix indexing of non-float vectors 2021-07-05 18:58:55 +02:00
Connor Abbott 9579132942
[d3d9] Remove extra spaces in def file
wrc is pickier about this than windres and refuses to accept it.
2021-07-03 14:28:28 +02:00
Connor Abbott aae0e57a46
Don't add def file as an object
This is unnecessary even on mingw, and leads to duplicating the .def
file on the linking command line which winegcc complains about.
2021-07-03 14:28:28 +02:00
Connor Abbott 2988875e93
[dxgi] Call QueryPerformanceCounter directly
dxvk::high_resolution_clock is meant to be a wrapper around the C++ time
library, and getCounter() is (AFAIK) an internal thing so calling it
directly is odd. On winelib this redirects to the host's implementation,
which means this fails to compile. Since this is a Windows API and not
for internal usage just call the Windows API function directly.
2021-07-03 14:28:28 +02:00
Connor Abbott b9135ca0cd
Do not try to load libraries natively under __WINE__
This was only half-implemented (e.g. OpenXR was still calling
GetModuleHandle), broke compilation with Vulkan due to mismatched ABI,
and wouldn't have worked anyways with winelib builds because we still
need access to wine's implementation of the Vulkan win32 winsys
integration. Perhaps this is still useful for dxvk-native but if so it
should be re-added under a DXVK_NATIVE flag.
2021-07-03 14:28:28 +02:00
Connor Abbott 120585c66d
Don't hardcode windres location
This isn't the meson way to do things. Doing this also prepares us for
using the builtin meson rc support instead of hand-rolling our own once
https://github.com/mesonbuild/meson/pull/8954 lands.
2021-07-03 14:28:25 +02:00
Philip Rebohle c8a9308c37
[dxvk] Enable disableMsaa option for World of Final Fantasy
Fixes #1216.
Fixes #2136.
2021-07-02 16:11:24 +02:00
Philip Rebohle 3b857d93b5
[d3d11] Add d3d11.disableMsaa option to disable multisampling
Aims to be mostly transparent to the application, although breakage
can still happen if shaders query the sample count and do not handle
a sample count of 1.
2021-07-02 05:52:05 +02:00
Philip Rebohle e379f472f6
[dxbc] Implement hack to treat multisampled textures as normal textures 2021-07-02 05:52:05 +02:00
Paul Gofman 8b6ac527b4 [d3d11] Initialize buffer flags in D3D11UnorderedAccessView::GetDescFromResource(). 2021-07-01 15:20:07 +02:00
Robin Kertels 309284e7dc [d3d9] Respect 4 byte pitch when reading back texture 2021-07-01 05:47:44 -07:00
Robin Kertels c43618d19f [d3d9] Fix texture dirty box clearing
- Fix interleaved locks with evictManagedOnUnlock
We need to make sure there are no other subresources of a texture locked
before clearing the dirty box. Otherwise the data for those other subresources
won't get copied into VRAM.

- Clear dirty box regardless of texture pool
Otherwise we keep repacking and copying the whole texture
for every single lock. This causes performance problems
in Star Wars: The Old Republic.
2021-07-01 05:47:44 -07:00
Philip Rebohle 2ff8b42fff [d3d9] Enable robustBufferAccess2 feature if available
Tightens some out-of-bound rules around vertex attributes.
2021-06-29 18:35:47 -07:00
Philip Rebohle 96f5641a7e [d3d9] Ensure that the bound UP vertex buffer region is large enough
If the buffer size is less than (vertexCount * stride), the last vertex
may be considered out-of-bounds, even if all attributes are included in
the vertex.

Fixes #2131.
2021-06-29 18:35:47 -07:00
Philip Rebohle 6e4778cc81
[build] Define _WINNT_WIN32 on MinGW
Fixes #2133.
2021-06-29 15:30:34 +02:00
Philip Rebohle 45a6d5fb5b
[dxvk] Fix potential undesired host-visible buffer invalidation
We cannot invalidate mapped buffers in the backend because the frontend
may cache the mapped slice from its own invalidations, which would then
become invalid. Very unlikely to be an issue in practice.
2021-06-29 13:58:52 +02:00
Philip Rebohle cd8a2bcfcd [dxvk] Use custom sync primitives 2021-06-29 00:51:20 +02:00
Philip Rebohle 7305da6951 [util] Implement custom sync primitives 2021-06-29 00:51:20 +02:00
Tobias Langendorf ca6d8c6ce9
[util] Use FIFO_RELAXED present mode Earth Defense Force 5 (#2127)
The game constantly switches between SyncInterval 0 and 1, possibly in an attempt to implement adaptive Vsync, which causes performance issues because it forces us to recreate the Vulkan swap chain every couple of frames. Instead, enable the Vulkan equivalent of adaptive Vsync if possible.
2021-06-28 18:30:03 +02:00
Philip Rebohle 1516464c8b
[tests] Update D3D11 triangle test
Essentially implements a microbenchmark for state changes.
2021-06-27 04:51:44 +02:00
Philip Rebohle 08a6b42458
[d3d11] Fix box validation in CopySubresourceRegion1 2021-06-24 21:07:48 +02:00
Philip Rebohle 9f80d9f8b2
[d3d11] Remove functions to update mapped buffers
No longer relevant since staging images will no longer be backed
by actual Vulkan images and dynamic images are not GPU-writable.
2021-06-24 21:07:48 +02:00
Philip Rebohle 7d76262c52
[d3d11] Use D3D11_COMMON_TEXTURE_MAP_MODE_STAGING if possible 2021-06-24 21:07:48 +02:00
Philip Rebohle 450c42444f
[d3d11] Use UpdateImage in D3D11DeferredContext::MapImage 2021-06-24 21:07:48 +02:00
Philip Rebohle fd66f44561
[d3d11] Use UpdateImage in D3D11ImmediateContext::UnmapImage 2021-06-24 21:07:48 +02:00
Philip Rebohle 6ba1746d46
[d3d11] Introduce UpdateImage 2021-06-24 21:07:48 +02:00
Philip Rebohle 5e4ed2d929
[d3d11] Introduce CopyImage 2021-06-24 21:07:48 +02:00
Philip Rebohle cd17301236
[d3d11] Introduce CopyBuffer
Generalizes some copy code.
2021-06-24 21:07:48 +02:00
Philip Rebohle 1a6f4456d8
[d3d11] Introduce ComputeMappedOffset for image resources
Modifies GetSubresourceLayout slightly in case only a partial aspect
mask is being passed to the function. This way we can conveniently
compute the offset of a given pixel within the mapped buffer of an
image subresource.
2021-06-24 21:07:48 +02:00
Philip Rebohle 7c0ee272c3
[d3d11] Add texel buffer usage to staging buffer
Needed for staging image updates.
2021-06-24 21:07:48 +02:00
Philip Rebohle 7160b85924
[d3d11] Add texel buffer usage flags to mapped subresource buffers 2021-06-24 21:07:48 +02:00
Philip Rebohle 731e88b196
[d3d11] Handle MAP_MODE_STAGING in initializer
Otherwise, we'll crash if no real image is present.
2021-06-24 21:07:48 +02:00
Philip Rebohle 596f65f75f
[d3d11] Handle MAP_MODE_STAGING when mapping images on the immediate context 2021-06-24 21:07:48 +02:00
Philip Rebohle 9e15831a2d
[d3d11] Store packed format info in D3D11CommonTexture 2021-06-24 21:07:48 +02:00
Philip Rebohle f155b8a8b9
[d3d11] Introduce DiscardSlice and GetMappedSlice for image resources
These do the same as they do for buffer resources, but for a mapped
image subresource instead.
2021-06-24 21:07:48 +02:00
Philip Rebohle 11aa2a703a
[d3d11] Introduce D3D11_COMMON_TEXTURE_MAP_MODE_STAGING
This map mode can be used when no Vulkan image is needed to back a
staging resource, which can save a significant amount of memory.
2021-06-24 21:07:48 +02:00
Philip Rebohle b384f5372e
[d3d11] Zero-initialize mapped buffers for images correctly 2021-06-24 21:07:48 +02:00
Philip Rebohle f50c5234dc
[dxvk] Add source offset/extent to copyPackedBufferToDepthStencilImage 2021-06-24 21:07:48 +02:00
Philip Rebohle a14884c652
[dxvk] Add destination offset/extent to copyDepthStencilImageToPackedBuffer
Needed to support partial copies between buffers and depth-stencil images.
2021-06-24 21:07:47 +02:00
Philip Rebohle ba9d670157
[dxvk] Introduce copyPackedBufferImage 2021-06-24 21:07:47 +02:00
Philip Rebohle 27155539b6
[dxvk] Add meta copy pipeline for packed buffer image copies 2021-06-24 21:07:47 +02:00
Philip Rebohle 9f7a5a077f
[dxvk] Fix broken row/slice alignment in buffer<->image copies
If the specified row or slice alignment matches the row size exactly
but is not a power of two, we could accidentally screw up the alignment.
2021-06-24 21:07:47 +02:00
Philip Rebohle ba4938e201
[dxvk] Add slice alignment to copyImageToBuffer 2021-06-24 21:07:47 +02:00
Philip Rebohle 4840cdaf8c
[dxvk] Add slice alignment to copyBufferToImage 2021-06-24 21:07:45 +02:00
Philip Rebohle 87d32a234d
[dxvk] Handle discard aspects correctly when performing clears
Should fix an Nvidia driver crash, see #2118.
2021-06-24 17:15:52 +02:00
Robin Kertels 8a93bbd8fa [d3d9] Make sure clear extent does not exceed rt size 2021-06-19 16:11:11 -07:00
Robin Kertels 7dd443802c [util] Report Nvidia GPU to Far Cry 1 2021-06-19 10:43:31 -07:00
Robin Kertels d7c4afbeba [d3d9] Pass correct element size to texture converter 2021-06-19 10:43:31 -07:00
Philip Rebohle 81664fce44
[dxbc] Remove atomic counter workaround for ancient Mesa versions
No one should be using Mesa 19.0 at this point.
2021-06-18 15:44:58 +02:00
Philip Rebohle 7beb344f6f
[dxbc] Remove dxvk.useEarlyDiscard option
No longer relevant on drivers that support DemoteToHelperInvocation.
Closes #2109.
2021-06-18 15:44:27 +02:00
Georg Lehmann 6b8ab4fd38 [d3d11] Remove mingw-w64 < 6 workarounds 2021-06-15 20:41:34 +02:00
Philip Rebohle dca63464b4
[meta] Release 1.9 2021-06-15 15:32:19 +02:00
Georg Lehmann 7a688bd74c [util] force 60fps for Demon Stone 2021-06-15 02:54:14 -07:00
Samuel Pitoiset dba539471d [dxso] Remove old RADV/LLVM workaround for early discard
This workaround has been removed for DXBC few weeks ago. Note that
RADV/ACO is no longer a thing with latest Mesa git anyways.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2021-06-15 01:07:35 -07:00
Philip Rebohle de05728c8c
[dxvk] Check view format as well when deferring clears
Otherwise, we may accidentally clear to an incorrect value.
Fixes #2100.
2021-06-14 16:41:31 +02:00
Philip Rebohle 30a1a29aa6 [util] Add DXVK_FRAME_RATE environment variable to limit frame rate 2021-06-12 13:50:08 +02:00
Philip Rebohle 12c51f1c3d [util] Enable frame rate limiter for Nier Replicant
The game does not run properly at frame rates above 60 and uses the sync
interval in a weird way that sometimes leads to the game being stuck at
31 FPS, and in the menus it displays content at weird refresh rates that
it was clearly not designed to run at.
2021-06-12 13:50:08 +02:00
Philip Rebohle 6044e63eb0 [dxgi] Notify presenter about display mode changes 2021-06-12 13:50:08 +02:00
Philip Rebohle e281eee795 [dxgi] Add NotifyModeChange method to IDXGIVkSwapChain 2021-06-12 13:50:08 +02:00
Philip Rebohle 8b67ef724e [d3d11] Add frame rate limiter and dxgi.maxFrameRate option 2021-06-12 13:50:08 +02:00
Philip Rebohle 4f5f85925b [d3d9] Add frame rate limiter and d3d9.maxFrameRate option 2021-06-12 13:50:08 +02:00
Philip Rebohle b537f19a3c [vulkan] Add frame rate limiter to Vulkan presenter 2021-06-12 13:50:08 +02:00
Philip Rebohle a16c861358 [util] Implement frame rate limiter
This tries to be sophisticated and disables itself when it notices
that the frame rate is going to be limited by presentation anyway.
2021-06-12 13:50:08 +02:00
Robin Kertels 6f468ec5e0 [d3d9] Fix texture converter 2021-06-12 03:48:01 -07:00
Philip Rebohle 9eeaedeeb7
[util] Remove FFXIV workaround
Looks like whatever caused this in Mesa got fixed quite a while ago.
2021-06-11 01:59:56 +02:00
Thomas Crider 63fd2b9d32 [util] Enable d3d9.deferSurfaceCreation for Ninja Gaiden Sigma/Sigma 2
Co-authored-by: Georg Lehmann <49841484+DadSchoorse@users.noreply.github.com>
2021-06-10 01:35:48 -07:00
Joshua Ashton 01033af9a4 [build] Avoid Wine Mono and Gecko installs in the setup script
Co-authored-by: Alexis Peypelut <iroalexis@outlook.fr>
2021-06-06 09:31:01 -07:00
Joshua Ashton f1a9d72d38 [d3d9] Don't scale z to [0, 1] for POSITIONT
I originally thought the depth clipping region was always [0, 1] when I first implemented this nearly 2 years ago.

The depth clipping region is already in the viewport's depth range, so just don't do anything here if we are z-testing.

( We still need to keep the flattening around for when ztest is disabled though :( )

Fixes: #2056
2021-06-06 09:31:01 -07:00
Philip Rebohle fe00919d5f [util] Handle upper-case file extensions correctly 2021-06-06 03:57:15 -07:00
Joshua Ashton f4cbc9ae9d [util] Enable emulateUMA for GTA IV
This game thinks we are on Intel, so report memory like they do.
2021-06-01 19:26:41 +02:00
Joshua Ashton 15e0594ec4 [dxgi] Add emulateUMA option
Some games think we are on Intel given a lack of NVAPI or AGS/atiadlxx support. Report our device memory as shared memory, and some small amount for a "carveout".
2021-06-01 19:26:41 +02:00
Joshua Ashton fe0dc2d579 [dxvk] Move isUnifiedMemoryArchitecture to adapter 2021-06-01 19:26:41 +02:00
Joshua Ashton e624cfa0b4 [util] Return custom device description for Crazy Machines 3
Otherwise the game decides it wants to crash.
2021-06-01 19:26:41 +02:00
Joshua Ashton 1d4c540b21 [dxgi] Add custom device description option 2021-06-01 19:26:41 +02:00
Joshua Ashton 747834e9b0 [d3d9] Bump frame id before presentation 2021-06-01 18:31:29 +02:00
Joshua Ashton e64a8ee61a [d3d11] Bump frame id before presentation 2021-06-01 18:31:29 +02:00
Joshua Ashton fcb7639106 [d3d9] Synchronize frame latency on latency change 2021-06-01 18:16:35 +02:00
Joshua Ashton 787de33022 [d3d9] Sync frame latency after presentation 2021-06-01 18:16:35 +02:00
Joshua Ashton f98a45b305 [d3d11] Sync frame latency after presentation 2021-06-01 18:16:35 +02:00
Philip Rebohle 0fe8f2e40c
[vulkan] Acquire next image immediately after presentation
vkAcquireNextImageKHR is a blocking call, so doing this immediately after
presentation may reduce the amount of time that passes between the application
requesing presentation and presentation actually happening on the Vulkan device.

Idea based on PR #2075.
2021-06-01 04:52:09 +02:00
Philip Rebohle 0b88d0deab
[vulkan] Remove getSyncSemaphores from presenter
Instead, return the semaphores in acquireNextImage.
2021-06-01 04:32:50 +02:00
Philip Rebohle 253884a8c7
[vulkan] Remove fence from presenter
We don't use these anywhere.
2021-06-01 03:51:16 +02:00
Philip Rebohle 0af7229b8e
[util] Restore display modes of all monitors in RestoreMonitorDisplayMode
Fixes #2064.
2021-06-01 01:48:12 +02:00
Philip Rebohle e7897e8289
[tests] Add YUY2 video processor test 2021-05-31 15:55:08 +02:00
Philip Rebohle 383cde2051
[d3d11] Allow creation of render target views for planar images 2021-05-30 19:42:44 +02:00
Philip Rebohle 01051bac99
[d3d11] Allow creation of unordered access views for planar images 2021-05-30 19:42:44 +02:00
Philip Rebohle 6d72bc94f4
[d3d11] Allow creation of shader resource views for planar images 2021-05-30 19:42:44 +02:00
Philip Rebohle 2740030fca
[d3d11] Support video processor output views in ClearView 2021-05-30 19:42:44 +02:00
Philip Rebohle b04721f9a2
[d3d11] Use staging buffer for MapImage on deferred contexts 2021-05-30 19:42:44 +02:00
Philip Rebohle ff9d6e3226
[d3d11] Use staging buffer and copyBufferToImage for UpdateSubresource
Reduces number of copies and also fixes problems with multi-plane formats.
2021-05-30 19:42:44 +02:00
Philip Rebohle e749a4a4ac
[d3d11] Create shadow copy of video input images if sampled bit is not set
This can happen with RGB input views since not having any bind flags set
is legal for video input views, and SHADER_RESOURCE is actually explicitly
disallowed, but we don't always want to set sampled bit for those resources.
2021-05-30 19:42:44 +02:00
Philip Rebohle 3c22f4066b
[d3d11] Lock context in video context entry points 2021-05-30 19:42:44 +02:00
Philip Rebohle 25607a0692
[d3d11] Report video processor capabilities for image formats 2021-05-30 19:42:44 +02:00
Philip Rebohle 6d9da5a8d7
[d3d11] Don't use MAP_MODE_DIRECT for multi-plane images 2021-05-30 19:42:44 +02:00
Philip Rebohle 01236fbd84
[d3d11] Use correct method to clear multi-plane images 2021-05-30 19:42:44 +02:00
Philip Rebohle ee30acf120
[d3d11] Use new packImageData for initializing mapped image buffers 2021-05-30 19:42:44 +02:00
Philip Rebohle 7184b75f8f
[d3d11] Use GetSubresourceLayout for image maps on the immediate context 2021-05-30 19:42:44 +02:00
Philip Rebohle 1b296f8338
[d3d11] Introduce GetSubresourceLayout 2021-05-30 19:42:44 +02:00
Philip Rebohle e87aa08fd2
[d3d11] Implement basic video processor blitting 2021-05-30 19:42:43 +02:00
Philip Rebohle 969ac59667
[d3d11] Add ID3D11VideoContext stub 2021-05-30 19:42:43 +02:00
Philip Rebohle 1df26a3605
[d3d11] Implement video processor views 2021-05-30 19:42:43 +02:00
Philip Rebohle 09cf2cd11e
[d3d11] Add ID3D11VideoProcessor stub 2021-05-30 19:42:43 +02:00
Philip Rebohle bdb7eef874
[d3d11] Add ID3D11VideoProcessorEnumerator stub 2021-05-30 19:42:43 +02:00
Philip Rebohle 1eaf2545c3
[d3d11] Add ID3D11VideoDevice stub 2021-05-30 19:42:43 +02:00
Philip Rebohle e988895e51
[d3d11] Set mutable and extended usage bits for multi-plane images 2021-05-30 19:42:43 +02:00
Philip Rebohle 2764f4abb5
[dxgi] Add format mapping for DXGI_FORMAT_AYUV 2021-05-30 19:42:43 +02:00
Philip Rebohle d859361a37
[dxgi] Add format mapping for DXGI_FORMAT_YUY2
And fix some existing 422 mappings.
2021-05-30 19:42:43 +02:00
Philip Rebohle 9b236078c2
[dxgi] Add format mapping for DXGI_FORMAT_NV12 and DXGI_FORMAT_420_OPAQUE 2021-05-30 19:42:43 +02:00
Philip Rebohle 8116927ec6
[dxvk] Introduce new version of packImageData 2021-05-30 19:42:43 +02:00
Philip Rebohle 4630bbc427
[dxvk] Support multi-plane formats in updateImage 2021-05-30 19:42:43 +02:00
Philip Rebohle 55a67988b2
[dxvk] Support multi-plane formats in computeImageSize 2021-05-30 19:42:43 +02:00
Philip Rebohle 6462174c13
[dxvk] Support multi-plane formats in copyImageToBuffer 2021-05-30 19:42:43 +02:00
Philip Rebohle a660b35f6e
[dxvk] Support multi-plane formats in clearCompressedColorImage 2021-05-30 19:42:43 +02:00
Philip Rebohle ed57019e13
[dxvk] Support multi-plane formats in copyImage 2021-05-30 19:42:43 +02:00
Philip Rebohle 41e28cb280
[dxvk] Support multi-plane formats in uploadImage 2021-05-30 19:42:43 +02:00
Philip Rebohle 86542248df
[dxvk] Support multi-plane formats in copyBufferToImage 2021-05-30 19:42:43 +02:00
Philip Rebohle cd2ea98670
[dxvk] Add helper functions to deal with plane aspects 2021-05-30 19:42:43 +02:00
Philip Rebohle 1d6da6f83e
[dxvk] Add format definition for VK_FORMAT_G8_B8R8_2PLANE_420_UNORM 2021-05-30 19:42:43 +02:00
Philip Rebohle 0f5e126735
[dxvk] Introduce flushSharedImages
Fixes problems with images not being cleared prior to presentation
if the clear is the last command issued in the frame.
2021-05-30 19:42:43 +02:00
Philip Rebohle 895b19c746
[tests] Add D3D11 video processor test 2021-05-30 19:42:43 +02:00
Philip Rebohle a1f3f6c971
[dxbc] Remove old RADV/LLVM workaround for early discard
We have Demote now, and ACO is the default.
2021-05-27 00:40:59 +02:00
Philip Rebohle 94674ac45e [dxvk] Skip CPU adapters if GPUs are present
Because some games try (and fail) to run on Lavapipe despite it already
being the lowest priority device in the list.
2021-05-21 22:55:54 +02:00
Joshua Ashton c51080068e [dxgi] Handle DXGI_PRESENT_TEST and failures in GetFrameStatistics 2021-05-20 23:02:07 +01:00
Philip Rebohle 401edc53fe [dxgi] Show warning in DxgiOutput::GetFrameStatistics 2021-05-20 22:27:36 +01:00
Philip Rebohle db3654a07f [dxgi] Implement present count and frame statistics for swap chains 2021-05-20 22:27:36 +01:00
Joshua Ashton a3d1699823
build: Don't strip binaries with --dev-build 2021-05-19 15:59:55 +01:00
Joshua Ashton 0520ce9448
[d3d9] Treat largest element in Stream 0 as vertex decl size
Closes #2059
2021-05-13 01:32:56 +01:00
orbea b84a03b4d4 [util] Enable d3d9.deferSurfaceCreation for Nights of Azure 2021-05-07 22:15:58 +01:00
Joshua Ashton f0c1e89443 [d3d9] Handle zero-sized draws
These return S_OK, because ofc they do.
2021-05-05 19:25:46 +01:00
Joshua Ashton 0f52c85d21 [d3d9] Account for vertex declaration size for UP draws
The stride may not give us the full picture here as the stride
may not encompass the vertex declaration entirely.

Consider a vertex declaration of size 20, and a stride of 12,
we may not have covered the whole range of space the draw wants with
VertexCount * Stride.

Some games such as FF13 Lightning Returns have two float3s in the vertex decl
and draw two triangles with the last float being out of bounds. This causes
the whole vertex element to be set to 0 on NVIDIA which breaks their fullscreen passes.

Instead, take (VertexCount - 1) * Stride + VertexDeclSize for the buffer size
and pad with 0s outside of the VertexCount * Stride range.

Closes: #2046
Closes: #1908
2021-05-05 19:25:46 +01:00
Joshua Ashton 1ab2565521 [tests] Add a UP range test 2021-05-05 19:25:46 +01:00
Joshua Ashton 4a4b96611d
[d3d9] Only log WaitForVBlank stub once 2021-04-30 19:33:24 +01:00
Joshua Ashton a980282ebe
[util] Increase constants for TrackMania Forever
Bump this to 256.

Fixes rendering issues.

Closes: #1910
2021-04-30 18:51:09 +01:00
Joshua Ashton 54d3ad1295
[util] Enable d3d9.memoryTrackTest for Kohan II
Closes: #2030
2021-04-30 18:49:39 +01:00
Robin Kertels 525fd53bbc [d3d9] Fix FlushBuffer
Use stored mapped slice and use correct dst offset.
2021-04-23 18:06:29 +01:00
Robin Kertels da23771df4 [d3d9] Remove unused variable 2021-04-23 18:06:29 +01:00
Robin Kertels 13f53531e5 [d3d9] Fix offset in UpdateSurface 2021-04-22 20:18:50 +01:00
Robin Kertels 0bc8b0b33a [d3d9] Align pitch to 4 2021-04-22 17:44:58 +01:00
Robin Kertels 2ba433bbd8 [d3d9+util] Remove option to disable implicit discard 2021-04-22 17:44:58 +01:00
Robin Kertels 03f5893011 [d3d9] Remove implicit discard 2021-04-22 17:44:58 +01:00
Robin Kertels b9512a4063 [d3d9] Only copy dirty parts of managed/sysmem resources 2021-04-22 17:44:58 +01:00
Robin Kertels 4261ff6ec1 [d3d9] Use staging buffer for managed copies 2021-04-22 17:44:58 +01:00
Robin Kertels bb11d7dee8 [d3d9] Refactor AllocUpBuffer so it can be used for managed uploads 2021-04-22 17:44:58 +01:00
Robin Kertels 8cc0c9a0f1 [d3d9] Clamp dirty buffer range
And always maintain dirty range.
2021-04-22 17:44:58 +01:00
Philip Rebohle 4eb884303a
[util] Enable d3d9.deferSurfaceCreation for even more Atelier games 2021-04-22 15:37:40 +02:00
Philip Rebohle cb7adeef08
[d3d11] Add range checking to GetShaderResources 2021-04-22 12:56:11 +02:00
Philip Rebohle 65655ce37c
[d3d11] Add range checking to GetSamplers 2021-04-22 12:56:11 +02:00
Philip Rebohle ef9ad29b7f
[d3d11] Add range checking to GetConstantBuffers 2021-04-22 12:56:11 +02:00
Philip Rebohle 2d9c229eaa
[d3d11] Add range checking to SOGetTargets 2021-04-22 12:56:11 +02:00
Philip Rebohle 11a02831a9
[d3d11] Add range checking to UAV and render target methods 2021-04-22 12:56:11 +02:00
Philip Rebohle b51fd4d06c
[d3d11] Add range checking to IAGetVertexBuffers 2021-04-22 12:56:11 +02:00
Philip Rebohle a13dad07cc
[d3d11] Add some missing STDMETHODCALLTYPE declarations 2021-04-22 12:56:11 +02:00
Philip Rebohle 65cc03a707
[util] Add app profile for Dal Segno
Fixes #2022.
2021-04-22 12:55:04 +02:00
Georg Lehmann 730f5cc418 [build] conditionally enable --quiet for glslang 2021-04-21 13:43:08 +02:00
Andrew Sheldon 6339c8ec17 [util] Enable apitraceMode for a couple of CryEngine games
Kingdom Come: Deliverance and Sniper Ghost Warrior Contracts
2021-04-16 10:49:14 +02:00
Georg Lehmann 18466d4ae4 [util] remove some movs in matrix add/sub assignment 2021-04-15 22:25:11 +01:00
Georg Lehmann 77d80acf75 [d3d9] respect Vector4 alignment in UpdateStateConstants 2021-04-15 22:25:11 +01:00
Georg Lehmann 1ed6edf096 [d3d9] respect Vector4 alignment in GetShaderConstants 2021-04-15 22:25:11 +01:00
Georg Lehmann d682ab0402 [util] static assert size of Vector4 and Matrix4 2021-04-15 22:25:11 +01:00
Georg Lehmann 5d3b130ec8 [d3d9] respect Matrix4 alignment in ConvertMatrix 2021-04-15 22:25:11 +01:00
Georg Lehmann 02eebb8595 [util] introduce a raw constructor for Matrix4 2021-04-15 22:25:11 +01:00
Georg Lehmann c7271d94c1 [util] move Matrix4 constructors to header 2021-04-15 22:25:11 +01:00
Liam Middlebrook fb0b11903b [d3d11] Implement D3D11UserDefinedAnnotation
Reviewed-by: Oleg Kuznetsov <okouznetsov@nvidia.com>
2021-04-08 14:25:02 +02:00
Liam Middlebrook 5ce5999232 [dxvk] Add support for debug utils labels
Reviewed-by: Oleg Kuznetsov <okouznetsov@nvidia.com>
2021-04-08 14:25:02 +02:00
Liam Middlebrook c89b274325 [dxvk] Track enabled instance extensions
Reviewed-by: Oleg Kuznetsov <okouznetsov@nvidia.com>
2021-04-08 14:25:02 +02:00
Philip Rebohle c3feea2bce [dxvk] Make samplerAnisotropy feature optional 2021-04-04 20:01:30 +01:00
Philip Rebohle 0a787683b6 [dxvk] Don't require shaderStorageImageExtendedFormats
No real reason to, not sure why we did this in the first place.
2021-04-04 20:01:30 +01:00
Robin Kertels 9d0c46b9c6 [d3d9] FF: use correct vector type when dealing with tex coords 2021-04-04 16:31:39 +01:00
Robin Kertels 8e352d0260 [util] Enable memory track test for Dragon Nest 2021-04-04 15:45:24 +01:00
Joshua Ashton a690210eae [dxgi] Implement swapchain dispatcher
Some overlays and hooks check if the vtable funcs reside in the dxgi.dll module.

Fixes: #1996
2021-03-30 17:48:10 +02:00
Rémi Bernon 9e646a3415 [util] Override default thread stack reserve size.
Some applications (Dragon Quest Builder 2 for instance) use an oversized
default thread stack reserve size (2G in this case), which cause every
DXVK thread to allocate as much memory, quickly exhausting system memory.
2021-03-29 17:59:06 +01:00
Joshua Ashton 6b833062a0
build: Enable SSE3 for x86_64
Some minor codegen improvements around vector/matrix math in DX9.
2021-03-27 13:34:17 +00:00
Joshua Ashton 403af8820b
build: Disable SSSE3
Apparently people are still using Phenoms in 2021. *sigh*
2021-03-27 13:23:27 +00:00
Joshua Ashton dd2823287a
build: Enable -mfpmath=sse 2021-03-27 12:33:37 +00:00
Joshua Ashton f8c7e29d6f
build: Enable SSE3 and SSSE3 for x86 2021-03-27 12:33:05 +00:00
Robin Kertels d17f62902d [d3d9+util] Remove AllowLockFlagReadonly option 2021-03-22 17:43:07 +00:00
Robin Kertels dba7525954 [d3d9] Mark non default resources as dirty by default 2021-03-22 17:43:07 +00:00
Robin Kertels 8159e87331 [d3d9] Fix some issues with dirty box handling
- The dst texture in UpdateSurface must be in D3DPOOL_DEFAULT
  which doesn't do dirty tracking. So we don't need to
  call AddDirtyBox there.
- Clear DirtyBox when we flush managed textures with EvictManagedOnUnlock.
- Do nothing in AddDirtyBox for D3DPOOL_DEFAULT textures
2021-03-22 17:43:07 +00:00
Robin Kertels cb5f8aa392 [d3d9] Properly scale dirty box 2021-03-22 17:43:07 +00:00
Robin Kertels 3f57a3a8cc [d3d9] Use buffer DirtyRange to track managed uploads 2021-03-22 17:43:07 +00:00
Robin Kertels 4f45e74d96 [d3d9] Improve naming of texture dirty flag and dirty boxes 2021-03-22 17:43:07 +00:00
Robin Kertels 6f139791d2 [d3d9] Improve naming of buffer flags and ranges 2021-03-22 17:43:07 +00:00
Philip Rebohle cf4ff820be
[dxbc] Handle shaders without refactoringAllowed flag 2021-03-18 17:46:45 +01:00
Philip Rebohle 38649372bf
[dxvk] Allow different but matching views in findAttachment as well
Allows us to merge clears in some further edge cases.
2021-03-18 16:06:21 +01:00
Philip Rebohle 8be777b8e2
[dxvk] Move inline clears out of performClear
It is easier to reason about this code when there is no way for
performClear to be called within an active render pass instance.
2021-03-18 16:06:21 +01:00
Philip Rebohle b9360bacc2
[dxvk] Do not clear read-only aspects inside render pass
Instead, end the render pass as necessary and clear outside of it.
May fix validation errors in some very rare scenarios where the game
performs a clear and then uses a read-only depth-stencil view.
2021-03-18 16:06:18 +01:00
Georg Lehmann f48e3f596f [vulkan] relax warning about exclusive fullscreen
Only warn if it's actually available.
2021-03-16 12:23:32 +01:00
Philip Rebohle 2f553b5b16
[d3d11] Implement conservative rasterization
Needed for Nvidia ShadowLibs in Final Fantasy XV.
2021-03-13 20:22:32 +01:00
Philip Rebohle e3b92bcfac
[dxvk] Add conservative rasterization mode to rasterizer state 2021-03-13 20:22:32 +01:00
Philip Rebohle a77c80f08a
[dxvk] Enable VK_EXT_conservative_rasterization if available 2021-03-13 20:22:32 +01:00
Fabian Bornschein 68e6676d68 Switch to the portable shebang to bash 2021-03-11 02:02:37 +01:00
Philip Rebohle 787297ee4e
[dxvk] Fix wrong aspect mask for clear copies 2021-03-07 16:29:21 +01:00
Philip Rebohle a520c5160e
[dxvk] Pack vertex binding divisor into reserved 14-bit field
Technically an illegal optimization since it limits the maximum
divisor to 16383, but there are no known applications relying
on very large divisors. Reduces state vector size by 128 bytes,
or roughly 20%.

This also bumps the state cache version to v10.
2021-03-06 16:59:12 +01:00
Philip Rebohle 95740eb78c
[dxvk] Use clears to impelemnt image copies if possible
Optimizes away a large amount of redundant depth-stencil clear+copy
madness in Final Fantasy XIV for a small performance improvement.
2021-03-06 02:43:28 +01:00
Philip Rebohle 8a4beefd3a
[dxvk] Store new image view when deferring clear/discard with matching subresources
Otherwise, if the view used for the second clear has a different format than
the first one, we'll end up clearing to the wrong colur. Assumes that images
with more than one aspect never have views with mismatching formats.

Also potentially improves logic around render pass clears depending on usage
patterns.
2021-03-06 02:37:02 +01:00
Philip Rebohle b579b03047
[dxvk] Spill render pass when clearing overlapping views
Since we're flushing all pending clears, we need to make sure
that all images are in the correct layout. Found by inspection.
2021-03-06 01:31:55 +01:00
Philip Rebohle 5f0f90f8d4
[dxvk] Merge clears with different views but identical subresources 2021-03-05 19:50:11 +01:00
Liam Middlebrook 1c2edabbcb [dxvk] Disable NVIDIA HVV bug workaround on fixed drivers
Reviewed-by: Arthur Huillet <ahuillet@nvidia.com>
2021-03-05 11:21:50 +01:00
Liam Middlebrook b25d6ba615 [dxvk] Add option to disable workaround for NVIDIA HVV bug
Adds a new dxvk.halveNvidiaHVVHeap option.

Reviewed-by: Arthur Huillet <ahuillet@nvidia.com>
2021-03-05 11:21:50 +01:00
Philip Rebohle 3acdf6e22a
[d3d11] Perform bound-checking in GetBufferSlice
Ensures that we don't pass invalid buffer slices to the backend.
2021-03-04 17:37:13 +01:00
Philip Rebohle 049fda9218
[d3d11] Revert index buffer optimization
This causes some problems when the app uses a combination of index
buffer offset and StartIndexLocation that overflows 32-bit integers.

In my testing, there haven't been many games benefitting from this
optimization anyway, so just reverting it should not have tangible
effects on performance.
2021-03-04 15:47:39 +01:00
DadSchoorse e44a1e614b [dxvk] preserve order of devices with the same type 2021-03-03 23:17:44 +01:00
Philip Rebohle 94049c0c90
[dxvk] Fix incorrect barrier for fragment shader resolve 2021-03-03 23:16:25 +01:00
Joshua Ashton 0367bf95c4 [build] MSVC check cleanup 2021-03-03 18:57:42 +01:00
Joshua Ashton aae889ccd9 [build] Use --file-alignment=4096 with MinGW
Avoids a copy in the Wine loader as well as enables debug symbols to work in perf.
2021-03-03 18:57:42 +01:00
Rémi Bernon 1589f516c9 [d3d9] Convert window position relative to its parent. 2021-03-03 15:49:52 +00:00
Philip Rebohle 5083b8474c
[meta] Release 1.8.1 2021-03-01 16:49:02 +01:00
Philip Rebohle 9bdc491cb7
[dxvk] Fix potential iterator invalidation in deferClear/Discard
flushClears clears the deferred clear list, so we need to
break out of the loop on that code path.
2021-03-01 16:49:02 +01:00
Joshua Ashton 31063252eb
[d3d9] Don't implicit discard if read locked 2021-02-28 15:06:23 +00:00
Joshua Ashton 741070785a
[d3d9] Allow implicit discard for all backed buffers 2021-02-28 13:01:00 +00:00
Joshua Ashton 572315567c
[util] Add custom vendor id for Warhammer Online 2021-02-28 09:54:33 +00:00
Joshua Ashton 375f8323e2
[dxso] Don't warn about Phase opcode 2021-02-27 21:17:01 +00:00
Joshua Ashton eadfa94f8e
[meta] Add missing D3D9 options to dxvk.conf 2021-02-27 20:49:37 +00:00
Joshua Ashton 6bb271b299
[d3d9] Cleanup options code 2021-02-27 20:35:37 +00:00
Joshua Ashton c7bebe8267
[util] Add config for Warhammer Online 2021-02-27 20:31:13 +00:00
Joshua Ashton 8c2ec5d9c9
[d3d9] Clean up resource locking code 2021-02-27 20:15:39 +00:00
Joshua Ashton e8fc7ea23a
[d3d9] Add d3d9.allowImplicitDiscard option 2021-02-27 20:08:57 +00:00
Joshua Ashton 50d223e614
[d3d9] Add option to use device local memory for constant buffers
Useful for testing performance.
2021-02-27 19:29:52 +00:00
Robin Kertels eec4481ca0 [d3d9] Fix various issues in UpdateTexture
- Skip copies for empty or invalid rects
- align up the extent
- use util functions to slightly clean up the code
2021-02-27 17:31:15 +00:00
Joshua Ashton fa947774b0 [meta] Update README 2021-02-27 18:25:15 +01:00
Philip Rebohle 12693b17f9 [d3d9] Use DxvkSwapchainBlitter for presentation 2021-02-27 14:54:14 +00:00
Philip Rebohle 148272fbce [d3d11] Use DxvkSwapchainBlitter for presentation 2021-02-27 14:54:14 +00:00
Philip Rebohle 49f2b4c4a6 [dxvk] Introduce DxvkSwapchainBlitter and new presentation shaders
This is meant to provide a common rendering code for D3D9 and D3D11 presentation.
2021-02-27 14:54:14 +00:00
Philip Rebohle 277a4f0206 [hud] Explicitly set up viewport state 2021-02-27 14:54:14 +00:00
Joshua Ashton 869190964f
[build] Add Github Actions workflows 2021-02-27 12:56:53 +00:00
Joshua Ashton d51562fc9a [dxvk] Only pass needed amount of clear values when binding a framebuffer
Works around a Renderdoc bug and should hopefully make more sense.

The views are compacted in a framebuffer so it should be fine to do this.
2021-02-26 18:43:45 +01:00
Philip Rebohle db69ade7e7
[dxvk] Include fragment shader stage in render pass barrier as necessary
If we have readable depth, we need to make sure that the fragment shader
can actually, well, read the image.
2021-02-26 12:59:12 +01:00
Paul Gofman 71ffffb832
[vr] Use registry key to get OpenVR extensions list if available. 2021-02-26 12:46:22 +01:00
Philip Rebohle dcf4599c98 [d3d9] Use ATTACHMENT_OPTIMAL layout for render targets
Significantly improves GPU-bound performance on RADV in a number of games.
2021-02-26 05:02:32 +00:00
Philip Rebohle 1b97ca253f [dxvk] Actually transition source image in fragment shader blits
All meta ops should transition all involved images to the correct
image layout.
2021-02-26 05:02:32 +00:00
Philip Rebohle 9c6d3a2bf6
[d3d11] Fix RSGetViewports and RSGetScissorRects
If the output array is non-null, these functons always return the
number of valid viewports or scissors actually written to the array.

Fixes a wine test failure.
2021-02-26 03:35:57 +01:00
Philip Rebohle d118d35820
[d3d11] Fix IAGetIndexBuffer with optimized index buffers 2021-02-26 02:39:14 +01:00
Joshua Ashton 5ac9c45f65
[util] Add config for Mafia 2
https://gitlab.freedesktop.org/mesa/mesa/-/issues/1325
2021-02-25 15:09:00 +00:00
Philip Rebohle 5e55ced8b2
[dxvk] Fix deferred clear logic for overlapping image views
If we clear the same image subresources twice with different views
and then start rendering to one view, we may end up clearing to
the wrong clear value.
2021-02-21 14:53:03 +01:00
Philip Rebohle 96e1079526
[dxbc] Set usesDerivatives for gather and LOD query operations as well
Because these do implicitly use derivatives.
2021-02-21 14:24:54 +01:00
Philip Rebohle 5643bf47fe
[d3d11] Use discardImageView in DiscardView1 2021-02-21 02:51:59 +01:00
Philip Rebohle 5d4d32c613
[d3d11] Remove explicit spec constant for gamma texture
No longer needed.
2021-02-21 02:20:14 +01:00
Philip Rebohle 7168cc160f
[dxvk] Remove layout transition hack for presentable images 2021-02-21 02:19:44 +01:00
Philip Rebohle ab3de5e94b
[d3d11] Manually discard swap chain image view on present 2021-02-21 02:19:23 +01:00
Philip Rebohle 73a06aea72
[d3d9] Manually discard swap chain image view on present 2021-02-21 02:18:55 +01:00
Philip Rebohle e46bf78f31
[dxvk] Implement discardImageView
Built on top of the deferred clear logic.
2021-02-21 01:56:52 +01:00
Philip Rebohle 0ba3e693c9
[dxbc] Clean up some texture handling code 2021-02-20 23:39:15 +01:00
Joshua Ashton 80049c360e [dxvk] Fix resource tracking in attachment transitions
Fixes a crash in Portal 2 on DXVK native in which an old depth stencil is used after free after a device reset.
2021-02-20 19:34:49 +01:00
Joshua Ashton e9c91daba7
[dxvk] Fix out of bounds read when uploading HUD texture
The width + height does not add up to the size of the global array.
2021-02-20 14:37:00 +01:00
Philip Rebohle 5fc83a6075
[dxvk] Add missing trackImage to changeImageLayout 2021-02-20 14:35:57 +01:00
Philip Rebohle 1a1cc32b11
[dxvk] Store VkImage in barrier set rather than DxvkImage*
Avoids some accidental ref counting.
2021-02-20 14:35:22 +01:00
Philip Rebohle d66ecf4a94
[meta] Release 1.8 2021-02-19 05:29:50 +01:00
Joshua Ashton 59816a71b9
Revert "[d3d9] Don't minimise in WM_ACTIVATEAPP"
Not needed as this was an FSHack bug.

This reverts commit d87200c4d9.
2021-02-19 03:14:56 +00:00
Nicholas Fraser cd49d03ee9 [build] Add optional build-id
Build-ids are required for doing certain kinds of performance tracing.
For example build-ids let Linux perf find the correct objects and
transfer them to other machines via "perf archive".

This adds an option to add -Wl,--build-id to the linker. It can be
enabled by passing -Dbuild_id=true to meson or --build-id to
package-release.sh.

Signed-off-by: Nicholas Fraser <nfraser@codeweavers.com>
2021-02-18 17:52:55 +01:00
Philip Rebohle fe5e215dfc [dxgi] Support multiple outputs per adapter 2021-02-18 14:19:55 +01:00
Joshua Ashton d87200c4d9
[d3d9] Don't minimise in WM_ACTIVATEAPP
Sometimes mode-setting jank can occur and technically we'd need to re-set the mode on the next present if the game gets actually minimised.
2021-02-15 17:29:45 +00:00
Philip Rebohle df76a5252a
[dxvk] Use default layout for depth-stencil image descriptors
Apparently the image layout matching rules were relaxed at some point,
so just using DEPTH_STENCIL_READ_ONLY_OPTIMAL for descriptors is legal
even if the image is in DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL or
DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL in the current render pass.
2021-02-15 17:00:35 +01:00
Robin Kertels ec5c324643 [d3d9] Mark generated mip maps as dirty 2021-02-14 23:55:00 +00:00
Robin Kertels 021ffe7350 [d3d9] Regenerate auto mip gen textures in UpdateTexture
.. instead of copying them
2021-02-14 23:55:00 +00:00
Robin Kertels 338f6dfb0e [d3d9] Track dirty regions for UpdateTexture 2021-02-14 23:55:00 +00:00
Philip Rebohle a0cf5926d8
[dxvk] Add parameter to prepareImage to ignore clears
Otherwise we may flush clears while clearing a render target,
which is silly and undoes the layout optimizations.
2021-02-14 04:22:52 +01:00
Philip Rebohle 2b401725dc [dxvk] Do not transition non-shared images at the end of the command buffer
Currently, if the frontend flushes the command list, we always transition
render targets to their default layout. This may lead to some arbitrary
GPU performance issues if the transitions are not free.

Instead, keep all images that are only used internally in their attachment
layout across command list boundaries, until they are unbound.
2021-02-14 04:00:02 +01:00
Philip Rebohle bce80b523f [d3d11] Mark images as shared if necessary 2021-02-14 04:00:02 +01:00
Philip Rebohle 4f184b3424 [d3d9] Mark images as shared if necessary 2021-02-14 04:00:02 +01:00
Philip Rebohle 6564895a32 [dxvk] Add shared flag to images
Indicates that images can be accessed by more than one context
internally, or through the interop interfaces without explicit
image layout transitions.
2021-02-14 04:00:02 +01:00
Philip Rebohle 6efc2588f8 [dxvk] Remove checkFramebufferBarrier
No longer serves any practical purpose.
2021-02-14 04:00:02 +01:00
Philip Rebohle 95676bf1e6 [dxvk] Always prepare images not bound to the current FB when clearing
Fixes a potential bug when clearing a render target after the
last render pass using it gets suspended.

Also, for some reason we were checking for <1 instead of <0.
2021-02-14 04:00:02 +01:00
Christopher Egert 594d09ae3a [util] Spoof a nvidia card for DIRT 5 2021-02-14 03:54:14 +01:00
Philip Rebohle 0c18a86090
[dxvk] Fix render target clears if attachments are not tightly packed
We do actually need to use the color target indices here rather than
the attachment index, since the repacking happens inside DxvkRenderPass.
Clear values still need to be tightly packed.
2021-02-12 03:13:11 +01:00
Philip Rebohle 436820d233
[dxvk] Add method to query color attachment index from attachment index 2021-02-12 03:13:11 +01:00
Philip Rebohle 0956050db6
[dxvk] Fix actual render target layout transitions for 3D images
Also, only emit transitions if the layouts differ.
2021-02-12 03:13:11 +01:00
Philip Rebohle bd87c12138
[dxvk] Make suspend parameter of spillRenderPass not optional 2021-02-12 03:13:11 +01:00
Philip Rebohle aa0296b7ca
[dxvk] Suspend render pass for most image operations
We can big brain this and only explicitly transition the render targets
that are used within the copy operation, if any, and leave the rest intact.
2021-02-12 03:13:11 +01:00
Philip Rebohle 96dfac7fea
[dxvk] Suspend render pass for certain render target clears 2021-02-12 03:13:11 +01:00
Philip Rebohle d7db413cac
[dxvk] Introduce prepareImage
This transitions any framebuffer attachment that is currently in
the wrong layout back to its default layout before it is used by
functions that expec it to be in the default layout.
2021-02-12 03:13:10 +01:00
Philip Rebohle fe43abbf32
[dxvk] Suspend render pass for buffer copies and render pass barriers
No images are directly involved in these, so we can save some layout
transitions.
2021-02-12 03:13:10 +01:00
Philip Rebohle ba698430cb
[dxvk] Suspend render pass when updating framebuffer
Saves barriers in case some of the previously bound framebuffer
arre reused in the new one.
2021-02-12 03:13:10 +01:00
Philip Rebohle d3b2db5978
[dxvk] Loosen render pass barriers
Still use ALL_COMMANDS_BIT at the end to avoid potential WAR hazards
for things like vertex buffers.
2021-02-12 03:13:10 +01:00
Philip Rebohle 29afaea338
[dxvk] Track current render target image layouts
This can be used to optimize away some barriers and layout transitions.
2021-02-12 03:13:10 +01:00
Philip Rebohle 2787ba8450
[d3d11] Fix D3D11 bind flags and DXGI usage for swap chain images 2021-02-12 03:12:48 +01:00
Philip Rebohle c98c5f5d17
[d3d11] Add internal DXGI usage flags to textures
We need this for swap chain images.
2021-02-12 03:12:48 +01:00
Philip Rebohle a60916f7ee
[dxvk] Improve device ordering
Make sure that integrated GPUs are preferred over CPU
implementations on systems that have no dedicated GPU.
2021-02-11 14:58:11 +01:00
Philip Rebohle bcadc04932
[dxvk] Validate vertex attribute alignment 2021-02-08 14:55:18 +01:00
Philip Rebohle a045cac281
[d3d11] Fix vertex input alignment for small formats
Fixes #1922.
2021-02-08 14:28:55 +01:00
Joshua Ashton fcaab6aa46
[d3d9] Expose adapter/backbuffer formats properly
Matches native behaviour in my testing.
2021-02-06 08:57:32 +00:00
Joshua Ashton 58d6f018bb
[d3d9] Allow A2R10G10B10 backbuffer format in Windowed 2021-02-06 08:43:37 +00:00
Joshua Ashton ff9d451a4e
[util] Force saner SWVP limits for TrackMania Forever
Closes: #1910
2021-02-06 08:28:03 +00:00
Joshua Ashton bba3f9f3db
[util] Defer surface creation for Nioh 2
Fixes black screen on startup.
2021-02-06 07:48:52 +00:00
Joshua Ashton 9bee3e1cb9
[util] Add config for Dark Messiah of Might & Magic
Same problem as other early Source titles, infinitely makes resources at startup to measute VRAM.
2021-01-30 04:36:26 +00:00
Philip Rebohle 01a511aa99
[dxvk,dxgi,d3d9] Fix shader spec constant IDs
These changed after changing the render target output swizzle stuff.
2021-01-29 16:46:01 +01:00
Philip Rebohle 2d670ec3db
[dxbc] Enable capabilities for float control modes
Fixes some validation errors (but seriously, why does everything
have to be a capability in SPIR-V?)
2021-01-29 16:29:39 +01:00
Philip Rebohle c1073455bf
[spirv] Add hasCapability method 2021-01-29 16:29:26 +01:00
Philip Rebohle 3a993d0c5c
[dxvk] Use only one spec constant for fragment shader output component mapping
Let's trust the driver to be able to constant-fold bitfieldExtract operations.
2021-01-29 16:17:07 +01:00
Philip Rebohle 307f43ff1e [d3d11] Introduce option to disable float controls
And disable for SotTR since it introduces rendering issues.
2021-01-28 20:32:38 +01:00
Philip Rebohle 8de9dc9378
[d3d11] Enable d3d11.invariantPosition by default 2021-01-28 20:09:47 +01:00
Philip Rebohle 1478011822
[dxbc] Enable NaN fixup by default on older RADV versions
And get rid of a whole bunch of game-specific workarounds.
2021-01-28 19:37:10 +01:00
Philip Rebohle f5fa7a9099
[dxbc] Set float control bits as necessary 2021-01-28 19:37:10 +01:00
Philip Rebohle 849fb329ec
[dxvk] Enable VK_KHR_shader_float_controls if supported 2021-01-28 19:37:10 +01:00
dom 7d7c057d46 [util] Enable dxgi.customVendorId for Hitman 3 2021-01-28 14:07:52 +01:00
Philip Rebohle a17ec95f21
[utils] Enable d3d9.deferSurfaceCreation for Atelier Ryza 2 2021-01-26 12:06:20 +01:00
Philip Rebohle b8bc36559d
[d3d11] Optimize index buffer binding with offset
Do not rebind the buffer if only the offset changes. Instead,
adjust StartIndexLocation in indexed draw calls. For indirect
draws, this will be disabled on the fly.

This may save a whole bunch of work in the backend, and reduces
the number of commands being sent to the CS thread in the first
place, which is why this optimization is not being done in the
backend itself but rather on the client API side.
2021-01-24 15:18:38 +01:00
Philip Rebohle f869881f55
[util] Enable TGSM barrier workaround for more F1 games
F1 2020 is reportedly broken as well.
2021-01-16 15:28:30 +01:00
Joshua Ashton 742b52bbb5 [d3d11] Fix device child refs properly 2021-01-15 23:47:48 +01:00
Philip Rebohle 499f15011f
[util] Enable TGSM barrier workaround for F1 2018
Game has the same bug as F1 2019. Fixes #1897.
2021-01-15 13:15:01 +01:00
Philip Rebohle 3caf5269f2
[dxvk] Add regular barrier after graphics queue depth image upload
We still need a barrier for the layout transition.
2021-01-12 13:25:00 +01:00
Philip Rebohle b19293430a
[dxvk] Execute depth/stencil image upload on graphics queue
Silences a validation error.
2021-01-12 12:14:53 +01:00
Philip Rebohle 8163eb4185
[meta] Do not use built-in arguments
Breaks ancient meson versions. Should fix #1893.
2021-01-12 00:54:16 +01:00
Joshua Ashton 0eec95843f
[d3d9] Fix warnings with query caching 2021-01-08 13:49:38 +00:00
Gabriel Ivăncescu 83f6400a07 d3d9: Send necessary messages for full-screen windows during WM_ACTIVATEAPP. 2021-01-08 13:40:34 +00:00
Joshua Ashton dde28a967f [d3d11] Fix forward declaration of ID3D11Texture2D
This should be struct not class.

Silences warnings in MSVC.
2021-01-08 13:06:02 +01:00
Joshua Ashton 838a6ef0f1 [d3d11] Disallow mismatching shader bytecode and type
Fixes a wine test which lead to a "refcounting bug" down the line.
2021-01-08 11:59:16 +01:00
Andrew Eikum 2405e474e5 [dxvk] Use wineopenxr to apply required OpenXR extensions 2021-01-07 23:54:02 +01:00
Andrew Eikum a3065fca8e [d3d11] Extend interop interfaces for OpenXR support 2021-01-07 23:54:02 +01:00
Robin Kertels 60a2aeb6ef [d3d9] End query before the stall heuristic flush 2021-01-07 21:19:28 +00:00
Robin Kertels 0f933fee8b [d3d9] Extend query stall tracking to other query types 2021-01-07 21:19:28 +00:00
Robin Kertels 6554ca8f9e [d3d9] Cache query data 2021-01-07 21:19:28 +00:00
gofman 5852e318e5
[d3d11] Fix device ref counting from queries. (#1887)
Fixes AO Tennis 2 crash on exit.

Co-authored-by: Paul Gofman <pgofman@codeweavers.com>
2021-01-06 20:10:44 +01:00
Philip Rebohle 6f5a28025e [meta] Delete 2020
Obligatory Happy New Year commit.
2021-01-04 12:12:13 +01:00
Philip Rebohle 7d673063f5 [meta] Move SSE/SSE2 enablement out of cross files
Fixes Proton build, which uses an outdated Meson version.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-01-04 01:00:10 +01:00
oltolm f337ad3c05
fix d3d11 header for MinGW 9 (#1883) 2021-01-04 00:52:43 +01:00
Kron4ek 77af1026e2
Use new section for c/cpp args and link_args (#1878)
Using lang_args and lang_links_args in the [properties] section has been deprecated in Meson 0.56.
[built-in options] section should be used instead.
2021-01-02 16:40:31 +01:00
PendingChaos f39472a9ba
[util] Set invariantPosition for Devil May Cry 5 (#1863)
Fixes some missing/shifting geometry on GFX10.3 and RADV/ACO.

Tested using dxvk.conf and DXVK 1.7.3.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
2021-01-02 10:42:33 +01:00
Jason Bagavatsingham 05f4b1bb3c
[util] Set enableRtOutputNaNFixup for Empire of Sin (#1858)
Co-authored-by: Jason Bagavatsingham <jason.bagavtsingham@gmail.com>
2021-01-02 10:42:26 +01:00
Samuel Pitoiset d0d1d99537
[util] set enableRtOutputNanFixup for VRChat (#1872)
Fixes rendering issues with RADV.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2021-01-01 23:07:11 +01:00
Robin Kertels ea13a68678 [util] Enable apitrace mode for Everquest 2020-12-26 17:37:07 +00:00
Robin Kertels 56399e49d1 [util] Enable apitraceMode for Tomb Raider Legend 2020-12-14 16:51:19 +00:00
Robin Kertels 6a54d86f25 [d3d9] Implement apitraceMode option 2020-12-14 16:51:19 +00:00
Robin Kertels 4b6632764f Revert "[d3d9] Only use DEVICE_LOCAL memory for small dynamic buffers"
This reverts commit f3a82a0bcc.

Apparently this makes other games slower. We need a different solution for TR: Legend.
2020-12-14 16:51:19 +00:00
Joshua Ashton 65635b23c1 [d3d9] Always slightly bias viewport, regardless of size
Since we got TRUNC_COORD on RADV, we always need to bias this now.

Closes: #1854
2020-12-14 03:51:49 +00:00
PendingChaos 495b2a098e
[util] Set invariantPosition for Monster Hunter World (#1850)
Fixes flickering on GFX10.3 with RADV/ACO.
2020-12-11 18:51:10 +01:00
Philip Rebohle 03f11baf57
[hud] Fix up nonsensical scaling factors 2020-12-06 01:03:01 +01:00
Philip Rebohle 74abb5bb80
[hud] Initialize scale to 1
See #1843.
2020-12-06 00:48:48 +01:00
Philip Rebohle 854ae7b862
[dxvk] Add transform feedback buffer usage to dummy buffer
Silences some Vulkan validation errors.
2020-12-06 00:35:29 +01:00
Philip Rebohle 0b4e167fc9
[hud] Fix typo 2020-12-02 17:13:41 +01:00
Philip Rebohle b67639bdf0
[meta] Release 1.7.3 2020-12-02 16:14:56 +01:00
Philip Rebohle 94121c313a
[meta] Update README 2020-12-02 16:14:56 +01:00
Philip Rebohle 6814ad45d4
[hud] Fix positioning of compiler item when scaled 2020-12-02 16:14:56 +01:00
Philip Rebohle a23be756d7
[hud] Implement HUD scaling
Can be set like DXVK_HUD=fps,scale=1.5.
2020-12-01 03:31:22 +01:00
Philip Rebohle 8fe3effb40
[hud] Draw lines as triangle strip 2020-12-01 03:31:22 +01:00
Philip Rebohle 0ce5dd8b03
[dxvk] Remove conditional rendering from backend
Was disabled anyway due to being broken on various drivers,
so let's get rid of it.
2020-11-30 19:18:26 +01:00
Philip Rebohle 34e730fe41
[d3d11] Remove predication-related code 2020-11-30 19:18:26 +01:00
Philip Rebohle e79e8b9062
[dxvk] Increase queued command buffer limit to 18
May help when games upload a large number of resources
at once, at the cost of increased memory usage.
2020-11-27 12:22:08 +01:00
Philip Rebohle c547039bef
[dxvk] Decide memory priority based on access flags rather than usage
Buffers used as shader resources are storage buffers as well,
and should not take priority over other read-only resources.
2020-11-27 12:20:55 +01:00
Joshua Ashton 5d8539672d [util] Fix config for EverQuest2 2020-11-27 06:27:01 +00:00
Joshua Ashton bbfd6d0690 [util] Enable alpha test wiggle room for EverQuest 2
Fixes clothing being alpha tested incorrectly due to wonky interpolation on NVIDIA.

Game uses oC0 == 1.0f

My testing on NV shows the alpha test has a precision of 1/256 for all A8 and below formats, and around 1 / 2048 for A32F formats and 1 / 4096 for A16F formats (It makes no sense to me too) so anyway, we're just going to round this to a precision of 1 / 4096 and hopefully this should make things happy everywhere.

Closes: #1832
2020-11-26 12:16:33 +00:00
Joshua Ashton 09043ddd16 [dxso] Implement option for alpha test wiggle room 2020-11-26 12:15:03 +00:00
Philip Rebohle f63abb2b5a
Revert "[meta] Update README"
This reverts commit 85f36c3072.
2020-11-25 14:07:08 +01:00
Philip Rebohle 538b55921e
[dxbc] Conditionally return zeroes for unbound textures in shader
May allow the driver to optimize away texture operations.
2020-11-24 18:39:20 +01:00
Philip Rebohle 45461ee54e
[dxbc] Use opSelect for unbound texel fetch instructions
Generates less annoying code compared to control flow instructions,
and drivers should be able to optimize away the texture instruction
anyway since the bound state is a specialization constant.
2020-11-24 18:36:40 +01:00
Philip Rebohle 5e5937baf4
[dxvk] Pass size of 0 for dummy vertex buffer
Silences some validation errors in case null descriptors are disabled.
2020-11-24 17:50:14 +01:00
Joshua Ashton 6a63f4af56 [d3d9] Enable null descriptors for D3D9 2020-11-24 16:17:36 +00:00
Philip Rebohle 3cf7d65789
[hud] Use textureLod in fragment shader
Should silence some validation errors.
2020-11-24 17:07:22 +01:00
Joshua Ashton c282ec7976 [dxso] Handle extraneous writemasks in matrix ops 2020-11-24 15:58:21 +00:00
Philip Rebohle f74071ac0a
[d3d11] Support different strides for merged indirect draws
Trine 4 uses a stride of 32 bytes. Detecting the stride dynamically
allows us to merge a couple of draws in this game, and others which
do not tightly pack their draw parameter buffers.
2020-11-21 05:39:05 +01:00
Philip Rebohle bf4465f5a2
[dxvk] Increase query pool sizes
Some games create hundreds of timestamp queries, we want to reduce
the number of pools in that case.
2020-11-21 03:35:41 +01:00
Philip Rebohle d256175981
[dxvk] Eliminate back-to-back clears when no render pass is active
Trine 4 hits this with a multisampled depth buffer multiple times
per frame. Previously, we'd only eliminate redudant clears if the
render target to clear was active in the current render pass.
2020-11-21 03:03:15 +01:00
Philip Rebohle 61a07fc9b9
[dxbc] Fix up incorrect infinity returned by f32tof16
Completely insane fix for #1826.
2020-11-21 01:25:03 +01:00
Philip Rebohle d0cdd79dd2
[dxgi] Allow creating R16_SFLOAT views for D16_UNORM images
Just use R16_UNORM. For some reason, D3D11 actually allows this, and
Trine 4 wants the corresponding calls to succeed, although we're going
to interpret the data as UNORM rather than FLOAT.
2020-11-20 17:14:41 +01:00
Philip Rebohle 85f36c3072
[meta] Update README
MinGW 10.0 is required for new DXGI headers.
2020-11-20 15:14:49 +01:00
Shawn M. Chapla 7ef6132cf0
[util] Use nvapiHack by default for Far Cry Primal (#1821)
Remove nvapiHack=False default override for Far Cry Primal as the game
is unplayable without an nvapi implementation and appears to now perform
fine with nvapiHack.

Co-authored-by: Shawn M. Chapla <schapla@codeweavers.com>
2020-11-18 10:12:40 +01:00
Joshua Ashton 6a10c81d4b
[d3d11] Define ordinals for exports (#1812) 2020-11-11 16:54:36 +01:00
TotalCaesar659 64f990cb24
Update URL to HTTPS (#1807) 2020-11-06 12:04:23 +01:00
Philip Rebohle 13052d4949
[dxgi] Actually expose new DXGI interfaces
Derp.
2020-10-24 17:41:55 +02:00
Philip Rebohle cbba1472db
[meta] Update README
We require MinGW 8.9 for updated DXGI headers.
2020-10-23 12:21:44 +02:00
Philip Rebohle 54a4e91dad
[dxgi] Implment IDXGIFactory7 2020-10-23 12:21:02 +02:00
Philip Rebohle a7de355646
[dxgi] Implement IDXGIFactory6 2020-10-23 12:15:48 +02:00
Philip Rebohle f81395c742
[dxbc] Fix operand modifiers on 64-bit types 2020-10-22 12:43:04 +02:00
Philip Rebohle 7b9644f355
[meta] Release 1.7.2 2020-10-07 17:41:54 +02:00
Philip Rebohle 1863c6e81c
[dxvk] Catch exceptions of type DxvkError on CS thread 2020-10-07 16:33:48 +02:00
Philip Rebohle 0b011ea361
[dxvk] Throw error in case a pipeline layout uses too many bindings 2020-10-07 16:33:48 +02:00
Philip Rebohle d153d5c19a
[dxvk] Bump state cache version to v9
Needed because the binding bit mask increased in size.
2020-10-07 16:33:48 +02:00
Philip Rebohle e98493fc24
[dxvk] Increase maximum active binding count to 384
Fixes a stack overflow in Baldur's Gate 3, caused by a compute shader
that uses 131 resources.
2020-10-07 16:33:48 +02:00
Rhys Perry 4251b7a59c [util]: Set enableRtOutputNaNFixup for Art of Rally
Fixes the (Windows) Art of Rally demo.

See https://gitlab.freedesktop.org/mesa/mesa/-/issues/3562

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
2020-10-06 15:57:07 +02:00
Samuel Pitoiset ccb782219c
[util] Set enableRtOutputNanFixup for some Chilla's Art games
See ValveSoftware/Proton#4167

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2020-09-26 16:45:49 +02:00
Samuel Pitoiset 3487685a79 [util] Set enableRtOutputNaNFixup for The Dungeon of Naheulbeuk
Fixes rendering issues with RADV and AMDVLK (haven't tried -pro).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2020-09-26 15:06:29 +02:00
Joshua Ashton c3fdc768cf [d3d9] Only define the push constants we use
Fixes #1742
2020-09-26 06:39:52 +01:00
Joshua Ashton 753fcd5649 [d3d9] Only read point scale push constant in fixed function
Otherwise it doesn't exist and we're reading garbage/non-existant data.

Even though this gets spec-constanted away via an opSelect, some drivers don't like this
2020-09-26 06:39:52 +01:00
Joshua Ashton e4bca7a42f [d3d9] Handle specular fog factor for fixed function
Also handle POSITION_T shenanigans

Closes #1771
2020-09-26 06:06:06 +01:00
Joshua Ashton dc392f7cfa [d3d9] Fix typo declaring fixed func fog inputs 2020-09-26 04:03:11 +01:00
Albin Engström 291b0bdf07 Fix spelling error in the d3d9.strictConstantCopies description. 2020-09-23 00:15:06 +01:00
Philip Rebohle ab04f45ea0
[d3d11] Handle null pointers in CopySubresourceRegion1.
Because of course Marvel's Avengers tries to do this..
2020-09-17 13:36:09 +02:00
Robin Kertels b21a673a8d [d3d11] Don't use clamped constant buffer range for bounds checking 2020-09-14 22:43:18 +02:00
Rhys Perry 73cb711f32 [dxbc] Bounds-check temporary array stores
Fixes flickering terrain in Just Cause 3 on RADV and possibly ANV.
2020-09-14 16:56:06 +02:00
Philip Rebohle 4801fbe098
[d3d11] Clamp and validate bound constant buffer range
SetConstantBuffers will only bind the first 65536 bytes of any
buffer passed to it if it is larger. This can be seen even when
querying the bound range via GetConstantBuffers1.

SetConstantBuffers1 does not have any effect if the bound range
is invalid.
2020-09-14 16:50:16 +02:00
Joshua Ashton 81632b91bb [dxso] Allocate shader compiler on the heap
In some apps that call us with limited stack space, this can stack overflow
2020-09-11 21:49:14 +01:00
Joshua Ashton 3e65c2bb87 [d3d9] Reduce copying around of shader metadata at Create time 2020-09-11 21:49:14 +01:00
Joshua Ashton 1274b7a8e7 [dxvk] Add helper to retrieve SHA1 hash from shader key 2020-09-11 21:49:14 +01:00
ishitatsuyuki bb85a4caa8 Handle non-ASCII characters properly in paths 2020-09-10 15:56:38 +02:00
Philip Rebohle 7bf02a1925
[d3d11] Fix incorrect layer count for some non-PoT 3D RTVs
Otherwise, we may end up with zero layers. Fixes #1756.
2020-09-04 23:04:06 +02:00
Philip Rebohle 41a49a9c14
[dxgi] Add B8G8A8X8 formats to GetMonitorFormatBpp
Doesn't really fix anything, just silences some warnings
in Horizon Zero Dawn.
2020-09-04 17:54:01 +02:00
Philip Rebohle 9433d0cbf3 [meta] Update README 2020-08-24 10:10:20 +02:00
Philip Rebohle 645c8f8177 [util] Add option to disable log files entirely
But still log to stderr. Fixes #1743.
2020-08-24 09:09:18 +02:00
Philip Rebohle 16a51f3c03 [dxvk] Only use half of the DEVICE_LOCAL | HOST_VISIBLE heap on Nvidia
Seems to help with random crashes in FFXIV and potentially
other games on 450 series drivers.
2020-08-22 11:51:56 +02:00
Philip Rebohle e435e071e0 [dxvk] Introduce memory heap budget
Allows more fine-grained control of memory allocations for specific
heaps. For now, target 80% for device-local heaps on UMA devices.
2020-08-22 11:50:37 +02:00
Joshua Ashton 743f309253 [d3d9] Implement YV12 video format
Needed for #1726 otherwise it will upload dump that upload garbage in a YUV2 texture.
2020-08-17 22:32:30 +01:00
Robin Kertels 89d36e1d7f [d3d9] Handle edge cases around implicit discard 2020-08-15 05:45:01 +01:00
Philip Rebohle ea53923406
[meta] Release 1.7.1 2020-08-13 19:10:20 +02:00
Philip Rebohle 2a0f10e611
[util] Enable apitrace mode for Monster Hunter World 2020-08-13 18:52:45 +02:00
Philip Rebohle 48777c8fcf
[dxvk] Remove optional memory property flags one by one
We don't always want to remove HOST_CACHED if no DEVICE_LOCAL
type exists, so iterate over the bits one by one.
2020-08-13 18:47:52 +02:00
Philip Rebohle 346197c8c1
[util] Enable apitrace mode for Darksiders Warmastered Edition
Fixes #1719.
2020-08-12 23:39:53 +02:00
Philip Rebohle d4f6ccb8a8
[dxvk] Add new 4444 formats to format list
Derp.
2020-08-12 23:12:18 +02:00
Joshua Ashton d92660923a
[d3d9] Use VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT 2020-08-10 09:45:49 +02:00
Philip Rebohle cb7f1dc966
[dxgi] Use VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT if available 2020-08-10 09:45:45 +02:00
Philip Rebohle 397daa0432
[dxvk] Enable VK_EXT_4444_formats if available 2020-08-10 09:45:45 +02:00
Philip Rebohle a714cd94bd
[include] Update Vulkan headers 2020-08-10 09:45:41 +02:00
Robin Kertels b28a7353bb [d3d9] Do implicit discard when locking system memory resources 2020-08-10 00:09:29 +01:00
Joshua Ashton 98c7da805b [d3d9] Rename BT.703 to BT.709
Don't know how this typo got introduced.

Thanks to Ryao for finding the matrix and pointing this out.
2020-08-07 20:54:45 +01:00
Kevin Schmidt 9f6f6a7979 [util] Enable d3d9.memoryTrackTest for Anarchy Online
Prevents the game from consuming all system memory.

Signed-off-by: Kevin Schmidt <kevin.patrick.schmidt@googlemail.com>
2020-08-07 11:11:05 +01:00
Joshua Ashton e2a26f2bc5 [d3d9] Optimize NV12 conversion to use a macropixel of [2, 1] 2020-08-07 10:56:26 +01:00
Joshua Ashton 9fe1b9d03f [d3d9] Replace macropixel size with plane count 2020-08-07 10:56:26 +01:00
Joshua Ashton 2bf9f298af [d3d9] Implement NV12 format conversion 2020-08-07 10:56:26 +01:00
Joshua Ashton 32c1a4e2b8 [tests] Implement an NV12 test 2020-08-07 10:56:26 +01:00
Joshua Ashton 2cfd219024 [d3d9] Move some YUV helpers to common and cleanup YUY2 shader 2020-08-07 10:56:26 +01:00
Joshua Ashton ad6b91d84a [d3d9] Flush and synchronize to cs before format conversion
Fixes a race when DISCARD is used
2020-08-07 10:56:26 +01:00
Joshua Ashton f1aa80dab9 [d3d9] Don't private reference additional swapchains 2020-08-07 10:56:26 +01:00
Joshua Ashton e7d9d4739a [util] Fix trace macro for functions with no args 2020-08-07 10:56:26 +01:00
Joshua Ashton aa01d914f1 [util] Implement METHOD_NAME for _MSC_VER 2020-08-07 10:56:26 +01:00
Jason Bagavatsingham 145d8225f4 [util] Set enableRtOutputNaNFixup for Observation 2020-08-06 14:14:49 +02:00
ryester27 d88b792447 Use d3d9.deferSurfaceCreation for Fairy Tail 2020-08-04 04:29:57 +02:00
Philip Rebohle 3322da4b94
[dxgi] Add DXGIGetDebugInterface1 stub
Required for Metro Exodus. Also exports the DXGI entry points
with their correct ordinals.
2020-07-24 12:25:48 +02:00
Biswapriyo Nath 3b52cad243 fix clang errors
File changes:
    * meson.build: add -Wno-unused-private-field and -Wno-microsoft-exception-spec
                   option to suppress clang compiler warnings
    * d3d9/d3d9_swvp_emu.h: include unordered_map for std::unordered_map
2020-07-21 11:41:28 +02:00
Christopher Egert 76e3bb78c9 [util] Disable DF24 support for Borderlands 2
and The Pre Sequel!
2020-07-20 18:41:40 +01:00
Robin Kertels f3a82a0bcc [d3d9] Only use DEVICE_LOCAL memory for small dynamic buffers
Tomb Raider Legend writes to multiple 128KB dynamic buffers
and one 512KB one every frame.
2020-07-20 18:36:20 +01:00
Robin Kertels 2714cb952d [d3d9] Extend dirty tracking to render targets
Ensures we copy a dynamic default pool texture to its
mapping buffer after the device renders to it.
2020-07-20 18:36:20 +01:00
Philip Rebohle 66814ea8db
Revert "[d3d11] Move D3D11Shader implementation to its own file"
Useless since it doesn't fix the clang problem.
2020-07-18 00:10:31 +02:00
Philip Rebohle 56fe52ca3c
[d3d11] Move D3D11Shader implementation to its own file
And resolve some include madness. Necessary because D3D11Shader::GetDevice
needs to know the full definition of D3D11Device, but D3D11Device needs
to know the full definition of the other shader-related classes.
2020-07-17 10:16:37 +02:00
Biswapriyo Nath 0b4489a31c meson: use if-else to detect rc compiler
this will help to add/build other architecture
2020-07-15 10:05:50 +02:00
Philip Rebohle 5ab12d9668
[d3d11] Reenable null descriptor feature 2020-07-10 16:59:20 +02:00
Philip Rebohle 23691cd0ff
[dxvk] Enable extended dynamic state feature if available 2020-07-10 16:59:20 +02:00
Philip Rebohle ce33b60f9c
[dxvk] Remove null descriptor code paths for unbound resources 2020-07-10 16:59:20 +02:00
Philip Rebohle 2c641566ab
[dxvk] Fix inefficient check in bindVertexBuffer 2020-07-10 16:59:20 +02:00
Philip Rebohle dfc0b740f8
[dxvk] Use vkCmdBindVertexBuffers2 to bind buffer ranges
Potentially fixes problems with OOB access on dynamic vertex buffers.
2020-07-10 16:59:20 +02:00
Philip Rebohle 9ba99eba93
[dxvk] Add feature bit for extended dynamic state 2020-07-10 16:59:20 +02:00
Philip Rebohle 9f3fb028b0
[dxvk] Enable VK_EXT_extended_dynamic_state if available. 2020-07-10 16:59:20 +02:00
Philip Rebohle 93f7735814
[meta] Update Vulkan headers 2020-07-10 16:59:16 +02:00
Gabriel Ivăncescu 1efe91e17d
[dxgi] Restore the Topmost state upon exiting fullscreen
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2020-07-08 18:57:49 +02:00
Gregor Münch 4ac9dcf855 [util] Enable d3d11.invariantPosition for Mafia III: Definitive Edition 2020-07-05 17:37:13 +02:00
Samuel Pitoiset c4f37d3981 [util] Enable d3d11.invariantPosition for Star Wars Jedi: Fallen Order
Seems to resolve https://gitlab.freedesktop.org/mesa/mesa/-/issues/2706#note_538316

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2020-06-18 13:40:24 +02:00
Robin Kertels 291f7e05bc [d3d9] Fix uninitialized BufferHandle when discarding mapped buffer
Co-authored-by: Christopher Egert <cme3000@gmail.com>
2020-06-15 03:26:47 +01:00
Joshua Ashton 9525f53d00 [d3d9] Only enable FETCH4 when POINT sampling
Closes #1660
2020-06-14 00:38:36 +01:00
Rhys Perry cd0a21dda5 [util] Enable d3d11.invariantPosition for Terminator: Resistance
Seems to resolve https://gitlab.freedesktop.org/mesa/mesa/-/issues/2608
2020-06-12 17:58:30 +02:00
Rhys Perry 0a486bd975 [util] Enable d3d11.invariantPosition for Borderlands 3
Seems to resolve https://gitlab.freedesktop.org/mesa/mesa/-/issues/2608
2020-06-12 17:58:30 +02:00
Philip Rebohle 51bd84368c
[util] Disable relaxed barrier option for RE7
Introduces lighting glitches in some places.
2020-06-11 22:06:53 +02:00
Joshua Ashton 67f01631fa [d3d9] Clear dirty range when discarding buffers 2020-06-11 05:58:17 +01:00
Robin Kertels 7389da29be [d3d9] Discard mapped buffer if it's currently in use 2020-06-11 05:53:33 +01:00
Robin Kertels 5d5ec2aa77 [d3d9] Remove IsUploading from CommonTexture
This was always true on subsequent Lock calls.
The first lock was handled by the 'freshly allocated fast path' anyway.
2020-06-11 05:53:33 +01:00
Joshua Ashton e6ed8dab63 [d3d9] Perform tracking for preloaded managed resources 2020-06-11 05:53:33 +01:00
Joshua Ashton 7e72010302 [d3d9] Upload managed resource if needed before mip gen 2020-06-11 05:53:33 +01:00
Joshua Ashton 04397e5a7b [d3d9] Mark mips as dirty when the filter changes 2020-06-11 05:53:33 +01:00
Joshua Ashton f537474fe4 [d3d9] Add missing locks to mipmap auto gen 2020-06-11 05:53:33 +01:00
Joshua Ashton b1bd3597a4 [d3d9] Implement PreLoad for buffers + textures 2020-06-11 05:53:33 +01:00
Samuel Pitoiset 86c53bb9e6 [util] Set enableRtOutputNaNFixup for Stars End
To fix output NaNs that introduce glitches with RADV.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2020-06-09 16:08:16 +02:00
Joshua Ashton 68ae3f4376 [d3d9] Return D3D_OK when unlocking not locked textures
Matches D3D9 behaviour
2020-06-05 23:46:33 +01:00
Joshua Ashton 124023bac5 [d3d9] Add read-only check to uploading managed textures on Lock 2020-06-05 23:33:00 +01:00
Joshua Ashton ed5cbb99b6 [d3d9] Mark managed for upload in Lock rather than Unlock
Fixes Nekopara properly.

Also refactor some locking checks
2020-06-05 23:29:23 +01:00
Joshua Ashton 86e8315416 [d3d9] Revert Nekopara hacks 2020-06-05 23:15:10 +01:00
Joshua Ashton fa988be4aa [d3d9] Improve MarkAllForUpload implementation
Only mark the bits we are actually using.
2020-06-05 02:40:41 +01:00
Joshua Ashton 326f6c26cb [util] Enable forceSamplerTypeSpecConstants for all of the games in the Spellforce 2 seires 2020-06-05 02:36:17 +01:00
Joshua Ashton b658cae509 [util] Enable uploadAllManagedSubresources for Nekopara titles 2020-06-05 02:35:03 +01:00
Joshua Ashton d39cf31189 [d3d9] Implement uploadAllManagedSubresources option
Nekopara locks mip 1, then unlocks mip 0 and expects it to upload all the mips.
2020-06-05 02:34:44 +01:00
Joshua Ashton 5558460853 [d3d9] Don't mark lock on DONOTWAIT path
Fixes some issues in some games using this feature.
2020-06-01 15:52:25 +01:00
Joshua Ashton 12356d7342 [dxso] Bias FETCH4 half-texel offset to avoid grid effect 2020-06-01 13:33:08 +01:00
Philip Rebohle 2cac70fbb6
[d3d11] Require transform feedback for FL10_0 and newer
This has been supported in drivers for one and a half years at this
point, so it should be safe to make it a hard requirement.
2020-05-30 16:02:22 +02:00
Joshua Ashton f92d60496c [util] Enable forceSamplerTypeSpecConstants for SpellForce 2: Faith in Destiny
The game binds a 2D texture to a 3D (volume) sampler which causes the readback to be 0 0 0 0 on native, whereas we can workaround it and see the intended texture and cool refracty effect that would have rendered on older real hardware 👏

Closes #1645
2020-05-27 17:14:20 +01:00
Joshua Ashton a21e0d4bcf Revert "[dxso] Make FETCH4 swizzle ARGB"
The documentation lies about the swizzle...

This reverts commit 2fc00a331b.

Closes #1641
Once and for all !
2020-05-27 12:11:43 +01:00
Joshua Ashton 56687cc258 [dxso] Handle half texel offset for FETCH4
Closes #1641
2020-05-27 10:16:03 +02:00
Joshua Ashton 362a591e5b [spirv] Implement constuReplicant helper 2020-05-27 10:16:03 +02:00
Joshua Ashton 16cea83325 [spirv] Implement constiReplicant helper 2020-05-27 10:16:03 +02:00
Joshua Ashton a9db65c8c2 [spirv] Implement OpImage 2020-05-27 10:16:03 +02:00
Joshua Ashton c03eaf2de7 [d3d9] Hook up auto gen mip filter 2020-05-27 10:12:43 +02:00
Joshua Ashton 7cd46e72e9 [dxvk] Add filter type to generateMipmaps 2020-05-27 10:12:43 +02:00
Joshua Ashton 3825d16a31 [d3d9] Move mip filter into common texture 2020-05-27 10:12:43 +02:00
Joshua Ashton 561254b51d [d3d9] Support RENDERTARGET and AUTOGENMIPMAP together
Fixes funky water in Trackmania
Closes #1642
2020-05-27 09:03:58 +01:00
Joshua Ashton 2fc00a331b [dxso] Make FETCH4 swizzle ARGB
https://developer.amd.com/wordpress/media/2012/10/Advanced-DX9-Capabilities-for-ATI-Radeon-Cards_v2.pdf
2020-05-27 06:19:13 +01:00
Joshua Ashton d8381dab8d [d3d9] Fix a typo when unmarking autogen mips 2020-05-26 18:57:28 +01:00
Joshua Ashton 1a920f44ea [d3d9] Rename GenerateMips to EmitGenerateMips 2020-05-26 18:50:34 +01:00
Joshua Ashton fabe7b5d59 [d3d9] Check if needs mip gen in GenerateTextureMips
There could be duplicate indices!
2020-05-26 18:49:17 +01:00
Joshua Ashton 6c030afc95 [d3d9] Update device tracking when manually autogenning mips
Avoids some needless generations potentially.
2020-05-26 18:48:42 +01:00
Joshua Ashton e57aea5749 [d3d9] Track and defer mipmap generations
Turns out we need to track this crap and generate at draw time and handle a bunch of other wacky cases for it...

Bah.

Fixes #1642
(The funky water.)
2020-05-26 18:42:53 +01:00
Joshua Ashton b958473cc9 [d3d9] Move pLockedBox/Rect checks to subresource 2020-05-26 13:14:58 +01:00
Joshua Ashton 4c1deabcd3 [d3d9] Don't expose surfaces for autogenned mips 2020-05-26 13:11:24 +01:00
Joshua Ashton a35df1c3b1 [d3d9] Fix AUTOGENMIPMAP not working in some instances
Closes #1642
2020-05-26 12:46:55 +01:00
Christopher Egert 67b1ee4f9b [d3d9] Only allow ColorFill on surfaces in D3DPOOL_DEFAULT
Both nine and native nvidia d3d9 seems to do this,
this fixes a crash in spacemail by xplsv.
2020-05-25 13:33:12 +01:00
Joshua Ashton 4d70d59ea4 [d3d9] Use base texture for subresource refs
Fixes a crash when running d3d9-triangle
2020-05-25 13:29:56 +01:00
Joshua Ashton 9ee4add77e [dxso] Forbid FETCH4 for 3D and not Cube
SPIR-V spec contradicts itself as to what is allowed here, and SPIR-V val doesn't help by listing the wrong dimension.
2020-05-25 09:26:09 +01:00
Joshua Ashton 87e8b9733f [dxso] Blacklist FETCH4 for cubes and normalize flags 2020-05-25 09:21:30 +01:00
Joshua Ashton b12fa99435 [dxso] Fix scalar select on vector in FETCH4 code 2020-05-25 09:05:58 +01:00
Joshua Ashton 4e1ee5bf39 [d3d9] Normalize projection spec constant further
Only include those used in the pixel shader and are bound.
2020-05-25 06:13:21 +01:00
Joshua Ashton 8fdf9e67d3 [d3d9, dxso] Implement FETCH4 2020-05-25 06:13:21 +01:00
Joshua Ashton 5d69898cbd [tests] Add D3D9 fetch4 state tests 2020-05-25 06:13:21 +01:00
Philip Rebohle cf1ff99b10 [vulkan] Disable fullscreen exclusive support on wine
Fixes issues with RenderDoc captures on winevulkan.
2020-05-24 18:38:54 +02:00
Joshua Ashton 9a40c1e6ae [dxvk] Fix fb resolve offset
gl_FragCoord is read in the fs shader, so we need to take into account the dstOffset here!

This was causing the offset to be doubled rather than eliminated
for the resolves for refractive water in Serious Sam 2
as srcOffset == dstOffset.

Fixes #1637
2020-05-22 11:13:07 +02:00
Joshua Ashton 8e7df31878 [d3d9] Correct resolve offset regions for intermediate StretchRect resolves
We don't want to use the dst info for these, given the blit will do that.

Partially fixes #1637
2020-05-22 11:13:07 +02:00
Joshua Ashton e2ad3b1b20 [d3d9] Improve sampler anisotropy normalization 2020-05-21 08:58:39 +01:00
Philip Rebohle 0c0d582f24
[dxvk] Default to fragment shader resolved on official AMD drivers
Improves performance of MSAA resolves. RADV does not benefit.
2020-05-19 18:54:25 +02:00
Philip Rebohle 5d7b5b0e35
[dxvk] Fix framebuffer resolve barriers 2020-05-19 16:23:44 +02:00
Christopher Egert 79feed9d89 [d3d9] Allow D3DFMT_NULL as RenderTargetFormat in CheckDepthStencilMatch
This partially fixes shadows in Timeshift.
2020-05-19 04:12:36 +01:00
Joshua Ashton 63a4c4d457 [tests] Add tests for D3DFMT_NULL format querying 2020-05-19 04:11:59 +01:00
Joshua Ashton 5339f8df53 [tests] Fix d3d9_triangle 2020-05-19 04:07:11 +01:00
DadSchoorse 84bb768a32 [util] Enable d3d9.invariantPosition for Halo/Hale CE
Fixes #1550
2020-05-17 23:41:42 +02:00
Philip Rebohle 2e378257ea
[meta] Release 1.7 2020-05-16 17:07:18 +02:00
Robin Kertels 724d0fc0b2 [d3d9] Set scissor to the viewport if that's smaller
Fixes #1608
2020-05-13 18:53:11 +01:00
Philip Rebohle 6643c75f37
[dxvk] Use access flags rather than usage when tracking gfx barriers 2020-05-12 00:24:09 +02:00
Philip Rebohle 57acbbd7c7
[d3d11] Always enable STORAGE_BUFFER_BIT usage for srv/uav buffers
Fixes validation errors in games that use incorrect view types in
some cases, e.g. Cloudpunk.
2020-05-12 00:23:12 +02:00
Philip Rebohle aa0b306d2e
[d3d11] Require multiDrawIndirect feature for Feature Level 11.0
All hardware that DXVK can run on supports this, so let's just enable it.
Saves some feature checks in games using Ubisoft's Anvil Next engine.
2020-05-11 01:15:06 +02:00
Philip Rebohle e7455b6460
[vulkan] Remove VulkanFn wrapper
Not really necessary, and apparently this is causing trouble on GCC 10.1.

Fixes #1620.
2020-05-10 02:06:27 +02:00
Joshua Ashton 3a6c0cf605 [dxso] Implicitly define Color inputs as centroid in PS <= 2 2020-05-09 20:49:55 +01:00
Joshua Ashton 774f74cd36 [d3d9] Only dirty ff pixel shader if set texture is in PS binding range 2020-05-07 16:14:11 +01:00
Joshua Ashton 27b9736626 [d3d9] Dirty fixed function pixel shader on texture type change
Fixes #1603
2020-05-07 16:09:58 +01:00
Joshua Ashton b2f6885e55 [d3d9] Make texture stage state args mask easier to read 2020-05-07 15:37:05 +01:00
Joshua Ashton a6771daf49 [d3d9] Unbind depth image views on device reset 2020-05-07 15:35:48 +01:00
Joshua Ashton 42deab0d60 [d3d9] Cleanup SetStateTextureStageState dirty flags 2020-05-07 14:50:26 +01:00
Joshua Ashton f88f424da4 [d3d9] Convert border color to float in CS thread
It's cheaper to look up sampler keys this way
2020-05-07 13:11:59 +01:00
Joshua Ashton fd75775197 [d3d9] Use unordered comparison opposed to isnan
Results in better codegen
2020-05-07 13:05:36 +01:00
Joshua Ashton 198ce13934 [d3d9] Replace clamp with min in sampler normalization 2020-05-07 13:01:14 +01:00
Philip Rebohle 68be040f4a
[dxvk] Use compute queue for transfers if DMA queue is not available
Affects RADV. Let's see if this works and does anything for performance.
2020-05-05 12:49:13 +02:00
Philip Rebohle d999d0a15c
[tests] Improve HLSL compiler
Makes it easier to generate code for D3D12 tests.
2020-05-05 10:26:19 +02:00
Philip Rebohle 5fd361757b
[d3d9] Disable old border color hack if custom border colors are supported 2020-05-04 20:18:44 +02:00
Philip Rebohle 263865cf28
[d3d9] Enable custom border color features if available 2020-05-04 19:46:57 +02:00
Philip Rebohle 00613d1dc7
[d3d11] Enable custom border color features if available 2020-05-04 19:46:57 +02:00
Philip Rebohle 1fc6e3adbe
[dxvk] Use custom border colors if available 2020-05-04 19:46:57 +02:00
Philip Rebohle 0648314451
[dxvk] Refactor DxvkSampler::getBorderColor 2020-05-04 19:46:57 +02:00
Philip Rebohle 7b81db2c75
[dxvk] Pass device to sampler constructor 2020-05-04 19:46:57 +02:00
Philip Rebohle a968f29754
[dxvk] Enable VK_EXT_custom_border_color if available 2020-05-04 13:27:35 +02:00
Philip Rebohle 513f3f552d
[meta] Update Vulkan headers 2020-05-04 13:16:08 +02:00
Philip Rebohle 7239066c5c
[dxvk] Don't stall SDMA command buffer for image initialization 2020-05-02 20:20:56 +02:00
Philip Rebohle 4fafeb21d0
[dxvk] Optimize clearDepthStencilImage barrier 2020-05-02 20:13:13 +02:00
Philip Rebohle e24954ca39
[dxvk] Optimize clearColorImage barrier 2020-05-02 20:13:13 +02:00
Philip Rebohle 52cad95f2c
[dxvk] Use initializeImage in clearColorImage 2020-05-02 20:13:13 +02:00
Philip Rebohle bbd5762d3d
[dxvk] Add initializeImage helper
Allows us to use TOP_OF_PIPE -> xxx barriers more often.
2020-05-02 20:10:19 +02:00
Philip Rebohle a208f45fe4
[dxvk] Actually reinitialize image if necessary 2020-05-02 19:27:45 +02:00
Philip Rebohle 651646ca7f
[dxvk] Fix acquire barrier in clearCompressedColorImage 2020-05-02 19:06:22 +02:00
Philip Rebohle dcc38c98e7
[dxvk] Fix acquire barriers in resolveImageHw 2020-05-02 18:58:38 +02:00
Philip Rebohle b370d13743
[dxvk] Fix acquire barrier in updateImage 2020-05-02 18:52:35 +02:00
Philip Rebohle 8921be81bd
[dxvk] Fix blit acquire barriers 2020-05-02 18:49:58 +02:00
Philip Rebohle 85db84a1b3
[dxvk] Fix access mask in clearImageViewFb
VK_ATTACHMENT_LOAD_OP_LOAD requires the read flags to be set.
2020-05-02 18:48:59 +02:00
Philip Rebohle 5bab5ae7a5
[dxvk] Fix acquire barriers in copyImageHw 2020-05-02 18:46:35 +02:00
Philip Rebohle c1fcc3fc98
[dxvk] Simplify barriers around meta copy operations 2020-05-02 18:46:21 +02:00
Philip Rebohle f6007e4f1a
[dxvk] Emit graphics barriers upon spilling render pass
We actually need to do this now since we no longer set
all the access flags in the render pass barrier.
2020-05-02 11:36:32 +02:00
Philip Rebohle 0245273ab7
[dxvk] Remove store op from render pass ops
This is always going to be VK_ATTACHMENT_STORE_OP_STORE anyway.
2020-05-02 11:36:32 +02:00
Philip Rebohle c0f72940dd
[dxvk] Optimize regular render pass barriers
Only applies the depth/color attachment stage and access mask
if necessary, and removes a bunch of pointless read-only flags.
2020-05-02 11:36:32 +02:00
Philip Rebohle 94077ed42b
[dxvk] Reintroduce EXTERNAL->0 subpass dependency
Ensures that the layout transition happens at the right time, and
otherwise relaxes the barrier since it is assumed that the backend
will emit barriers with the appropriate as necessary.
2020-05-02 11:36:32 +02:00
Philip Rebohle 2089426420
[dxvk] Simplify render pass barriers after clears
This wasn't really doing what we intended.
2020-05-02 11:36:32 +02:00
Philip Rebohle b9c56e3e97
[dxvk] Improve deferred clear logic
Ignores currently bound render targets until we actually begin a
render pass. This allows us to use LOAD_OP_CLEAR in more situations,
including when games clear their RTs before binding them.
2020-05-02 11:36:32 +02:00
Philip Rebohle 3cbd109020
[dxvk] Remove redundant null pointer check for framebuffer
Not necessary because we're *always* calling updateFramebuffer
before startRenderPass.
2020-05-02 11:36:31 +02:00
Philip Rebohle 2967f567d8
[dxvk] Introduce performClear helper 2020-05-02 11:36:31 +02:00
Philip Rebohle 46f860f93e
[dxvk] Don't flush memory in changeImageLayout 2020-05-02 11:36:28 +02:00
DadSchoorse 9b602ef850
[util] Rework tearFree as a Tristate
PR #1606.
2020-05-02 10:18:13 +02:00
Philip Rebohle c9dde91760
[d3d11] Disable null descriptors again
Breaks ELEX due to incorrect image query results.
2020-05-02 01:02:46 +02:00
Philip Rebohle f1e069568d
[build] Remove .spec files
No longer needed now that we don't support winelib builds anymore.
2020-05-01 00:52:33 +02:00
Philip Rebohle 6face8a1dc [d3d11] Enable new robustness features if available 2020-04-30 16:36:59 +02:00
Philip Rebohle 80009831d4 [d3d11] Use explicit spec constant for gamma texture
With null descriptors, the "bound" spec constants would always be 1.
2020-04-30 16:36:59 +02:00
Philip Rebohle 7b8a65589e [dxvk] Use null descriptors for unbound resources
This way we won't have to recompile pipelines any time the app
unbinds a resource.
2020-04-30 16:36:59 +02:00
Philip Rebohle 6ea9d83f94 [dxvk] Enable VK_EXT_robustness2 if available 2020-04-30 16:36:59 +02:00
Philip Rebohle 6d9a1e69d6 [meta] Update Vulkan headers 2020-04-30 16:36:59 +02:00
Philip Rebohle 2a25e3f899 [dxvk] Skip draws if no index buffer is bound
It doesn't make much sense to bind the null buffer here, as we'd
just draw the same vertex over and over again.
2020-04-30 16:36:59 +02:00
Philip Rebohle ca59d8e74b
[dxgi] Implement DXGIDeclareAdapterRemovalSupport 2020-04-28 15:20:43 +02:00
Philip Rebohle 5d0efd87c2
[dxgi] Implement IDXGIOutput6 2020-04-28 15:00:57 +02:00
Philip Rebohle 15f5efe4c3
[dxgi] Implement IDXGIAdapter4 2020-04-28 14:50:36 +02:00
Philip Rebohle 26ea12b18e
[dxgi] Include DXGI 1.6 headers 2020-04-28 14:44:20 +02:00
Joshua Ashton 9f4baf3f55 [d3d9] Fix swapchain surface refs once and for all
The refcounting for d3d9 swapchain surfaces is very funny.
They don't actually hold any form of reference to their parent, unlike the surface->texture relationship.

When a swapchain is destroyed, the surfaces become orphans (like offscreen rendertargets) if they are still reffed.

Calling GetContainer on them when orphaned will return E_NOINTERFACE and nullptr for __uuidof(IDirect3DSwapChain)

Fixes some potential lingering refs on the device.
2020-04-26 13:32:22 +01:00
Joshua Ashton 353c7f7671 [tests] Add D3D9 swapchain refcounting tests 2020-04-26 13:32:22 +01:00
Philip Rebohle 6d5f5580fb
[dxvk] Use correct size to clear zero buffer 2020-04-23 20:49:59 +02:00
Philip Rebohle 9a76645228
[d3d11] Simplify ClearView implementation
Removes some code duplication for the no-clear-rect case.
2020-04-22 22:32:53 +02:00
Philip Rebohle b3c19ba5e8
[d3d11] Optimize ClearView for render target and depth-only views
We should use clearRenderTarget whenever we clear the entire view.
The Talos Principle uses ClearView to clear its render targets for
some reason, and we were hitting a slow path there.
2020-04-22 21:02:46 +02:00
Tk-Glitch 6b6347ea2c [meta] Restore .a files removal on non-devbuilds.
This was -supposedly mistakenly- removed with 436357e280
2020-04-22 10:04:40 +02:00
Philip Rebohle bea16263e4
[dxvk] Use GPU-local buffer in clearCompressedColorImage
Saves VA space in applications that do not initialize their textures..
2020-04-21 18:10:09 +02:00
Philip Rebohle 436357e280
[meta] Remove support for winelib builds
Untested, unmaintained, and constantly causing issues on various
setups for no apparent reason. Time to get rid of it for good.

Closes #1584.
2020-04-20 17:35:08 +02:00
Philip Rebohle dbc9f40aa1
[meta] Release 1.6.1 2020-04-19 21:43:03 +02:00
Philip Rebohle b0503b54ce
[dxvk] Don't pad dedicated image allocations
Fixes validation errors on Nvidia.
2020-04-19 17:19:06 +02:00
Joshua Ashton 409eac9d20 [d3d9] Use if/else in GetCommonTexture and TextureRefPrivate
These are the only things it can be, and they all end up calling what the compiler will optimize to the same function so we can avoid a branch here.
2020-04-19 01:11:11 +01:00
Joshua Ashton 3f2b582d5f [d3d9] Avoid prematurely deleting swapchain backbuffers if they are still reffed on reset 2020-04-19 00:59:02 +01:00
Joshua Ashton 837861ffdd [d3d9] Cleanup private ref code for subresources 2020-04-18 21:06:38 +01:00
Joshua Ashton 42089d73c5 [d3d9] Fix ref-counting for swapchain surfaces 2020-04-18 21:06:38 +01:00
Christian Sturm 97cd91885d [util] Enable constant buffer range check for Secret World Legends 2020-04-18 21:53:21 +02:00
Robin Kertels d6e1c19fec [d3d11] Ignore buffer usage for the single use mapping hack
The usage doesn't matter as we swap out the entire backing slice anyway.
2020-04-18 17:15:48 +02:00
Philip Rebohle 8c68236f70
[d3d11] Check return value of Map in UpdateSubresource1
And fall back to a GPU-side copy if necessary.
2020-04-18 17:04:16 +02:00
Philip Rebohle 487ecd861c
[util] Enable constant buffer range check for Blue Reflection
Fixes #1574.
2020-04-18 14:00:04 +02:00
yao mtc ce3d0ab4b4
[meta] Correct Mingw-w64 name (#1565) 2020-04-14 09:18:37 +02:00
Philip Rebohle 2204cff86a [tests] Remove unused variables from D3D9 test
Fixes a whole bunch of annoying compiler warnings.
2020-04-13 22:05:27 +01:00
Philip Rebohle ab8ab4052f [d3d9] Fix compiler warnings 2020-04-13 22:05:27 +01:00
Philip Rebohle f257a794cc
[meta] Trim \r character from winepath output.
Wine 5.6 for some reason now requires this. Fixes #1569.
2020-04-13 20:16:51 +02:00
Joshua Ashton 4699d4162a [d3d9] Implement swapchain containers for surfaces
Fixes a crash in L.A. Noire.

Closes #1564
2020-04-13 01:42:30 +01:00
Philip Rebohle 4d8940957c
[d3d11] Add option to enforce mailbox present mode 2020-04-12 20:28:33 +02:00
Philip Rebohle 7f03f45301
[util] Support encapsulated strings in configuration files
Fixes #1567.
2020-04-10 21:16:29 +02:00
Joshua Ashton 6e5e50c359 [d3d9] Optimize hazard tracking in the SetTexture case
We don't need to perform DS/RT hazard tracking updates if the texture we replaced and ourselves do not have those usages.
2020-04-09 15:29:41 +01:00
Joshua Ashton 9b4cd8aa87 [d3d9] Remove texMask from UpdateActiveHazardsRT
This is an invalid optimization and leads to render hazards being dropped

Our hazard tracking for render targets is done in render target indices as opposed to texture indices for depth stencil tracking so `texMask` doesn't work for that reason, and the fact that even if it did, there is no relationship to an individual texture and a render target index that has a hazard.
2020-04-09 15:29:41 +01:00
Joshua Ashton 6b431851da [util] Enable d3d9.invariantPosition for Battlefield 2
Closes #1558 for good
2020-04-09 14:00:26 +01:00
Joshua Ashton ecb3e05cb9 [d3d9] Ignore adapter type for CheckDepthStencilMatch and CheckDeviceType when windowed 2020-04-09 02:35:35 +01:00
Joshua Ashton 8d7bdc5392 [test] Add tests for adapter functions 2020-04-09 02:34:35 +01:00
Joshua Ashton f549586331 [util] Set d3d9.longMad to True for Battlefield 2 2020-04-08 23:23:21 +01:00
Joshua Ashton c3cff09c4f [d3d9] Implement d3d9.longMad option 2020-04-08 23:20:57 +01:00
Joshua Ashton 93b4427a13 [d3d9] Add and use D3D9WindowMessageFilter helper
Stops us forgetting to reset the message filter

Previously when the device was intially created with fullscreen, filter would always be enabled
2020-04-08 20:20:01 +01:00
Georg Lehmann e95e4ca225 [hud] remove unused texture 2020-04-08 20:11:02 +02:00
Joshua Ashton 3f4ffdfba8 [d3d9] Fix MinGW compilation
MSVC doesn't care about static.
2020-04-06 20:35:30 +01:00
Joshua Ashton 46329689ba [d3d9] Handle WM_DESTROY event 2020-04-06 20:16:17 +01:00
Joshua Ashton 18b46e5c22 [d3d9] Move HookWindowProc out of swapchain class 2020-04-06 20:15:49 +01:00
Joshua Ashton a340cd4dd3 [d3d9] Add CallCharsetFunction helper 2020-04-06 20:06:45 +01:00
Joshua Ashton 6cf052b3f2 [d3d9] Cleanup ResetWindowProc 2020-04-06 19:45:15 +01:00
Joshua Ashton 135d246610 [d3d9] Cleanup and formatting for window proc hook 2020-04-06 19:42:48 +01:00
Joshua Ashton 47ddd8466a [d3d9] Re-look up wnd proc iterator
Avoids a potential issue where this could change address during this time.
2020-04-06 19:40:25 +01:00
Joshua Ashton a80eea926a [d3d9] Filter out window messages we cause
Closes #1517
2020-04-06 19:38:26 +01:00
Joshua Ashton 83e03ac9d8 [d3d9] Make COPM render state unlikely
This is only ever called once per game and we don't support it anyway
2020-04-05 06:27:14 +01:00
Joshua Ashton 92031a7bac [d3d9] Fix dumb typo in ATOC handling 2020-04-03 21:13:15 +01:00
Philip Rebohle 00d371d78d [util] Spoof AMD GPU for GTA IV 2020-04-03 16:39:29 +01:00
Joshua Ashton bbe681d9ca [dxvk] Fix incorrect logic in resolveDepthStencilImage
This fallbath check path should be triggered if we aren't currently using the fb.

Impacts #1537
2020-04-03 11:20:21 +02:00
Joshua Ashton 457c0c3021 [d3d9] Fix state sometimes not being set in SetRenderState
Previously this prevented us disabling AlphaToCoverage once the application enabled it.
2020-04-03 07:52:35 +01:00
Philip Rebohle 5c3d0c6836
[util] Enable d3d11.relaxedBarriers option for Resident Evil 3 2020-04-03 02:58:59 +02:00
Philip Rebohle 4d6f47640f
[dxgi] Name adapter event thread 2020-04-03 02:09:06 +02:00
Philip Rebohle 079cda1c0c
[dxgi] Implement RegisterVideoMemoryBudgetChangeNotificationEvent
Closes #1544.
2020-04-03 02:05:23 +02:00
Joshua Ashton 904d3e6c90 [d3d9] Don't declspec dllexport on MinGW builds
Fixes ordinal exporting on MinGW, which was causing a crash in CSGO due to it querying a fixed ordinal for a D3D9On12 hack.
2020-04-02 02:00:42 +01:00
Philip Rebohle 4f75dbfa03
[meta] Fix typo 2020-04-01 00:20:11 +02:00
Philip Rebohle c1aeacde29
Update issue template 2020-03-31 23:26:26 +02:00
stefson 16c3c48758 [documentation] improve README.md with regards to mingw64
Signed-off-by: Steffen Kuhn <nielson2@yandex.com>
2020-03-28 11:34:43 +01:00
Philip Rebohle 5750a7d85c
[dxbc] Fix the udiv crap again 2020-03-26 17:17:01 +01:00
Joshua Ashton 62c2c9cd15 [dxbc] Handle 0 divisors in UDiv
UDiv is defined as having 0xffffffff as both the quotient and remainder value when the divisor is 0

This fixes vertex corruption on the water bottles in Half-Life: Alyx
https://github.com/ValveSoftware/Proton/issues/3681

https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/udiv--sm4---asm-
2020-03-26 10:49:42 +01:00
Samuel Pitoiset 649c3805d9 [util] fix typo for Yooka-Laylee executable name 2020-03-25 14:29:28 +01:00
Joshua Ashton bb2e88ee06 [d3d9] Fix crash when calling ColorFill with NULL format
Impacts #1528
2020-03-25 07:23:17 +00:00
Joshua Ashton bb0772eb8d [tests] Add test for ColorFill on NULL format 2020-03-25 07:21:02 +00:00
Joshua Ashton 5ff7cad77d [d3d9] Fix formatting in D3D9WindowProc 2020-03-25 07:14:35 +00:00
Samuel Pitoiset f6a79c366a [util] Set enableRtOutputNaNFixup for Super Monkey and Yooka-Laylee
Both games output NaNs that introduce glitches with RADV and
AMDVLK.
2020-03-22 15:38:24 +01:00
Philip Rebohle 3104192af7
[d3d11] Fix winelib build
Closes #1521.
2020-03-20 17:01:46 +01:00
Philip Rebohle 9c7945d936
[meta] Release 1.6 2020-03-20 16:07:25 +01:00
Philip Rebohle c22c30ccf6
[meta] Update README 2020-03-20 16:07:25 +01:00
Joshua Ashton a9339ae832 [d3d9] Fix depth hazard case for write + read
Closes #1519
2020-03-20 14:23:29 +01:00
Philip Rebohle 1150121606 [d3d9] Fix depth-stencil layouts
Otherwise we're always using GENERAL for depth buffers.
2020-03-20 04:04:53 +00:00
Philip Rebohle a9b6421f60
[d3d11] Support signaling event in Flush1 2020-03-19 23:38:28 +01:00
Philip Rebohle 76fd9013d4
[util] Add missing include 2020-03-19 23:22:13 +01:00
Philip Rebohle 3697583f71
[d3d10] Separate d3d10core from d3d10
This way we skip compiling and linking unnecessary garbage
into the core library.
2020-03-18 22:01:11 +01:00
Philip Rebohle c1627a1b57
[meta] Don't install d3d10 and d3d10_1 by default 2020-03-18 21:02:42 +01:00
Joshua Ashton 7a134e49be
[d3d10] Implement D3D10[Core]GetVersion and D3D10[Core]RegisterLayers 2020-03-18 20:49:17 +01:00
Joshua Ashton 021c593ad8 [d3d9] Use all heaps when determining initial texture memory
Matches behaviour on Windows 10

Merges #1436
2020-03-18 19:40:01 +00:00
Florian Will ba41a5219a [util] Disable explicit frontbuffer for ZUSI 3
Fixes flickering when parts of the screen are not redrawn in a frame.

Closes #1368
Merges #1437
2020-03-18 19:32:45 +00:00
Florian Will 1a4b15a82d [d3d9] Add option to disable the explicit frontbuffer
The Vulkan swapchain is unaffected by this, but we don't create an
"internal" frontbuffer in D3D9SwapChainEx if this option is set. This
breaks GetFrontBufferData (which returns backbuffer data if the option
is enabled), but it disables front/backbuffer flipping.

Most windows drivers apparently always use the same backbuffer for all
frames in windowed mode. At least one game (ZUSI 3) seems to rely on
this behavior, and only redraws dirty regions for each frame instead of
redrawing everything. With buffer flips, this leads to flickering. When
enabling this new noExplicitFrontBuffer option, the flickering
disappears.
2020-03-18 19:31:00 +00:00
Joshua Ashton 6a8933cf31 [d3d9] Allow arbitrary backbuffer/adapter formats
It seems these aren't linked in the way the docs made out, this fixes a crash when starting some titles.

Closes #1508
2020-03-18 06:00:28 +00:00
Joshua Ashton a9040c5cce [d3d9] Allow multisampled depth stencil resolves in StretchRect
Fixes a crash in some Source 2 titles
2020-03-18 04:59:27 +00:00
Joshua Ashton 19842532c2 [build] Specify C++ std manually in meson build
Meson doesn't specify this otherwise...
2020-03-18 03:47:55 +00:00
Philip Rebohle bf480ce659
[d3d11] Initialize all D3D11ContextState members
Otherwise, SwapDeviceContextState may swap in some uninitialized data.
Closes #1512.

Reported-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
2020-03-16 18:42:57 +01:00
Philip Rebohle 26798eb312 [util] Use SwitchToThread for yield
According to MSDN, this doesn't interfere with scheduling of other threads,
unlike Sleep(0).
2020-03-15 03:43:04 +01:00
Philip Rebohle ba213c1fa0 [dxvk] Factor out waiting for resource to become idle
And use the new generic spin function to reduce syscall spam.
2020-03-15 03:43:04 +01:00
Philip Rebohle da506f5932 [util] Add generic recursive spinlock 2020-03-15 03:43:04 +01:00
Philip Rebohle 55e3240479 [util] Add generic spin function 2020-03-15 03:43:04 +01:00
nopjmp 3835230ce5 [meta] use c++latest only for old versions of MSVC
c++latest is only needed for c++17 features when the compiler is before MSVC 15.3
2020-03-14 11:26:03 +01:00
Philip Rebohle 33b0d4c991
[d3d10] Create type reflection objects on demand
See previous commits for details. Fixes #1507.
2020-03-12 21:03:31 +01:00
Philip Rebohle 3d81b3eb82
[d3d10] Create variable reflection objects on demand 2020-03-12 21:03:30 +01:00
Philip Rebohle 21fe6a3405
[d3d10] Create constant buffer reflection objects on demand
The reported constant buffer count does not necessarily match the
number of constant buffers that can be retrieved from reflection.
2020-03-12 21:03:30 +01:00
Rémi Bernon 14946c599f [d3d9] Hook WM_NCCALCSIZE to get rid of fullscreen non-client areas. 2020-03-11 17:46:08 +00:00
Joshua Ashton 2ee7facb9f [tests] Add some d3d9 srgb format tests 2020-03-09 03:05:51 +00:00
Joshua Ashton 64e649ae18 [d3d9] Don't check IsNull for depth stencil views
We don't need to do this. Depth stencils can never be D3DFMT_NULL.
2020-03-09 01:13:54 +00:00
Joshua Ashton e33627cfdc [d3d9] Optimize unnecessary loops in hazard tracking
We only want to update specific indices of bitfields at a time, so pass through that information and mask it off.
2020-03-09 01:03:18 +00:00
Joshua Ashton 812a113a85 [d3d9] Avoid multiple tzcnts per loop in hazard tracking 2020-03-09 00:53:50 +00:00
Joshua Ashton f6b26b302d [d3d9] Handle depth stencil hazards
Track depth stencil textures being used and whether we have any active hazards.

Rebind the framebuffer with VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL if we encounter a depth stencil hazard.

Fixes black squares in Mass Effect and validation errors in some titles.

Closes #1484
2020-03-09 00:53:19 +00:00
Joshua Ashton 102d97db02 [d3d9] Add IsDepthStencil helper to D3D9CommonTexture 2020-03-09 00:24:56 +00:00
Joshua Ashton a432befa8d [d3d9] Add RT suffix to current hazard tracking
We can have DS hazards...
2020-03-09 00:23:22 +00:00
Joshua Ashton eaa599bf9a [d3d9] Implement A2W10V10U10 format via conversion 2020-03-08 23:32:33 +00:00
Joshua Ashton 60ec7e8208 [d3d9] Implement X8L8V8U8 format via conversion 2020-03-08 23:22:52 +00:00
Joshua Ashton afd4e6e457 [d3d9] Use a common header for cs conversion helpers 2020-03-08 22:29:41 +00:00
Philip Rebohle 304dad2d2e
[dxvk] Fix dumb typo in changeImageLayout 2020-03-08 03:18:34 +01:00
Philip Rebohle 7b760800b4
[d3d11] Fix buffer view compatibility check 2020-03-08 01:28:51 +01:00
Philip Rebohle 2291484696
[d3d11] Fix texture view compatibility check 2020-03-08 01:28:51 +01:00
Jens Peters f85be773aa [meta] Remove D3D10 HUD restriction in the README
D3D10 in the HUD api option is identified correctly since be16da37d7
2020-03-07 22:58:30 +01:00
Joshua Ashton 45c8b09104 [d3d9] Don't update present region in Reset
Fixes a regression in A Hat in Time when changing resolutions
2020-03-06 18:23:08 +00:00
Philip Rebohle 245007daba [d3d9] Don't use m_monitor in GetDisplayModeEx
Should fix #1495.
2020-03-05 15:25:05 +00:00
Philip Rebohle 3a1243b05e [util] Don't set display mode if the desired mode is already set
See #1489.

Co-authored-by: zvova7890 <zvova7890@gmail.com>
2020-03-04 23:06:15 +00:00
Philip Rebohle 5e41e00456 [d3d9] Use new common monitor functions 2020-03-04 23:06:15 +00:00
Philip Rebohle a623e8e7d6 [dxgi] Use new common monitor functions 2020-03-04 23:06:15 +00:00
Philip Rebohle 4e16d65bb8 [util] Introduce common functions to set, get and restore display modes 2020-03-04 23:06:15 +00:00
Philip Rebohle 66503aeaa0 [util] Factor out common monitor-related functions 2020-03-04 23:06:15 +00:00
Joshua Ashton 8c68cf1551 [d3d9] Fix alignment of SubresourceData
This should match SubresourceType...
2020-03-02 16:11:07 +00:00
Joshua Ashton 27d7af65a1 [d3d9] Consolidate format helper code 2020-03-02 04:37:20 +00:00
Joshua Ashton 1b26fabc6e [d3d9] Use uniform texel buffers for conversion 2020-03-02 04:37:20 +00:00
Joshua Ashton 077f48b4ef [d3d9] Flush format converter in device after init
Otherwise we can be overwritten if its a new resource we just created by the initializer.
2020-03-02 04:37:20 +00:00
Joshua Ashton 58316ebe4c [d3d9] Add missing breaks to format helper switch 2020-03-02 04:37:20 +00:00
Joshua Ashton 7743276e1d [d3d9] Implement L6V5U5 format via conversion 2020-03-02 04:37:20 +00:00
Joshua Ashton 419083f126 [tests] Add a test for L6V5U5 format 2020-03-02 04:03:27 +00:00
Joshua Ashton b67f4974be [d3d9] Fix view formats for conversion formats 2020-03-02 04:03:27 +00:00
Philip Rebohle 1e426cdb08
[meta] Release 1.5.5 2020-02-29 15:45:57 +01:00
Joshua Ashton 36d3e8e83d [d3d9] Don't InitReturnPtr in CreateQuery
Matches native behaviour

Fixes a Wine test
2020-02-28 21:51:34 +00:00
Joshua Ashton 5548493fad [d3d9] Don't update device state for offset/stride if the buffer is nullptr
May also avoid some redundant rebinds here too...

Fixes a Wine test
2020-02-28 21:40:19 +00:00
Joshua Ashton 722520a9f7 [d3d9] Don't rebind user's vertex buffer/indices in DrawPrimitive[Indexed]UP
D3D9 doesn't do this, it instead sets them to NULL so we can simplify this logic a fair bit.

Found via a Wine test.
2020-02-28 21:37:00 +00:00
Joshua Ashton 3587bcdb9f [d3d9] Disallow creating additional swapchains if we are fullscreen
From Wine tests...
2020-02-28 01:43:07 +00:00
Joshua Ashton 632812b88f [d3d9] Disallow additional fullscreen swapchains
From Wine tests...
2020-02-28 01:39:52 +00:00
Joshua Ashton 0757097fa0 [d3d9] Initialize return ptr in device's GetBackBuffer
The swapchain's function does not do this, but this one does.
2020-02-28 01:37:23 +00:00
Joshua Ashton 528cacca5f [d3d9] Only have a single implicit swapchain
I am naive to think that this API is in any way sane, and that iSwapChains actually does what you would expect.

Swapchains created by CreateAdditionalSwapchain[Ex] are not tracked in that figure... There can only ever be one.

Great API. Very cool.

This also adds and consolidates some missing thread synchronization on the swapchain functions (that should have already had it).

(note: m_implicitSwapchain always exists, so we don't need to lock if that's all we call.)
2020-02-28 01:29:38 +00:00
Joshua Ashton e41640dcde [d3d9] Make nullptr/oob checks in GetBackBuffer unlikely 2020-02-28 01:03:34 +00:00
Joshua Ashton 8cfca32c2a [d3d9] Don't InitReturnPtr in GetBackBuffer
Matches native behaviour.

Found via a Wine test.
2020-02-28 01:02:56 +00:00
Joshua Ashton c07f8c941c [d3d9] Delegate VCACHE check to QuerySupported
Fixes a failing Wine test
2020-02-28 00:59:44 +00:00
Joshua Ashton 3332bb2844 [d3d9] Add some missing synchronization when completely remaking a presenter 2020-02-27 22:55:20 +00:00
Joshua Ashton 33f6add0ff [d3d9] Fix sampler decision at Present time 2020-02-27 22:54:43 +00:00
Joshua Ashton b6e1da916a [d3d9] Fix scissor rect size when presenting 2020-02-27 22:53:14 +00:00
Joshua Ashton 1592e2770b [d3d9] Remove unnecessary dirty checks in Reset 2020-02-26 22:34:17 +00:00
Joshua Ashton fbf76e8420 [d3d9] Don't mark unuploaded textures as uploaded 2020-02-25 04:37:01 +00:00
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
Philip Rebohle d424fb87aa
[tests] Enable d3dcompiler option for unbounded descriptor tables
Makes compiling SM5.1 shaders for D3D12 a bit less painful.
2020-02-21 10:29:10 +01: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
Joshua Ashton 2caa3c9f88 [tests] Add alpha test > 255 to this triangle mess 2020-02-10 15:19:58 +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
Joshua Ashton c07f7e2ea0 [test] Add test for StretchRect DXT1 -> DXT1 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
Shmerl 238fcad055 Readability cleanup 2020-01-17 12:31:52 +01:00
Shmerl 0e5b5763f0 Use verbose file operations during installation 2020-01-17 12:31:52 +01:00
Shmerl b08a9e5acf Add installation support for pure 64-bit Wine (non WoW64) 2020-01-17 12:31:52 +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 d7f4e44c24 [meta] Happy New Year 🎉💃🎊
It's now 2020!
2020-01-01 01:19:15 +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
Joshua Ashton bcf8adf437 [meta] Add D3D9 specifics to the README 2019-12-16 12:01:17 +01:00
Joshua Ashton 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
Philip Rebohle 52301d12a7
[meta] Support frog builds 2019-12-11 03:21:10 +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
Joshua Ashton ec197b49f9 [util] Implement some basic vector and matrix math utils 2019-12-11 03:18:39 +01:00
Joshua Ashton d44707e349 [util] Mark clamp & align as constexpr 2019-12-11 03:18:39 +01:00
Joshua Ashton a3f74b5eda [util] Implement bit cast. 2019-12-11 03:18:39 +01:00
Philip Rebohle fc91fe1d34
[dxgi] Add fake implementation of DxgiFactory::EnumWarpAdapter
Apparently FIFA 19 needs this.
2019-12-09 23:27:56 +01:00
Philip Rebohle 945a64252d
[d3d11] Determine exclusive fullscreen mode based on swap chain flags 2019-12-05 13:11:06 +01:00
Philip Rebohle 575a267f07
[vulkan] Support exclusive fullscreen control in presenter 2019-12-05 13:10:11 +01:00
Philip Rebohle 9c26fad40e
[vulkan] Add feature bit for exclusive fullscreen control 2019-12-05 13:05:54 +01:00
Philip Rebohle dc13f48318
[dxvk] Enable VK_EXT_full_screen_exclusive if available
Also pulls in VK_KHR_get_surface_capabilities2 as a dependency.
2019-12-05 13:05:51 +01:00
Philip Rebohle 07c2de62be
[d3d11] Silence some errors about invalid API usage on deferred contexts
Halo MCC apparently spams calls to GetData on deferred contexts, which
is obviously illegal.
2019-12-04 20:18:51 +01:00
Issam Maghni e6503188d8 Adding `compiler` to `DXVK_HUD` 2019-12-04 19:20:10 +01:00
Philip Rebohle 1ae7d4b302
Revert "[dxvk] Don't clear bind mask for unbound UBOs and samplers"
For some bizarre reason, this crashes Star Citizen. The reason might be
that we create multiple pipelines with identical pipelines when using a
state cache, which used to crash some drivers in the past.

Fixes #1266.

This reverts commit 00a064e32b.
2019-12-04 12:24:25 +01:00
Philip Rebohle 0e44bc3068
[meta] Release 1.4.6 2019-12-03 14:52:22 +01:00
Joshua Ashton c47095a8dc
[meta] Update Vulkan headers 2019-12-03 00:53:16 +01:00
Philip Rebohle 27ea176295
[d3d11] Remove d3d11.strictDivision option 2019-11-30 20:39:32 +01:00
Philip Rebohle 3230cec3f3
[util] Enable d3d11.enableRtOutputNanFixup for FFXIV
And disable strict division. The previous workaround broke radial blur.
2019-11-30 20:39:32 +01:00
Philip Rebohle 3b030d9569
[dxbc] Implement workaround to replace NaN render target outputs by zero 2019-11-30 20:39:32 +01:00
Philip Rebohle 2e51e28849
[spirv] Implement opIsNan 2019-11-30 20:39:28 +01:00
Luis Cáceres abff2afeaf [dxvk] Fix multiple inclusion of dxvk_platform_exts.h
This fixes build failures when using `--unity on` meson parameter
2019-11-28 17:43:08 +01:00
Philip Rebohle 5fe8d823a0
[dxvk] Disable VK_EXT_conditional_rendering
We're currently not using it, and it prevents sharing RenderDoc captures
between different AMD drivers.
2019-11-28 15:41:02 +01:00
Philip Rebohle 4c0e4fba0c
[dxvk] Don't return a value from updateShaderResources
We're checking the bind point all the time anyway, so the previous
design was inconsistent.
2019-11-28 15:25:12 +01:00
Philip Rebohle 2aa1ff414c
[dxvk] Bind descriptor sets at descriptor update time
Gets rid of one 'if' per draw/dispatch and two functions.
2019-11-28 15:17:42 +01:00
Philip Rebohle 49e7df96ec
[dxbc] Emit a spec constant for uniform buffers
This partially reverts commit fd547b666e.

For some reason, not doing so breaks Overwatch (because of course it does).
2019-11-28 00:55:38 +01:00
Philip Rebohle 00a064e32b
[dxvk] Don't clear bind mask for unbound UBOs and samplers
These don't need special treatment, so we really don't need to
recompile the pipeline if they are not bound.
2019-11-28 00:55:36 +01:00
Joshua Ashton 15ef79be42 [meta] Recommend using new validation layers
VK_LAYER_LUNARG_standard_validation is deprecated and not available in the latest Vulkan SDK, recommend the new VK_LAYER_KHRONOS_validation instead.
2019-11-27 18:30:40 +01:00
Philip Rebohle 32ac8a8d51
[util] Make Fence and Win32Fence final
Otherwise, Josh will keep complaining about this until the end of time.
2019-11-27 12:31:17 +01:00
Philip Rebohle c9c6b1886b
[d3d11] Synchronize presentation when destroying swap chain
Otherwise, we might destroy the presenter before the CS thread
actually issues the present operation, and the waitForIdle has
not the desired effect.
2019-11-26 23:51:31 +01:00
Philip Rebohle 9ccad0d197
[dxvk] Use waitForIdle when destroying DXVK device
Otherwise, we might call vkDeviceWaitIdle before all command buffers
have been submitted to the Vulkan queue. Found by inspection.
2019-11-26 22:06:13 +01:00
Philip Rebohle b2eeecd624
[meta] Update default config file 2019-11-26 17:27:05 +01:00
Philip Rebohle 7446d3c58a
[dxgi] Don't allow changing the FRAME_LATENCY_WAITABLE_OBJECT flag 2019-11-26 16:54:52 +01:00
Philip Rebohle 9785fba66e
[dxgi] Implement IDXGISwapChain2::GetFrameLatencyWaitableObject 2019-11-26 16:54:52 +01:00
Philip Rebohle 65cc8c2b31
[d3d11] Create frame latency event for swap chain
Needed in order to support the DXGI 1.3 frame latency API.
2019-11-26 16:54:52 +01:00
Philip Rebohle 6ebf3e1656
[util] Implement fence capable of signaling win32 events 2019-11-26 16:11:46 +01:00
Philip Rebohle ef37b5fed6
[dxgi] Implement IDXGISwapChain2::SetFrameLatency 2019-11-26 16:11:46 +01:00
Philip Rebohle 2d1fb52b2f
[util] Reimplement Signal
The new implementation is more akin to D3D12 fences or timeline
semaphores, and should make implementing similar concepts easier.
2019-11-26 16:11:46 +01:00
Philip Rebohle 69bad7bf8c
[d3d11] Move frame latency handling into D3D11SwapChain 2019-11-26 16:11:46 +01:00
Philip Rebohle a0651392c4
[dxvk] Fix include awfulness 2019-11-26 16:10:58 +01:00
Philip Rebohle e648d59a10
[util] Fix winelib build
Fixes #1256.
2019-11-26 16:09:35 +01:00
Joshua Ashton bf14371f9e [util] Wide character conversion changes
Replaces tows with an easier helper that fits in nicer with fixed-size arrays in DXGI, etc.

Prefer UTF8 in tows/fromws.
2019-11-26 01:53:49 +01:00
Joshua Ashton 7e3142b2ed [d3d11] Hook up platform-specific clock
See 89dfa2bc22
2019-11-26 01:52:58 +01:00
Joshua Ashton c39c3e8dcc [dxvk] Hook up platform-specific clock
See 89dfa2bc22
2019-11-26 01:52:58 +01:00
Joshua Ashton 38f945bf0b [util] Add platform-specific clock implementation
MinGW calls to GetSystemTimeAsFileTime via gettimeofday for std::chrono::high_resolution_clock::now,
This is horribly slow and inaccurate.

There are also issues if MinGW is not built with libstdc++ at the same time that can cause the precision to be bad enough to cause massive hangs.
This effectively works around that as well.

Relevant: ValveSoftware/Proton#3198
2019-11-26 01:52:58 +01:00
Philip Rebohle 25a1e0d355
[d3d11] Actually fix subresources discarded by DiscardView1 2019-11-24 00:34:15 +01:00
Philip Rebohle 53fca5143f
[d3d11] Ignore D3D11_COPY_DISCARD
Various truck simulations are broken and set this on every
CopySubresourceRegion call, which, if we were to implement
DiscardBuffer for non-mappable resources again, would break
them. This flag seemingly has no effect on native D3D11.
2019-11-24 00:08:06 +01:00
Philip Rebohle a7c21a617c
[d3d11] Overhaul DiscardResource and DiscardView implementations
For host-visible resources, these behave like MAP_DISCARD.
Euro Truck Simulator 2 and friends relies on this (see #1250).
2019-11-23 23:57:07 +01:00
Philip Rebohle 1211bb5e5f
[dxvk] Sort buffer slices before returning them to the buffer
Buffer slices often get shuffled over time due to timing and thread
synchronization, which makes it less and less likely for the dynamic
uniform buffer binding optimization to be effective. Sorting the
slices beforehand addresses the issue and may help CPU performance.
2019-11-23 00:42:54 +01:00
Philip Rebohle 596001c37e
[dxvk] Enable shader-based depth-stencil copies for AMDVLK
Turns out to be slightly faster in practice.
2019-11-22 02:12:02 +01:00
Philip Rebohle 9e965546fc
[meta] Release 1.4.5 2019-11-19 23:36:01 +01:00
Philip Rebohle 6b3d60ab25
[dxvk] Enable asynchronous presentation on all hardware
...and remove the dxvk.asyncPresent option.
2019-11-19 23:34:24 +01:00
Philip Rebohle ceddbaf7c4
[dxvk] Fix synchronization around vkDeviceWaitIdle
From the spec:
	"Host access to all VkQueue objects created
	from device must be externally synchronized"

We were not doing that, which could cause hangs and
all sorts of issues when recreating the swap chain
on Nvidia GPUs.
2019-11-19 23:34:14 +01:00
Philip Rebohle 4fff2343c1
[dxvk] Fix handling of undefined shader inputs
If the previous stage or the input layout does not define an input,
D3D11 will read zeroes wheras the result is undefined in Vulkan.

Fixes performance degradation and rendering issue in Final Fantasy XV
with the "Geomapping" (terrain tessellation) option enabled.
2019-11-19 15:34:29 +01:00
Philip Rebohle a1f55330ee
[dxvk] Implement pass to eliminate undefined shader input variables 2019-11-19 15:26:32 +01:00
Philip Rebohle 5a2fd7c71b
[spirv] Add method to retrieve literal string from instruction 2019-11-19 12:49:07 +01:00
Philip Rebohle 8252d1ccd5
[spirv] Add method to erase data from code buffer 2019-11-19 12:17:11 +01:00
Philip Rebohle 9f88249b91
[spirv] Add method to allocate new ID from code buffer. 2019-11-19 12:12:05 +01:00
Philip Rebohle 014798161c
[dxvk] Avoid some unnecessary barriers around render target clears 2019-11-18 19:36:19 +01:00
Philip Rebohle c7718e5952
[d3d11] Zero-initialize UAV counters
Fixes a hang in Dirt Rally on RADV.
2019-11-18 18:40:39 +01:00
Philip Rebohle cee7db1c57
[dxvk] Always align texel buffers to at least 16 bytes
Since we don't know the view format in advance, and some
drivers require single-texel alignment.
2019-11-18 13:45:35 +01:00
Philip Rebohle 73a5b33375
[d3d11] Also fix reset counter memory order for deferred context queries 2019-11-15 19:48:41 +01:00
Philip Rebohle e787077554
[util] Remove traces of the allowMapFlagNoWait option 2019-11-15 19:45:40 +01:00
Philip Rebohle c24dad75dc
[d3d11] Remove allowMapFlagNoWait option 2019-11-15 11:09:11 +01:00
Philip Rebohle dbc14fe65c
[d3d11] Fix memory order for query reset counter
Probably doesn't change anything, but let's fix it anyway.
2019-11-14 23:43:58 +01:00
Philip Rebohle a6483e02fe
[d3d11] Submit stalling event queries before flushing
Otherwise, instead of preventing syncs, this would actually
have the opposite effect.
2019-11-14 22:57:30 +01:00
Philip Rebohle 3457e312b0
[dxvk] Always align index buffer slices to 256 Bytes
To be on the safe side.
2019-11-14 14:32:01 +01:00
Philip Rebohle 420d95e396
[dxvk] Store shader capability information in separate set of flags 2019-11-12 18:05:03 +01:00
Philip Rebohle 1ca235d186
[util] Disable strict DC mode for MGSV again
Not necessary since the resubmitted contexts don't contain mapped buffers.
2019-11-12 00:59:33 +01:00
Philip Rebohle 4f7e7979e3
[util] Add app profile for Metal Gear Solid 5 2019-11-11 23:31:14 +01:00
Philip Rebohle cc18730967
[dxvk] Enable option to disable OpenVR integration 2019-11-11 23:30:35 +01:00
Philip Rebohle 9f66351b82
[dxvk] Move extension provider list to DxvkInstance 2019-11-11 23:30:07 +01:00
Philip Rebohle 6948d18f5f
[dxvk] Always align vertex buffer slices to 256 bytes
Works around an unknown geometry rendering isssue in Warhammer Chaosbane.
Should probably be investigated at some point.
2019-11-10 22:37:11 +01:00
Philip Rebohle 31baf3529a
[d3d11] Fix uninitialized DSV flags
Fixes #1242.
2019-11-10 15:02:21 +01:00
Philip Rebohle 4b199ef60d
[dxvk] Remove option to disable transfer queue 2019-11-08 11:29:22 +01:00
Philip Rebohle a74449c367
[dxvk] Remove ability to query instance from adapter
Adapters don't hold a reference to the instance.
2019-11-08 11:28:08 +01:00
Philip Rebohle 77574d9970
[d3d11] Don't query DXVK instance from adapter 2019-11-08 11:25:58 +01:00
Philip Rebohle b2317cad4d
[dxvk] Pass DXVK instance to DXVK device directly, not through the adapter 2019-11-08 11:17:02 +01:00
Philip Rebohle 212f5ba1f3
[dxgi] Query DXVK instance from DXGI factory, not the adapter 2019-11-08 11:06:15 +01:00
Philip Rebohle ed8af3ccc4
[dxvk] Document wonky DxvkAdapter ref count behaviour 2019-11-07 21:08:20 +01:00
Philip Rebohle a0dba6bbf9
[d3d11] Hold reference to DxvkInstance
Hack to keep the instance alive which owns the adapters. Should
fix #1240 for now, but we should fix this properly later on.
2019-11-07 20:21:27 +01:00
Philip Rebohle b18c50d5ab
[dxvk] Use static variables for extension provider instances
Also, remove redundant interface documentation.
2019-11-07 01:35:10 +01:00
Joshua Ashton dbf2407fd3 [dxvk] Implement extension provider system
This change introduces a new system for providing extra instance/device extensions.

This consolidates platform-specific and vr-related to its' own thing for potential future cross-platform/native Linux work.
2019-11-07 01:24:52 +01:00
Joshua Ashton 27898ebbfc [build] Simplify and correct errors in options handling
Fix some typos...

D3D10 is dependent on D3D11 therefore DXGI is always dependent on D3D11
2019-11-07 01:24:52 +01:00
Joshua Ashton 4ad99feb73 [build] Demote no frontends/tests to a warning 2019-11-07 01:24:52 +01:00
Philip Rebohle 1d961b7dc3
[d3d11] 'a' is not a very good name for a variable 2019-11-04 13:46:18 +01:00
Philip Rebohle 77a0cb2b19
[d3d11] Don't synchronize with CS thread on present
Instead, submit from the CS thread in order to prevent out-of-order
submissions. Improves minimum FPS in Final Fantasy XIV by 5-10%.
2019-11-02 17:53:17 +01:00
Philip Rebohle e6c3f0479d
[dxvk] Let device know that async presentation is enabled 2019-11-02 17:53:17 +01:00
Philip Rebohle d96c22be05
[d3d11] Do not synchronize with CS thread in GetData
Instead, use a counter to determine whether there are any
pending operation for the query on the CS thread.
2019-11-02 17:53:17 +01:00
Philip Rebohle 0924bb469c
[d3d11] Move query state tracking to immediate context implementation 2019-11-02 17:53:17 +01:00
Philip Rebohle be5dc234c1
[d3d11] Move common Begin/End implementation to immediate context 2019-11-02 13:48:03 +01:00
Philip Rebohle 63dbca82e7
[d3d11] Track used queries in deferred contexts and command lists 2019-11-02 13:48:03 +01:00
Philip Rebohle 0671007437
[d3d11] Only execute Begin for scoped queries 2019-11-02 13:48:03 +01:00
Philip Rebohle 1459f0e852
[util] Fix != and == operator for private/public COM pointers 2019-11-02 13:48:00 +01:00
Philip Rebohle 1780c549e5
[d3d11] Only add storage buffer usage flag to constant buffers if needed
Otherwise, the backend optimization for dynamic uniform buffers will not
kick in.
2019-10-30 10:58:05 +01:00
Philip Rebohle e95bc3256f
[d3d11] Move handling of constantBufferRangeCheck option to D3D11Options 2019-10-30 10:57:36 +01:00
Philip Rebohle 9e084e63ca
[d3d11] Remove useless members from D3D11DeferredContextMapEntry 2019-10-30 00:44:17 +01:00
Philip Rebohle 9e69a610cb
[dxgi] Use 64-bit integers for refresh rate matching math
Otherwise, there may be integer overflows for certain parameter values.
2019-10-29 08:42:53 +01:00
Philip Rebohle c4e5323e0e
[dxbc] Remove old constant buffer range check 2019-10-28 17:52:50 +01:00
Philip Rebohle fd547b666e
[dxbc] Don't emit a spec constant for uniform buffers 2019-10-28 15:44:02 +01:00
Philip Rebohle 3d213efe53
[dxbc] Use SSBOs for dynamically indexed constant buffers if needed
SSBOs are tightly bound-checked on all Nvidia GPUs, so this allows for
a more accurate workaround for games relying on OOB access behaviour.
2019-10-28 15:42:46 +01:00
Philip Rebohle 68760f5b20
[dxbc] Parse dynamically indexed flag for constant buffers 2019-10-28 14:15:44 +01:00
Philip Rebohle 7db98a1aa4
[meta] Release 1.4.4 2019-10-27 17:56:31 +01:00
Alexandr dacf1ab4d6 [util] Enable constant buffer range check for Saints Row games
Fixes character flickering on Nvidia.
2019-10-27 11:55:48 +01:00
Philip Rebohle a2b629415e
Revert "[d3d11] Fix ref counting for D3D11CommandList"
This reverts commit 55bae45915.
2019-10-27 11:10:49 +01:00
Philip Rebohle fc0ede0657
Revert "[d3d11] Recycle command lists from deferred contexts"
This reverts commit 4e3da45fde.

For some reason this caused crashes.
2019-10-27 11:00:59 +01:00
Philip Rebohle 8c34f4ff8a
[dxvk] Validate image layouts in render pass formats read from cache
This will discard invalid cache entries generated by DXVK 1.4.3.
2019-10-27 00:04:57 +02:00
Philip Rebohle 03dc59ef39
[dxvk] Write correct depth-stencil attachment layout to state cache
Fixes a dumb issue where we'd compress layouts with high enum values
to a single byte and incorrectly interpret the result as PREINITIALIZED.
2019-10-26 23:59:11 +02:00
Philip Rebohle 9361f19da6
[dxvk] Fix uninitialized depth attachment reference
Also don't redundantly null color attachment refs for cosmetic reasons.
2019-10-26 23:37:46 +02:00
Philip Rebohle 6888a98c89
[dxbc] Always set geometry shader invocation count
Fixes validation errors when the DXBC shader does not specify
the invocation count itself.
2019-10-26 23:19:59 +02:00
Philip Rebohle 144f4badef
[dxbc] Always allocate at least one input array element
Turns out that shaders with no inputs can still have an input signature,
in which case we were generating a zero-length array which is illegal.
2019-10-26 23:13:59 +02:00
Philip Rebohle 20f79a754b
[d3d11] Adjust buffer memory flags if apitrace is attached
Using cached memory speeds up apitrace significantly as it
reads back mapped memory regions.
2019-10-26 22:56:47 +02:00
Philip Rebohle 44c0f96fc1
[dxvk] Pause transform feedback on buffer updates
Otherwise, we might override a currently bound transform
feedback buffer or counter buffer. Fixes Unity Engine.
2019-10-26 19:57:39 +02:00
Philip Rebohle 3c4a57acc6
[dxvk] Fix bogus xfb buffer update check 2019-10-26 19:40:32 +02:00
Philip Rebohle 0683f4f2c0
[d3d11] Remove D3D11 counter buffer class 2019-10-26 17:44:29 +02:00
Philip Rebohle e967c52ff7
[d3d11] Allocate predicate buffer per query
Allows us to get rid of the D3D11 counter buffer class.
2019-10-26 17:44:29 +02:00
Philip Rebohle 09f507c284
[d3d11] Allocate xfb counter buffer per buffer
Same idea as with UAV counters, allows for more efficient updates.
2019-10-26 17:44:29 +02:00
Philip Rebohle 191c9644af
[d3d11] Allocate counter buffer per UAV
Might slightly increase memory overhead, however this allows
the backend to execute UAV counter updates more efficiently.
2019-10-26 17:44:29 +02:00
Philip Rebohle 320e0de4a0
[dxvk] Handle xfb barriers in commitGraphicsBarriers
Avoids spilling the render pass when switching xfb buffers.
2019-10-26 17:44:29 +02:00
Philip Rebohle 5b66f1ec0b
[dxvk] Replace buffer in updateBuffer even outside of render passes
Needed to avoid barriers arount D3D11 UAV counter buffer updates.
2019-10-26 17:44:29 +02:00
Philip Rebohle d1e9e1392d
[dxvk] Lazily allocate slices of small buffers
Reduces memory overhead in case games create small static
buffers. This is somewhat common for index buffers used
to render fullscreen quads or triangles.
2019-10-26 15:24:55 +02:00
Philip Rebohle 7751541662
[dxvk] Don't lock swap lock if not necessary
The swap lock only protects the 'next' free list, which
is not accessed at all when creating a new buffer.
2019-10-26 15:24:54 +02:00
Philip Rebohle e868f829b5
[dxvk] Pad buffers more tightly
This will allow for smaller buffers to be laid out more efficiently.
2019-10-26 15:24:54 +02:00
Philip Rebohle 83fc15c594
[dxvk] Force-update draw buffer for graphics pipeline barrier checks 2019-10-26 12:41:40 +02:00
Philip Rebohle c44d30d78b
[dxvk] Consider indirect draw buffer in graphics pipeline barriers 2019-10-26 04:13:05 +02:00
Philip Rebohle f60d1db1f1
[dxvk] Consider vertex/index buffers in graphics pipeline barriers
Leaving these out was an oversight.
2019-10-26 04:12:32 +02:00
Philip Rebohle e918104ef3
[dxvk] Introduce checkGfxImageBarrier 2019-10-26 03:56:57 +02:00
Philip Rebohle 7a78852776
[dxvk] Introduce checkGfxBufferBarrier 2019-10-26 03:56:52 +02:00
Philip Rebohle 2b812f07c1
[dxvk] Move finalizeDraw into commitGraphicsState
There is no readon to perform this after the draw anymore.
2019-10-26 03:55:03 +02:00
Philip Rebohle 4e3da45fde
[d3d11] Recycle command lists from deferred contexts
Can save a few memory allocations and deallocations at runtime.
2019-10-25 23:09:21 +02:00
Philip Rebohle 7f66373a69
[util] Add virtual destructor to NoWrapper 2019-10-25 22:08:00 +02:00
Philip Rebohle 55bae45915
[d3d11] Fix ref counting for D3D11CommandList 2019-10-25 21:37:18 +02:00
Philip Rebohle 41f04ffb61
[d3d11] Fix incorrect AddRef return value 2019-10-25 21:36:21 +02:00
Philip Rebohle f9c2e43ffc
[d3d11] Don't set HOST pipeline stage and access flags for resources
The backend does not and will not use that information at all.
2019-10-24 16:57:06 +02:00
Philip Rebohle 2d6a3396dd
[dxbc] Declare length of shader input array late
Otherwise, we generate out-of-bounds array reads and writes
in broken ENB shaders.
2019-10-23 16:36:52 +02:00
Philip Rebohle df61a479a2
[spirv] Add 'late' constants
Late constants can be used to reserve a placeholder ID for a constant
before the constant's value is known. The value can be changed later.
Only scalar 32-bit integer and floating point types are supported
as of right now.
2019-10-23 16:09:28 +02:00
Philip Rebohle 59d4556641
[dxbc] Extend scalar constants to vectors if required
Needed for ENB. Fixes #865.
2019-10-23 15:26:22 +02:00
Philip Rebohle ec8ca8a403
[dxbc] Assume vec4 type for i/o vars not declared in signature
Works around an ENB bug.
2019-10-23 15:26:22 +02:00
Philip Rebohle 3e12a116bb
[dxbc] Declare temp registers on demand
And ignore dcl_temps. Needed to successfully compile some broken
ENB shaders (this does work on Windows too). See #865.
2019-10-23 13:55:04 +02:00
Philip Rebohle ee77afb6af
[d3d11] Validate shader module capabilities
Only create a shader module if the device actually supports
the required features. Apparently this is needed for some
Unity Engine games.
2019-10-21 12:10:05 +02:00
Philip Rebohle ddf010479d
[d3d11] Refactor shader module creation 2019-10-21 12:09:53 +02:00
Philip Rebohle 9444162ca6
[util] Enable constant buffer range check for Titan Quest
Reportedly flickers on Nvidia GPUs otherwise.
2019-10-20 13:27:12 +02:00
Philip Rebohle 7a0360d7c2
[dxgi] Remove useless d3d10.enable option 2019-10-19 00:34:51 +02:00
Philip Rebohle ad3542f4fc
[meta] Release 1.4.3 2019-10-18 17:50:38 +02:00
Philip Rebohle 8211225ad4
[dxbc] Swap OpSelect arguments for Ne/Dne, don't use OpLogicalNot
Saves one instruction.
2019-10-18 03:22:20 +02:00
Philip Rebohle b756c229a9
[dxvk] Implement more compact state cache data format (v8)
Omits a lot of unnecessary data and considerably reduces
the state cache file size, often by over 80%.
2019-10-18 00:33:50 +02:00
Philip Rebohle 0ac89ccd9e
[util] Add missing != operator to Sha1Hash 2019-10-18 00:33:40 +02:00
Philip Rebohle 4b0a5dffb2
[dxvk] Support component mappings in blitter 2019-10-16 20:00:38 +02:00
Philip Rebohle d998aaad12
[dxvk] Add some component mapping helpers 2019-10-16 20:00:38 +02:00
Philip Rebohle 0d7f658f96
[dxvk] Implement framebuffer-based blit 2019-10-16 20:00:38 +02:00
Philip Rebohle 6290cfdb48
[dxvk] Add class for framebuffer-based blits 2019-10-16 17:31:40 +02:00
Philip Rebohle 6234a1a6b0
[dxvk] Support arbitrary source texture coordinates in blitter 2019-10-16 02:45:44 +02:00
Philip Rebohle 859ac59e6c
[dxvk] Support multisampled destinations in blitter
Apparently this is required for some D3D9 content.
2019-10-16 02:17:55 +02:00
Philip Rebohle e747315ba6
[dxvk] Support both linear and nearest samplers in blitter 2019-10-16 02:08:04 +02:00
Philip Rebohle 6ea21d57fe
[dxvk] Factor out mip gen classes and rename them to DxvkMetaBlit*
Since mip map generation is a blit operation, we can make a more
general-purpose blitter and implement mip map generation on top
of that.
2019-10-16 01:52:14 +02:00
Philip Rebohle d899bd2d76
[d3d11] Remove obsolete DefaultDesc methods from state classes 2019-10-14 05:28:46 +02:00
Philip Rebohle 68c257fc0d
[d3d11] Fix ref counting for state objects bound to a context
Using raw pointers is safe here since the objects never get destroyed
during the lifetime of the context.
2019-10-14 02:06:33 +02:00
Philip Rebohle 1282c2b99e
[d3d11] Fix immediate context reference counting
Fixes various wine test failures.
2019-10-14 01:56:34 +02:00
Philip Rebohle 4d0cc3e24e
[d3d11] Don't subclass state objects from ComObject
These override reference counting, so we shouldn't use ComObject.
2019-10-14 01:44:37 +02:00
Philip Rebohle c5c43fb2a4
[d3d11] Allow choosing type wrapper for D3D11DeviceChild base class
Allows subclasses to replace ComObject with something else.
2019-10-14 01:44:27 +02:00
Philip Rebohle dd9a55ecc0
[util] Don't allow multiple inheritance for COM objects
This never made any sense whatsoever in the first place.
2019-10-14 01:42:24 +02:00
Philip Rebohle c281e76bac
[d3d11] Don't get private references for state objects
Otherwise we will end up deleting the objects even though they
aren't explicitly heap-allocated. Whoops...
2019-10-14 01:39:54 +02:00
Philip Rebohle 9c6209fbf5
[d3d11] Fix reference counting for state objects
Fixes various wine test failures. Also, state objects are now
allocated in the hash map itself rather than a wrapped COM object.
2019-10-14 01:27:59 +02:00
Philip Rebohle accbc8828c
[d3d11] Return error if no desc is provided for Create*State methods
Fixes wine test failures.
2019-10-14 01:08:31 +02:00
Philip Rebohle bd58f1a913
[d3d11] Don't sync CS thread if resource to map is already in use
SynchronizeCsThread can only update the in-use state from available
to in-use, so doing this on a resource that is already in-use is not
necessary. May improve performance in combination with DO_NOT_WAIT.
2019-10-14 00:14:00 +02:00
Philip Rebohle 12f0f8b13f
[d3d11] Don't use a state object for default blend state 2019-10-13 23:15:23 +02:00
Philip Rebohle c30fd8fb97
[d3d11] Don't use a state object for default depth-stencil state 2019-10-13 23:15:23 +02:00
Philip Rebohle b0231403fe
[d3d11] Don't use a state object for default rasterizer state 2019-10-13 23:15:23 +02:00
Philip Rebohle a89c662984
[d3d11] Introduce ResetState and use it for ClearState
ClearState gets used a lot in games that use deferred
contexts, so we should make sure it's fast. Since we
apply default state everywhere, there is no need to
perform any expensive RestoreState operations.

Reduces the amount of time spent on ClearState on the
CS thread by ~40%, and by ~90% on the calling thread.
2019-10-13 23:15:23 +02:00
Philip Rebohle dbe8b09b05
[dxvk] Don't store sampler description in sampler objects
We aren't using this anywhere in the backend or client APIs.
2019-10-13 04:36:33 +02:00
Philip Rebohle b67e5809ba
[dxvk] Fix buffer usage flags in commitGraphicsBarriers
Only checking for one single usage flag is incorrect since
buffers can have both the storage buffer and storage texel
buffer usage bits set.
2019-10-13 03:18:08 +02:00
Philip Rebohle 950ea21b83
[dxvk] Don't rely on binding mask in commitGraphicsBarriers
We can't actually use that here since we check barriers before
updating shader resources, unlike on the compute path. Check
all resources manually instead.
2019-10-13 02:19:48 +02:00
Philip Rebohle 0e578adcf5
[dxvk] Don't clear binding masks in update*Pipeline
Has no effect anymore since the entire mask gets
overridden in updateShaderResources anyway.
2019-10-13 02:18:09 +02:00
Philip Rebohle b25ab4155b
[dxvk] Remove outdated comment 2019-10-13 02:01:14 +02:00
Philip Rebohle 0a5b427ded
[dxvk] Add function to insert framebuffer read-back barriers
Required for some D3D9 content.
2019-10-13 02:00:10 +02:00
Philip Rebohle 41cb5ab5f7
[dxvk] Add dependency flag parameter to emitMemoryBarrier
Will be needed for framebuffer-local barriers inside render passes.
2019-10-13 01:51:29 +02:00
Philip Rebohle 8446c28de1
[dxvk] Remove spill parameter from bindRenderTargets
No longer needed.
2019-10-13 01:44:31 +02:00
Philip Rebohle 102a18060e
[d3d11] Don't spill render pass when rebinding render targets
The backend handles this now, so it's no longer necessary.
2019-10-13 01:44:31 +02:00
Philip Rebohle 4360021539
[dxvk] Implement accurate barrier tracking for draws with side effects
Similar to how this is handled for compute shaders, with some caveats:
- The barriers are never actually emitted, only tracked. Spilling the
  render pass will reset the barriers as it acts as a full barrier.
- Doing this for all draws and all resources would be prohibitively
  expensive, so whenever switching between pipelines with side effects
  and pipelines without side effects, we'll spill the render pass.
2019-10-13 01:44:28 +02:00
Philip Rebohle baf81473a6
[dxvk] Introduce HasStorageDescriptors to signify pipeline side effects 2019-10-13 01:43:18 +02:00
Philip Rebohle c5676d3108
[dxvk] Remove incorrect framebuffer-space barriers
We're technically required to use VK_DEPENDENCY_BY_REGION_BIT,
but that isn't actually good enough.
2019-10-12 23:54:54 +02:00
Philip Rebohle 803ec3542d
[dxbc] Fix sample positions
From the D3D11.3 functional specification:
"The sample position is relative to the pixel's center"

Fixes wine test failures.
2019-10-11 18:41:10 +02:00
Philip Rebohle 3a39027987
[d3d11] Add more rigid validation for buffer creation
Fixes several wine test failures.
2019-10-11 17:32:46 +02:00
Philip Rebohle 762df0bedf
[d3d11] Change ValidateBufferProperties to NormalizeBufferProperties 2019-10-11 17:23:02 +02:00
Philip Rebohle 409991b9db
[d3d10] Fix reported bind flags for D3D10 resources
Turns out that the UAV bind flag remains set in the D3D10 description,
even though D3D10 does not support the feature. Fixes wine test failures.
2019-10-11 17:15:33 +02:00
Philip Rebohle 127e037627
[d3d11] Validate texture array size
Fixes a wine test failure and possibly prevents invalid Vulkan API usage.
2019-10-11 17:11:01 +02:00
Philip Rebohle 554b77b47a
[d3d11] Initialize feature level to zero in D3D11CreateDevice
Fixes a wine test failure.
2019-10-11 17:01:23 +02:00
Philip Rebohle d8c3002b92
[dxvk] Don't use dynamic storage buffers
Doesn't really help in pracrice, but getting rid of them reduces
the number of dynamic offsets we have to update per draw/dispatch.
2019-10-11 14:33:45 +02:00
Philip Rebohle 0068740341
[dxvk] Optimize invalidateBuffer for use with uniform buffers
Since this is by far the most common use case for this
method, an early-out path helps save a bit of CPU time.

Ditch dynamic descriptor set offsets for storage buffers
at the same time since it does not seem to benefit any
real-world applications.
2019-10-11 14:16:47 +02:00
Philip Rebohle bd5630439e
[dxvk] Inline freeBufferSlice implementation
May save a cycle or two in invalidateBuffer.
2019-10-11 13:06:55 +02:00
Philip Rebohle 594f04d4ed
[dxvk] Dirty framebuffer in beginRecording
This guarantees that the framebuffer is never null.
2019-10-11 12:19:45 +02:00
Philip Rebohle 48b3b3ee85
[dxvk] Use float format for sampled unbound image views
Fixes validation errors in many cases if a texture is not bound.
2019-10-11 02:58:39 +02:00
Philip Rebohle e615416b31
[dxvk] Fix tessellation validation
Prevents crashes in case an app tries to use tessellation with
an incorrect primitive topology.
2019-10-11 00:04:06 +02:00
Philip Rebohle 2c974cbe1e
[dxvk] Validate graphics state in commitGraphicsState
Same idea as for the related compute work.
2019-10-10 23:56:54 +02:00
Philip Rebohle 649c8d10d6
[dxvk] Validate compute state in commitComputePipelines
This way we can implement early-out for invalid dispatch calls
and save a few validation checks later in the pipeline.
2019-10-10 23:56:54 +02:00
Philip Rebohle 63cc8cdd35
[dxvk] Move descriptor set updates to updateShaderResources
Saves two state flags and allows us to move the descriptor info
array into the function itself.
2019-10-10 22:48:06 +02:00
Philip Rebohle 7df3b409c3
[dxvk] Move dynamic descriptor offset array to stack
There's absolutely no reason to store it in the object.
2019-10-10 22:19:31 +02:00
Philip Rebohle a743ba6531
[dxvk] Use memcmp replacement for pipeline state lookup
Measured to be over twice as fast as memcmp on Ryzen for the
512-byte graphics pipeline state struct, achieving two cycles
per iteration.
2019-10-07 22:01:48 +02:00
Philip Rebohle 5cb7be2454
[dxvk] Implement state cache v6 -> v7 conversion 2019-10-07 22:01:48 +02:00
Philip Rebohle 345e263a3b
[dxvk] Increase maximum spec constant count to 12
Fills some padding created by the 32-byte alignment.
2019-10-07 22:01:48 +02:00
Philip Rebohle 782b021690
[dxvk] Move compute pipeline state to dxvk_graphics_state.h 2019-10-07 22:01:48 +02:00
Philip Rebohle e086db5ce5
[dxvk] Use new struct for specialization constant info
Stylistic reasons.
2019-10-07 22:01:47 +02:00
Philip Rebohle b2087b2e7e
[dxvk] Use packed blend state 2019-10-07 22:01:47 +02:00
Philip Rebohle 079b480602
[dxvk] Use packed depth-stencil state 2019-10-07 22:01:47 +02:00
Philip Rebohle a933bec72c
[dxvk] Use packed multisample state 2019-10-07 22:01:47 +02:00
Philip Rebohle 09c813c934
[dxvk] Use packed rasterizer state 2019-10-07 22:01:47 +02:00
Philip Rebohle a5ab88d8f2
[dxvk] Use packed input layout state
Also move attribute and binding descriptions to the end
so that comparisons are more likely to fail early.
2019-10-07 22:01:47 +02:00
Philip Rebohle c0ae4e38eb
[dxvk] Use packed input assembly state 2019-10-07 22:01:47 +02:00
Philip Rebohle 8d09aa12da
[dxvk] Move DxvkGraphicsPipelineStateInfo to new file
We're going to put a lot of code here, so try to keep things clean.
2019-10-07 22:01:47 +02:00
Philip Rebohle 9dad44a6b1
[dxvk] Prepare for pipeline state changes and bump cache format to v7
One of the changes includes hard-coding certain constants into the old
pipeline state structs, since changing the constants would invalidate
any old state cache and making the conversion pointless.
2019-10-07 22:01:47 +02:00
Philip Rebohle 32dff89b2d
[dxvk] Don't use alignas(16) for DxvkMetaClearArgs members
Instead, pad members explicitly. This is necessary because GCC
makes incorrect assumptions about stack alignment on 32-bit.
2019-10-07 22:01:47 +02:00
Joshua Ashton ca634ec484 [dxvk] Add missing {} to border color list
Fixes a warning when compiling with Clang
2019-10-06 00:28:19 +02:00
Joshua Ashton e8ee7a0790 [util] Fix Sha1 dword extraction
Previously we were getting incorrect values here.

The u suffix is no longer necessary, which was originally there to work around a MSVC compiler warning which now doesn't happen under the new code 🤷‍♀
2019-10-06 00:28:19 +02:00
Joshua Ashton 19fa1c405c [d3d10] Remove unused copies of device ptr in D3D10 wrappers
Silences a warning when building with Clang, and removes duplicate unused data.
2019-10-06 00:28:19 +02:00
Joshua Ashton 6d0757520b [dxgi] Initialize size of DEVMODEW structure
The documentation says we should do this.
2019-10-06 00:28:19 +02:00
Philip Rebohle 1117daec24 [dxvk] Don't redundantly clear unused vertex strides to zero
We're already doing this when setting the input layout, and we
don't touch the strides in other parts of the code. May save
a handful of CPU cycles.
2019-10-05 16:52:26 +02:00
Philip Rebohle 70ef456911
[meta] Release 1.4.2 2019-10-04 21:07:36 +02:00
Philip Rebohle 02b79fb738
[util] Report Nvidia GPUs for Modern Warfare Remastered 2019-10-04 18:35:36 +02:00
Philip Rebohle 50349d1bfe
[d3d11] Add missing break; in CreateSurface
Found by a frog. Initial testing did not check return values.
2019-10-02 12:06:51 +02:00
Philip Rebohle 85581bdace
[util] Move GetAdapterLUID out of DXGI internals 2019-10-02 08:42:22 +02:00
Philip Rebohle 8f00af556e
[d3d11] Implement CreateSurface for D3D11DXGIDevice
Documentation for this method is really poor so we'll just try to
make pretty much everything work. Fixes various wine tests.
2019-10-02 02:29:06 +02:00
Philip Rebohle 1366fce0f8
[dxgi] Generate adapter LUIDs if Vulkan does not provide them
Needed because winevulkan does not provide adapter LUIDs.
Fixes various wine test failures, and will be required to
get D3D12 (vkd3d) to work on top of our DXGI implementation.
2019-10-02 01:07:18 +02:00
Philip Rebohle 73b9846c4f
[dxgi] Fix some IDXGIAdapter return codes
Fixes various wine test failures.
2019-10-02 00:33:06 +02:00
Philip Rebohle d90d450618
[dxgi] Handle invalid arguments passed to Present1
fixes a wine test failure.
2019-10-02 00:19:41 +02:00
Philip Rebohle f58c1c2d1d
[dxgi] Fix SetFullscreenState behaviour with invalid usage
Fixes various wine test failures.
2019-10-02 00:01:26 +02:00
Philip Rebohle 60ff2b8977
[dxgi] Fix GetContainingOutput and GetFullscreenState output pointer
We're supposed to keep a reference to the output around and return
that for fullscreen swap chains. Fixes various wine test failures.
2019-10-02 00:00:37 +02:00
Philip Rebohle 8d8f4b9200
[d3d11] Add support for DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE
Trivial since we treat back buffers as regular D3D textures.
Fixes a wine test failure.
2019-10-01 23:37:54 +02:00
Philip Rebohle aa35cdbb18
[d3d11] Fix return code on swap chain creation failure
Fixes a wine test failure.
2019-10-01 23:37:54 +02:00
Philip Rebohle 0f15c60192
[d3d11] Use private reference to D3D11 device in D3D11SwapChain
Fixes a wine test failure.
2019-10-01 22:26:07 +02:00
Philip Rebohle 0436e6ddce
[dxgi] Fix some return codes in DxgiSwapChain
Fixes some wine test failures.
2019-10-01 22:25:37 +02:00
Philip Rebohle 0d1048fa87
[d3d11] Fix error handling in SetMaximumFrameLatency
Fixes a wine test failure.
2019-10-01 22:12:23 +02:00
Philip Rebohle 2cb9d34f8f
[dxgi] Fix QueryVideoMemoryInfo return values
Fixes a wine test failure.
2019-10-01 22:12:19 +02:00
Philip Rebohle 1e00f8046c
[dxgi] Fix CheckInterfaceSupport UMD version writeback
Fixes a wine test failure.
2019-10-01 22:12:16 +02:00
Philip Rebohle cd82669a85
[dxgi] Fix GetDisplayModeList1 output for DXGI_FORMAT_UNKNOWN
Fixes a wine test failure.
2019-10-01 22:12:09 +02:00
Philip Rebohle f5515075f2
[dxgi] Fix GetDisplayModeList behaviour with a zero mode count
Allocate at least one array element so that we don't accidentally
treat the mode list like it was NULL. Fixes a wine test failure.
2019-10-01 22:12:08 +02:00
Philip Rebohle 2f4e4abcac
[dxgi] Fix CheckInterfaceSupport for IDXGIDevice
On Windows, this succeeds and reports the D3D9 driver version to the
application.
2019-10-01 15:06:50 +02:00
Philip Rebohle ab51aac6d7 [dxvk] Implement context-local lookup cache for pipeline objects
On hit, looking up a pipeline becomes an extremly cheap O(1) operation,
avoiding a mutex lock and an expensive std::unordered_map lookup. This
works because we don't ever destroy pipeline objects.
2019-09-30 03:42:20 +02:00
Philip Rebohle 35a8cedbc2 [dxvk] Move shader set hash/eq functions into respective structs
Makes it easier to use them outside the pipeline manager.
2019-09-30 03:42:20 +02:00
Philip Rebohle ba5f319809 [dxvk] Use new shader lookup hash in pipeline manager 2019-09-30 02:09:09 +02:00
Philip Rebohle 5115a42b08 [dxvk] Expose key-based lookup hash in DxvkShader 2019-09-30 02:08:09 +02:00
Philip Rebohle 54ff7bf769 [dxvk] Add methods to retrieve shaders from pipeline 2019-09-30 01:54:49 +02:00
Philip Rebohle 59d4e8a36a [dxbc] Fix NaN handling in not-equal comparison
Ne and Dne are unordered in DXBC. Avoid FUnordNotEqual to
avoid potential issues with drivers and debugging tools.
2019-09-30 00:19:47 +02:00
Philip Rebohle d128d776ad
[dxvk] Re-introduce state check for updateFramebuffer
Turns out we broke batching render target clears earlier.
2019-09-28 03:29:52 +02:00
Philip Rebohle 6b5d01c934
[meta] Release 1.4.1 2019-09-27 23:03:23 +02:00
Philip Rebohle 2e6da26ff0
[dxvk] Spoof Nvidia GPU for HITMAN 2
This game requires a functioning AGS implementation when it detects
an AMD GPU and complains about missing D3D11 support otherwise.
2019-09-26 19:27:19 +02:00
Philip Rebohle a920a7275b
[dxvk] Eliminate some redundant state checks 2019-09-26 14:25:56 +02:00
Philip Rebohle 7cdc402a58
[dxvk] Introduce finalizeDraw
May improve code gen by reducing function call overhead, in a
similar way as the duplicated checks in commitGraphicsState do.
2019-09-26 01:31:51 +02:00
Philip Rebohle 187748e4d3
[d3d11] Add a comment explaining ID3D11Predicate/ID3D11Query hack 2019-09-25 22:18:08 +02:00
Philip Rebohle 53fe3423e2
[d3d11] Fix GetPredication 2019-09-25 20:55:43 +02:00
Philip Rebohle b6cf518962
Revert "[dxbc] Always decorate SV_POSITION as invariant"
This reverts commit 5ee790a4a3.

Breaks Shadow of the Tomb Raider on Nvidia for unknown reasons.
2019-09-24 23:01:36 +02:00
Philip Rebohle 5ee790a4a3
[dxbc] Always decorate SV_POSITION as invariant
Apparently fixes Z-Fighting in Saints Row IV on Nvidia.
2019-09-24 22:19:43 +02:00
Philip Rebohle 51f1d7725c
[dxvk] Store context flags as a 32-bit integer
Might improve code generation for 32-bit builds. We currently
have 31 flags and don't expect any new ones to be added.
2019-09-23 23:34:04 +02:00
Philip Rebohle 8f6df2b7fb
[d3d10] Add some null pointer checks when dealing with resources
Also, fix some more awkward formatting.
2019-09-23 21:59:02 +02:00
Philip Rebohle cb60211ce0
[d3d10] Fix some awkward formatting 2019-09-23 21:47:30 +02:00
Philip Rebohle f498e742ec
[d3d11] Handle D3D_PRIMITIVE_TOPOLOGY_UNDEFINED correctly
Luckily, all known cases where games use UNDEFINED topology fail
validation elsewhere due to missing vertex shaders, but we should
handle this correctly anyway.
2019-09-23 15:20:53 +02:00
Philip Rebohle e8055f81df
[dxvk] Validate primitive topology in pipeline state 2019-09-23 15:19:46 +02:00
Philip Rebohle f38cfd592e
[dbxc] Actually fix callc implementation
Yeah maybe we should close our blocks properly. There seems to be
no way to generate a callc instruction with fxc so this is untested.
2019-09-22 22:36:42 +02:00
Philip Rebohle 94ce76da6b
[dxbc] Implement label, call and callc instructions
Fixes #1200.
2019-09-22 22:28:58 +02:00
Philip Rebohle 1fa8887c47
[d3d11] Return device lost errors in Present if necessary 2019-09-22 19:20:53 +02:00
Philip Rebohle 11b7b1f1a5
[d3d11] Implement GetDeviceRemovedReason 2019-09-22 19:07:48 +02:00
Philip Rebohle 2e9a836adb
[dxvk] Handle device lost errors on command submission 2019-09-22 19:06:53 +02:00
Philip Rebohle 92d1cf8ae0
[d3d11] Fix CheckFeatureSupport formatting and return code 2019-09-22 15:01:49 +02:00
Entryhazard 252d71e55e Retrieve the function pointer once (#1198) 2019-09-22 10:11:17 +02:00
Philip Rebohle f37d4b58b6
[dxvk] Explicitly compare resource use count to zero
Fixes MSVC compiler warnings.
2019-09-21 19:04:23 +02:00
Philip Rebohle 21b2a9a078
[meta] Release 1.4 2019-09-21 16:15:37 +02:00
Philip Rebohle a74eceaf46
[dxvk] Bump state cache version to v6 2019-09-21 14:11:51 +02:00
Philip Rebohle e253183bc2
[dxvk] Apply spec constants to compute shaders as well 2019-09-21 14:11:51 +02:00
Philip Rebohle e926ceb9cc
[dxvk] Only time pipeline compile times if requested
Avoids some unnecessary calls to high_resolution_clock::now().
2019-09-21 13:10:09 +02:00
Philip Rebohle 6ecb74d2c0
[dxvk] Check if xfb buffers have actually changed on binding
We should avoid redundant render pass spilling at all costs.
This affects all games using deferred contexts for rendering
due to their implicit use of ClearState and RestoreState.
2019-09-21 05:13:05 +02:00
Philip Rebohle 1347aeba33
[dxvk] Use separate counters for read/write resource usage
It is not unrealistic at all to overflow the 18-bit and 14-bit
counters in modern games, so just use two 32-bit counters instead.
Avoid 64-bit atomics due to poor performance on 32-bit builts.
2019-09-21 02:45:23 +02:00
Philip Rebohle 71e74f1810
[d3d11] Disable DO_NOT_WAIT for Overwatch
Because of course this game breaks for some people with it enabled.
2019-09-21 01:44:38 +02:00
Philip Rebohle 7514aa1ec8
[d3d11] Implement IDXGIDevice4 2019-09-20 18:06:34 +02:00
Philip Rebohle 32410a4f2b
[dxgi] Implement IDXGISwapChain4 2019-09-20 18:06:34 +02:00
Philip Rebohle 5cb7f26bb7
[dxgi] Implement IDXGIOutput5 2019-09-20 18:06:34 +02:00
Philip Rebohle 3e8a6ec463
[dxgi] Implement IDXGIFactory5 2019-09-20 18:06:34 +02:00
Philip Rebohle 9ed980a962
[dxgi] Include DXGI 1.5 headers 2019-09-20 18:06:34 +02:00
marcin mikołajczak 9941769237 [util] Update comment for FIFA 19+ workaround (#1197) 2019-09-20 16:20:26 +02:00
Philip Rebohle 7e7609cac0
Revert "[d3d11] Don't create linearly tiled compressed images"
This reverts commit b8888ffe6a.

This is no longer beneficial since initialization of a
linear image does not stall Map anymore.
2019-09-20 05:59:54 +02:00
Philip Rebohle e82c87dc52
[d3d11] Implement GetDC / ReleaseDC 2019-09-20 01:44:18 +02:00
Philip Rebohle 028633138a
[d3d11] Implement GDI surface 2019-09-20 01:44:18 +02:00
Joshua Ashton 014870b1ff
[util] Add helpers for GDI/DDI interop 2019-09-20 01:44:18 +02:00
Philip Rebohle c9a0f06ff4
[d3d11] Enable allowMapFlagNoWait by default
We still keep the option around so that in case of regressions,
users can check if disabling this option fixes their issue.
2019-09-20 01:44:02 +02:00
Philip Rebohle e9fcf64a8c
[dxvk] Only wait for writes when mapping with D3D11_MAP_READ 2019-09-20 01:44:02 +02:00
Philip Rebohle 5b5927dd41
[dxvk] Implement read-write tracking for resources 2019-09-20 01:44:01 +02:00
Philip Rebohle 63183141bc
[dxvk] Implement read/write tracking in lifetime tracker
This way we will be able to more accurately determine how a
resource is going to be used by the GPU, and we can also cut
unnecessary atomic operations for non-resource objects.
2019-09-20 01:44:01 +02:00
Philip Rebohle 136ad3e4c9
[d3d11] Write to image memory directly in InitHostVisibleTexture
Avoids performing a potentially expensive copy or clear operation
on the GPU.
2019-09-20 01:44:01 +02:00
Philip Rebohle ae4a5232aa
[d3d11] Use VK_IMAGE_LAYOUT_PREINITIALIZED for mapped images
This way we can directly write image data directly to the image
without having to do it on the GPU.
2019-09-20 01:44:01 +02:00
Philip Rebohle eb0a492f51
[dxvk] Add initial layout to initImage
Allows us to initialize an image from the PREINITIALIZED layout.
2019-09-20 01:44:01 +02:00
Philip Rebohle 4570b34456
[dxvk] Add initial layout to image create info 2019-09-20 01:44:01 +02:00
Philip Rebohle 51c6eb5cdb
[util] Enable FIFA 19 workaround for FIFA 20 as well
Same procedure as every year.
2019-09-20 00:50:01 +02:00
Philip Rebohle 48417c7d19
[d3d11] Implement DiscardView1
Basically just behave like DiscardView if no rects are passed to
the function, otherwise ignore the call since we can't discard
individual rectangles in any meaningful way.
2019-09-19 13:56:50 +02:00
Philip Rebohle 0338b70596
[dxgi] Implement IDXGIVkInteropAdapter for IDXGIAdapter 2019-09-18 14:53:44 +02:00
Philip Rebohle 9af8387e4e
[dxgi] Define IDXGIVkInteropAdapter interface
Can be used to pull the Vulkan instance and physical device from
a DXGI adapter.
2019-09-18 14:53:44 +02:00
Philip Rebohle 9e02b6b433
[dxgi] Rename IDXGIVkAdapter -> IDXGIDXVKAdapter
This interface exposes DXVK internals and cannot be used for
Vulkan interop. We shouldn't pretend like it could.
2019-09-18 14:07:13 +02:00
Philip Rebohle bc853d0e48
[d3d11] Only use mapped buffer for images if bind flags are non-zero
We really shouldn't use the intermediate buffer for DYNAMIC images
that can only ever be used for copy commands, since the copies will
be redundant.
2019-09-18 13:15:22 +02:00
Philip Rebohle 65428da3fe
[util] Enable allowMapFlagNoWait for Warhammer II 2019-09-18 13:14:53 +02:00
Philip Rebohle abf89356cd
[d3d11] Report unified memory if all heaps are device-local
Together with mapping default resources, this may or may not
help performance in some applications on integrated graphics.
2019-09-17 23:52:02 +02:00
Philip Rebohle 518d06b9c2
[d3d11] Enable D3D11.3 MapOnDefaultTextures feature 2019-09-17 23:39:06 +02:00
Philip Rebohle c59ab258a5
[d3d11] Implement ReadFromSubresource and WriteToSubresource 2019-09-17 23:39:06 +02:00
Philip Rebohle e764f05a1a
[d3d11] Allow pMappedResource to be null when mapping images
This is required to implement mapping default textures correctly.
2019-09-17 23:39:06 +02:00
Philip Rebohle 6ce8450b12
[d3d11] Implement D3D11.2 MapOnDefaultBuffers feature
Basically just allocates the buffer on a host-visible memory
type, like DYNAMIC or STAGING buffers depending depending on
the CPU access flags.
2019-09-17 17:47:33 +02:00
Philip Rebohle 2cdbe2e6df
[d3d11] Move GetMemoryFlagsForUsage into D3D11Buffer
D3D11Buffer is the only user of this function and the code sharing
potential is limited. This allows us to implement the memory type
selection for buffers in one single place rather than two.
2019-09-17 17:21:10 +02:00
Philip Rebohle f7b311499c
[d3d11] Query format support in d3d11-formats test
Because why not. Knowing about native d3d11 feature support never hurts.
2019-09-17 16:34:41 +02:00
Philip Rebohle dda89a075e
[d3d11] Report MapOnDefaultTextures feature as unsupported
Bad things can happen if we leave this undefined.
2019-09-17 14:21:19 +02:00
Joshua Ashton ebc394218a [dxvk] Replicate R component of border color for depth compare samplers (#1194)
Only the red component matters for these samplers -- this lets us pick the best colour based on that alone, as we could get garbage data that doesn't matter in the other components.
2019-09-17 11:15:09 +02:00
Philip Rebohle 2ef34a055d
[d3d11] Implement ID3D11Device5 2019-09-16 16:37:37 +02:00
Philip Rebohle 56daf44d4c
[d3d11] Implement ID3D11Device4 2019-09-16 16:26:18 +02:00
Philip Rebohle 3ba541fde6
[d3d11] Implement D3D11.4 feature queries 2019-09-16 16:22:52 +02:00
Philip Rebohle 6ab6b4a209
[d3d11] Include D3D11.4 headers 2019-09-16 16:14:47 +02:00
Philip Rebohle fdf560150f
[d3d11] Implement ID3D11Device3 2019-09-16 16:13:34 +02:00
Philip Rebohle b0f6655b92
[d3d11] Implement ID3D11Query1 2019-09-16 16:13:34 +02:00
Philip Rebohle 84c80a4aaf
[d3d11] Implement ID3D11UnorderedAccessView1 2019-09-16 16:13:34 +02:00
Philip Rebohle 81935e1684
[d3d11] Implement ID3D11ShaderResourceView1 2019-09-16 14:27:44 +02:00
Philip Rebohle 345f8694e8
[d3d11] Implement ID3D11RenderTargetView1 2019-09-16 14:27:44 +02:00
Philip Rebohle 0758f14a35
[d3d11] Implement ID3D11Texture2D1 and ID3D11Texture3D1 2019-09-16 14:27:44 +02:00
Philip Rebohle d9f409b92f
[d3d11] Implement ID3D11RasterizerState2 2019-09-16 13:41:31 +02:00
Philip Rebohle f9d9307a28
[d3d11] Implement ID3D11DeviceContext4 2019-09-16 13:41:31 +02:00
Philip Rebohle 0599a82dee
[d3d11] Implement ID3D11DeviceContext3 2019-09-16 13:41:31 +02:00
Philip Rebohle 17a6c4168e
[dxbc] Implement stencil ref export from fragment shaders
This is an optional feature in D3D11.3, but easy enough to support.
2019-09-16 12:42:15 +02:00
Philip Rebohle b7bc51c3bd
[d3d11] Use shaderStorageImageReadWithoutFormat for typed UAV loads 2019-09-16 12:42:15 +02:00
Philip Rebohle 7fae4a41e8
[d3d11] Add definitions for feature levels 12_0 and 12_1
Mostly useful for debugging as we're not going to support these
feature levels for now.
2019-09-16 12:42:14 +02:00
Philip Rebohle 51ff65fbc5
[d3d11] Implement D3D11.3 feature queries 2019-09-16 12:42:14 +02:00
Philip Rebohle aad44458f7
[d3d11] Include D3D11.3 headers 2019-09-16 12:42:14 +02:00
Philip Rebohle 26afaba410
[dxbc] Implement MSAD4 instruction
Apparently we're required to support this for Direct3D 11.2+.
There are currently no known games that require this instruction.
2019-09-16 12:42:14 +02:00
Philip Rebohle 72a356fe01
[d3d11] Implement GetResourceTiling
When called on a regular resource, native D3D11 will zero
out the return values. We should match this behaviour.
2019-09-16 12:42:14 +02:00
Philip Rebohle 7ba7178d14
[d3d11] Implement ID3D11Device2
Adds some extra validation to resource creation so that
apps cannot accidentally create tiled resources.
2019-09-16 12:42:14 +02:00
Philip Rebohle c1a7243811
[d3d11] Implement ID3D11DeviceContext2
We don't support tiled resources nor markers for now.
Marker support could be added through debug layers.
2019-09-16 12:42:14 +02:00
Philip Rebohle 6e28ab956d
[d3d11] Implement D3D11.2 feature queries 2019-09-16 12:42:14 +02:00
Philip Rebohle d7476f3fb8
[d3d11] Include D3D11.2 headers 2019-09-16 12:42:14 +02:00
Philip Rebohle f2d461ab5b
[d3d11] Prevent log spam from repeated Get/SetResourceMinLOD calls 2019-09-16 12:41:44 +02:00
Philip Rebohle 3e17ccfaaa
[d3d11] Implement missing D3D11_FEATURE_D3D9_OPTIONS feature query 2019-09-16 02:21:46 +02:00
Philip Rebohle c852b6de34
[d3d11] Optimize viewport updates if there is only one single viewport 2019-09-13 14:38:51 +02:00
Philip Rebohle 160b684d5a
[d3d11] Add range check for scissors and make failing it unlikely 2019-09-13 11:49:00 +02:00
Philip Rebohle e2808309a3
[metæ] Release 1.3.4 2019-09-08 21:03:46 +02:00
Philip Rebohle f57c021ab5
[util] Enable d3d11.allowMapFlagNoWait for Control 2019-09-08 10:35:57 +02:00
Philip Rebohle b8888ffe6a
[d3d11] Don't create linearly tiled compressed images
Quantum Break uses this for texture uploads, which causes unnecessary
GPU synchronization and queue submissions when doing texture uploads.
2019-09-07 20:16:16 +02:00
orbea c57e63f7d2 Work around build failure with winegcc/clang. (#1184)
Fixes #1182.
2019-09-05 18:01:33 +02:00
Philip Rebohle 5ea5d2a816
[meta] Work around wine 4.15 build failure
Wine bug report: https://bugs.winehq.org/show_bug.cgi?id=47710
We should probably revisit this with the next wine release.

Closes #1179.
2019-09-01 14:22:34 +02:00
Philip Rebohle 2466992549
[meta] Use -std=c++17
Realistically, there is no way to build recent versions of DXVK
anymore with a compiler that doesn't have C++17 support.

GCC 8.x (maybe 7.x?) or Clang 5.x should support this.
2019-09-01 13:36:47 +02:00
Philip Rebohle b0552751ad
[d3d11] Fix incorrect AddRef -> Release
Spotted by @jp7677
2019-08-29 21:24:47 +02:00
Philip Rebohle 2776ef43a3
[meta] Release 1.3.3 2019-08-29 20:56:47 +02:00
Philip Rebohle 30d19cd0f2
[d3d11] Rename some hazard tracking methods for clarity 2019-08-29 19:10:53 +02:00
Philip Rebohle 6be124e2cd
[d3d11] Check for conflicts withing RTV and UAV lists upon binding them 2019-08-29 19:10:53 +02:00
Philip Rebohle e07ef1ec40
[d3d11] Resolve pipeline hazards when binding render targets 2019-08-29 19:10:53 +02:00
Philip Rebohle a36f056572
[d3d11] Resolve pipeline hazards when binding compute shader UAVs 2019-08-29 19:10:53 +02:00
Philip Rebohle c8c781c88b
[d3d11] Add check whether a viewed resource has a given bind flag 2019-08-29 19:10:50 +02:00
Sveinar Søpler 7a57357717 Update README (#1174) 2019-08-28 09:42:03 +02:00
Philip Rebohle afc8e4c29d
[d3d11] Filter redundant OMSetRenderTargets calls
Since rebinding render targets is a rather expensive
operation, we should avoid doing so whenever possible.

Affects Resident Evil 2 and Devil May Cry 5.
2019-08-26 23:59:08 +02:00
Philip Rebohle 4789790087
[d3d11] Remove outdated comment
We actually handle this properly now.
2019-08-26 23:43:47 +02:00
Philip Rebohle 5756e5c921
[d3d11] Check for shader resource view hazards
Fixes incorrect behaviour in games that try to use a currently bound
UAV or render target as a shader resource at the same time.

Fixes visual artifacts in Shining Resonance Refrain on AMD hardware.
2019-08-26 23:43:47 +02:00
Philip Rebohle 137589d755
[d3d11] Add state to track potentially hazardous bound SRVs 2019-08-26 23:29:01 +02:00
Philip Rebohle 4064dd3737
[d3d11] Add bound compute shader UAV mask
Will be used for efficient hazard tracking.
2019-08-26 23:29:01 +02:00
Philip Rebohle 8208cedfa9
[d3d11] Add common view info struct to all view types
Will be used for hazard detection.
2019-08-26 23:29:01 +02:00
Philip Rebohle 5ae5053a2a
[d3d11] Remove templated SetUnorderedAccessViews
Not needed because the CS and OM paths are separate anyway.
2019-08-26 23:29:01 +02:00
Philip Rebohle 08e3500beb
[d3d11] Don't use .at() 2019-08-26 23:29:01 +02:00
Philip Rebohle 473025a93b
[dxvk] Add function to find set bits in binding mask 2019-08-26 23:29:01 +02:00
Philip Rebohle d2d19b0dec
[dxvk] Add function to set bind mask bit to a given value 2019-08-26 23:29:00 +02:00
Jacek Caban e7b71926e3 [build] Check if --add-stdcall-alias and --enable-stdcall-fixup is supported before using it.
lld-link linker does not support nor need it.
2019-08-26 20:07:58 +02:00
Jacek Caban 1981140257 [dxvk] Explicitly include unordered_map in dxvk_renderpass.h
When using libstdc++, it's somehow implicitly included, but it's not the case for libc++.
2019-08-26 20:07:58 +02:00
Joshua Ashton 8e54477c2a [util] Use R string literals for app compat regexes 2019-08-24 21:32:51 +02:00
Philip Rebohle 54ca5900e1 [util] Use regular expressions on full exe path to match app profiles
This allows us to detect applications with non-unique executable names
or with variable executable names more reliably, and also allows us to
merge profiles for games that have multiple known exe names.

The matching is also no longer case-sensitive.
2019-08-18 17:49:22 +02:00
Philip Rebohle c934333a5c [util] Add method to retrieve full exe path 2019-08-17 11:50:39 +02:00
Philip Rebohle d38607c9be
[dxvk] Implement depth-stencil resolve 2019-08-13 15:16:09 +02:00
Philip Rebohle e54dfab471
[dxvk] Support depth-stencil resolve using VK_KHR_depth_stencil_resolve 2019-08-13 15:16:09 +02:00
Philip Rebohle 7e95493fba
[dxvk] Support shader-based depth-stencil resolve
Requires VK_EXT_shader_stencil_export for stencil resolves.
2019-08-13 15:16:00 +02:00
Philip Rebohle a516ca5b85
[dxvk] Add meta shaders for depth-stencil resolve 2019-08-13 14:37:50 +02:00
Philip Rebohle acf0001fd1
[dxvk] Make device properties accessible from the device 2019-08-13 14:37:50 +02:00
Philip Rebohle 2f15cb7602
[dxvk] Enable VK_KHR_depth_stencil_resolve if available 2019-08-13 12:53:31 +02:00
Philip Rebohle d127c08487
[dxvk] Enable VK_KHR_create_renderpass2 if available 2019-08-13 12:52:54 +02:00
Philip Rebohle 1999ca9dd4
[util] Set d3d11.dcSingleUseMode=False for SteamVR perf test
*Actually* fixes #1160.
2019-08-10 11:21:47 +02:00
Philip Rebohle 4cce07ccd9
[d3d11] Update resources mapped on deferred contexts in Map()
Apparently it is legal to use mapped buffers on deferred contexts
in D3D11, so we have to execute our update code immediately.

Fixes #1160.
2019-08-10 11:11:44 +02:00
Joshua Ashton d579f07238 [util] Fix compiling with clang/clang-cl 2019-08-07 06:08:54 +02:00
Philip Rebohle 590834660e
Revert "[dxvk] Use vkCmdUpdateBuffer to clear tiny buffers"
This reverts commit 311661e404.

This once fixed Far Cry Primal, but now for some reason it
breaks Far Cry Primal. Fixes #1155.
2019-08-07 05:41:33 +02:00
Philip Rebohle bd40b05720
[d3d11] Recreate swap chain immediately after synchronous present fails
Fully restores pre-1.3 behaviour in case async present is disabled.
Apparently this is necessary to avoid hangs on Nvidia for some reason.
2019-08-06 09:11:04 +02:00
Philip Rebohle 9fdd7bf789
[meta] Release 1.3.2 2019-08-05 20:38:22 +02:00
Philip Rebohle bc0537df37 [d3d11] Remove d3d11.asyncPresent option 2019-08-04 21:49:55 +02:00
Philip Rebohle a558f82b5f [dxvk] Implement asynchronous presentation option in the backend 2019-08-04 21:49:55 +02:00
Philip Rebohle 77fde83479 [dxvk] Move some code to where it makes more sense 2019-08-04 21:37:26 +02:00
Philip Rebohle 6b2f4f93cc [d3d11] Fix incorrect tracking of mapped image subresources
When returnig DXGI_ERROR_WAS_STILL_DRAWING, we should not mark
the subresource as mapped, and instead ignore subsequent calls
to Unmap.
2019-08-03 19:11:19 +02:00
Philip Rebohle 140a2c1017 Revert "[d3d11] Return error when mapping an already mapped image"
This reverts commit 1cc531eaf8.

Even though an FFXIV apitrace clearly indicates that mapping an
already mapped subresource returns E_OUTOFMEMORY in that game,
this doesn't always seem to be correct behaviour.

Fixes #1148, #1149.
2019-08-03 19:08:22 +02:00
Philip Rebohle 02d92210ad
[dxvk] Avoid redundant descriptor set updates when binding buffers (v2)
We need to check not just the buffer object but also the length of the
bound buffer range, since this information will be written into the
descriptor and cannot be changed via dynamic offsets.

Fixes: f501ebc ('[dxvk] Avoid redundant descriptor set updates when binding buffers')
2019-08-01 21:30:27 +02:00
Philip Rebohle af15d85baa
[dxvk] Add config option to enable the HUD 2019-08-01 12:37:55 +02:00
Philip Rebohle 4fd41f8550
[dxvk] Don't allow common objects to be reference-counted 2019-07-30 20:06:59 +02:00
Philip Rebohle 65c1e58bd9
[dxvk] Use DxvkObjects to create and pass around common objects 2019-07-30 20:00:38 +02:00
Philip Rebohle 35679d2ba7
[dxvk] Add class that bundles objects shared between device and context
Uses lazy initialization for various meta objects.
2019-07-30 20:00:38 +02:00
Philip Rebohle cfd7033e40
[dxvk] Pass DxvkDevice to DxvkRenderPassPool constructor 2019-07-30 20:00:38 +02:00
Philip Rebohle e12103121f
[dxvk] Pass DxvkDevice to DxvkEventPool constructor 2019-07-30 20:00:38 +02:00
Philip Rebohle 40028a5b8c
[dxvk] Pass DxvkDevice to DxvkMetaClearObjects constructor 2019-07-30 20:00:38 +02:00
Philip Rebohle 6a58c432ec
[dxvk] Pass DxvkDevice to DxvkMetaPackObjects constructor 2019-07-30 20:00:38 +02:00
Philip Rebohle 9a2da555c0
[util] Add helper for lazy initialization
a
2019-07-30 20:00:35 +02:00
Philip Rebohle 23379b6b9c
[dxvk] Check render pass before pipeline state during pipeline lookup
Checking one pointer is a bit cheaper than comparing a 1600 byte struct.
2019-07-30 16:19:16 +02:00
Philip Rebohle c020ffc31e
[meta] Remove old issue template 2019-07-30 16:11:37 +02:00
Philip Rebohle 797991702d Update issue templates 2019-07-30 16:11:18 +02:00
Philip Rebohle a7666aad82
[dxvk] Refactor the way render passes to pipeline compiler methods 2019-07-30 13:17:56 +02:00
Philip Rebohle 13bc3df92f
[dxvk] Refactor render pass objects to not use reference counting
Like pipeline objects, we keep these around anyway so there's no
reason to add ref count overhead. Also use a hash map to perform
the lookup.
2019-07-30 13:13:02 +02:00
Philip Rebohle d01b6baf38
[dxvk] Introduce compilePipeline method to Dxvk*Pipeline classes
Decouples the act of synchronously retrieving a handle
from asynchronously compiling the pipeline.
2019-07-30 12:14:52 +02:00
Philip Rebohle 3dc33c64a9
[dxvk] Introduce DxvkComputePipelineInstance
Same as the graphics pipeline equivalent.
2019-07-30 11:07:07 +02:00
Philip Rebohle 20b0cbdfb6
[dxvk] Rename compilePipeline -> createPipeline
More in line with Vulkan naming.
2019-07-30 11:06:25 +02:00
Philip Rebohle 6ab074c95b
[dxbc] Only use atomic append/consume optimization in compute shaders
- For fragment shaders, this isn't safe since ballots include helper invocations
- For vertex shaders, if drivers don't support subgroup operations in those
  stages, we don't want it to affect the performance of compute shadres.
2019-07-26 14:07:39 +02:00
Philip Rebohle dfe2922136
[dxvk] Fix partial clears for mismatched framebuffer attachment sizes
Fixes an issue in Borderlands: The Pre-Sequel, which binds a 512x512
color attachment and a full-screen depth buffer at the same time and
then attempts to clear the depth buffer.
2019-07-24 23:46:02 +02:00
Philip Rebohle 9c5102e257
[dxvk] Don't duplicate geometry shader system value outputs
Fixes #1121. The basic idea here is that all built-ins that can be
written by the GS will be consumed as built-ins by the FS anyway,
so we do not need to keep the o# variable around.
2019-07-24 18:18:20 +02:00
Philip Rebohle eaa41eb76c
[dxvk] Don't use reference counting for pipeline objects
Again not necessary since these objects are persistent.
Eliminates refcount overhead of pipeline lookups entirely.
2019-07-23 13:15:06 +02:00
Philip Rebohle 8cd13cc5bd
[dxvk] Use shader key structs directly for pipeline lookups
Removes some overhead and unnecessary ref count changes on shaders.
2019-07-23 13:00:04 +02:00
Philip Rebohle 8d4996bcda
[dxvk] Use shader key structs to store shaders in DxvkPipeline objects
Mostly a code cleanup to make constructing these objects a bit easier.
2019-07-23 12:48:11 +02:00
Philip Rebohle 604e89b97a
[dxvk] Rename Dxvk*PipelineKey -> Dxvk*PipelineShaders 2019-07-23 12:41:09 +02:00
Philip Rebohle 70294aac44
[dxvk] Disable resource tracking for DxvkPipeline objects
This isn't necessary at all since these objects are persistent.
2019-07-23 12:34:48 +02:00
Philip Rebohle 00cf2a20a3
[d3d11] Don't allow the creation of buffers with a size of zero 2019-07-21 20:47:42 +02:00
Philip Rebohle f5cec978c8
[meta] Release 1.3.1 2019-07-20 20:33:19 +02:00
Philip Rebohle c89bec5abd
[dxvk] Don't log submission errors on presentation
Makes no sense and only leads to confusion.
2019-07-20 20:25:18 +02:00
Philip Rebohle d9c0940734
[meta] Update README 2019-07-19 00:42:37 +02:00
Philip Rebohle 3f4c9a3bb5
[hud] Add GPU load monitor 2019-07-18 23:23:36 +02:00
Philip Rebohle 5bb20cceb6
[dxvk] Add GPU idle time to stat counters 2019-07-18 23:23:12 +02:00
Philip Rebohle 3d86ecd94d
[dxvk] Estimate GPU idle time based on cleanup thread activity
We'll assume that GPU idle time == time spent waiting for new
command lists to be added to the queue of the cleanup thread.
This isn't entirely accurate, especially if CPU load is very
high, but should be good enough.
2019-07-18 22:54:11 +02:00
Philip Rebohle 02d917c680
[dxvk] Fix meta copy operation for mipmapped images 2019-07-18 19:52:24 +02:00
Philip Rebohle fb9ea958a1
[dxvk] Fix meta copy operation for 1D images 2019-07-18 19:50:57 +02:00
Philip Rebohle 2905ba82d2
[dxvk] Remove old meta vertex and geometry shaders 2019-07-18 18:59:11 +02:00
Philip Rebohle 8889d6402e
[dxvk] Use new fullscreen shaders for mip gen operations 2019-07-18 18:57:18 +02:00
Philip Rebohle e91efb6dc2
[dxvk] Use new fullscreen shaders for meta resolve operations 2019-07-18 18:57:17 +02:00
Philip Rebohle 792f15680a
[dxvk] Use new fullscreen shaders for meta copy operations 2019-07-18 18:57:17 +02:00
Philip Rebohle 07408bcdcc
[dxvk] Add new vertex and geometry shaders for fullscreen passes
These new shaders are aimed to be used by all meta operations
and will work without geometry shaders on supported hardware.
2019-07-18 18:57:15 +02:00
Philip Rebohle 92d6f26130
[d3d11] Always enable depth-stencil attachment usage for depth-stencil images
Allows us to use framebuffer copies even if the game itself does not
intend to render to the image.

Improves performance in Final Fantasy XIV on RADV.
2019-07-18 17:26:02 +02:00
Philip Rebohle 8a9cee903b
[dxvk] Use render pass copy for depth-stencil images if beneficial 2019-07-18 17:26:02 +02:00
Philip Rebohle a08f9d0897
[dxvk] Implement device- and driver-specific performance hints
These are meant to be read by the DxvkContext in order to choose
a fast path for certasin operations.
2019-07-18 17:25:56 +02:00
Philip Rebohle e611dff45e
[dxvk] Support depth-stencil meta-copy operations 2019-07-18 17:25:56 +02:00
Philip Rebohle 0dd8cba199
[dxvk] Support depth-stencil formats for meta copy objects 2019-07-18 17:25:50 +02:00
Philip Rebohle 89516e2da2
[dxvk] Add meta copy shaders for depth-stencil formats 2019-07-18 17:25:48 +02:00
Philip Rebohle 677e33b9c9
[dxvk] Enable VK_EXT_shader_stencil_export if available 2019-07-18 17:25:48 +02:00
Philip Rebohle f0fb25c082
[dxvk] Log more device info on device creation
This should tell us whether extension features are actually used.
2019-07-18 13:37:14 +02:00
Philip Rebohle f3943934a7
[util] Improve multi-line logging 2019-07-18 13:34:52 +02:00
Philip Rebohle f16ba4794b
[d3d11] Use unlikely() for some query code
This is a somewhat hot path in some games, so why not.
2019-07-17 20:35:00 +02:00
Philip Rebohle c4b56b9d8d
[d3d11] Use private temporary references for queries
Like the previous commit, just with queries.
2019-07-17 20:16:19 +02:00
Philip Rebohle 7225674088
[d3d11] Use private temporary references for state objects
We really shouldn't be altering the application-visible ref
count when sending these objects to the CS thread.
2019-07-17 20:01:57 +02:00
Philip Rebohle 21a2ce045f
[util] Add convenience method to return public/private references 2019-07-17 19:59:50 +02:00
Philip Rebohle af8e1a3d47
[d3d11] Simplify ApplyPrimitiveTopology code 2019-07-17 15:54:59 +02:00
Philip Rebohle 3f30fbd098
[d3d11] Simplify BindIndexBuffer code 2019-07-17 14:41:00 +02:00
Philip Rebohle 63fe899bdc
[dxvk] Don't check if bindings have changed in the backend
The state tracker should perform these checks before sending commands
off to the backend anyway, so checking again in the backend is redundant.
2019-07-17 14:26:55 +02:00
Philip Rebohle b6c395c013
[dxvk] Don't track command count in CS chunks
We weren't using this at all, and it's not necessary
to check whether the chunk is empty either.
2019-07-17 12:52:25 +02:00
Philip Rebohle 11b7fc8914
[d3d11] Catch invalid ClearUnorderedAccessViewFloat calls
This method cannot be called on integer UAVs.
2019-07-17 11:47:42 +02:00
Philip Rebohle b20ceec727
[d3d11] Handle integer formats in ClearRenderTargetView correctly
We're supposed to apply the same color conversion as in ClearView.
2019-07-17 11:47:42 +02:00
Philip Rebohle c6ea115ca3
[dxvk] Add method to retrieve buffer view format info 2019-07-17 11:47:42 +02:00
Philip Rebohle c29314de5a
[dxvk] Change DxvkImageView::formatInfo to return view format info
Makes more sense and won't break any existing code using it.
2019-07-17 11:33:39 +02:00
Philip Rebohle 7895272806
[dxvk] Use correct command buffer for buffer updates
Fixes a regression in SpellForce 3.
2019-07-16 23:47:33 +02:00
Philip Rebohle 493b55b073
[dxvk] Compute memory chunk size per memory type rather than per heap 2019-07-16 09:59:44 +02:00
Philip Rebohle 6936da17d9
[dxvk] Try harder to allocate memory from a given memory type
Before failing, see if we can't allocate a smaller chunk size.
2019-07-16 09:59:44 +02:00
Philip Rebohle 18aada29ef
[dxvk] Don't put large resources into their own memory allocations
This approach currently has two issues:
- We might fail to allocate the resource on the desired memory type
  even if there is a chunk available that it would tif in
- With 128MB chunks, this no longer seems to be beneficial anyway
2019-07-16 09:24:55 +02:00
Philip Rebohle ad8fdcac07
[dxvk] Don't mark queries as stalling if DONOTFLUSH is set 2019-07-16 01:19:02 +02:00
Philip Rebohle 362ecf1e0e
[meta] Fix release number 2019-07-15 20:42:37 +02:00
Philip Rebohle acf6c27e76
[dxvk] Limit maximum size of multi-slice buffers
Reduces memory fragmentation caused by frequently renamed buffers.
2019-07-15 04:14:23 +02:00
Philip Rebohle d8e31f221f
[dxvk] Fix offset in DxvkBuffer::subSlice 2019-07-15 04:06:12 +02:00
Philip Rebohle f88658d88c
[dxvk] Template BindPoint parameter in some DxvkContext methods
Again, there's no reason not to do this since the argument is always
constant, and we can skip some work in the compute case.
2019-07-14 20:09:35 +02:00
Philip Rebohle def05f007c
[dxvk] Template Index parameter of commitGraphicsState
This is always constant anyway, so avoid some unnecessary code.
2019-07-14 19:57:50 +02:00
Philip Rebohle 8dfdda7a39
[dxvk] Get rid of validateCompute/GraphicsState
After all this time we haven't found a single situation where
we need more validation, so scrap it. Checking whether there
is an active render pass was redundant anyway.
2019-07-14 19:34:56 +02:00
Philip Rebohle a93dd74f71
[dxvk] Don't use derivative pipelines
No driver appears to be taking advantage of this, so why bother.
2019-07-14 13:58:00 +02:00
Philip Rebohle 03c6df56c1
[d3d11] Initialize subresourceLayers in the inner loop
Not doing so causes Dirt Rally to fail uploading some textures
properly for some extremely weird reason.
2019-07-13 23:39:58 +02:00
Philip Rebohle 7cb385facd
[meta] Release 1.3 2019-07-13 19:15:30 +02:00
Philip Rebohle e116ff49e6
[dxvk] Rename memoryAvailable -> memoryBudget 2019-07-13 19:04:33 +02:00
Joshua Ashton fac3ae9f83 [spirv] Implement opCross 2019-07-12 23:32:09 +02:00
Joshua Ashton f280386aec [spirv] Implement opFMix 2019-07-12 23:32:09 +02:00
Philip Rebohle 649cc07f5e
[tests] Enable demoteToHelperInvocation in off-line DXBC compiler 2019-07-11 19:33:17 +02:00
Philip Rebohle 8644d75722
[dxbc] Use OpDemoteToHelperInvocationEXT for discards if supported 2019-07-11 19:33:17 +02:00
Philip Rebohle e901e1269d
[spirv] Add support for OpDemoteToHelperInvocationEXT 2019-07-11 19:33:17 +02:00
Philip Rebohle 7b34b8515b
[d3d11] Enable shaderDemoteToHelperInvocation feature 2019-07-11 19:33:17 +02:00
Philip Rebohle b2a53a2413
[dxvk] Enable VK_EXT_shader_demote_to_helper_invocation if available 2019-07-11 19:33:17 +02:00
Philip Rebohle e076b75579
[meta] Update SPIR-V headers 2019-07-11 19:33:17 +02:00
Philip Rebohle 5c7f8d8e30
[meta] Update Vulkan headers 2019-07-11 19:33:14 +02:00
Liam Middlebrook 2e83aae472 [dxbc] Print shader signatures at debug loglevel 2019-07-11 12:40:44 +02:00
Liam Middlebrook ff4fa29304 [dxbc] Add string output function for DxbcRegMask 2019-07-11 12:40:44 +02:00
Liam Middlebrook 2164a44887 [dxbc] Add ostream operator for DxbcScalarType 2019-07-11 12:40:44 +02:00
Joshua Ashton 89afd586ef [build] Mark tests as gui apps in Meson
Fixes building the tests on Windows and uses the right entrypoint and linker subsystem.
2019-07-08 17:09:07 +02:00
Philip Rebohle 06d4e06d8a
[dxbc] Enable early discard on RADV/ACO
Still can't enable on LLVM due to GPU hangs. The way we detect it
may have to change in the future, but for now, this should do.
2019-07-08 16:30:56 +02:00
Robin Kertels 47f7333c18
[d3d11] Fix RSGetViewports and RSGetScissorRects behaviour
Fixes #1116.
2019-07-08 13:14:42 +02:00
Philip Rebohle 24e1969dc4
[dxvk] Remove obsolete DxvkEvent class 2019-07-08 00:16:03 +02:00
Philip Rebohle 15072afa1f
[d3d11] Use new signals as frame synchronization events 2019-07-08 00:16:03 +02:00
Philip Rebohle f0acc40e50
[dxvk] Add support for new signals to the backend 2019-07-08 00:16:03 +02:00
Philip Rebohle 4e8122eda9
[dxvk] Add new signal class 2019-07-08 00:16:00 +02:00
Philip Rebohle c631953ab6
[d3d11] Don't immediately synchronize after present
This will actually enable asynchronous presentation.
Improves performance in Quake Champions.
2019-07-05 21:20:09 +02:00
Philip Rebohle 77db8158c8
[dxvk] Add option to toggle asynchronous presentation 2019-07-05 21:20:09 +02:00
Philip Rebohle ed5c43a14d
[dxvk] Implement asynchronous presentation
Off-loads the vkQueuePresentKHR call to the queue submission thread
to avoid synchronization with that thread on a present call.
2019-07-05 15:11:59 +02:00
Philip Rebohle 0900f5d1bc
[dxvk] Fix typo 2019-07-05 15:09:15 +02:00
Philip Rebohle 1cc531eaf8
[d3d11] Return error when mapping an already mapped image
Final Fantasy XIV does this. Should avoid some unnecessary work.
2019-07-05 10:25:06 +02:00
Philip Rebohle 2f64f5b4e7
[dxvk] Check whether CS thread is busy before synchronizing with it
Reduces unnecessary locking overhead, which may be relevant if this
function gets called frequently by GetData or WaitForResource.
2019-07-04 21:37:17 +02:00
Philip Rebohle f6dbf5bbf0
[dxvk] Increase staging buffer size to 32 MiB
Since the chunk size was also doubled to 128 MiB and we want
staging buffers to get their own allocations.
2019-07-04 20:39:27 +02:00
Philip Rebohle 3b1376b2fe
[dxvk] Increase memory chunk size to 128 MiB
Nvidia drivers apparently don't like smaller chunks very much.
May increase overall memory consumption and fragmentation.
2019-07-04 16:11:13 +02:00
Philip Rebohle 3b128179ab
[dxvk] Print VK_EXT_memory_budget stats on allocation failure
Based on PR #1112, but using a cleaner method to check
support for the VK_EXT_memory_budget extension.

Suggested-by: Liam Middlebrook <lmiddlebrook@nvidia.com>
2019-07-03 11:11:12 +02:00
Philip Rebohle ac9610f377
[dxvk] Add VK_EXT_memory_budget as a passive extension 2019-07-03 11:02:13 +02:00
Philip Rebohle f21c02caef
[dxvk] Add support for passive device extensions
These extensions only affect physical device functionality and
do not have to be enabled during device creation.
2019-07-03 10:59:48 +02:00
Philip Rebohle cb806a5d56
[dxvk] Free memory if vkMapMemory fails
Otherwise, we leak the allocated memory chunk and make the
problem even worse than it already is.
2019-07-02 01:26:54 +02:00
Joshua Ashton 1dadba3cce [dxvk] Give null values to empty DxvkGraphicsPipelineInstances
Silences an MSVC warning.
2019-07-01 02:46:54 +02:00
Joshua Ashton c381e8a29e [util] Add correct type suffixes to Sha1Hash dword function to silence compiler warning 2019-07-01 02:46:54 +02:00
Philip Rebohle 67122d9246
[d3d11] Enable initial image uploads over SDMA 2019-06-29 01:53:43 +02:00
Philip Rebohle 9d902418c0
[d3d11] Enable initial buffer uploads over SDMA 2019-06-29 01:53:43 +02:00
Philip Rebohle d5c0a8c842
[dxvk] Upload HUD font texture via SDMA 2019-06-29 01:53:43 +02:00
Philip Rebohle c7c90830c4
[dxvk] Implement image uploads on SDMA 2019-06-29 01:53:32 +02:00
Philip Rebohle eb71c62b33
[dxvk] Implement buffer uploads on SDMA 2019-06-29 01:53:32 +02:00
Philip Rebohle 0a40e2c868
[dxvk] Support queue ownership transfer barriers 2019-06-29 01:53:32 +02:00
Philip Rebohle f85b9088d4
[dxvk] Explicitly specify the command buffer for copy commands 2019-06-29 01:53:32 +02:00
Philip Rebohle be24ca6099
[dxvk] Rename and add SDMA barrier sets 2019-06-29 01:53:32 +02:00
Philip Rebohle 4f3dcf2bc8
[dxvk] Add SDMA command buffer
This new command buffer will be submitted to the transfer queue,
if available, otherwise it will be the first buffer submitted
to the graphics queue.
2019-06-29 01:53:32 +02:00
Philip Rebohle 4e0de6bc20
[dxvk] Refactor queue submission 2019-06-29 01:53:32 +02:00
Philip Rebohle 545cd52020
[dxvk] Create transfer queue command pool if available 2019-06-29 01:53:32 +02:00
Philip Rebohle d8163c4446
[dxvk] Don't pass queue handles to DxvkCommandList
Instead, pull them from the device as needed. This coupling would
only make sense if we required one command list per queue family.
2019-06-29 01:53:32 +02:00
Philip Rebohle d2d11bf995
[dxvk] Add option to enable or disable the transfer queue 2019-06-29 01:53:32 +02:00
Philip Rebohle 191bba660b
[dxvk] Provide way to access queue properties from device 2019-06-29 01:53:32 +02:00
Philip Rebohle 1c39765b86
[dxvk] Rework queue family selection
This allows us to support multiple queues more easily.
2019-06-29 01:53:32 +02:00
Philip Rebohle 110fc8f833
[dxvk] Properly clear used command buffer flags
Fixes an issue where we would always submit the init buffer, even
if it is empty.
2019-06-29 01:53:29 +02:00
Philip Rebohle 770ec2c4db
[dxvk] Get rid of array in present vertex shader 2019-06-29 01:34:16 +02:00
Philip Rebohle 42e61020e4
[d3d11] Remove unused SetRenderTargets method 2019-06-27 15:54:42 +02:00
Philip Rebohle 2148619f3c
[d3d11] Spill render pass when restoring context state as needed 2019-06-27 15:54:42 +02:00
Philip Rebohle a704e6d27e
[d3d11] Fix UAV binding in OMSetRenderTargets{,AndUnorderedAccessViews}
Unlike for compute shaders, we're supposed to replace all UAV bindings
when binding render targets. We also should spill the render pass when
disabling UAV rendering to avoid read-after-write hazards.

Fixes a potential synchronization bug encountered in Devil May Cry 5.
2019-06-27 15:54:42 +02:00
Joshua Ashton 194db57a4d [spirv] Expose MatrixStride decoration for members 2019-06-27 10:49:49 +02:00
Joshua Ashton 80808d743b [spirv] Add generic memberDecorate 2019-06-27 10:49:49 +02:00
Joshua Ashton 1b8c54eb84 [spirv] Expose opMatrixTimesMatrix, opMatrixTimesVector and opVectorTimesMatrix 2019-06-27 10:49:49 +02:00
Philip Rebohle afe2b487a6
[dxvk] Avoid redundant vertex and index buffer tracking
Same optimization as for regular resources. Mostly reduces load
on the cleanup thread.
2019-06-27 01:51:15 +02:00
Philip Rebohle c3ebf4658c
[dxvk] Reorder command list reset operations by importance 2019-06-27 00:02:43 +02:00
Philip Rebohle 7491c06389
[meta] Release 1.2.3 2019-06-26 17:33:57 +02:00
Philip Rebohle 5728d10587
[d3d11] Copy initial texture data to mapped buffer, if available
Otherwise, if an application maps the image right after creating it,
we might end up reading garbage data or overriding the image data.
2019-06-25 14:22:47 +02:00
Philip Rebohle 4d4db6c683
[dxvk] Use void pointers for packImageData
Makes this function a bit less annoying to use.
2019-06-25 14:17:03 +02:00
Philip Rebohle 3293bd21d1
[dxvk] Avoid updating binding mask on hot path in updateShaderResources
Assuming that everything is bound by default allows us to save a few
CPU cycles per descriptor to update as long as that assumption holds
true, while adding only a small constant cost for the update operation.
2019-06-23 23:43:25 +02:00
Philip Rebohle b7769759f2
[dxvk] Implement comparison and setting multiple bits for DxvkBindingSet 2019-06-23 23:41:56 +02:00
Philip Rebohle 5e3336d79b
[dxvk] Clean up updateShaderResources a bit 2019-06-23 23:21:47 +02:00
Philip Rebohle 81e7a8d1f6
[dxvk] Avoid redundant resource tracking
Only tracks a shader resource if the resource bound to the slot
has actually changed, or if we began recording a new command
buffer. Reduces the number of atomic operations in some games.
2019-06-23 18:55:49 +02:00
Philip Rebohle 924ca9eaec
[dxvk] Add more generic version of DxvkBindingMask 2019-06-23 18:45:34 +02:00
Philip Rebohle f58242c58d
[dxvk] Fix poor API design around defining resource slots 2019-06-23 15:49:29 +02:00
Andrew Eikum 326eb0bf80 [dxgi] Don't fail leaving fullscreen if window is already destroyed
Unreal Engine 4 games destroy the window, then call
SetFullscreenMode(FALSE). If this call fails, they pop up an error
dialog. Wine tests show that this call should succeed.
2019-06-21 17:27:34 +02:00
Philip Rebohle 62372f5d47
[dxvk] Release staging buffer memory for HUD context
We really don't want to waste 32MB of system RAM because of
one single texture update all the time.
2019-06-21 16:43:22 +02:00
Philip Rebohle 34cdba1df5
[dxvk] Add method to explicitly release staging buffer memory 2019-06-21 16:43:22 +02:00
Philip Rebohle 1c9bc235d0
[dxvk] Remove old staging buffer code 2019-06-21 16:43:22 +02:00
Philip Rebohle 8c1a56af89
[dxvk] Remove old staging buffer allocator from DxvkCommandList 2019-06-21 16:43:22 +02:00
Philip Rebohle 24c282378e
[dxvk] Use new staging buffer allocator in DxvkContext 2019-06-21 16:43:22 +02:00
Philip Rebohle 970deb452e
[dxvk] Implement new staging buffer allocator 2019-06-21 16:43:19 +02:00
Philip Rebohle a41bd8c4a0
[d3d11] Further optimize constant buffer binding
Saves a few CPU cycles on the more common SetConstantBuffers method,
compared to SetConstantBuffers1.
2019-06-20 22:49:19 +02:00
Philip Rebohle 3141467c37
[d3d11] Template all functions that take ShaderStage as an argument
Basically what D9VK does. Doesn't seem to affect performance, but why not.
2019-06-20 22:09:02 +02:00
Philip Rebohle 138dde6c3d
[dxvk] Prefer VRAM allocation over dedicated sysmem allocation
May in some cases improve performance when under memory pressure:
If a dedicated allocation is preferred, but the alloaction fails,
try to allocate memory from an already allocated chunk instead
of falling back to system memory right away.
2019-06-20 10:34:54 +02:00
Joshua Ashton a4a4f5a822 [util] Correct return value of SetThreadDescription 2019-06-19 19:43:36 +02:00
Philip Rebohle 0a35ae6fca
[dxvk] Log memory utilization per heap on memory allocation failures 2019-06-19 14:47:09 +02:00
Philip Rebohle 684355dfca
[d3d11] Fix GetData parameter validation
We're supposed to return an error if a null pointer is
passed along with a non-zero DataSize. Fixes more wine
test failures.
2019-06-16 19:24:44 +02:00
Philip Rebohle 43389d8ef4
[d3d11] Implement timestamp disjoint queries 2019-06-16 17:14:39 +02:00
Philip Rebohle 1c718402f8
[d3d11] Use an array for query and event objects
We're going to need multiple queries to implement certain query types.
2019-06-16 17:14:24 +02:00
Philip Rebohle fd1b5c8eb9
[dxvk] Add method to permanently change image layout 2019-06-15 16:45:59 +02:00
616 changed files with 96454 additions and 36395 deletions

31
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,31 @@
---
name: Bug report
about: Report crashes, rendering issues etc.
title: ''
labels: ''
assignees: ''
---
Please describe your issue as accurately as possible.
If you use Windows, please check the following page: https://github.com/doitsujin/dxvk/wiki/Windows
### Software information
Name of the game, settings used etc.
### System information
- GPU:
- Driver:
- Wine version:
- DXVK version:
### Apitrace file(s)
- Put a link here
For instructions on how to use apitrace, see: https://github.com/doitsujin/dxvk/wiki/Using-Apitrace
### Log files
Please attach Proton or Wine logs as a text file:
- When using Proton, set the Steam launch options for your game to `PROTON_LOG=1 %command%` and attach the corresponding `steam-xxxxx.log` file in your home directory.
- When using regular Wine, use `wine game.exe > game.log 2>&1` and attach the resulting `game.log` file.

83
.github/workflows/artifacts.yml vendored Normal file
View File

@ -0,0 +1,83 @@
name: Artifacts (Package)
on: [push, pull_request, workflow_dispatch]
jobs:
artifacts-mingw-w64:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
id: checkout-code
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup problem matcher
uses: Joshua-Ashton/gcc-problem-matcher@v3
- name: Build release
id: build-release
uses: Joshua-Ashton/arch-mingw-github-action@v8
with:
command: |
export VERSION_NAME="${GITHUB_REF##*/}-${GITHUB_SHA##*/}"
./package-release.sh ${VERSION_NAME} build --no-package
echo "VERSION_NAME=${VERSION_NAME}" >> $GITHUB_ENV
- name: Upload artifacts
id: upload-artifacts
uses: actions/upload-artifact@v4
with:
name: dxvk-win-${{ env.VERSION_NAME }}
path: build/dxvk-${{ env.VERSION_NAME }}
if-no-files-found: error
artifacts-steamrt-sniper:
runs-on: ubuntu-20.04
container: registry.gitlab.steamos.cloud/steamrt/sniper/sdk:beta
steps:
- name: Checkout code
id: checkout-code
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup problem matcher
uses: Joshua-Ashton/gcc-problem-matcher@v3
- name: Build release
id: build-release
shell: bash
run: |
export VERSION_NAME="${GITHUB_REF##*/}-${GITHUB_SHA##*/}"
./package-native.sh ${VERSION_NAME} build
echo "VERSION_NAME=${VERSION_NAME}" >> $GITHUB_ENV
- name: Upload artifacts
id: upload-artifacts
uses: actions/upload-artifact@v4
with:
name: dxvk-native-${{ env.VERSION_NAME }}
path: build/dxvk-native-${{ env.VERSION_NAME }}.tar.gz
if-no-files-found: error
merge-artifacts:
runs-on: ubuntu-20.04
needs: [artifacts-mingw-w64, artifacts-steamrt-sniper]
steps:
- name: Get version
id: get-version
shell: bash
run: |
echo "VERSION_NAME=${GITHUB_REF##*/}-${GITHUB_SHA##*/}" >> $GITHUB_ENV
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: dxvk-${{ env.VERSION_NAME }}
pattern: dxvk*
delete-merged: true

View File

@ -0,0 +1,51 @@
name: Test Builds on Windows
on: [push, pull_request, workflow_dispatch]
jobs:
build-set-windows:
runs-on: windows-2022
steps:
- name: Checkout code
id: checkout-code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup glslangValidator
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/HansKristian-Work/vkd3d-proton-ci/main/glslangValidator.exe" -OutFile "glslangValidator.exe"
Write-Output "$pwd" | Out-File -FilePath "${Env:GITHUB_PATH}" -Append
- name: Setup Meson
shell: pwsh
run: pip install meson
- name: Find Visual Studio
shell: pwsh
run: |
$installationPath = Get-VSSetupInstance `
| Select-VSSetupInstance -Require Microsoft.VisualStudio.Workload.NativeDesktop -Latest `
| Select-Object -ExpandProperty InstallationPath
Write-Output "VSDEVCMD=${installationPath}\Common7\Tools\VsDevCmd.bat" `
| Out-File -FilePath "${Env:GITHUB_ENV}" -Append
- name: Build MSVC x86
shell: pwsh
run: |
& "${Env:COMSPEC}" /s /c "`"${Env:VSDEVCMD}`" -arch=x86 -host_arch=x64 -no_logo && set" `
| % { , ($_ -Split '=', 2) } `
| % { [System.Environment]::SetEnvironmentVariable($_[0], $_[1]) }
meson --buildtype release --backend vs2022 build-msvc-x86
msbuild -m build-msvc-x86/dxvk.sln
- name: Build MSVC x64
shell: pwsh
run: |
& "${Env:COMSPEC}" /s /c "`"${Env:VSDEVCMD}`" -arch=x64 -host_arch=x64 -no_logo && set" `
| % { , ($_ -Split '=', 2) } `
| % { [System.Environment]::SetEnvironmentVariable($_[0], $_[1]) }
meson --buildtype release --backend vs2022 build-msvc-x64
msbuild -m build-msvc-x64/dxvk.sln

13
.gitmodules vendored Normal file
View File

@ -0,0 +1,13 @@
[submodule "include/native/directx"]
path = include/native/directx
url = https://github.com/Joshua-Ashton/mingw-directx-headers
[submodule "include/vulkan"]
path = include/vulkan
url = https://github.com/KhronosGroup/Vulkan-Headers
[submodule "include/spirv"]
path = include/spirv
url = https://github.com/KhronosGroup/SPIRV-Headers.git
[submodule "subprojects/libdisplay-info"]
path = subprojects/libdisplay-info
url = https://gitlab.freedesktop.org/JoshuaAshton/libdisplay-info.git
branch = windows

View File

@ -1,4 +1,5 @@
Copyright (c) 2017-2019 Philip Rebohle
Copyright (c) 2017 Philip Rebohle
Copyright (c) 2019 Joshua Ashton
zlib/libpng license

131
README.md
View File

@ -1,38 +1,53 @@
# DXVK
A Vulkan-based translation layer for Direct3D 10/11 which allows running 3D applications on Linux using Wine.
A Vulkan-based translation layer for Direct3D 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).
The most recent development builds can be found [here](https://github.com/doitsujin/dxvk/actions/workflows/artifacts.yml?query=branch%3Amaster).
Release builds can be found [here](https://github.com/doitsujin/dxvk/releases).
## How to use
In order to install a DXVK package obtained from the [release](https://github.com/doitsujin/dxvk/releases) page into a given wine prefix, run the following commands from within the DXVK directory:
In order to install a DXVK package obtained from the [release](https://github.com/doitsujin/dxvk/releases) page into a given wine prefix, copy or symlink the DLLs into the following directories as follows, then open `winecfg` and manually add DLL overrides for `d3d11`, `d3d10core`, `dxgi`, and `d3d9`.
In a default Wine prefix that would be as follows:
```
export WINEPREFIX=/path/to/.wine-prefix
./setup_dxvk.sh install
export WINEPREFIX=/path/to/wineprefix
cp x64/*.dll $WINEPREFIX/drive_c/windows/system32
cp x32/*.dll $WINEPREFIX/drive_c/windows/syswow64
winecfg
```
This will **copy** the DLLs into the `system32` and `syswow64` directories of your wine prefix and set up the required DLL overrides. Pure 32-bit prefixes are also supported.
The setup script optionally takes the following arguments:
- `--symlink`: Create symbolic links to the DLL files instead of copying them. This is especially useful for development.
- `--without-dxgi`: Do not install DXVK's DXGI implementation and use the one provided by wine instead. This is necessary for both vkd3d and DXVK to work within the same wine prefix.
Verify that your application uses DXVK instead of wined3d by checking for the presence of the log file `d3d11.log` in the application's directory, or by enabling the HUD (see notes below).
In order to remove DXVK from a prefix, run the following command:
For a pure 32-bit Wine prefix (non default) the 32-bit DLLs instead go to the `system32` directory:
```
export WINEPREFIX=/path/to/.wine-prefix
./setup_dxvk.sh uninstall
export WINEPREFIX=/path/to/wineprefix
cp x32/*.dll $WINEPREFIX/drive_c/windows/system32
winecfg
```
Verify that your application uses DXVK instead of wined3d by enabling the HUD (see notes below).
In order to remove DXVK from a prefix, remove the DLLs and DLL overrides, and run `wineboot -u` to restore the original DLL files.
Tools such as Steam Play, Lutris, Bottles, Heroic Launcher, etc will automatically handle setup of dxvk on their own when enabled.
### Notes on Vulkan drivers
Before reporting an issue, please check the [Wiki](https://github.com/doitsujin/dxvk/wiki/Driver-support) page on the current driver status and make sure you run a recent enough driver version for your hardware.
## Build instructions
In order to pull in all submodules that are needed for building, clone the repository using the following command:
```
git clone --recursive https://github.com/doitsujin/dxvk.git
```
### Requirements:
- [wine 3.10](https://www.winehq.org/) or newer
- [Meson](http://mesonbuild.com/) build system (at least version 0.43)
- [MinGW64](http://mingw-w64.org/) 6.0 compiler and headers
- [wine 7.1](https://www.winehq.org/) or newer
- [Meson](https://mesonbuild.com/) build system (at least version 0.49)
- [Mingw-w64](https://www.mingw-w64.org) compiler and headers (at least version 10.0)
- [glslang](https://github.com/KhronosGroup/glslang) compiler
### Building DLLs
@ -52,25 +67,25 @@ cd /your/target/directory/build.64
ninja install
```
A winelib build can be created by adding the `--winelib` argument.
#### Compiling manually
```
# 64-bit build. For 32-bit builds, replace
# build-win64.txt with build-win32.txt
meson --cross-file build-win64.txt --buildtype release --prefix /your/dxvk/directory build.w64
meson setup --cross-file build-win64.txt --buildtype release --prefix /your/dxvk/directory build.w64
cd build.w64
ninja install
```
The D3D10, D3D11 and DXGI DLLs will be located in `/your/dxvk/directory/bin`. Setup has to be done manually in this case.
### Notes on Vulkan drivers
Before reporting an issue, please check the [Wiki](https://github.com/doitsujin/dxvk/wiki/Driver-support) page on the current driver status and make sure you run a recent enough driver version for your hardware.
The D3D9, D3D10, D3D11 and DXGI DLLs will be located in `/your/dxvk/directory/bin`. Setup has to be done manually in this case.
### Online multi-player games
Manipulation of Direct3D libraries in multi-player games may be considered cheating and can get your account **banned**. This may also apply to single-player games with an embedded or dedicated multiplayer portion. **Use at your own risk.**
### Logs
When used with Wine, DXVK will print log messages to `stderr`. Additionally, standalone log files can optionally be generated by setting the `DXVK_LOG_PATH` variable, where log files in the given directory will be called `app_d3d11.log`, `app_dxgi.log` etc., where `app` is the name of the game executable.
On Windows, log files will be created in the game's working directory by default, which is usually next to the game executable.
### HUD
The `DXVK_HUD` environment variable controls a HUD which can display the framerate and some stat counters. It accepts a comma-separated list of the following options:
- `devinfo`: Displays the name of the GPU and the driver version.
@ -79,39 +94,91 @@ The `DXVK_HUD` environment variable controls a HUD which can display the framera
- `submissions`: Shows the number of command buffers submitted per frame.
- `drawcalls`: Shows the number of draw calls and render passes per frame.
- `pipelines`: Shows the total number of graphics and compute pipelines.
- `descriptors`: Shows the number of descriptor pools and descriptor sets.
- `memory`: Shows the amount of device memory allocated and used.
- `gpuload`: Shows estimated GPU load. May be inaccurate.
- `version`: Shows DXVK version.
- `api`: Shows the D3D feature level used by the application. Does not work correctly for D3D10 at the moment.
- `api`: Shows the D3D feature level used by the application.
- `cs`: Shows worker thread statistics.
- `compiler`: Shows shader compiler activity
- `samplers`: Shows the current number of sampler pairs used *[D3D9 Only]*
- `scale=x`: Scales the HUD by a factor of `x` (e.g. `1.5`)
- `opacity=y`: Adjusts the HUD opacity by a factor of `y` (e.g. `0.5`, `1.0` being fully opaque).
Additionally, `DXVK_HUD=1` has the same effect as `DXVK_HUD=devinfo,fps`, and `DXVK_HUD=full` enables all available HUD elements.
### Frame rate limit
The `DXVK_FRAME_RATE` environment variable can be used to limit the frame rate. A value of `0` uncaps the frame rate, while any positive value will limit rendering to the given number of frames per second. Alternatively, the configuration file can be used.
### Device filter
Some applications do not provide a method to select a different GPU. In that case, DXVK can be forced to use a given device:
- `DXVK_FILTER_DEVICE_NAME="Device Name"` Selects devices with a matching Vulkan device name, which can be retrieved with tools such as `vulkaninfo`. Matches on substrings, so "VEGA" or "AMD RADV VEGA10" is supported if the full device name is "AMD RADV VEGA10 (LLVM 9.0.0)", for example. If the substring matches more than one device, the first device matched will be used.
**Note:** If the device filter is configured incorrectly, it may filter out all devices and applications will be unable to create a D3D device.
### Graphics Pipeline Library
On drivers which support `VK_EXT_graphics_pipeline_library` Vulkan shaders will be compiled at the time the game loads its D3D shaders, rather than at draw time. This reduces or eliminates shader compile stutter in many games when compared to the previous system.
In games that load their shaders during loading screens or in the menu, this can lead to prolonged periods of very high CPU utilization, especially on weaker CPUs. For affected games it is recommended to wait for shader compilation to finish before starting the game to avoid stutter and low performance. Shader compiler activity can be monitored with `DXVK_HUD=compiler`.
This feature largely replaces the state cache.
**Note:** Games which only load their D3D shaders at draw time (e.g. most Unreal Engine games) will still exhibit some stutter, although it should still be less severe than without this feature.
### State cache
DXVK caches pipeline state by default, so that shaders can be recompiled ahead of time on subsequent runs of an application, even if the driver's own shader cache got invalidated in the meantime. This cache is enabled by default, and generally reduces stuttering.
The following environment variables can be used to control the cache:
- `DXVK_STATE_CACHE=0` Disables the state cache.
- `DXVK_STATE_CACHE`: Controls the state cache. The following values are supported:
- `disable`: Disables the cache entirely.
- `reset`: Clears the cache file.
- `DXVK_STATE_CACHE_PATH=/some/directory` Specifies a directory where to put the cache files. Defaults to the current working directory of the application.
This feature is mostly only relevant on systems without support for `VK_EXT_graphics_pipeline_library`
### Debugging
The following environment variables can be used for **debugging** purposes.
- `VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_standard_validation` Enables Vulkan debug layers. Highly recommended for troubleshooting rendering issues and driver crashes. Requires the Vulkan SDK to be installed on the host system.
- `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` Enables Vulkan debug layers. Highly recommended for troubleshooting rendering issues and driver crashes. Requires the Vulkan SDK to be installed on the host system.
- `DXVK_LOG_LEVEL=none|error|warn|info|debug` Controls message logging.
- `DXVK_LOG_PATH=/some/directory` Changes path where log files are stored.
- `DXVK_LOG_PATH=/some/directory` Changes path where log files are stored. Set to `none` to disable log file creation entirely, without disabling logging.
- `DXVK_DEBUG=markers|validation` Enables use of the `VK_EXT_debug_utils` extension for translating performance event markers, or to enable Vulkan validation, respecticely.
- `DXVK_CONFIG_FILE=/xxx/dxvk.conf` Sets path to the configuration file.
- `DXVK_CONFIG="dxgi.hideAmdGpu = True; dxgi.syncInterval = 0"` Can be used to set config variables through the environment instead of a configuration file using the same syntax. `;` is used as a seperator.
## Troubleshooting
DXVK requires threading support from your mingw-w64 build environment. If you
are missing this, you may see "error: 'mutex' is not a member of 'std'". On
Debian and Ubuntu, this can usually be resolved by using the posix alternate, which
are missing this, you may see "error: std::cv_status has not been declared"
or similar threading related errors.
On Debian and Ubuntu, this can be resolved by using the posix alternate, which
supports threading. For example, choose the posix alternate from these
commands (use i686 for 32-bit):
commands:
```
update-alternatives --config x86_64-w64-mingw32-gcc
update-alternatives --config x86_64-w64-mingw32-g++
update-alternatives --config i686-w64-mingw32-gcc
update-alternatives --config i686-w64-mingw32-g++
```
For non debian based distros, make sure that your mingw-w64-gcc cross compiler
does have `--enable-threads=posix` enabled during configure. If your distro does
ship its mingw-w64-gcc binary with `--enable-threads=win32` you might have to
recompile locally or open a bug at your distro's bugtracker to ask for it.
# DXVK Native
DXVK Native is a version of DXVK which allows it to be used natively without Wine.
This is primarily useful for game and application ports to either avoid having to write another rendering backend, or to help with port bringup during development.
[Release builds](https://github.com/doitsujin/dxvk/releases) are built using the Steam Runtime.
### How does it work?
DXVK Native replaces certain Windows-isms with a platform and framework-agnostic replacement, for example, `HWND`s can become `SDL_Window*`s, etc.
All it takes to do that is to add another WSI backend.
**Note:** DXVK Native requires a backend to be explicitly set via the `DXVK_WSI_DRIVER` environment variable. The current built-in options are `SDL2` and `GLFW`.
DXVK Native comes with a slim set of Windows header definitions required for D3D9/11 and the MinGW headers for D3D9/11.
In most cases, it will end up being plug and play with your renderer, but there may be certain teething issues such as:
- `__uuidof(type)` is supported, but `__uuidof(variable)` is not supported. Use `__uuidof_var(variable)` instead.

View File

@ -1 +1 @@
1.2.2
2.3.1

415
VP_DXVK_requirements.json Normal file
View File

@ -0,0 +1,415 @@
{
"$schema": "https://schema.khronos.org/vulkan/profiles-0.8.1-224.json#",
"capabilities": {
"vulkan10requirements": {
"features": {
"VkPhysicalDeviceFeatures": {
"robustBufferAccess": true
}
}
},
"vulkan11requirements": {
"features": {
"VkPhysicalDeviceVulkan11Features": {
"multiview": true
}
},
"properties": {
"VkPhysicalDeviceVulkan11Properties": {
"maxMultiviewViewCount": 6,
"maxMultiviewInstanceIndex": 134217727
}
}
},
"vulkan12requirements": {
"features": {
"VkPhysicalDeviceVulkan12Features": {
"uniformBufferStandardLayout": true,
"subgroupBroadcastDynamicId": true,
"imagelessFramebuffer": true,
"separateDepthStencilLayouts": true,
"hostQueryReset": true,
"timelineSemaphore": true,
"shaderSubgroupExtendedTypes": true
}
},
"properties": {
"VkPhysicalDeviceVulkan12Properties": {
"maxTimelineSemaphoreValueDifference": 2147483647
}
}
},
"vulkan13requirements": {
"features": {
"VkPhysicalDeviceVulkan12Features": {
"vulkanMemoryModel": true,
"vulkanMemoryModelDeviceScope": true,
"bufferDeviceAddress": true
},
"VkPhysicalDeviceVulkan13Features": {
"robustImageAccess": true,
"shaderTerminateInvocation": true,
"shaderZeroInitializeWorkgroupMemory": true,
"synchronization2": true,
"shaderIntegerDotProduct": true,
"maintenance4": true,
"pipelineCreationCacheControl": true,
"subgroupSizeControl": true,
"computeFullSubgroups": true,
"shaderDemoteToHelperInvocation": true,
"inlineUniformBlock": true,
"dynamicRendering": true
}
},
"properties": {
"VkPhysicalDeviceVulkan13Properties": {
"maxBufferSize": 1073741824,
"maxInlineUniformBlockSize": 256,
"maxPerStageDescriptorInlineUniformBlocks": 4,
"maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks": 4,
"maxDescriptorSetInlineUniformBlocks": 4,
"maxDescriptorSetUpdateAfterBindInlineUniformBlocks": 4,
"maxInlineUniformTotalSize": 4
}
}
},
"d3d9_baseline": {
"extensions": {
"VK_EXT_robustness2": 1
},
"features": {
"VkPhysicalDeviceFeatures": {
"geometryShader": true,
"imageCubeArray": true,
"depthClamp": true,
"depthBiasClamp": true,
"fillModeNonSolid": true,
"sampleRateShading": true,
"shaderClipDistance": true,
"shaderCullDistance": true,
"textureCompressionBC": true,
"occlusionQueryPrecise": true,
"independentBlend": true,
"fullDrawIndexUint32": true,
"shaderImageGatherExtended": true
},
"VkPhysicalDeviceVulkan12Features": {
"samplerMirrorClampToEdge": true
},
"VkPhysicalDeviceRobustness2FeaturesEXT": {
"nullDescriptor": true,
"robustBufferAccess2": true
}
}
},
"d3d9_optional": {
"extensions": {
"VK_EXT_memory_priority": 1,
"VK_EXT_vertex_attribute_divisor": 1,
"VK_EXT_depth_clip_enable": 1,
"VK_EXT_custom_border_color": 1,
"VK_EXT_attachment_feedback_loop_layout": 1,
"VK_EXT_non_seamless_cube_map": 1
},
"features": {
"VkPhysicalDeviceFeatures": {
"depthBounds": true,
"vertexPipelineStoresAndAtomics": true,
"pipelineStatisticsQuery": true,
"samplerAnisotropy": true
},
"VkPhysicalDeviceMemoryPriorityFeaturesEXT": {
"memoryPriority": true
},
"VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT": {
"vertexAttributeInstanceRateDivisor": true,
"vertexAttributeInstanceRateZeroDivisor": true
},
"VkPhysicalDeviceDepthClipEnableFeaturesEXT": {
"depthClipEnable": true
},
"VkPhysicalDeviceCustomBorderColorFeaturesEXT": {
"customBorderColors": true,
"customBorderColorWithoutFormat": true
},
"VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT": {
"attachmentFeedbackLoopLayout": true
},
"VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT": {
"nonSeamlessCubeMap": true
}
}
},
"d3d11_baseline": {
"extensions": {
"VK_EXT_robustness2": 1,
"VK_EXT_transform_feedback": 1
},
"features": {
"VkPhysicalDeviceFeatures": {
"depthBiasClamp": true,
"depthClamp": true,
"dualSrcBlend": true,
"fillModeNonSolid": true,
"fullDrawIndexUint32": true,
"geometryShader": true,
"imageCubeArray": true,
"independentBlend": true,
"multiViewport": true,
"occlusionQueryPrecise": true,
"sampleRateShading": true,
"shaderClipDistance": true,
"shaderCullDistance": true,
"shaderImageGatherExtended": true,
"textureCompressionBC": true
},
"VkPhysicalDeviceVulkan11Features": {
"shaderDrawParameters": true
},
"VkPhysicalDeviceVulkan12Features": {
"samplerMirrorClampToEdge": true
},
"VkPhysicalDeviceRobustness2FeaturesEXT": {
"nullDescriptor": true,
"robustBufferAccess2": true
},
"VkPhysicalDeviceTransformFeedbackFeaturesEXT": {
"transformFeedback": true,
"geometryStreams": true
}
}
},
"d3d11_baseline_optional":{
"extensions": {
"VK_EXT_memory_priority": 1,
"VK_EXT_vertex_attribute_divisor": 1,
"VK_EXT_custom_border_color": 1,
"VK_EXT_depth_clip_enable": 1,
"VK_EXT_swapchain_colorspace": 1,
"VK_EXT_hdr_metadata": 1
},
"features": {
"VkPhysicalDeviceFeatures": {
"depthBounds": true,
"pipelineStatisticsQuery": true,
"logicOp": true,
"samplerAnisotropy": true
},
"VkPhysicalDeviceMemoryPriorityFeaturesEXT": {
"memoryPriority": true
},
"VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT": {
"vertexAttributeInstanceRateDivisor": true,
"vertexAttributeInstanceRateZeroDivisor": true
},
"VkPhysicalDeviceCustomBorderColorFeaturesEXT": {
"customBorderColors": true,
"customBorderColorWithoutFormat": true
},
"VkPhysicalDeviceDepthClipEnableFeaturesEXT": {
"depthClipEnable": true
}
}
},
"d3d11_level11_0": {
"features": {
"VkPhysicalDeviceFeatures": {
"drawIndirectFirstInstance": true,
"fragmentStoresAndAtomics": true,
"multiDrawIndirect": true,
"tessellationShader": true
}
}
},
"d3d11_level11_0_optional": {
"features": {
"VkPhysicalDeviceFeatures": {
"shaderFloat64": true,
"shaderInt64": true
}
}
},
"d3d11_level11_1": {
"features": {
"VkPhysicalDeviceFeatures": {
"logicOp": true,
"vertexPipelineStoresAndAtomics": true
}
}
},
"d3d11_level12_0": {
"features": {
"VkPhysicalDeviceFeatures": {
"shaderResourceResidency": true,
"shaderResourceMinLod": true,
"sparseBinding": true,
"sparseResidencyBuffer": true,
"sparseResidencyAliased": true,
"sparseResidencyImage2D": true
},
"VkPhysicalDeviceVulkan12Features": {
"samplerFilterMinmax": true
}
},
"properties": {
"VkPhysicalDeviceProperties": {
"sparseProperties": {
"residencyStandard2DBlockShape": true,
"residencyAlignedMipSize": false,
"residencyNonResidentStrict": true
}
}
}
}
},
"profiles": {
"VP_DXVK_d3d9_baseline": {
"version": 1,
"api-version": "1.3.204",
"label": "DXVK D3D9 Baseline profile",
"description": "DXVK for D3D9 minimum requirements",
"capabilities": [
"vulkan10requirements",
"vulkan11requirements",
"vulkan12requirements",
"vulkan13requirements",
"d3d9_baseline"
]
},
"VP_DXVK_d3d9_optimal": {
"version": 1,
"api-version": "1.3.224",
"label": "DXVK D3D9 Optimal profile",
"description": "DXVK for D3D9 including optional capabilities",
"capabilities": [
"vulkan10requirements",
"vulkan11requirements",
"vulkan12requirements",
"vulkan13requirements",
"d3d9_baseline",
"d3d9_optional"
]
},
"VP_DXVK_d3d10_level_10_1_baseline": {
"version": 1,
"api-version": "1.3.204",
"label": "DXVK D3D10 Level 10.1 Baseline profile",
"description": "DXVK for D3D10 Feature Level 10.1 minimum requirements",
"capabilities": [
"vulkan10requirements",
"vulkan11requirements",
"vulkan12requirements",
"vulkan13requirements",
"d3d11_baseline"
]
},
"VP_DXVK_d3d11_level_11_0_baseline": {
"version": 1,
"api-version": "1.3.204",
"label": "DXVK D3D11 Level 11.0 Baseline profile",
"description": "DXVK for D3D11 Feature Level 11.0 minimum requirements",
"capabilities": [
"vulkan10requirements",
"vulkan11requirements",
"vulkan12requirements",
"vulkan13requirements",
"d3d11_baseline",
"d3d11_level11_0"
]
},
"VP_DXVK_d3d11_level_11_1_baseline": {
"version": 1,
"api-version": "1.3.204",
"label": "DXVK D3D11 Level 11.1 Baseline profile",
"description": "DXVK for D3D11 Feature Level 11.1 minimum requirements",
"capabilities": [
"vulkan10requirements",
"vulkan11requirements",
"vulkan12requirements",
"vulkan13requirements",
"d3d11_baseline",
"d3d11_level11_0",
"d3d11_level11_1"
]
},
"VP_DXVK_d3d11_level_11_1_optimal": {
"version": 1,
"api-version": "1.3.204",
"label": "DXVK D3D11 Level 11.1 Optimal profile",
"description": "DXVK for D3D11 Feature Level 11.1 including optional capabilities",
"capabilities": [
"vulkan10requirements",
"vulkan11requirements",
"vulkan12requirements",
"vulkan13requirements",
"d3d11_baseline",
"d3d11_baseline_optional",
"d3d11_level11_0",
"d3d11_level11_0_optional",
"d3d11_level11_1"
]
},
"VP_DXVK_d3d11_level_12_0_optimal": {
"version": 1,
"api-version": "1.3.204",
"label": "DXVK D3D11 Level 12.0 Optimal profile",
"description": "DXVK for D3D11 Feature Level 12.0 including optional capabilities",
"capabilities": [
"vulkan10requirements",
"vulkan11requirements",
"vulkan12requirements",
"vulkan13requirements",
"d3d11_baseline",
"d3d11_baseline_optional",
"d3d11_level11_0",
"d3d11_level11_0_optional",
"d3d11_level11_1",
"d3d11_level12_0"
]
}
},
"contributors": {
"Philip Rebohle": {
"company": "Valve"
},
"Joshua Ashton": {
"company": "Valve"
},
"Pierre-Loup A. Griffais": {
"company": "Valve"
},
"Georg Lehmann": {
"company": "DXVK"
},
"Christophe Riccio": {
"company": "LunarG"
}
},
"history": [
{
"revision": 4,
"date": "2022-12-18",
"author": "Joshua Ashton",
"comment": "Add VK_EXT_swapchain_colorspace and VK_EXT_hdr_metadata to d3d11_baseline_optional"
},
{
"revision": 3,
"date": "2022-10-13",
"author": "Christophe Riccio",
"comment": "Factorize history and contributors sections using schema 0.8.1"
},
{
"revision": 2,
"date": "2022-08-30",
"author": "Philip Rebohle",
"comment": "Add VP_DXVK_d3d11_level_12_0_optimal profile"
},
{
"revision": 1,
"date": "2022-08-22",
"author": "Christophe Riccio",
"comment": "Initial revision"
}
]
}

View File

@ -3,12 +3,9 @@ c = 'i686-w64-mingw32-gcc'
cpp = 'i686-w64-mingw32-g++'
ar = 'i686-w64-mingw32-ar'
strip = 'i686-w64-mingw32-strip'
windres = 'i686-w64-mingw32-windres'
[properties]
c_args=['-msse', '-msse2']
cpp_args=['-msse', '-msse2']
c_link_args = ['-static', '-static-libgcc']
cpp_link_args = ['-static', '-static-libgcc', '-static-libstdc++', '-Wl,--add-stdcall-alias,--enable-stdcall-fixup']
needs_exe_wrapper = true
[host_machine]

View File

@ -3,10 +3,9 @@ c = 'x86_64-w64-mingw32-gcc'
cpp = 'x86_64-w64-mingw32-g++'
ar = 'x86_64-w64-mingw32-ar'
strip = 'x86_64-w64-mingw32-strip'
windres = 'x86_64-w64-mingw32-windres'
[properties]
c_link_args = ['-static', '-static-libgcc']
cpp_link_args = ['-static', '-static-libgcc', '-static-libstdc++']
needs_exe_wrapper = true
[host_machine]

View File

@ -1,19 +0,0 @@
[binaries]
c = 'winegcc'
cpp = 'wineg++'
ar = 'ar'
strip = 'strip'
[properties]
needs_exe_wrapper = true
c_args=['-m32', '-msse', '-msse2', '-fvisibility=hidden']
cpp_args=['-m32', '--no-gnu-unique', '-msse', '-msse2', '-fvisibility=hidden', '-fvisibility-inlines-hidden']
cpp_link_args=['-m32', '-mwindows']
[host_machine]
system = 'linux'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'

View File

@ -1,19 +0,0 @@
[binaries]
c = 'winegcc'
cpp = 'wineg++'
ar = 'ar'
strip = 'strip'
[properties]
needs_exe_wrapper = true
c_args=['-m64', '-fvisibility=hidden']
cpp_args=['-m64', '--no-gnu-unique', '-fvisibility=hidden', '-fvisibility-inlines-hidden']
cpp_link_args=['-m64', '-mwindows']
[host_machine]
system = 'linux'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

595
dxvk.conf
View File

@ -1,3 +1,23 @@
# Device filter. Only exposes devices whose Vulkan device name contains
# the given string. May be useful to force an application to run on a
# specific GPU, but not applications launched by that application.
# dxvk.deviceFilter = ""
# Expose the HDR10 ColorSpace (DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020)
# to the application by default.
# This shows to the game that the global Windows 'HDR Mode' is enabled.
# Many (broken) games will need this to be set to consider exposing HDR output
# as determine it based on the DXGIOutput's current ColorSpace instead of
# using CheckColorSpaceSupport.
# This defaults to the value of the DXVK_HDR environment variable.
#
# Supported values: True, False
# dxgi.enableHDR = True
# Create the VkSurface on the first call to IDXGISwapChain::Present,
# rather than when creating the swap chain. Some games that start
# rendering with a different graphics API may require this option,
@ -6,6 +26,7 @@
# Supported values: True, False
# dxgi.deferSurfaceCreation = False
# d3d9.deferSurfaceCreation = False
# Enforce a stricter maximum frame latency. Overrides the application
@ -15,6 +36,17 @@
# Supported values : 0 - 16
# dxgi.maxFrameLatency = 0
# d3d9.maxFrameLatency = 0
# Enables frame rate limiter. The main purpose of this is to work around
# bugs in games that have physics or other simulation tied to their frame
# rate, but do not provide their own limiter.
#
# Supported values : Any non-negative integer
# dxgi.maxFrameRate = 0
# d3d9.maxFrameRate = 0
# Override PCI vendor and device IDs reported to the application. Can
@ -25,19 +57,55 @@
# dxgi.customDeviceId = 0000
# dxgi.customVendorId = 0000
# d3d9.customDeviceId = 0000
# d3d9.customVendorId = 0000
# Report Nvidia GPUs as AMD GPUs by default. This is enabled by default
# to work around issues with NVAPI, but may cause issues in some games.
# Override the reported device description
#
# Supported values: True, False
# Supported values: Any string.
# dxgi.nvapiHack = True
# dxgi.customDeviceDesc = ""
# d3d9.customDeviceDesc = ""
# Report Nvidia GPUs as AMD GPUs. Unless NVAPI support is explicitly
# enabled through Proton, this is done by default in order to work
# around crashes or low performance with Nvidia-speciic code paths
# in games, especially Unreal Engine.
#
# Supported values: Auto, True, False
# dxgi.hideNvidiaGpu = Auto
# Report Nvidia GPUs running on NVK as AMD GPUs.
#
# Supported values: Auto, True, False
# dxgi.hideNvkGpu = Auto
# Report AMD GPUs as Nvidia GPUs. This is only done for games that are
# known to have issues with AMDAGS or other AMD-specific code paths.
#
# Supported values: Auto, True, False
# dxgi.hideAmdGpu = Auto
# Report Intel GPUs as AMD GPUs. This is only done for games that are
# known to have issues with Intel-specific libraries such as XESS.
#
# Supported values: Auto, True, False
# dxgi.hideIntelGpu = Auto
# Override maximum amount of device memory and shared system memory
# reported to the application. This may fix texture streaming issues
# in games that do not support cards with large amounts of VRAM.
# This is not a hard cap and applications can choose to ignore it.
#
# Supported values: Any number in Megabytes.
@ -45,12 +113,22 @@
# dxgi.maxSharedMemory = 0
# Some games think we are on Intel given a lack of NVAPI or
# AGS/atiadlxx support. Report our device memory as shared memory,
# and some small amount for a "carveout".
# Supported values: True, False
# dxgi.emulateUMA = False
# Override back buffer count for the Vulkan swap chain.
# Setting this to 0 or less will have no effect.
#
# Supported values: Any number greater than or equal to 2.
# dxgi.numBackBuffers = 0
# d3d9.numBackBuffers = 0
# Overrides synchronization interval (Vsync) for presentation.
@ -61,31 +139,23 @@
# Supported values: Any non-negative number
# dxgi.syncInterval = -1
# d3d9.presentInterval = -1
# Enables or dsables d3d10 support.
#
# Supported values: True, False
# d3d10.enable = True
# Handle D3D11_MAP_FLAG_DO_NOT_WAIT correctly when D3D11DeviceContext::Map()
# is called. Enabling this can potentially improve performance, but breaks
# games which do not expect Map() to return an error despite using the flag.
#
# Supported values: True, False
# d3d11.allowMapFlagNoWait = False
# Performs range check on dynamically indexed constant buffers in shaders.
# This may be needed to work around a certain type of game bug, but may
# also introduce incorrect behaviour.
# True enables the mailbox present mode in case regular Vsync is disabled.
# This should avoid tearing, but may be unsupported on some systems
# or require setting dxgi.numBackBuffers to a higher value in order
# to work properly.
#
# Supported values: True, False
# False enables the relaxed fifo present mode in case regular Vsync is enabled.
# This should result in tearing but reduce stutter if FPS are too low,
# but may be unsupported on some systems.
#
# Please do not report issues with this option.
#
# Supported values: Auto, True, False
# d3d11.constantBufferRangeCheck = False
# dxvk.tearFree = Auto
# Assume single-use mode for command lists created on deferred contexts.
@ -101,9 +171,9 @@
# with. Setting this to a higher value may allow some applications to run
# that would otherwise fail to create a D3D11 device.
#
# Supported values: 9_1, 9_2, 9_3, 10_0, 10_1, 11_0, 11_1
# Supported values: 9_1, 9_2, 9_3, 10_0, 10_1, 11_0, 11_1, 12_0, 12_1
# d3d11.maxFeatureLevel = 11_1
# d3d11.maxFeatureLevel = 12_1
# Overrides the maximum allowed tessellation factor. This can be used to
@ -124,6 +194,16 @@
# d3d11.relaxedBarriers = False
# Ignores barriers around UAV writes from fragment shaders.
#
# This may improve performance in some games, but may also introduce
# rendering issues. Please don't report bugs with the option enabled.
#
# Supported values: True, False
# d3d11.ignoreGraphicsBarriers = False
# Overrides anisotropic filtering for all samplers. Set this to a positive
# value to enable AF for all samplers in the game, or to 0 in order to
# disable AF entirely. Negative values will have no effect.
@ -131,15 +211,54 @@
# Supported values: Any number between 0 and 16
# d3d11.samplerAnisotropy = -1
# d3d9.samplerAnisotropy = -1
# Enables SM4-compliant division-by-zero behaviour. Enabling may reduce
# performance and / or cause issues in games that expect the default
# behaviour of Windows drivers, which also is not SM4-compliant.
# Changes the mipmap LOD bias for all samplers. The given number will be
# added to the LOD bias provided by the application, rather than replacing
# it entirely. Positive values will reduce texture detail, while negative
# values may increase sharpness at the cost of shimmer.
#
# Supported values: Any number between -2.0 and 1.0
# d3d11.samplerLodBias = 0.0
# d3d9.samplerLodBias = 0.0
# Clamps any negative LOD bias to 0. Applies after samplerLodBias has been
# applied. May help with games that use a high negative LOD bias by default.
#
# Supported values: True, False
# d3d11.strictDivision = False
# d3d11.clampNegativeLodBias = False
# d3d9.clampNegativeLodBias = False
# Declares vertex positions as invariant in order to solve
# potential Z-fighting issues at a small performance cost.
#
# Supported values: True, False
# d3d11.invariantPosition = True
# d3d9.invariantPosition = True
# Forces per-sample rate shading when MSAA is enabled, rather than per-pixel
# shading. May improve visual clarity at a significant performance cost, but
# may also introduce visual issues in some games.
#
# Supported values: True, False
# d3d11.forceSampleRateShading = False
# d3d9.forceSampleRateShading = False
# Forces the sample count of all textures to 1, and performs
# the needed fixups in resolve operations and shaders.
#
# Supported values: True, False
# d3d11.disableMsaa = False
# Clears workgroup memory in compute shaders to zero. Some games don't do
@ -150,10 +269,79 @@
# d3d11.zeroWorkgroupMemory = False
# Resource size limit for implicit discards, in kilobytes. For small staging
# resources mapped with MAP_WRITE, DXVK will sometimes allocate new backing
# storage in order to avoid GPU synchronization, so setting this too high
# may cause memory issues, setting it to -1 disables the feature.
# d3d11.maxImplicitDiscardSize = 256
# Resource size limit for buffer-mapped dynamic images, in kilobytes.
# A higher threshold may reduce memory usage and PCI-E bandwidth in
# some games, but may also increase GPU synchronizations. Setting it
# to -1 disables the feature.
# d3d11.maxDynamicImageBufferSize = -1
# Allocates dynamic resources with the given set of bind flags in
# cached system memory rather than uncached memory or host-visible
# VRAM, in order to allow fast readback from the CPU. This is only
# useful for buggy applications, and may reduce GPU-bound performance.
#
# Supported values: Any combination of the following:
# - v: Vertex buffers
# - i: Index buffers
# - c: Constant buffers
# - r: Shader resources
# - a: All dynamic resources
# d3d11.cachedDynamicResources = ""
# Force-enables the D3D11 context lock via the ID3D10Multithread
# interface. This may be useful to debug race conditions.
#
# Supported values: True, False
# d3d11.enableContextLock = False
# Exposes or hides support for driver command lists
#
# Some games use the feature flag to decide whether to use deferred
# contexts or not. We enable this by default, but in some situations
# this can lead to issues if games detect an AMD GPU where command
# lists are not natively supported on Windows.
#
# Supported values: True, False
# d3d11.exposeDriverCommandLists = True
# Reproducible Command Stream
#
# Ensure that for the same D3D commands the output VK commands
# don't change between runs. Useful for comparative benchmarking,
# can negatively affect performance and can break some games
# that don't use queries correctly.
#
# Supported values:
# - True/False
# d3d11.reproducibleCommandStream = False
# d3d9.reproducibleCommandStream = False
# Sets number of pipeline compiler threads.
#
# If the graphics pipeline library feature is enabled, the given
# number of threads will be used for shader compilation. Some of
# these threads will be reserved for high-priority work.
#
# Supported values:
# - 0 to automatically determine the number of threads to use
# - 0 to use all available CPU cores
# - any positive number to enforce the thread count
# dxvk.numCompilerThreads = 0
@ -174,16 +362,343 @@
# dxvk.useRawSsbo = Auto
# Toggles early discard.
# Changes memory chunk size.
#
# Can be used to override the maximum memory chunk size.
#
# Supported values:
# - 0 to use the defaults
# - any positive integer to limit the chunk size, in MiB
# dxvk.maxChunkSize = 0
# Controls graphics pipeline library behaviour
#
# Can be used to change VK_EXT_graphics_pipeline_library usage for
# debugging purpose. Doing so will likely result in increased stutter
# or degraded performance.
#
# Supported values:
# - Auto: Enable if supported, and compile optimized pipelines in the background
# - True: Enable if supported, but do not compile optimized pipelines
# - False: Always disable the feature
# dxvk.enableGraphicsPipelineLibrary = Auto
# Controls pipeline lifetime tracking
#
# If enabled, pipeline libraries will be freed aggressively in order
# save memory and address space. Has no effect if graphics pipeline
# libraries are not supported or disabled.
#
# Supported values:
# - Auto: Enable tracking for 32-bit applications only
# - True: Always enable tracking
# - False: Always disable tracking
# dxvk.trackPipelineLifetime = Auto
# Sets enabled HUD elements
#
# Uses subgroup operations to determine whether it is safe to
# discard fragments before the end of a fragment shader. This
# is enabled by default on all drivers except RADV and Nvidia.
# Enabling this may improve or degrade performance depending
# on the game and hardware, or cause other issues.
# Behaves like the DXVK_HUD environment variable if the
# environment variable is not set, otherwise it will be
# ignored. The syntax is identical.
# dxvk.hud =
# Reported shader model
#
# The shader model to state that we support in the device
# capabilities that the applicatation queries.
#
# Supported values:
# - Auto: Don't change the default
# - 1: Shader Model 1
# - 2: Shader Model 2
# - 3: Shader Model 3
# d3d9.shaderModel = 3
# DPI Awareness
#
# Decides whether we should call SetProcessDPIAware on device
# creation. Helps avoid upscaling blur in modern Windows on
# Hi-DPI screens/devices.
#
# Supported values:
# - True, False: Always enable / disable
# dxvk.useEarlyDiscard = Auto
# d3d9.dpiAware = True
# Strict Constant Copies
#
# Decides whether we should always copy defined constants to
# the UBO when relative addressing is used, or only when the
# relative addressing starts a defined constant.
#
# Supported values:
# - True, False: Always enable / disable
# d3d9.strictConstantCopies = False
# Strict Pow
#
# Decides whether we have an opSelect for handling pow(0,0) = 0
# otherwise it becomes undefined.
#
# Supported values:
# - True, False: Always enable / disable
# d3d9.strictPow = True
# Lenient Clear
#
# Decides whether or not we fastpath clear anyway if we are close enough to
# clearing a full render target.
#
# Supported values:
# - True, False: Always enable / disable
# d3d9.lenientClear = False
# Max available memory
#
# Changes the max initial value used in tracking and GetAvailableTextureMem
# Value in Megabytes
#
# Supported values:
# - Max Available Memory: Any int32_t
# - Memory Tracking Testing: True, False
# d3d9.maxAvailableMemory = 4096
# d3d9.memoryTrackTest = False
# Force enable/disable floating point quirk emulation
#
# Force toggle anything * 0 emulation
# Setting it to True will use a faster but less accurate approach that works for most games.
# Supported values:
# - True: Use a faster but less accurate approach. Good enough for most games
# - False: Disable float emulation completely
# - Strict: Use a slower but more correct approach. Necessary for some games
# - Auto: DXVK will pick automatically
# d3d9.floatEmulation = Auto
# Enable dialog box mode
#
# Changes the default state of dialog box mode.
# *Disables* exclusive fullscreen when enabled.
#
# Supported values:
# - True, False: Always enable / disable
# d3d9.enableDialogMode = False
# Overrides the application's MSAA level on the swapchain
#
# Supported values: -1 (application) and 0 to 16 (user override)
# d3d9.forceSwapchainMSAA = -1
# Long Mad
#
# Should we make our Mads a FFma or do it the long way with an FMul and an FAdd?
# This solves some rendering bugs in games that have z-pass shaders which
# don't match entirely to the regular vertex shader in this way.
#
# Supported values:
# - True/False
# d3d11.longMad = False
# d3d9.longMad = False
# Device Local Constant Buffers
#
# Enables using device local, host accessible memory for constant buffers in D3D9.
# This tends to actually be slower for some reason on AMD,
# and the exact same performance on NVIDIA.
#
# Supported values:
# - True/False
# d3d9.deviceLocalConstantBuffers = False
# Support DF formats
#
# Support the vendor extension DF floating point depth formats on AMD and Intel.
# Note that this config is ignored and disabled by default on Nvidia, or when
# spoofing a Nvidia GPU, as it does not support these formats natively.
#
# Supported values:
# - True/False
# d3d9.supportDFFormats = True
# Use D32f for D24
#
# Useful for reproducing AMD issues on other hw.
#
# Supported values:
# - True/False
# d3d9.useD32forD24 = False
# Support X4R4G4B4
#
# Support the X4R4G4B4 format.
# The Sims 2 is a very broken game.
#
# Supported values:
# - True/False
# d3d9.supportX4R4G4B4 = True
# Support D32
#
# Support the D32 format.
#
# Supported values:
# - True/False
# d3d9.supportD32 = True
# Disable A8 as a Render Target
#
# Disable support for A8 format render targets
# Once again, The Sims 2 is a very broken game.
#
# Supported values:
# - True/False
# d3d9.disableA8RT = False
# Support for VCache Query
#
# Support for the vcache query
# Not very important as a user config.
# Used internally.
#
# Supported values:
# - True/False
# Defaults to True if vendorId == 0x10de
# d3d9.supportVCache = True
# Force Sampler Type Spec Constants
#
# Useful if games use the wrong image and sampler
# type combo like Halo: CE or Spellforce.
# Can fix rendering in older, broken games in some instances.
#
# Supported values:
# - True/False
# d3d9.forceSamplerTypeSpecConstants = False
# Force Aspect Ratio
#
# Only exposes modes with a given aspect ratio.
# Useful for titles that break if they see ultra-wide.
#
# Supported values:
# - Any ratio, ie. "16:9", "4:3"
# d3d9.forceAspectRatio = ""
# Enumerate by Displays
#
# Whether we should enumerate D3D9 adapters by display (windows behaviour)
# or by physical adapter.
# May be useful in PRIME setups.
#
# Supported values:
# - True/False
# d3d9.enumerateByDisplays = True
# Cached Dynamic Buffers
#
# Allocates dynamic resources in D3DPOOL_DEFAULT in
# cached system memory rather than uncached memory or host-visible
# VRAM, in order to allow fast readback from the CPU. This is only
# useful for buggy applications, and may reduce GPU-bound performance.
#
# Supported values:
# - True/False
# d3d9.cachedDynamicBuffers = False
# Seamless Cubes
#
# Don't use non seamless cube maps even if they are supported.
# Non seamless cubes are correct d3d9 behavior, but can produce worse looking edges.
#
# Supported values:
# - True/False
# d3d9.seamlessCubes = False
# Debug Utils
#
# Enables debug utils as this is off by default, this enables user annotations like BeginEvent()/EndEvent().
# Alternatively could be enabled with DXVK_DEBUG=markers environment variable.
#
# Supported values:
# - True/False
# dxvk.enableDebugUtils = False
# Memory limit for locked D3D9 textures
#
# How much virtual memory will be used for textures (in MB).
# 0 to disable the limit.
# THIS DOES NOT IMPACT ACTUAL MEMORY CONSUMPTION OR TEXTURE QUALITY.
# DO NOT CHANGE THIS UNLESS YOU HAVE A VERY GOOD REASON.
# d3d9.textureMemory = 100
# Hide integrated graphics from applications
#
# Only has an effect when dedicated GPUs are present on the system. It is
# not recommended to use this option at all unless absolutely necessary for
# a game to work; prefer using DXVK_FILTER_DEVICE_NAME whenever possible.
#
# Supported values:
# - True/False
# dxvk.hideIntegratedGraphics = False
# Trigger DEVICELOST when losing focus
#
# D3D9 requires the application to call Device::Reset after
# it loses focus in fullscreen.
# Some games rely on observing a D3DERR_DEVICELOST or D3DERR_NOTRESET.
# Others don't handle it correctly.
#
# Supported values:
# - True/False
# d3d9.deviceLossOnFocusLoss = False
# Reject Device::Reset if any losable resource is still alive
#
# D3D9 rejects Device::Reset if there's still any alive resources of specific types.
# (State blocks, additional swapchains, D3DPOOL_DEFAULT resources)
# Some games leak resources leading to a hang.
#
# Supported values:
# - True/False
# d3d9.countLosableResources = True

@ -0,0 +1 @@
Subproject commit 9df86f2341616ef1888ae59919feaa6d4fad693d

View File

@ -0,0 +1,19 @@
install_subdir(
'directx',
install_dir: get_option('includedir') / 'dxvk',
strip_directory: true,
exclude_files: '.git'
)
install_subdir(
'windows',
install_dir: get_option('includedir') / 'dxvk',
strip_directory: true,
)
install_headers(
'wsi/native_wsi.h',
'wsi/native_sdl2.h',
'wsi/native_glfw.h',
subdir: 'dxvk/wsi',
)

View File

@ -0,0 +1,3 @@
#pragma once
// Don't care.

View File

@ -0,0 +1,3 @@
#pragma once
// Don't care.

View File

@ -0,0 +1,3 @@
#pragma once
// Don't care.

View File

@ -0,0 +1,3 @@
#pragma once
// Don't care.

View File

@ -0,0 +1,8 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#if !(defined(lint) || defined(RC_INVOKED))
#pragma pack(pop)
#endif

View File

@ -0,0 +1,8 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#if !(defined(lint) || defined(RC_INVOKED))
#pragma pack(push,4)
#endif

View File

@ -0,0 +1,3 @@
#pragma once
// Don't care.

View File

@ -0,0 +1,3 @@
#pragma once
// Don't care.

View File

@ -0,0 +1,52 @@
#pragma once
#include "windows_base.h"
typedef interface IUnknown IUnknown;
DEFINE_GUID(IID_IUnknown, 0x00000000,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46)
#ifdef __cplusplus
struct IUnknown {
public:
virtual HRESULT QueryInterface(REFIID riid, void** ppvObject) = 0;
template<class Q>
HRESULT STDMETHODCALLTYPE QueryInterface(Q **pp) {
return QueryInterface(__uuidof(Q), (void **)pp);
}
virtual ULONG AddRef() = 0;
virtual ULONG Release() = 0;
};
#else
typedef struct IUnknownVtbl
{
BEGIN_INTERFACE
HRESULT (STDMETHODCALLTYPE *QueryInterface)(
IUnknown *This,
REFIID riid,
void **ppvObject
);
ULONG (STDMETHODCALLTYPE *AddRef)(IUnknown *This);
ULONG (STDMETHODCALLTYPE *Release)(IUnknown *This);
END_INTERFACE
} IUnknownVtbl;
interface IUnknown
{
CONST_VTBL struct IUnknownVtbl *lpVtbl;
};
#define IUnknown_AddRef(This) ((This)->lpVtbl->AddRef(This))
#define IUnknown_Release(This) ((This)->lpVtbl->Release(This))
#endif // __cplusplus
DECLARE_UUIDOF_HELPER(IUnknown, 0x00000000,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46)
#define IID_PPV_ARGS(ppType) __uuidof(decltype(**(ppType))), [](auto** pp) { (void)static_cast<IUnknown*>(*pp); return reinterpret_cast<void**>(pp); }(ppType)

View File

@ -0,0 +1,4 @@
#pragma once
#include "windows_base.h"
#include "unknwn.h"

View File

@ -0,0 +1,398 @@
#pragma once
#ifdef __cplusplus
#include <cstdint>
#include <cstring>
#else
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#endif // __cplusplus
// GCC complains about the COM interfaces
// not having virtual destructors
// and class conversion for C...DESC helper types
#if defined(__GNUC__) && defined(__cplusplus)
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#pragma GCC diagnostic ignored "-Wclass-conversion"
#endif // __GNUC__ && __cplusplus
typedef int32_t INT;
typedef uint32_t UINT;
typedef int32_t LONG;
typedef uint32_t ULONG;
typedef int32_t *LPLONG;
typedef int32_t HRESULT;
typedef wchar_t WCHAR;
typedef WCHAR *NWPSTR, *LPWSTR, *PWSTR;
typedef unsigned char UCHAR, *PUCHAR;
typedef char CHAR;
typedef const CHAR *LPCSTR, *PCSTR;
typedef INT BOOL;
typedef BOOL WINBOOL;
typedef uint16_t UINT16;
typedef uint32_t UINT32;
typedef uint64_t UINT64;
typedef void VOID;
typedef void* PVOID;
typedef void* LPVOID;
typedef const void* LPCVOID;
typedef size_t SIZE_T;
typedef int8_t INT8;
typedef uint8_t UINT8;
typedef uint8_t BYTE;
typedef int16_t SHORT;
typedef uint16_t USHORT;
typedef int64_t LONGLONG;
typedef int64_t INT64;
typedef uint64_t ULONGLONG;
typedef uint64_t UINT64;
typedef intptr_t LONG_PTR;
typedef uintptr_t ULONG_PTR;
typedef float FLOAT;
#ifndef GUID_DEFINED
#define GUID_DEFINED
typedef struct GUID {
uint32_t Data1;
uint16_t Data2;
uint16_t Data3;
uint8_t Data4[8];
} GUID;
#endif // GUID_DEFINED
typedef GUID UUID;
typedef GUID IID;
#ifdef __cplusplus
#define REFIID const IID&
#define REFGUID const GUID&
#define REFCLSID const GUID&
#else
#define REFIID const IID*
#define REFGUID const GUID*
#define REFCLSID const GUID* const
#endif // __cplusplus
#ifdef __cplusplus
template <typename T>
constexpr GUID __uuidof_helper();
#define __uuidof(T) __uuidof_helper<T>()
#define __uuidof_var(T) __uuidof_helper<decltype(T)>()
inline bool operator==(const GUID& a, const GUID& b) { return std::memcmp(&a, &b, sizeof(GUID)) == 0; }
inline bool operator!=(const GUID& a, const GUID& b) { return std::memcmp(&a, &b, sizeof(GUID)) != 0; }
#endif // __cplusplus
typedef uint32_t DWORD;
typedef uint16_t WORD;
typedef DWORD *LPDWORD;
typedef void* HANDLE;
typedef HANDLE HMONITOR;
typedef HANDLE HDC;
typedef HANDLE HMODULE;
typedef HANDLE HINSTANCE;
typedef HANDLE HWND;
typedef HANDLE HKEY;
typedef HANDLE *LPHANDLE;
typedef DWORD COLORREF;
#if INTPTR_MAX == INT64_MAX
typedef int64_t INT_PTR;
typedef uint64_t UINT_PTR;
#else
typedef int32_t INT_PTR;
typedef uint32_t UINT_PTR;
#endif
typedef INT_PTR* PINT_PTR;
typedef UINT_PTR* PUINT_PTR;
#ifdef STRICT
#define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
#else /*STRICT*/
#define DECLARE_HANDLE(a) typedef HANDLE a
#endif /*STRICT*/
typedef char* LPSTR;
typedef wchar_t* LPWSTR;
typedef const char* LPCSTR;
typedef const wchar_t* LPCWSTR;
typedef struct LUID {
DWORD LowPart;
LONG HighPart;
} LUID;
typedef struct POINT {
LONG x;
LONG y;
} POINT;
typedef POINT* LPPOINT;
typedef struct RECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT,*PRECT,*NPRECT,*LPRECT;
typedef struct SIZE {
LONG cx;
LONG cy;
} SIZE,*PSIZE,*LPSIZE;
typedef union {
struct {
DWORD LowPart;
LONG HighPart;
};
struct {
DWORD LowPart;
LONG HighPart;
} u;
LONGLONG QuadPart;
} LARGE_INTEGER;
typedef struct MEMORYSTATUS {
DWORD dwLength;
SIZE_T dwTotalPhys;
} MEMORYSTATUS;
typedef struct SECURITY_ATTRIBUTES {
DWORD nLength;
void* lpSecurityDescriptor;
BOOL bInheritHandle;
} SECURITY_ATTRIBUTES;
typedef struct PALETTEENTRY {
BYTE peRed;
BYTE peGreen;
BYTE peBlue;
BYTE peFlags;
} PALETTEENTRY, *PPALETTEENTRY, *LPPALETTEENTRY;
typedef struct RGNDATAHEADER {
DWORD dwSize;
DWORD iType;
DWORD nCount;
DWORD nRgnSize;
RECT rcBound;
} RGNDATAHEADER;
typedef struct RGNDATA {
RGNDATAHEADER rdh;
char Buffer[1];
} RGNDATA,*PRGNDATA,*NPRGNDATA,*LPRGNDATA;
// Ignore these.
#define STDMETHODCALLTYPE
#define __stdcall
#define CONST const
#define CONST_VTBL const
#define TRUE 1
#define FALSE 0
#define WAIT_TIMEOUT 0x00000102
#define WAIT_FAILED 0xffffffff
#define WAIT_OBJECT_0 0
#define WAIT_ABANDONED 0x00000080
#define interface struct
#define MIDL_INTERFACE(x) struct
#ifdef __cplusplus
#define DEFINE_GUID(iid, a, b, c, d, e, f, g, h, i, j, k) \
constexpr GUID iid = {a,b,c,{d,e,f,g,h,i,j,k}};
#define DECLARE_UUIDOF_HELPER(type, a, b, c, d, e, f, g, h, i, j, k) \
extern "C++" { template <> constexpr GUID __uuidof_helper<type>() { return GUID{a,b,c,{d,e,f,g,h,i,j,k}}; } } \
extern "C++" { template <> constexpr GUID __uuidof_helper<type*>() { return __uuidof_helper<type>(); } } \
extern "C++" { template <> constexpr GUID __uuidof_helper<const type*>() { return __uuidof_helper<type>(); } } \
extern "C++" { template <> constexpr GUID __uuidof_helper<type&>() { return __uuidof_helper<type>(); } } \
extern "C++" { template <> constexpr GUID __uuidof_helper<const type&>() { return __uuidof_helper<type>(); } }
#else
#define DEFINE_GUID(iid, a, b, c, d, e, f, g, h, i, j, k) \
static const GUID iid = {a,b,c,{d,e,f,g,h,i,j,k}};
#define DECLARE_UUIDOF_HELPER(type, a, b, c, d, e, f, g, h, i, j, k)
#endif // __cplusplus
#define __CRT_UUID_DECL(type, a, b, c, d, e, f, g, h, i, j, k) DECLARE_UUIDOF_HELPER(type, a, b, c, d, e, f, g, h, i, j, k)
#define S_OK 0
#define S_FALSE 1
#define E_INVALIDARG ((HRESULT)0x80070057)
#define E_FAIL ((HRESULT)0x80004005)
#define E_NOINTERFACE ((HRESULT)0x80004002)
#define E_NOTIMPL ((HRESULT)0x80004001)
#define E_OUTOFMEMORY ((HRESULT)0x8007000E)
#define E_POINTER ((HRESULT)0x80004003)
#define DXGI_STATUS_OCCLUDED ((HRESULT)0x087a0001)
#define DXGI_STATUS_CLIPPED ((HRESULT)0x087a0002)
#define DXGI_STATUS_NO_REDIRECTION ((HRESULT)0x087a0004)
#define DXGI_STATUS_NO_DESKTOP_ACCESS ((HRESULT)0x087a0005)
#define DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE ((HRESULT)0x087a0006)
#define DXGI_STATUS_MODE_CHANGED ((HRESULT)0x087a0007)
#define DXGI_STATUS_MODE_CHANGE_IN_PROGRESS ((HRESULT)0x087a0008)
#define DXGI_STATUS_UNOCCLUDED ((HRESULT)0x087a0009)
#define DXGI_STATUS_DDA_WAS_STILL_DRAWING ((HRESULT)0x087a000a)
#define DXGI_STATUS_PRESENT_REQUIRED ((HRESULT)0x087a002f)
#define DXGI_ERROR_INVALID_CALL ((HRESULT)0x887A0001)
#define DXGI_ERROR_NOT_FOUND ((HRESULT)0x887A0002)
#define DXGI_ERROR_MORE_DATA ((HRESULT)0x887A0003)
#define DXGI_ERROR_UNSUPPORTED ((HRESULT)0x887A0004)
#define DXGI_ERROR_DEVICE_REMOVED ((HRESULT)0x887A0005)
#define DXGI_ERROR_DEVICE_HUNG ((HRESULT)0x887A0006)
#define DXGI_ERROR_DEVICE_RESET ((HRESULT)0x887A0007)
#define DXGI_ERROR_WAS_STILL_DRAWING ((HRESULT)0x887A000A)
#define DXGI_ERROR_FRAME_STATISTICS_DISJOINT ((HRESULT)0x887A000B)
#define DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE ((HRESULT)0x887A000C)
#define DXGI_ERROR_DRIVER_INTERNAL_ERROR ((HRESULT)0x887A0020)
#define DXGI_ERROR_NONEXCLUSIVE ((HRESULT)0x887A0021)
#define DXGI_ERROR_NOT_CURRENTLY_AVAILABLE ((HRESULT)0x887A0022)
#define DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED ((HRESULT)0x887A0023)
#define DXGI_ERROR_REMOTE_OUTOFMEMORY ((HRESULT)0x887A0024)
#define DXGI_ERROR_ACCESS_LOST ((HRESULT)0x887A0026)
#define DXGI_ERROR_WAIT_TIMEOUT ((HRESULT)0x887A0027)
#define DXGI_ERROR_SESSION_DISCONNECTED ((HRESULT)0x887A0028)
#define DXGI_ERROR_RESTRICT_TO_OUTPUT_STALE ((HRESULT)0x887A0029)
#define DXGI_ERROR_CANNOT_PROTECT_CONTENT ((HRESULT)0x887A002A)
#define DXGI_ERROR_ACCESS_DENIED ((HRESULT)0x887A002B)
#define DXGI_ERROR_NAME_ALREADY_EXISTS ((HRESULT)0x887A002C)
#define DXGI_ERROR_SDK_COMPONENT_MISSING ((HRESULT)0x887A002D)
#define WINAPI
#define WINUSERAPI
#define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))
#define MAKE_HRESULT(sev,fac,code) \
((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
#ifdef __cplusplus
#define STDMETHOD(name) virtual HRESULT name
#define STDMETHOD_(type, name) virtual type name
#else
#define STDMETHOD(name) HRESULT (STDMETHODCALLTYPE *name)
#define STDMETHOD_(type, name) type (STDMETHODCALLTYPE *name)
#endif // __cplusplus
#define THIS_
#define THIS
#define __C89_NAMELESSSTRUCTNAME
#define __C89_NAMELESSUNIONNAME
#define __C89_NAMELESSUNIONNAME1
#define __C89_NAMELESSUNIONNAME2
#define __C89_NAMELESSUNIONNAME3
#define __C89_NAMELESSUNIONNAME4
#define __C89_NAMELESSUNIONNAME5
#define __C89_NAMELESSUNIONNAME6
#define __C89_NAMELESSUNIONNAME7
#define __C89_NAMELESSUNIONNAME8
#define __C89_NAMELESS
#define DUMMYUNIONNAME
#define DUMMYSTRUCTNAME
#define DUMMYUNIONNAME1
#define DUMMYUNIONNAME2
#define DUMMYUNIONNAME3
#define DUMMYUNIONNAME4
#define DUMMYUNIONNAME5
#define DUMMYUNIONNAME6
#define DUMMYUNIONNAME7
#define DUMMYUNIONNAME8
#define DUMMYUNIONNAME9
#ifdef __cplusplus
#define DECLARE_INTERFACE(x) struct x
#define DECLARE_INTERFACE_(x, y) struct x : public y
#else
#ifdef CONST_VTABLE
#define DECLARE_INTERFACE(x) \
typedef interface x { \
const struct x##Vtbl *lpVtbl; \
} x; \
typedef const struct x##Vtbl x##Vtbl; \
const struct x##Vtbl
#else
#define DECLARE_INTERFACE(x) \
typedef interface x { \
struct x##Vtbl *lpVtbl; \
} x; \
typedef struct x##Vtbl x##Vtbl; \
struct x##Vtbl
#endif // CONST_VTABLE
#define DECLARE_INTERFACE_(x, y) DECLARE_INTERFACE(x)
#endif // __cplusplus
#define BEGIN_INTERFACE
#define END_INTERFACE
#ifdef __cplusplus
#define PURE = 0
#else
#define PURE
#endif // __cplusplus
#define DECLSPEC_SELECTANY
#define __MSABI_LONG(x) x
#define ENUM_CURRENT_SETTINGS ((DWORD)-1)
#define ENUM_REGISTRY_SETTINGS ((DWORD)-2)
#define INVALID_HANDLE_VALUE ((HANDLE)-1)
#define DUPLICATE_CLOSE_SOURCE ((DWORD)0x1)
#define DUPLICATE_SAME_ACCESS ((DWORD)0x2)
#define FAILED(hr) ((HRESULT)(hr) < 0)
#define SUCCEEDED(hr) ((HRESULT)(hr) >= 0)
#define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
#define ZeroMemory RtlZeroMemory
#ifndef DEFINE_ENUM_FLAG_OPERATORS
#ifdef __cplusplus
# define DEFINE_ENUM_FLAG_OPERATORS(type) \
extern "C++" \
{ \
inline type operator &(type x, type y) { return (type)((int)x & (int)y); } \
inline type operator &=(type &x, type y) { return (type &)((int &)x &= (int)y); } \
inline type operator ~(type x) { return (type)~(int)x; } \
inline type operator |(type x, type y) { return (type)((int)x | (int)y); } \
inline type operator |=(type &x, type y) { return (type &)((int &)x |= (int)y); } \
inline type operator ^(type x, type y) { return (type)((int)x ^ (int)y); } \
inline type operator ^=(type &x, type y) { return (type &)((int &)x ^= (int)y); } \
}
#else
# define DEFINE_ENUM_FLAG_OPERATORS(type)
#endif
#endif /* DEFINE_ENUM_FLAG_OPERATORS */

View File

@ -0,0 +1,25 @@
#include <windows.h>
#include <GLFW/glfw3.h>
namespace dxvk::wsi {
inline GLFWwindow* fromHwnd(HWND hWindow) {
return reinterpret_cast<GLFWwindow*>(hWindow);
}
inline HWND toHwnd(GLFWwindow* pWindow) {
return reinterpret_cast<HWND>(pWindow);
}
// Offset so null HMONITORs go to -1
inline int32_t fromHmonitor(HMONITOR hMonitor) {
return static_cast<int32_t>(reinterpret_cast<intptr_t>(hMonitor)) - 1;
}
// Offset so -1 display id goes to 0 == NULL
inline HMONITOR toHmonitor(int32_t displayId) {
return reinterpret_cast<HMONITOR>(static_cast<intptr_t>(displayId + 1));
}
}

View File

@ -0,0 +1,25 @@
#include <windows.h>
#include <SDL.h>
namespace dxvk::wsi {
inline SDL_Window* fromHwnd(HWND hWindow) {
return reinterpret_cast<SDL_Window*>(hWindow);
}
inline HWND toHwnd(SDL_Window* pWindow) {
return reinterpret_cast<HWND>(pWindow);
}
// Offset so null HMONITORs go to -1
inline int32_t fromHmonitor(HMONITOR hMonitor) {
return static_cast<int32_t>(reinterpret_cast<intptr_t>(hMonitor)) - 1;
}
// Offset so -1 display id goes to 0 == NULL
inline HMONITOR toHmonitor(int32_t displayId) {
return reinterpret_cast<HMONITOR>(static_cast<intptr_t>(displayId + 1));
}
}

View File

@ -0,0 +1,11 @@
#pragma once
#ifdef DXVK_WSI_WIN32
#error You shouldnt be using this code path.
#elif DXVK_WSI_SDL2
#include "wsi/native_sdl2.h"
#elif DXVK_WSI_GLFW
#include "wsi/native_glfw.h"
#else
#error Unknown wsi!
#endif

1
include/spirv Submodule

@ -0,0 +1 @@
Subproject commit 8b246ff75c6615ba4532fe4fde20f1be090c3764

View File

@ -1,131 +0,0 @@
/*
** Copyright (c) 2014-2016 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and/or associated documentation files (the "Materials"),
** to deal in the Materials without restriction, including without limitation
** the rights to use, copy, modify, merge, publish, distribute, sublicense,
** and/or sell copies of the Materials, and to permit persons to whom the
** Materials are furnished to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in
** all copies or substantial portions of the Materials.
**
** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
** IN THE MATERIALS.
*/
#ifndef GLSLstd450_H
#define GLSLstd450_H
static const int GLSLstd450Version = 100;
static const int GLSLstd450Revision = 3;
enum GLSLstd450 {
GLSLstd450Bad = 0, // Don't use
GLSLstd450Round = 1,
GLSLstd450RoundEven = 2,
GLSLstd450Trunc = 3,
GLSLstd450FAbs = 4,
GLSLstd450SAbs = 5,
GLSLstd450FSign = 6,
GLSLstd450SSign = 7,
GLSLstd450Floor = 8,
GLSLstd450Ceil = 9,
GLSLstd450Fract = 10,
GLSLstd450Radians = 11,
GLSLstd450Degrees = 12,
GLSLstd450Sin = 13,
GLSLstd450Cos = 14,
GLSLstd450Tan = 15,
GLSLstd450Asin = 16,
GLSLstd450Acos = 17,
GLSLstd450Atan = 18,
GLSLstd450Sinh = 19,
GLSLstd450Cosh = 20,
GLSLstd450Tanh = 21,
GLSLstd450Asinh = 22,
GLSLstd450Acosh = 23,
GLSLstd450Atanh = 24,
GLSLstd450Atan2 = 25,
GLSLstd450Pow = 26,
GLSLstd450Exp = 27,
GLSLstd450Log = 28,
GLSLstd450Exp2 = 29,
GLSLstd450Log2 = 30,
GLSLstd450Sqrt = 31,
GLSLstd450InverseSqrt = 32,
GLSLstd450Determinant = 33,
GLSLstd450MatrixInverse = 34,
GLSLstd450Modf = 35, // second operand needs an OpVariable to write to
GLSLstd450ModfStruct = 36, // no OpVariable operand
GLSLstd450FMin = 37,
GLSLstd450UMin = 38,
GLSLstd450SMin = 39,
GLSLstd450FMax = 40,
GLSLstd450UMax = 41,
GLSLstd450SMax = 42,
GLSLstd450FClamp = 43,
GLSLstd450UClamp = 44,
GLSLstd450SClamp = 45,
GLSLstd450FMix = 46,
GLSLstd450IMix = 47, // Reserved
GLSLstd450Step = 48,
GLSLstd450SmoothStep = 49,
GLSLstd450Fma = 50,
GLSLstd450Frexp = 51, // second operand needs an OpVariable to write to
GLSLstd450FrexpStruct = 52, // no OpVariable operand
GLSLstd450Ldexp = 53,
GLSLstd450PackSnorm4x8 = 54,
GLSLstd450PackUnorm4x8 = 55,
GLSLstd450PackSnorm2x16 = 56,
GLSLstd450PackUnorm2x16 = 57,
GLSLstd450PackHalf2x16 = 58,
GLSLstd450PackDouble2x32 = 59,
GLSLstd450UnpackSnorm2x16 = 60,
GLSLstd450UnpackUnorm2x16 = 61,
GLSLstd450UnpackHalf2x16 = 62,
GLSLstd450UnpackSnorm4x8 = 63,
GLSLstd450UnpackUnorm4x8 = 64,
GLSLstd450UnpackDouble2x32 = 65,
GLSLstd450Length = 66,
GLSLstd450Distance = 67,
GLSLstd450Cross = 68,
GLSLstd450Normalize = 69,
GLSLstd450FaceForward = 70,
GLSLstd450Reflect = 71,
GLSLstd450Refract = 72,
GLSLstd450FindILsb = 73,
GLSLstd450FindSMsb = 74,
GLSLstd450FindUMsb = 75,
GLSLstd450InterpolateAtCentroid = 76,
GLSLstd450InterpolateAtSample = 77,
GLSLstd450InterpolateAtOffset = 78,
GLSLstd450NMin = 79,
GLSLstd450NMax = 80,
GLSLstd450NClamp = 81,
GLSLstd450Count
};
#endif // #ifndef GLSLstd450_H

View File

@ -1,135 +0,0 @@
/*
** Copyright (c) 2014-2016 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and/or associated documentation files (the "Materials"),
** to deal in the Materials without restriction, including without limitation
** the rights to use, copy, modify, merge, publish, distribute, sublicense,
** and/or sell copies of the Materials, and to permit persons to whom the
** Materials are furnished to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in
** all copies or substantial portions of the Materials.
**
** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
** IN THE MATERIALS.
*/
#ifndef GLSLstd450_HPP
#define GLSLstd450_HPP
namespace spv {
static const int GLSLstd450Version = 100;
static const int GLSLstd450Revision = 3;
enum GLSLstd450 {
GLSLstd450Bad = 0, // Don't use
GLSLstd450Round = 1,
GLSLstd450RoundEven = 2,
GLSLstd450Trunc = 3,
GLSLstd450FAbs = 4,
GLSLstd450SAbs = 5,
GLSLstd450FSign = 6,
GLSLstd450SSign = 7,
GLSLstd450Floor = 8,
GLSLstd450Ceil = 9,
GLSLstd450Fract = 10,
GLSLstd450Radians = 11,
GLSLstd450Degrees = 12,
GLSLstd450Sin = 13,
GLSLstd450Cos = 14,
GLSLstd450Tan = 15,
GLSLstd450Asin = 16,
GLSLstd450Acos = 17,
GLSLstd450Atan = 18,
GLSLstd450Sinh = 19,
GLSLstd450Cosh = 20,
GLSLstd450Tanh = 21,
GLSLstd450Asinh = 22,
GLSLstd450Acosh = 23,
GLSLstd450Atanh = 24,
GLSLstd450Atan2 = 25,
GLSLstd450Pow = 26,
GLSLstd450Exp = 27,
GLSLstd450Log = 28,
GLSLstd450Exp2 = 29,
GLSLstd450Log2 = 30,
GLSLstd450Sqrt = 31,
GLSLstd450InverseSqrt = 32,
GLSLstd450Determinant = 33,
GLSLstd450MatrixInverse = 34,
GLSLstd450Modf = 35, // second operand needs an OpVariable to write to
GLSLstd450ModfStruct = 36, // no OpVariable operand
GLSLstd450FMin = 37,
GLSLstd450UMin = 38,
GLSLstd450SMin = 39,
GLSLstd450FMax = 40,
GLSLstd450UMax = 41,
GLSLstd450SMax = 42,
GLSLstd450FClamp = 43,
GLSLstd450UClamp = 44,
GLSLstd450SClamp = 45,
GLSLstd450FMix = 46,
GLSLstd450IMix = 47, // Reserved
GLSLstd450Step = 48,
GLSLstd450SmoothStep = 49,
GLSLstd450Fma = 50,
GLSLstd450Frexp = 51, // second operand needs an OpVariable to write to
GLSLstd450FrexpStruct = 52, // no OpVariable operand
GLSLstd450Ldexp = 53,
GLSLstd450PackSnorm4x8 = 54,
GLSLstd450PackUnorm4x8 = 55,
GLSLstd450PackSnorm2x16 = 56,
GLSLstd450PackUnorm2x16 = 57,
GLSLstd450PackHalf2x16 = 58,
GLSLstd450PackDouble2x32 = 59,
GLSLstd450UnpackSnorm2x16 = 60,
GLSLstd450UnpackUnorm2x16 = 61,
GLSLstd450UnpackHalf2x16 = 62,
GLSLstd450UnpackSnorm4x8 = 63,
GLSLstd450UnpackUnorm4x8 = 64,
GLSLstd450UnpackDouble2x32 = 65,
GLSLstd450Length = 66,
GLSLstd450Distance = 67,
GLSLstd450Cross = 68,
GLSLstd450Normalize = 69,
GLSLstd450FaceForward = 70,
GLSLstd450Reflect = 71,
GLSLstd450Refract = 72,
GLSLstd450FindILsb = 73,
GLSLstd450FindSMsb = 74,
GLSLstd450FindUMsb = 75,
GLSLstd450InterpolateAtCentroid = 76,
GLSLstd450InterpolateAtSample = 77,
GLSLstd450InterpolateAtOffset = 78,
GLSLstd450NMin = 79,
GLSLstd450NMax = 80,
GLSLstd450NClamp = 81,
GLSLstd450Count
};
}
#endif // #ifndef GLSLstd450_HPP

File diff suppressed because it is too large Load Diff

1
include/vulkan Submodule

@ -0,0 +1 @@
Subproject commit 46dc0f6e514f5730784bb2cac2a7c731636839e8

View File

@ -1,92 +0,0 @@
//
// File: vk_platform.h
//
/*
** Copyright (c) 2014-2017 The Khronos Group Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
#ifndef VK_PLATFORM_H_
#define VK_PLATFORM_H_
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
/*
***************************************************************************************************
* Platform-specific directives and type declarations
***************************************************************************************************
*/
/* Platform-specific calling convention macros.
*
* Platforms should define these so that Vulkan clients call Vulkan commands
* with the same calling conventions that the Vulkan implementation expects.
*
* VKAPI_ATTR - Placed before the return type in function declarations.
* Useful for C++11 and GCC/Clang-style function attribute syntax.
* VKAPI_CALL - Placed after the return type in function declarations.
* Useful for MSVC-style calling convention syntax.
* VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
*
* Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
* Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
*/
#if defined(_WIN32)
// On Windows, Vulkan commands use the stdcall convention
#define VKAPI_ATTR
#define VKAPI_CALL __stdcall
#define VKAPI_PTR VKAPI_CALL
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
#error "Vulkan isn't supported for the 'armeabi' NDK ABI"
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
// On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
// calling convention, i.e. float parameters are passed in registers. This
// is true even if the rest of the application passes floats on the stack,
// as it does by default when compiling for the armeabi-v7a NDK ABI.
#define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
#define VKAPI_CALL
#define VKAPI_PTR VKAPI_ATTR
#else
// On other platforms, use the default calling convention
#define VKAPI_ATTR
#define VKAPI_CALL
#define VKAPI_PTR
#endif
#include <stddef.h>
#if !defined(VK_NO_STDINT_H)
#if defined(_MSC_VER) && (_MSC_VER < 1600)
typedef signed __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
#endif // !defined(VK_NO_STDINT_H)
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif

View File

@ -1,79 +0,0 @@
#ifndef VULKAN_H_
#define VULKAN_H_ 1
/*
** Copyright (c) 2015-2018 The Khronos Group Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
#include "vk_platform.h"
#include "vulkan_core.h"
#ifdef VK_USE_PLATFORM_ANDROID_KHR
#include "vulkan_android.h"
#endif
#ifdef VK_USE_PLATFORM_IOS_MVK
#include "vulkan_ios.h"
#endif
#ifdef VK_USE_PLATFORM_MACOS_MVK
#include "vulkan_macos.h"
#endif
#ifdef VK_USE_PLATFORM_MIR_KHR
#include <mir_toolkit/client_types.h>
#include "vulkan_mir.h"
#endif
#ifdef VK_USE_PLATFORM_VI_NN
#include "vulkan_vi.h"
#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
#include <wayland-client.h>
#include "vulkan_wayland.h"
#endif
#ifdef VK_USE_PLATFORM_WIN32_KHR
#include <windows.h>
#include "vulkan_win32.h"
#endif
#ifdef VK_USE_PLATFORM_XCB_KHR
#include <xcb/xcb.h>
#include "vulkan_xcb.h"
#endif
#ifdef VK_USE_PLATFORM_XLIB_KHR
#include <X11/Xlib.h>
#include "vulkan_xlib.h"
#endif
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#include "vulkan_xlib_xrandr.h"
#endif
#endif // VULKAN_H_

File diff suppressed because it is too large Load Diff

View File

@ -1,276 +0,0 @@
#ifndef VULKAN_WIN32_H_
#define VULKAN_WIN32_H_ 1
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright (c) 2015-2018 The Khronos Group Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*
** This header is generated from the Khronos Vulkan XML API Registry.
**
*/
#define VK_KHR_win32_surface 1
#define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6
#define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface"
typedef VkFlags VkWin32SurfaceCreateFlagsKHR;
typedef struct VkWin32SurfaceCreateInfoKHR {
VkStructureType sType;
const void* pNext;
VkWin32SurfaceCreateFlagsKHR flags;
HINSTANCE hinstance;
HWND hwnd;
} VkWin32SurfaceCreateInfoKHR;
typedef VkResult (VKAPI_PTR *PFN_vkCreateWin32SurfaceKHR)(VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex);
#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(
VkInstance instance,
const VkWin32SurfaceCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface);
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(
VkPhysicalDevice physicalDevice,
uint32_t queueFamilyIndex);
#endif
#define VK_KHR_external_memory_win32 1
#define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
#define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32"
typedef struct VkImportMemoryWin32HandleInfoKHR {
VkStructureType sType;
const void* pNext;
VkExternalMemoryHandleTypeFlagBits handleType;
HANDLE handle;
LPCWSTR name;
} VkImportMemoryWin32HandleInfoKHR;
typedef struct VkExportMemoryWin32HandleInfoKHR {
VkStructureType sType;
const void* pNext;
const SECURITY_ATTRIBUTES* pAttributes;
DWORD dwAccess;
LPCWSTR name;
} VkExportMemoryWin32HandleInfoKHR;
typedef struct VkMemoryWin32HandlePropertiesKHR {
VkStructureType sType;
void* pNext;
uint32_t memoryTypeBits;
} VkMemoryWin32HandlePropertiesKHR;
typedef struct VkMemoryGetWin32HandleInfoKHR {
VkStructureType sType;
const void* pNext;
VkDeviceMemory memory;
VkExternalMemoryHandleTypeFlagBits handleType;
} VkMemoryGetWin32HandleInfoKHR;
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleKHR)(VkDevice device, const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandlePropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties);
#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleKHR(
VkDevice device,
const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo,
HANDLE* pHandle);
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR(
VkDevice device,
VkExternalMemoryHandleTypeFlagBits handleType,
HANDLE handle,
VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties);
#endif
#define VK_KHR_win32_keyed_mutex 1
#define VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION 1
#define VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHR_win32_keyed_mutex"
typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHR {
VkStructureType sType;
const void* pNext;
uint32_t acquireCount;
const VkDeviceMemory* pAcquireSyncs;
const uint64_t* pAcquireKeys;
const uint32_t* pAcquireTimeouts;
uint32_t releaseCount;
const VkDeviceMemory* pReleaseSyncs;
const uint64_t* pReleaseKeys;
} VkWin32KeyedMutexAcquireReleaseInfoKHR;
#define VK_KHR_external_semaphore_win32 1
#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1
#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHR_external_semaphore_win32"
typedef struct VkImportSemaphoreWin32HandleInfoKHR {
VkStructureType sType;
const void* pNext;
VkSemaphore semaphore;
VkSemaphoreImportFlags flags;
VkExternalSemaphoreHandleTypeFlagBits handleType;
HANDLE handle;
LPCWSTR name;
} VkImportSemaphoreWin32HandleInfoKHR;
typedef struct VkExportSemaphoreWin32HandleInfoKHR {
VkStructureType sType;
const void* pNext;
const SECURITY_ATTRIBUTES* pAttributes;
DWORD dwAccess;
LPCWSTR name;
} VkExportSemaphoreWin32HandleInfoKHR;
typedef struct VkD3D12FenceSubmitInfoKHR {
VkStructureType sType;
const void* pNext;
uint32_t waitSemaphoreValuesCount;
const uint64_t* pWaitSemaphoreValues;
uint32_t signalSemaphoreValuesCount;
const uint64_t* pSignalSemaphoreValues;
} VkD3D12FenceSubmitInfoKHR;
typedef struct VkSemaphoreGetWin32HandleInfoKHR {
VkStructureType sType;
const void* pNext;
VkSemaphore semaphore;
VkExternalSemaphoreHandleTypeFlagBits handleType;
} VkSemaphoreGetWin32HandleInfoKHR;
typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreWin32HandleKHR)(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo);
typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreWin32HandleKHR)(VkDevice device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreWin32HandleKHR(
VkDevice device,
const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo);
VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHR(
VkDevice device,
const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo,
HANDLE* pHandle);
#endif
#define VK_KHR_external_fence_win32 1
#define VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION 1
#define VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME "VK_KHR_external_fence_win32"
typedef struct VkImportFenceWin32HandleInfoKHR {
VkStructureType sType;
const void* pNext;
VkFence fence;
VkFenceImportFlags flags;
VkExternalFenceHandleTypeFlagBits handleType;
HANDLE handle;
LPCWSTR name;
} VkImportFenceWin32HandleInfoKHR;
typedef struct VkExportFenceWin32HandleInfoKHR {
VkStructureType sType;
const void* pNext;
const SECURITY_ATTRIBUTES* pAttributes;
DWORD dwAccess;
LPCWSTR name;
} VkExportFenceWin32HandleInfoKHR;
typedef struct VkFenceGetWin32HandleInfoKHR {
VkStructureType sType;
const void* pNext;
VkFence fence;
VkExternalFenceHandleTypeFlagBits handleType;
} VkFenceGetWin32HandleInfoKHR;
typedef VkResult (VKAPI_PTR *PFN_vkImportFenceWin32HandleKHR)(VkDevice device, const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo);
typedef VkResult (VKAPI_PTR *PFN_vkGetFenceWin32HandleKHR)(VkDevice device, const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceWin32HandleKHR(
VkDevice device,
const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo);
VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceWin32HandleKHR(
VkDevice device,
const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo,
HANDLE* pHandle);
#endif
#define VK_NV_external_memory_win32 1
#define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
#define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32"
typedef struct VkImportMemoryWin32HandleInfoNV {
VkStructureType sType;
const void* pNext;
VkExternalMemoryHandleTypeFlagsNV handleType;
HANDLE handle;
} VkImportMemoryWin32HandleInfoNV;
typedef struct VkExportMemoryWin32HandleInfoNV {
VkStructureType sType;
const void* pNext;
const SECURITY_ATTRIBUTES* pAttributes;
DWORD dwAccess;
} VkExportMemoryWin32HandleInfoNV;
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleNV)(VkDevice device, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE* pHandle);
#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV(
VkDevice device,
VkDeviceMemory memory,
VkExternalMemoryHandleTypeFlagsNV handleType,
HANDLE* pHandle);
#endif
#define VK_NV_win32_keyed_mutex 1
#define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 1
#define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex"
typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV {
VkStructureType sType;
const void* pNext;
uint32_t acquireCount;
const VkDeviceMemory* pAcquireSyncs;
const uint64_t* pAcquireKeys;
const uint32_t* pAcquireTimeoutMilliseconds;
uint32_t releaseCount;
const VkDeviceMemory* pReleaseSyncs;
const uint64_t* pReleaseKeys;
} VkWin32KeyedMutexAcquireReleaseInfoNV;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,19 +0,0 @@
Please describe your issue as accurately as possible. If you run into a problem with a binary release, make sure to test with latest `master` as well.
**Important:** When reporting an issue with a specific game or application, such as crashes or rendering issues, please include log files and a D3D11 Apitrace (see https://github.com/apitrace/apitrace) so that the issue can be reproduced. In order to create a trace, run `wine apitrace.exe trace -a dxgi YOURGAME.exe`. DO NOT use DXVK together with apitrace!
### Software information
Name of the game, settings used etc.
### System information
- GPU:
- Driver:
- Wine version:
- DXVK version:
### Apitrace file(s)
- Put a link here
### Log files
- d3d11.log:
- dxgi.log:

Binary file not shown.

View File

@ -1,17 +0,0 @@
; File generated automatically from d3dcompiler_43.spec; do not edit!
LIBRARY d3dcompiler_43.dll
EXPORTS
D3DAssemble @1
D3DCompile @3
D3DCreateBlob @5
D3DDisassemble @8
D3DGetBlobPart @9
D3DGetDebugInfo @10
D3DGetInputAndOutputSignatureBlob @11
D3DGetInputSignatureBlob @12
D3DGetOutputSignatureBlob @13
D3DPreprocess @14
D3DReflect @15
D3DStripShader @17

Binary file not shown.

Binary file not shown.

View File

@ -1,17 +0,0 @@
; File generated automatically from d3dcompiler_43.spec; do not edit!
LIBRARY d3dcompiler_43.dll
EXPORTS
D3DAssemble@32 @1
D3DCompile@44 @3
D3DCreateBlob@8 @5
D3DDisassemble@20 @8
D3DGetBlobPart@20 @9
D3DGetDebugInfo@12 @10
D3DGetInputAndOutputSignatureBlob@12 @11
D3DGetInputSignatureBlob@12 @12
D3DGetOutputSignatureBlob@12 @13
D3DPreprocess@28 @14
D3DReflect@16 @15
D3DStripShader@16 @17

Binary file not shown.

View File

@ -1,103 +1,194 @@
project('dxvk', ['c', 'cpp'], version : 'v1.2.2', meson_version : '>= 0.43')
project('dxvk', ['c', 'cpp'], version : 'v2.3.1', meson_version : '>= 0.58', default_options : [ 'cpp_std=c++17', 'warning_level=2' ])
pkg = import('pkgconfig')
cpu_family = target_machine.cpu_family()
platform = target_machine.system()
fs = import('fs')
add_project_arguments('-DNOMINMAX', language : 'cpp')
cpp = meson.get_compiler('cpp')
cc = meson.get_compiler('c')
dxvk_is_msvc = cpp.get_argument_syntax() == 'msvc'
dxvk_compiler = meson.get_compiler('cpp')
if dxvk_compiler.get_id() == 'msvc'
dxvk_cpp_std='c++latest'
dxvk_msvc=true
else
dxvk_cpp_std='c++1z'
dxvk_msvc=false
compiler_args = [
'-msse',
'-msse2',
'-msse3',
'-mfpmath=sse',
'-Wimplicit-fallthrough',
# gcc
'-Wno-missing-field-initializers',
'-Wno-unused-parameter',
'-Wno-cast-function-type', # Needed for GetProcAddress.
# clang
'-Wno-unused-private-field',
'-Wno-microsoft-exception-spec',
'-Wno-extern-c-compat',
'-Wno-unused-const-variable',
'-Wno-missing-braces',
]
link_args = []
if get_option('build_id')
link_args += [
'-Wl,--build-id',
]
endif
if dxvk_compiler.get_id() == 'msvc'
add_project_arguments('/std:' + dxvk_cpp_std, language : 'cpp')
dxvk_include_dirs = ['./include']
if fs.is_dir('./include/vulkan/include')
dxvk_include_dirs += ['./include/vulkan/include']
elif not cpp.check_header('vulkan/vulkan.h')
error('Missing Vulkan-Headers')
endif
if fs.is_dir('./include/spirv/include')
dxvk_include_dirs += ['./include/spirv/include']
elif not cpp.check_header('spirv/unified1/spirv.hpp')
error('Missing SPIRV-Headers')
endif
dxvk_include_path = include_directories('./include')
dep_displayinfo = dependency(
'libdisplay-info',
version: ['>= 0.0.0', '< 0.2.0'],
fallback: ['libdisplay-info', 'di_dep'],
default_options: ['default_library=static'],
)
if (cpu_family == 'x86_64')
dxvk_library_path = meson.source_root() + '/lib'
else
dxvk_library_path = meson.source_root() + '/lib32'
endif
if platform == 'windows'
dxvk_so_version = {'name_prefix': ''}
code = '''#ifndef __WINE__
#error 1
#endif'''
compiler_args += [
'-DNOMINMAX',
'-D_WIN32_WINNT=0xa00',
]
dxvk_winelib = dxvk_compiler.compiles(code, name: 'winelib check')
dxvk_extradep = [ ]
if not dxvk_is_msvc
link_args += [
'-static',
'-static-libgcc',
'-static-libstdc++',
# We need to set the section alignment for debug symbols to
# work properly as well as avoiding a memcpy from the Wine loader.
'-Wl,--file-alignment=4096',
]
if dxvk_winelib
wrc = find_program('wrc')
lib_vulkan = declare_dependency(link_args: [ '-lwinevulkan' ])
lib_d3d11 = declare_dependency(link_args: [ '-ld3d11' ])
lib_dxgi = declare_dependency(link_args: [ '-ldxgi' ])
lib_d3dcompiler_43 = declare_dependency(link_args: [ '-L'+dxvk_library_path, '-ld3dcompiler_43' ])
lib_d3dcompiler_47 = declare_dependency(link_args: [ '-ld3dcompiler' ])
dxvk_extradep += [ declare_dependency(link_args: [ '-ldl' ]) ]
exe_ext = '.exe.so'
dll_ext = '.dll'
res_ext = '.res'
def_spec_ext = '.spec'
else
if dxvk_compiler.get_id() == 'msvc'
wrc = find_program('rc')
# Wine's built-in back traces only work with dwarf4 symbols
if get_option('debug')
compiler_args += [
'-gdwarf-4',
]
endif
# Enable stdcall fixup on 32-bit
if cpu_family == 'x86'
link_args += [
'-Wl,--enable-stdcall-fixup',
'-Wl,--kill-at',
]
endif
else
wrc = cpu_family == 'x86_64' ? find_program('x86_64-w64-mingw32-windres') : find_program('i686-w64-mingw32-windres')
link_args += [
'/FILEALIGN:4096',
]
endif
lib_vulkan = dxvk_compiler.find_library('vulkan-1', dirs : dxvk_library_path)
lib_d3d11 = dxvk_compiler.find_library('d3d11')
lib_dxgi = dxvk_compiler.find_library('dxgi')
lib_d3dcompiler_43 = dxvk_compiler.find_library('d3dcompiler_43', dirs : dxvk_library_path)
lib_d3d9 = cpp.find_library('d3d9')
lib_d3d11 = cpp.find_library('d3d11')
lib_dxgi = cpp.find_library('dxgi')
if dxvk_compiler.get_id() == 'msvc'
lib_d3dcompiler_47 = dxvk_compiler.find_library('d3dcompiler')
if dxvk_is_msvc
lib_d3dcompiler_47 = cpp.find_library('d3dcompiler')
else
lib_d3dcompiler_47 = dxvk_compiler.find_library('d3dcompiler_47')
lib_d3dcompiler_47 = cpp.find_library('d3dcompiler_47')
endif
exe_ext = ''
dll_ext = ''
if dxvk_compiler.get_id() == 'msvc'
if dxvk_is_msvc
res_ext = '.res'
wrc = find_program('rc')
wrc_generator = generator(wrc,
output : [ '@BASENAME@' + res_ext ],
arguments : [ '/fo', '@OUTPUT@', '@INPUT@' ],
)
else
res_ext = '.o'
wrc = find_program('windres')
wrc_generator = generator(wrc,
output : [ '@BASENAME@' + res_ext ],
arguments : [ '-i', '@INPUT@', '-o', '@OUTPUT@' ],
)
endif
def_spec_ext = '.def'
endif
glsl_compiler = find_program('glslangValidator')
glsl_generator = generator(glsl_compiler,
output : [ '@BASENAME@.h' ],
arguments : [ '-V', '--vn', '@BASENAME@', '@INPUT@', '-o', '@OUTPUT@' ])
if dxvk_compiler.get_id() == 'msvc'
wrc_generator = generator(wrc,
output : [ '@BASENAME@' + res_ext ],
arguments : [ '/fo', '@OUTPUT@', '@INPUT@' ])
dxvk_name_prefix = ''
compiler_args += ['-DDXVK_WSI_WIN32']
else
wrc_generator = generator(wrc,
output : [ '@BASENAME@' + res_ext ],
arguments : [ '-i', '@INPUT@', '-o', '@OUTPUT@' ])
dxvk_abi_version = '0'
dxvk_version = meson.project_version().strip('v').split('.')
dxvk_so_version = {'version': dxvk_abi_version + '.' + dxvk_version[0] + dxvk_version[1] + dxvk_version[2]}
wrc = find_program('touch')
wrc_generator = generator(wrc, output : [ '@BASENAME@_ignored.h' ], arguments : [ '@OUTPUT@' ] )
dxvk_include_dirs += [
'./include/native',
'./include/native/windows',
'./include/native/directx'
]
lib_sdl2 = dependency('SDL2', required: false)
lib_glfw = dependency('glfw', required: false)
if lib_sdl2.found()
compiler_args += ['-DDXVK_WSI_SDL2']
endif
if lib_glfw.found()
compiler_args += ['-DDXVK_WSI_GLFW']
endif
if (not lib_sdl2.found() and not lib_glfw.found())
error('SDL2 or GLFW are required to build dxvk-native')
endif
dxvk_name_prefix = 'dxvk_'
dxvk_pkg_prefix = 'dxvk-'
link_args += [
'-static-libgcc',
'-static-libstdc++',
]
endif
dxvk_include_path = include_directories(dxvk_include_dirs)
add_project_arguments(cpp.get_supported_arguments(compiler_args), language: 'cpp')
add_project_arguments(cc.get_supported_arguments(compiler_args), language: 'c')
add_project_link_arguments(cpp.get_supported_link_arguments(link_args), language: 'cpp')
add_project_link_arguments(cc.get_supported_link_arguments(link_args), language: 'c')
exe_ext = ''
def_spec_ext = '.def'
glsl_compiler = find_program('glslang', 'glslangValidator')
glsl_args = [
'--quiet',
'--target-env', 'vulkan1.3',
'--vn', '@BASENAME@',
'--depfile', '@DEPFILE@',
'@INPUT@',
'-o', '@OUTPUT@',
]
glsl_generator = generator(
glsl_compiler,
output : [ '@BASENAME@.h' ],
depfile : '@BASENAME@.h.d',
arguments : glsl_args,
)
dxvk_version = vcs_tag(
command: ['git', 'describe', '--dirty=+'],
input: 'version.h.in',
output: 'version.h')
output: 'version.h',
)
if platform != 'windows'
subdir('include/native')
endif
subdir('src')
enable_tests = get_option('enable_tests')
if enable_tests
subdir('tests')
endif

View File

@ -1,4 +1,7 @@
option('enable_tests', type : 'boolean', value : false)
option('enable_dxgi', type : 'boolean', value : true, description: 'Build DXGI')
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')
option('build_id', type : 'boolean', value : false)
option('dxvk_native_wsi', type : 'string', value : 'sdl2', description: 'WSI system to use if building natively.')

89
package-native.sh Executable file
View File

@ -0,0 +1,89 @@
#!/usr/bin/env bash
set -e
shopt -s extglob
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: $0 version destdir [--no-package] [--dev-build]"
exit 1
fi
DXVK_VERSION="$1"
DXVK_SRC_DIR=$(readlink -f "$0")
DXVK_SRC_DIR=$(dirname "$DXVK_SRC_DIR")
DXVK_BUILD_DIR=$(realpath "$2")"/dxvk-native-$DXVK_VERSION"
DXVK_ARCHIVE_PATH=$(realpath "$2")"/dxvk-native-$DXVK_VERSION.tar.gz"
if [ -e "$DXVK_BUILD_DIR" ]; then
echo "Build directory $DXVK_BUILD_DIR already exists"
exit 1
fi
shift 2
opt_nopackage=0
opt_devbuild=0
opt_buildid=false
CC=${CC:="gcc"}
CXX=${CXX:="g++"}
while [ $# -gt 0 ]; do
case "$1" in
"--no-package")
opt_nopackage=1
;;
"--dev-build")
opt_nopackage=1
opt_devbuild=1
;;
"--build-id")
opt_buildid=true
;;
*)
echo "Unrecognized option: $1" >&2
exit 1
esac
shift
done
function build_arch {
cd "$DXVK_SRC_DIR"
opt_strip=
if [ $opt_devbuild -eq 0 ]; then
opt_strip=--strip
fi
CC="$CC -m$1" CXX="$CXX -m$1" meson setup \
--buildtype "release" \
--prefix "$DXVK_BUILD_DIR/usr" \
$opt_strip \
--bindir "$2" \
--libdir "$2" \
-Dbuild_id=$opt_buildid \
--force-fallback-for=libdisplay-info \
"$DXVK_BUILD_DIR/build.$1"
cd "$DXVK_BUILD_DIR/build.$1"
ninja install
if [ $opt_devbuild -eq 0 ]; then
rm -r "$DXVK_BUILD_DIR/build.$1"
fi
}
function package {
cd "$DXVK_BUILD_DIR"
tar -czf "$DXVK_ARCHIVE_PATH" "usr"
cd ".."
rm -R "dxvk-native-$DXVK_VERSION"
}
build_arch 64 lib
build_arch 32 lib32
if [ $opt_nopackage -eq 0 ]; then
package
fi

View File

@ -1,16 +1,17 @@
#!/bin/bash
#!/usr/bin/env bash
set -e
shopt -s extglob
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: $0 version destdir [--no-package] [--dev-build] [--winelib]"
echo "Usage: $0 version destdir [--no-package] [--dev-build]"
exit 1
fi
DXVK_VERSION="$1"
DXVK_SRC_DIR=`dirname $(readlink -f $0)`
DXVK_SRC_DIR=$(readlink -f "$0")
DXVK_SRC_DIR=$(dirname "$DXVK_SRC_DIR")
DXVK_BUILD_DIR=$(realpath "$2")"/dxvk-$DXVK_VERSION"
DXVK_ARCHIVE_PATH=$(realpath "$2")"/dxvk-$DXVK_VERSION.tar.gz"
@ -23,7 +24,7 @@ shift 2
opt_nopackage=0
opt_devbuild=0
opt_winelib=0
opt_buildid=false
crossfile="build-win"
@ -36,9 +37,8 @@ while [ $# -gt 0 ]; do
opt_nopackage=1
opt_devbuild=1
;;
"--winelib")
opt_winelib=1
crossfile="build-wine"
"--build-id")
opt_buildid=true
;;
*)
echo "Unrecognized option: $1" >&2
@ -53,32 +53,30 @@ function build_arch {
cd "$DXVK_SRC_DIR"
meson --cross-file "$DXVK_SRC_DIR/$crossfile$1.txt" \
--buildtype "release" \
--prefix "$DXVK_BUILD_DIR" \
--strip \
--bindir "x$1" \
--libdir "x$1" \
-Denable_tests=false \
opt_strip=
if [ $opt_devbuild -eq 0 ]; then
opt_strip=--strip
fi
meson setup --cross-file "$DXVK_SRC_DIR/$crossfile$1.txt" \
--buildtype "release" \
--prefix "$DXVK_BUILD_DIR" \
$opt_strip \
--bindir "x$1" \
--libdir "x$1" \
-Dbuild_id=$opt_buildid \
"$DXVK_BUILD_DIR/build.$1"
cd "$DXVK_BUILD_DIR/build.$1"
ninja install
if [ $opt_devbuild -eq 0 ]; then
if [ $opt_winelib -eq 0 ]; then
# get rid of some useless .a files
rm "$DXVK_BUILD_DIR/x$1/"*.!(dll)
fi
# get rid of some useless .a files
rm "$DXVK_BUILD_DIR/x$1/"*.!(dll)
rm -R "$DXVK_BUILD_DIR/build.$1"
fi
}
function build_script {
cp "$DXVK_SRC_DIR/setup_dxvk.sh" "$DXVK_BUILD_DIR/setup_dxvk.sh"
chmod +x "$DXVK_BUILD_DIR/setup_dxvk.sh"
}
function package {
cd "$DXVK_BUILD_DIR/.."
tar -czf "$DXVK_ARCHIVE_PATH" "dxvk-$DXVK_VERSION"
@ -87,7 +85,6 @@ function package {
build_arch 64
build_arch 32
build_script
if [ $opt_nopackage -eq 0 ]; then
package

View File

@ -1,178 +0,0 @@
#!/bin/bash
# figure out where we are
basedir=`dirname "$(readlink -f $0)"`
# figure out which action to perform
action="$1"
case "$action" in
install)
;;
uninstall)
;;
*)
echo "Unrecognized action: $action"
echo "Usage: $0 [install|uninstall] [--without-dxgi] [--symlink]"
exit 1
esac
# process arguments
shift
with_dxgi=1
file_cmd="cp"
while [ $# -gt 0 ]; do
case "$1" in
"--without-dxgi")
with_dxgi=0
;;
"--symlink")
file_cmd="ln -s"
;;
esac
shift
done
# check wine prefix before invoking wine, so that we
# don't accidentally create one if the user screws up
if [ -n "$WINEPREFIX" ] && ! [ -f "$WINEPREFIX/system.reg" ]; then
echo "$WINEPREFIX:"' Not a valid wine prefix.' >&2
exit 1
fi
# find wine executable
export WINEDEBUG=-all
if [ -z "$wine" ]; then
wine="wine"
fi
wine64="${wine}64"
wineboot="${wine}boot"
# resolve 32-bit and 64-bit system32 path
winever=`$wine --version | grep wine`
if [ -z "$winever" ]; then
echo "$wine:"' Not a wine executable. Check your $wine.' >&2
exit 1
fi
# ensure wine placeholder dlls are recreated
# if they are missing
$wineboot -u
win32_sys_path=$($wine winepath -u 'C:\windows\system32' 2> /dev/null)
win64_sys_path=$($wine64 winepath -u 'C:\windows\system32' 2> /dev/null)
if [ -z "$win32_sys_path" ] && [ -z "$win64_sys_path" ]; then
echo 'Failed to resolve C:\windows\system32.' >&2
exit 1
fi
# create native dll override
overrideDll() {
$wine reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1 /d native /f >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "Failed to add override for $1"
exit 1
fi
}
# remove dll override
restoreDll() {
$wine reg delete 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1 /f > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Failed to remove override for $1"
fi
}
# copy or link dxvk dll, back up original file
installFile() {
dstfile="${1}/${3}.dll"
srcfile="${basedir}/${2}/${3}.dll"
if [ -f "${srcfile}.so" ]; then
srcfile="${srcfile}.so"
fi
if ! [ -f "${srcfile}" ]; then
echo "${srcfile}: File not found. Skipping." >&2
return 1
fi
if [ -n "$1" ]; then
if [ -f "${dstfile}" ] || [ -h "${dstfile}" ]; then
if ! [ -f "${dstfile}.old" ]; then
mv "${dstfile}" "${dstfile}.old"
else
rm "${dstfile}"
fi
$file_cmd "${srcfile}" "${dstfile}"
else
echo "${dstfile}: File not found in wine prefix" >&2
return 1
fi
fi
return 0
}
# remove dxvk dll, restore original file
uninstallFile() {
dstfile="${1}/${3}.dll"
srcfile="${basedir}/${2}/${3}.dll"
if [ -f "${srcfile}.so" ]; then
srcfile="${srcfile}.so"
fi
if ! [ -f "${srcfile}" ]; then
echo "${srcfile}: File not found. Skipping." >&2
return 1
fi
if ! [ -f "${dstfile}" ] && ! [ -h "${dstfile}" ]; then
echo "${dstfile}: File not found. Skipping." >&2
return 1
fi
if [ -f "${dstfile}.old" ]; then
rm "${dstfile}"
mv "${dstfile}.old" "${dstfile}"
return 0
else
return 1
fi
}
install() {
installFile "$win32_sys_path" "x32" "$1"
inst32_ret="$?"
installFile "$win64_sys_path" "x64" "$1"
inst64_ret="$?"
if [ "$inst32_ret" -eq 0 ] || [ "$inst64_ret" -eq 0 ]; then
overrideDll "$1"
fi
}
uninstall() {
uninstallFile "$win32_sys_path" "x32" "$1"
uninst32_ret="$?"
uninstallFile "$win64_sys_path" "x64" "$1"
uninst64_ret="$?"
if [ "$uninst32_ret" -eq 0 ] || [ "$uninst64_ret" -eq 0 ]; then
restoreDll "$1"
fi
}
# skip dxgi during install if not explicitly
# enabled, but always try to uninstall it
if [ $with_dxgi -ne 0 ] || [ "$action" == "uninstall" ]; then
$action dxgi
fi
$action d3d10
$action d3d10_1
$action d3d10core
$action d3d11

View File

@ -1,27 +0,0 @@
LIBRARY D3D10.DLL
EXPORTS
D3D10CreateDevice
D3D10CreateDeviceAndSwapChain
D3D10GetVertexShaderProfile
D3D10GetGeometryShaderProfile
D3D10GetPixelShaderProfile
D3D10CreateBlob
D3D10GetInputSignatureBlob
D3D10GetOutputSignatureBlob
D3D10ReflectShader
D3D10CompileShader
D3D10CreateEffectFromMemory
D3D10CreateEffectPoolFromMemory
D3D10CompileEffectFromMemory
D3D10DisassembleEffect
D3D10DisassembleShader
D3D10PreprocessShader
D3D10CreateStateBlock
D3D10StateBlockMaskDifference
D3D10StateBlockMaskDisableAll
D3D10StateBlockMaskDisableCapture
D3D10StateBlockMaskEnableAll
D3D10StateBlockMaskEnableCapture
D3D10StateBlockMaskGetSetting
D3D10StateBlockMaskIntersect
D3D10StateBlockMaskUnion

View File

@ -1,31 +0,0 @@
@ stdcall D3D10CreateDevice(ptr long ptr long long ptr)
@ stdcall D3D10CreateDeviceAndSwapChain(ptr long ptr long long ptr ptr ptr)
@ stdcall D3D10GetVertexShaderProfile(ptr)
@ stdcall D3D10GetGeometryShaderProfile(ptr)
@ stdcall D3D10GetPixelShaderProfile(ptr)
@ stdcall D3D10CreateBlob(long ptr)
@ stdcall D3D10GetInputSignatureBlob(ptr long ptr)
@ stdcall D3D10GetOutputSignatureBlob(ptr long ptr)
@ stdcall D3D10ReflectShader(ptr long ptr)
@ stdcall D3D10CompileShader(ptr long str ptr ptr str str long ptr ptr)
@ stdcall D3D10CreateEffectFromMemory(ptr long long ptr ptr ptr)
@ stdcall D3D10CreateEffectPoolFromMemory(ptr long long ptr ptr)
@ stdcall D3D10CompileEffectFromMemory(ptr long ptr ptr ptr long long ptr ptr)
@ stub D3D10DisassembleEffect
@ stdcall D3D10DisassembleShader(ptr long long ptr ptr)
@ stub D3D10PreprocessShader
@ stdcall D3D10CreateStateBlock(ptr ptr ptr)
@ stdcall D3D10StateBlockMaskDifference(ptr ptr ptr)
@ stdcall D3D10StateBlockMaskDisableAll(ptr)
@ stdcall D3D10StateBlockMaskDisableCapture(ptr long long long)
@ stdcall D3D10StateBlockMaskEnableAll(ptr)
@ stdcall D3D10StateBlockMaskEnableCapture(ptr long long long)
@ stdcall D3D10StateBlockMaskGetSetting(ptr long long)
@ stdcall D3D10StateBlockMaskIntersect(ptr ptr ptr)
@ stdcall D3D10StateBlockMaskUnion(ptr ptr ptr)

View File

@ -1,27 +0,0 @@
LIBRARY D3D10_1.DLL
EXPORTS
D3D10CreateDevice1
D3D10CreateDeviceAndSwapChain1
D3D10GetVertexShaderProfile
D3D10GetGeometryShaderProfile
D3D10GetPixelShaderProfile
D3D10CreateBlob
D3D10GetInputSignatureBlob
D3D10GetOutputSignatureBlob
D3D10ReflectShader
D3D10CompileShader
D3D10CreateEffectFromMemory
D3D10CreateEffectPoolFromMemory
D3D10CompileEffectFromMemory
D3D10DisassembleEffect
D3D10DisassembleShader
D3D10PreprocessShader
D3D10CreateStateBlock
D3D10StateBlockMaskDifference
D3D10StateBlockMaskDisableAll
D3D10StateBlockMaskDisableCapture
D3D10StateBlockMaskEnableAll
D3D10StateBlockMaskEnableCapture
D3D10StateBlockMaskGetSetting
D3D10StateBlockMaskIntersect
D3D10StateBlockMaskUnion

View File

@ -1,31 +0,0 @@
@ stdcall D3D10CreateDevice1(ptr long ptr long long long ptr)
@ stdcall D3D10CreateDeviceAndSwapChain1(ptr long ptr long long long ptr ptr ptr)
@ stdcall D3D10GetVertexShaderProfile(ptr)
@ stdcall D3D10GetGeometryShaderProfile(ptr)
@ stdcall D3D10GetPixelShaderProfile(ptr)
@ stdcall D3D10CreateBlob(long ptr)
@ stdcall D3D10GetInputSignatureBlob(ptr long ptr)
@ stdcall D3D10GetOutputSignatureBlob(ptr long ptr)
@ stdcall D3D10ReflectShader(ptr long ptr)
@ stdcall D3D10CompileShader(ptr long str ptr ptr str str long ptr ptr)
@ stdcall D3D10CreateEffectFromMemory(ptr long long ptr ptr ptr)
@ stdcall D3D10CreateEffectPoolFromMemory(ptr long long ptr ptr)
@ stdcall D3D10CompileEffectFromMemory(ptr long ptr ptr ptr long long ptr ptr)
@ stub D3D10DisassembleEffect
@ stdcall D3D10DisassembleShader(ptr long long ptr ptr)
@ stub D3D10PreprocessShader
@ stdcall D3D10CreateStateBlock(ptr ptr ptr)
@ stdcall D3D10StateBlockMaskDifference(ptr ptr ptr)
@ stdcall D3D10StateBlockMaskDisableAll(ptr)
@ stdcall D3D10StateBlockMaskDisableCapture(ptr long long long)
@ stdcall D3D10StateBlockMaskEnableAll(ptr)
@ stdcall D3D10StateBlockMaskEnableCapture(ptr long long long)
@ stdcall D3D10StateBlockMaskGetSetting(ptr long long)
@ stdcall D3D10StateBlockMaskIntersect(ptr ptr ptr)
@ stdcall D3D10StateBlockMaskUnion(ptr ptr ptr)

View File

@ -105,7 +105,7 @@ namespace dxvk {
pDesc->ByteWidth = d3d11Desc.ByteWidth;
pDesc->Usage = D3D10_USAGE(d3d11Desc.Usage);
pDesc->BindFlags = d3d11Desc.BindFlags & 0x7F;
pDesc->BindFlags = d3d11Desc.BindFlags;
pDesc->CPUAccessFlags = d3d11Desc.CPUAccessFlags;
pDesc->MiscFlags = ConvertD3D11ResourceFlags(d3d11Desc.MiscFlags);
}

View File

@ -12,8 +12,8 @@ namespace dxvk {
public:
D3D10Buffer(D3D11Buffer* pParent, D3D10Device* pDevice)
: m_device(pDevice), m_d3d11(pParent) { }
D3D10Buffer(D3D11Buffer* pParent)
: m_d3d11(pParent) { }
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
@ -64,7 +64,6 @@ namespace dxvk {
private:
D3D10Device* m_device;
D3D11Buffer* m_d3d11;
};

71
src/d3d10/d3d10_core.cpp Normal file
View File

@ -0,0 +1,71 @@
#include <d3d11.h>
#include <d3d10_1.h>
#include "../dxgi/dxgi_interfaces.h"
extern "C" {
using namespace dxvk;
HRESULT __stdcall D3D11CoreCreateDevice(
IDXGIFactory* pFactory,
IDXGIAdapter* pAdapter,
D3D_DRIVER_TYPE DriverType,
HMODULE Software,
UINT Flags,
const D3D_FEATURE_LEVEL* pFeatureLevels,
UINT FeatureLevels,
UINT SDKVersion,
ID3D11Device** ppDevice,
D3D_FEATURE_LEVEL* pFeatureLevel);
DLLEXPORT HRESULT __stdcall D3D10CoreCreateDevice(
IDXGIFactory* pFactory,
IDXGIAdapter* pAdapter,
UINT Flags,
D3D_FEATURE_LEVEL FeatureLevel,
ID3D10Device** ppDevice) {
InitReturnPtr(ppDevice);
Com<ID3D11Device> d3d11Device;
HRESULT hr = pAdapter->CheckInterfaceSupport(
__uuidof(ID3D10Device), nullptr);
if (FAILED(hr))
return hr;
hr = D3D11CoreCreateDevice(pFactory, pAdapter, D3D_DRIVER_TYPE_UNKNOWN,
nullptr, Flags, &FeatureLevel, 1, D3D11_SDK_VERSION, &d3d11Device, nullptr);
if (FAILED(hr))
return hr;
Com<ID3D10Multithread> multithread;
d3d11Device->QueryInterface(__uuidof(ID3D10Multithread), reinterpret_cast<void**>(&multithread));
multithread->SetMultithreadProtected(!(Flags & D3D10_CREATE_DEVICE_SINGLETHREADED));
Com<IDXGIDXVKDevice> dxvkDevice;
d3d11Device->QueryInterface(__uuidof(IDXGIDXVKDevice), reinterpret_cast<void**>(&dxvkDevice));
dxvkDevice->SetAPIVersion(10);
if (FAILED(d3d11Device->QueryInterface(
__uuidof(ID3D10Device), reinterpret_cast<void**>(ppDevice))))
return E_FAIL;
return S_OK;
}
UINT64 STDMETHODCALLTYPE D3D10CoreGetVersion() {
// Match the Windows 10 return value, but we
// don't know the exact function signature
return 0xa000100041770ull;
}
HRESULT STDMETHODCALLTYPE D3D10CoreRegisterLayers() {
return E_NOTIMPL;
}
}

View File

@ -110,11 +110,10 @@ namespace dxvk {
reinterpret_cast<const D3D11_SUBRESOURCE_DATA*>(pInitialData),
ppBuffer != nullptr ? &d3d11Buffer : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppBuffer = static_cast<D3D11Buffer*>(d3d11Buffer)->GetD3D10Iface();
return S_OK;
}
@ -143,11 +142,10 @@ namespace dxvk {
reinterpret_cast<const D3D11_SUBRESOURCE_DATA*>(pInitialData),
ppTexture1D != nullptr ? &d3d11Texture1D : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppTexture1D = static_cast<D3D11Texture1D*>(d3d11Texture1D)->GetD3D10Iface();
return S_OK;
}
@ -178,11 +176,10 @@ namespace dxvk {
reinterpret_cast<const D3D11_SUBRESOURCE_DATA*>(pInitialData),
ppTexture2D != nullptr ? &d3d11Texture2D : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppTexture2D = static_cast<D3D11Texture2D*>(d3d11Texture2D)->GetD3D10Iface();
return S_OK;
}
@ -212,11 +209,10 @@ namespace dxvk {
reinterpret_cast<const D3D11_SUBRESOURCE_DATA*>(pInitialData),
ppTexture3D != nullptr ? &d3d11Texture3D : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppTexture3D = static_cast<D3D11Texture3D*>(d3d11Texture3D)->GetD3D10Iface();
return S_OK;
}
@ -227,7 +223,7 @@ namespace dxvk {
ID3D10ShaderResourceView** ppSRView) {
InitReturnPtr(ppSRView);
if (pResource == nullptr)
if (!pResource)
return E_INVALIDARG;
Com<ID3D11Resource> d3d11Resource;
@ -238,11 +234,10 @@ namespace dxvk {
reinterpret_cast<const D3D11_SHADER_RESOURCE_VIEW_DESC*>(pDesc),
ppSRView ? &d3d11Srv : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppSRView = static_cast<D3D11ShaderResourceView*>(d3d11Srv)->GetD3D10Iface();
return S_OK;
}
@ -253,7 +248,7 @@ namespace dxvk {
ID3D10ShaderResourceView1** ppSRView) {
InitReturnPtr(ppSRView);
if (pResource == nullptr)
if (!pResource)
return E_INVALIDARG;
Com<ID3D11Resource> d3d11Resource;
@ -264,11 +259,10 @@ namespace dxvk {
reinterpret_cast<const D3D11_SHADER_RESOURCE_VIEW_DESC*>(pDesc),
ppSRView ? &d3d11View : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppSRView = static_cast<D3D11ShaderResourceView*>(d3d11View)->GetD3D10Iface();
return S_OK;
}
@ -279,7 +273,7 @@ namespace dxvk {
ID3D10RenderTargetView** ppRTView) {
InitReturnPtr(ppRTView);
if (pResource == nullptr)
if (!pResource)
return E_INVALIDARG;
Com<ID3D11Resource> d3d11Resource;
@ -290,11 +284,10 @@ namespace dxvk {
reinterpret_cast<const D3D11_RENDER_TARGET_VIEW_DESC*>(pDesc),
ppRTView ? &d3d11View : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppRTView = static_cast<D3D11RenderTargetView*>(d3d11View)->GetD3D10Iface();
return S_OK;
}
@ -305,7 +298,7 @@ namespace dxvk {
ID3D10DepthStencilView** ppDepthStencilView) {
InitReturnPtr(ppDepthStencilView);
if (pResource == nullptr)
if (!pResource)
return E_INVALIDARG;
Com<ID3D11Resource> d3d11Resource;
@ -359,11 +352,10 @@ namespace dxvk {
d3d11Resource.ptr(), pDesc ? &d3d11Desc : nullptr,
ppDepthStencilView ? &d3d11View : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppDepthStencilView = static_cast<D3D11DepthStencilView*>(d3d11View)->GetD3D10Iface();
return S_OK;
}
@ -385,11 +377,10 @@ namespace dxvk {
NumElements, pShaderBytecodeWithInputSignature, BytecodeLength,
ppInputLayout ? &d3d11InputLayout : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppInputLayout = static_cast<D3D11InputLayout*>(d3d11InputLayout)->GetD3D10Iface();
return hr;
}
@ -406,11 +397,10 @@ namespace dxvk {
pShaderBytecode, BytecodeLength, nullptr,
ppVertexShader ? &d3d11Shader : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppVertexShader = static_cast<D3D11VertexShader*>(d3d11Shader)->GetD3D10Iface();
return S_OK;
}
@ -427,11 +417,10 @@ namespace dxvk {
pShaderBytecode, BytecodeLength, nullptr,
ppGeometryShader ? &d3d11Shader : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppGeometryShader = static_cast<D3D11GeometryShader*>(d3d11Shader)->GetD3D10Iface();
return S_OK;
}
@ -466,11 +455,10 @@ namespace dxvk {
D3D11_SO_NO_RASTERIZED_STREAM, nullptr,
ppGeometryShader ? &d3d11Shader : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppGeometryShader = static_cast<D3D11GeometryShader*>(d3d11Shader)->GetD3D10Iface();
return S_OK;
}
@ -487,11 +475,10 @@ namespace dxvk {
pShaderBytecode, BytecodeLength, nullptr,
ppPixelShader ? &d3d11Shader : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppPixelShader = static_cast<D3D11PixelShader*>(d3d11Shader)->GetD3D10Iface();
return S_OK;
}
@ -523,11 +510,10 @@ namespace dxvk {
HRESULT hr = m_device->CreateBlendState(&d3d11Desc,
ppBlendState ? &d3d11BlendState : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppBlendState = static_cast<D3D11BlendState*>(d3d11BlendState)->GetD3D10Iface();
return S_OK;
}
@ -542,11 +528,10 @@ namespace dxvk {
reinterpret_cast<const D3D11_BLEND_DESC*>(pBlendStateDesc),
ppBlendState ? &d3d11BlendState : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppBlendState = static_cast<D3D11BlendState*>(d3d11BlendState)->GetD3D10Iface();
return S_OK;
}
@ -561,11 +546,10 @@ namespace dxvk {
reinterpret_cast<const D3D11_DEPTH_STENCIL_DESC*>(pDepthStencilDesc),
ppDepthStencilState ? &d3d11DepthStencilState : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppDepthStencilState = static_cast<D3D11DepthStencilState*>(d3d11DepthStencilState)->GetD3D10Iface();
return S_OK;
}
@ -580,11 +564,10 @@ namespace dxvk {
reinterpret_cast<const D3D11_RASTERIZER_DESC*>(pRasterizerDesc),
ppRasterizerState ? &d3d11RasterizerState : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppRasterizerState = static_cast<D3D11RasterizerState*>(d3d11RasterizerState)->GetD3D10Iface();
return S_OK;
}
@ -615,11 +598,10 @@ namespace dxvk {
HRESULT hr = m_device->CreateSamplerState(&d3d11Desc,
ppSamplerState ? &d3d11SamplerState : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppSamplerState = static_cast<D3D11SamplerState*>(d3d11SamplerState)->GetD3D10Iface();
return S_OK;
}
@ -640,11 +622,10 @@ namespace dxvk {
HRESULT hr = m_device->CreateQuery(&d3d11Desc,
ppQuery ? &d3d11Query : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppQuery = static_cast<D3D11Query*>(d3d11Query)->GetD3D10Iface();
return S_OK;
}
@ -662,11 +643,10 @@ namespace dxvk {
HRESULT hr = m_device->CreatePredicate(&d3d11Desc,
ppPredicate ? &d3d11Predicate : nullptr);
if (FAILED(hr) || hr == S_FALSE)
if (hr != S_OK)
return hr;
*ppPredicate = static_cast<D3D11Query*>(d3d11Predicate)->GetD3D10Iface();
*ppPredicate = D3D11Query::FromPredicate(d3d11Predicate)->GetD3D10Iface();
return S_OK;
}
@ -725,10 +705,7 @@ namespace dxvk {
HANDLE hResource,
REFIID ReturnedInterface,
void** ppResource) {
InitReturnPtr(ppResource);
Logger::err("D3D10Device::OpenSharedResource: Not implemented");
return E_NOTIMPL;
return m_device->OpenSharedResource(hResource, ReturnedInterface, ppResource);
}
@ -760,7 +737,7 @@ namespace dxvk {
D3D10Query* d3d10Predicate = static_cast<D3D10Query*>(pPredicate);
D3D11Query* d3d11Predicate = d3d10Predicate ? d3d10Predicate->GetD3D11Iface() : nullptr;
m_context->SetPredication(d3d11Predicate, PredicateValue);
m_context->SetPredication(D3D11Query::AsPredicate(d3d11Predicate), PredicateValue);
}
@ -773,8 +750,8 @@ namespace dxvk {
ppPredicate ? &d3d11Predicate : nullptr,
pPredicateValue);
if (ppPredicate != nullptr)
*ppPredicate = d3d11Predicate ? static_cast<D3D11Query*>(d3d11Predicate)->GetD3D10Iface() : nullptr;
if (ppPredicate)
*ppPredicate = d3d11Predicate ? D3D11Query::FromPredicate(d3d11Predicate)->GetD3D10Iface() : nullptr;
}
@ -787,9 +764,12 @@ namespace dxvk {
ID3D10Resource* pSrcResource,
UINT SrcSubresource,
const D3D10_BOX* pSrcBox) {
if (!pDstResource || !pSrcResource)
return;
Com<ID3D11Resource> d3d11DstResource;
Com<ID3D11Resource> d3d11SrcResource;
GetD3D11Resource(pDstResource, &d3d11DstResource);
GetD3D11Resource(pSrcResource, &d3d11SrcResource);
@ -803,6 +783,9 @@ namespace dxvk {
void STDMETHODCALLTYPE D3D10Device::CopyResource(
ID3D10Resource* pDstResource,
ID3D10Resource* pSrcResource) {
if (!pDstResource || !pSrcResource)
return;
Com<ID3D11Resource> d3d11DstResource;
Com<ID3D11Resource> d3d11SrcResource;
@ -822,6 +805,9 @@ namespace dxvk {
const void* pSrcData,
UINT SrcRowPitch,
UINT SrcDepthPitch) {
if (!pDstResource)
return;
Com<ID3D11Resource> d3d11DstResource;
GetD3D11Resource(pDstResource, &d3d11DstResource);
@ -847,6 +833,9 @@ namespace dxvk {
ID3D10Resource* pSrcResource,
UINT SrcSubresource,
DXGI_FORMAT Format) {
if (!pDstResource || !pSrcResource)
return;
Com<ID3D11Resource> d3d11DstResource;
Com<ID3D11Resource> d3d11SrcResource;
@ -966,8 +955,9 @@ namespace dxvk {
ID3D11InputLayout* d3d11InputLayout = nullptr;
m_context->IAGetInputLayout(&d3d11InputLayout);
*ppInputLayout = d3d11InputLayout ? static_cast<D3D11InputLayout*>(
d3d11InputLayout)->GetD3D10Iface() : nullptr;
*ppInputLayout = d3d11InputLayout
? static_cast<D3D11InputLayout*>(d3d11InputLayout)->GetD3D10Iface()
: nullptr;
}
@ -995,7 +985,7 @@ namespace dxvk {
ppVertexBuffers ? d3d11Buffers : nullptr,
pStrides, pOffsets);
if (ppVertexBuffers != nullptr) {
if (ppVertexBuffers) {
for (uint32_t i = 0; i < NumBuffers; i++) {
ppVertexBuffers[i] = d3d11Buffers[i]
? static_cast<D3D11Buffer*>(d3d11Buffers[i])->GetD3D10Iface()
@ -1015,7 +1005,7 @@ namespace dxvk {
pIndexBuffer ? &d3d11Buffer : nullptr,
Format, Offset);
if (pIndexBuffer != nullptr)
if (pIndexBuffer)
*pIndexBuffer = d3d11Buffer ? static_cast<D3D11Buffer*>(d3d11Buffer)->GetD3D10Iface() : nullptr;
}

View File

@ -1,7 +1,9 @@
#pragma once
#include "../dxgi/dxgi_include.h"
#include "../util/sync/sync_spinlock.h"
#include "../util/sync/sync_recursive.h"
#include <d3d10_1.h>
#include <d3d11_1.h>

View File

@ -1,361 +0,0 @@
#include <d3dcompiler.h>
#include "d3d10_include.h"
#include "d3d10_reflection.h"
#include "../dxgi/dxgi_adapter.h"
namespace dxvk {
Logger Logger::s_instance("d3d10.log");
}
extern "C" {
using namespace dxvk;
HRESULT __stdcall D3D11CoreCreateDevice(
IDXGIFactory* pFactory,
IDXGIAdapter* pAdapter,
UINT Flags,
const D3D_FEATURE_LEVEL* pFeatureLevels,
UINT FeatureLevels,
ID3D11Device** ppDevice);
DLLEXPORT HRESULT __stdcall D3D10CoreCreateDevice(
IDXGIFactory* pFactory,
IDXGIAdapter* pAdapter,
UINT Flags,
D3D_FEATURE_LEVEL FeatureLevel,
ID3D10Device** ppDevice) {
InitReturnPtr(ppDevice);
Com<ID3D11Device> d3d11Device;
HRESULT hr = pAdapter->CheckInterfaceSupport(
__uuidof(ID3D10Device), nullptr);
if (FAILED(hr))
return hr;
hr = D3D11CoreCreateDevice(pFactory, pAdapter,
Flags, &FeatureLevel, 1, &d3d11Device);
if (FAILED(hr))
return hr;
Com<ID3D10Multithread> multithread;
d3d11Device->QueryInterface(__uuidof(ID3D10Multithread), reinterpret_cast<void**>(&multithread));
multithread->SetMultithreadProtected(!(Flags & D3D10_CREATE_DEVICE_SINGLETHREADED));
if (FAILED(d3d11Device->QueryInterface(
__uuidof(ID3D10Device), reinterpret_cast<void**>(ppDevice))))
return E_FAIL;
return S_OK;
}
static HRESULT D3D10InternalCreateDeviceAndSwapChain(
IDXGIAdapter* pAdapter,
D3D10_DRIVER_TYPE DriverType,
HMODULE Software,
UINT Flags,
D3D10_FEATURE_LEVEL1 HardwareLevel,
UINT SDKVersion,
DXGI_SWAP_CHAIN_DESC* pSwapChainDesc,
IDXGISwapChain** ppSwapChain,
REFIID deviceIID,
void** ppDevice) {
InitReturnPtr(ppDevice);
InitReturnPtr(ppSwapChain);
if (ppSwapChain && !pSwapChainDesc)
return E_INVALIDARG;
HRESULT hr;
// Get DXGI factory and adapter. This is mostly
// copied from the equivalent D3D11 functions.
Com<IDXGIFactory> dxgiFactory = nullptr;
Com<IDXGIAdapter> dxgiAdapter = pAdapter;
Com<ID3D10Device> device = nullptr;
if (!pAdapter) {
if (DriverType != D3D10_DRIVER_TYPE_HARDWARE)
Logger::warn("D3D10CreateDevice: Unsupported driver type");
hr = CreateDXGIFactory(__uuidof(IDXGIFactory), reinterpret_cast<void**>(&dxgiFactory));
if (FAILED(hr)) {
Logger::err("D3D10CreateDevice: Failed to create a DXGI factory");
return hr;
}
hr = dxgiFactory->EnumAdapters(0, &dxgiAdapter);
if (FAILED(hr)) {
Logger::err("D3D10CreateDevice: No default adapter available");
return hr;
}
} else {
if (FAILED(dxgiAdapter->GetParent(__uuidof(IDXGIFactory), reinterpret_cast<void**>(&dxgiFactory)))) {
Logger::err("D3D10CreateDevice: Failed to query DXGI factory from DXGI adapter");
return E_INVALIDARG;
}
if (DriverType != D3D10_DRIVER_TYPE_HARDWARE || Software)
return E_INVALIDARG;
}
hr = D3D10CoreCreateDevice(
dxgiFactory.ptr(), dxgiAdapter.ptr(),
Flags, D3D_FEATURE_LEVEL(HardwareLevel),
&device);
if (FAILED(hr))
return hr;
if (ppSwapChain) {
DXGI_SWAP_CHAIN_DESC desc = *pSwapChainDesc;
hr = dxgiFactory->CreateSwapChain(device.ptr(), &desc, ppSwapChain);
if (FAILED(hr)) {
Logger::err("D3D10CreateDevice: Failed to create swap chain");
return hr;
}
}
if (ppDevice) {
// Just assume that this succeeds
device->QueryInterface(deviceIID, ppDevice);
}
if (!ppDevice && !ppSwapChain)
return S_FALSE;
return S_OK;
}
DLLEXPORT HRESULT __stdcall D3D10CreateDevice(
IDXGIAdapter* pAdapter,
D3D10_DRIVER_TYPE DriverType,
HMODULE Software,
UINT Flags,
UINT SDKVersion,
ID3D10Device** ppDevice) {
return D3D10InternalCreateDeviceAndSwapChain(
pAdapter, DriverType, Software, Flags,
D3D10_FEATURE_LEVEL_10_0, SDKVersion,
nullptr, nullptr,
__uuidof(ID3D10Device),
reinterpret_cast<void**>(ppDevice));
}
DLLEXPORT HRESULT __stdcall D3D10CreateDevice1(
IDXGIAdapter* pAdapter,
D3D10_DRIVER_TYPE DriverType,
HMODULE Software,
UINT Flags,
D3D10_FEATURE_LEVEL1 HardwareLevel,
UINT SDKVersion,
ID3D10Device1** ppDevice) {
return D3D10InternalCreateDeviceAndSwapChain(
pAdapter, DriverType, Software, Flags,
HardwareLevel, SDKVersion,
nullptr, nullptr,
__uuidof(ID3D10Device1),
reinterpret_cast<void**>(ppDevice));
}
DLLEXPORT HRESULT __stdcall D3D10CreateDeviceAndSwapChain(
IDXGIAdapter* pAdapter,
D3D10_DRIVER_TYPE DriverType,
HMODULE Software,
UINT Flags,
UINT SDKVersion,
DXGI_SWAP_CHAIN_DESC* pSwapChainDesc,
IDXGISwapChain** ppSwapChain,
ID3D10Device** ppDevice) {
return D3D10InternalCreateDeviceAndSwapChain(
pAdapter, DriverType, Software, Flags,
D3D10_FEATURE_LEVEL_10_0, SDKVersion,
pSwapChainDesc, ppSwapChain,
__uuidof(ID3D10Device),
reinterpret_cast<void**>(ppDevice));
}
DLLEXPORT HRESULT __stdcall D3D10CreateDeviceAndSwapChain1(
IDXGIAdapter* pAdapter,
D3D10_DRIVER_TYPE DriverType,
HMODULE Software,
UINT Flags,
D3D10_FEATURE_LEVEL1 HardwareLevel,
UINT SDKVersion,
DXGI_SWAP_CHAIN_DESC* pSwapChainDesc,
IDXGISwapChain** ppSwapChain,
ID3D10Device1** ppDevice) {
return D3D10InternalCreateDeviceAndSwapChain(
pAdapter, DriverType, Software, Flags,
HardwareLevel, SDKVersion,
pSwapChainDesc, ppSwapChain,
__uuidof(ID3D10Device1),
reinterpret_cast<void**>(ppDevice));
}
const char* STDMETHODCALLTYPE D3D10GetVertexShaderProfile (ID3D10Device*) { return "vs_4_1"; }
const char* STDMETHODCALLTYPE D3D10GetGeometryShaderProfile (ID3D10Device*) { return "gs_4_1"; }
const char* STDMETHODCALLTYPE D3D10GetPixelShaderProfile (ID3D10Device*) { return "ps_4_1"; }
HRESULT STDMETHODCALLTYPE D3D10CreateBlob(SIZE_T size, LPD3D10BLOB* ppBuffer) {
return D3DCreateBlob(size, ppBuffer);
}
HRESULT STDMETHODCALLTYPE D3D10GetInputSignatureBlob(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
ID3D10Blob** ppSignatureBlob) {
return D3DGetInputSignatureBlob(
pShaderBytecode,
BytecodeLength,
ppSignatureBlob);
}
HRESULT STDMETHODCALLTYPE D3D10GetOutputSignatureBlob(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
ID3D10Blob** ppSignatureBlob) {
return D3DGetOutputSignatureBlob(
pShaderBytecode,
BytecodeLength,
ppSignatureBlob);
}
HRESULT STDMETHODCALLTYPE D3D10ReflectShader(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
ID3D10ShaderReflection** ppReflector) {
static const GUID IID_ID3D11ShaderReflection =
{0x0a233719,0x3960,0x4578,{0x9d,0x7c,0x20,0x3b,0x8b,0x1d,0x9c,0xc1}};
InitReturnPtr(ppReflector);
Com<ID3D11ShaderReflection> d3d11Reflector = nullptr;
HRESULT hr = D3DReflect(pShaderBytecode,
BytecodeLength, IID_ID3D11ShaderReflection,
reinterpret_cast<void**>(&d3d11Reflector));
if (FAILED(hr)) {
Logger::err("D3D10ReflectShader: Failed to create ID3D11ShaderReflection");
return hr;
}
*ppReflector = ref(new D3D10ShaderReflection(d3d11Reflector.ptr()));
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D10CompileShader(
LPCSTR pSrcData,
SIZE_T SrcDataSize,
LPCSTR pFileName,
const D3D10_SHADER_MACRO* pDefines,
LPD3D10INCLUDE pInclude,
LPCSTR pFunctionName,
LPCSTR pProfile,
UINT Flags,
ID3D10Blob** ppShader,
ID3D10Blob** ppErrorMsgs) {
return D3DCompile(pSrcData, SrcDataSize, pFileName,
pDefines, pInclude, pFunctionName, pProfile, Flags,
0, ppShader, ppErrorMsgs);
}
HRESULT STDMETHODCALLTYPE D3D10CreateEffectFromMemory(
void* pData,
SIZE_T DataSize,
UINT EffectFlags,
ID3D10Device* pDevice,
ID3D10EffectPool* pEffectPool,
ID3D10Effect** ppEffect) {
Logger::warn("D3D10CreateEffectFromMemory: Not implemented");
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE D3D10CreateEffectPoolFromMemory(
void* pData,
SIZE_T DataSize,
UINT EffectFlags,
ID3D10Device* pDevice,
ID3D10EffectPool** ppEffectPool) {
Logger::warn("D3D10CreateEffectPoolFromMemory: Not implemented");
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE D3D10CompileEffectFromMemory(
void* pData,
SIZE_T DataLength,
LPCSTR pSrcFileName,
const D3D10_SHADER_MACRO* pDefines,
ID3D10Include* pInclude,
UINT ShaderFlags,
UINT EffectFlags,
ID3D10Blob** ppCompiledEffect,
ID3D10Blob** ppErrors) {
Logger::warn("D3D10CompileEffectFromMemory: Not implemented");
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE D3D10DisassembleEffect(
ID3D10Effect* pEffect,
BOOL EnableColorCode,
ID3D10Blob** ppDisassembly) {
Logger::warn("D3D10DisassembleEffect: Not implemented");
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE D3D10DisassembleShader(
const void* pShader,
SIZE_T BytecodeLength,
BOOL EnableColorCode,
LPCSTR pComments,
ID3D10Blob** ppDisassembly) {
return D3DDisassemble(
pShader, BytecodeLength,
0, pComments, ppDisassembly);
}
HRESULT STDMETHODCALLTYPE D3D10PreprocessShader(
LPCSTR pSrcData,
SIZE_T SrcDataSize,
LPCSTR pFileName,
const D3D10_SHADER_MACRO* pDefines,
LPD3D10INCLUDE pInclude,
ID3D10Blob** ppShaderText,
ID3D10Blob** ppErrorMsgs) {
return D3DPreprocess(
pSrcData, SrcDataSize,
pFileName, pDefines,
pInclude,
ppShaderText,
ppErrorMsgs);
}
}

View File

@ -1,44 +1,17 @@
#include <utility>
#include "d3d10_device.h"
namespace dxvk {
void D3D10DeviceMutex::lock() {
while (!try_lock())
dxvk::this_thread::yield();
}
void D3D10DeviceMutex::unlock() {
if (likely(m_counter == 0))
m_owner.store(0, std::memory_order_release);
else
m_counter -= 1;
}
bool D3D10DeviceMutex::try_lock() {
uint32_t threadId = GetCurrentThreadId();
uint32_t expected = 0;
bool status = m_owner.compare_exchange_weak(
expected, threadId, std::memory_order_acquire);
if (status)
return true;
if (expected != threadId)
return false;
m_counter += 1;
return true;
}
D3D10Multithread::D3D10Multithread(
IUnknown* pParent,
BOOL Protected)
BOOL Protected,
BOOL Force)
: m_parent (pParent),
m_protected (Protected) {
m_protected (Protected || Force),
m_enabled (Protected),
m_forced (Force) {
}
@ -79,12 +52,18 @@ namespace dxvk {
BOOL STDMETHODCALLTYPE D3D10Multithread::SetMultithreadProtected(
BOOL bMTProtect) {
return std::exchange(m_protected, bMTProtect);
BOOL result = m_enabled;
m_enabled = bMTProtect;
if (!m_forced)
m_protected = m_enabled;
return result;
}
BOOL STDMETHODCALLTYPE D3D10Multithread::GetMultithreadProtected() {
return m_protected;
return m_enabled;
}
}
}

View File

@ -4,30 +4,6 @@
namespace dxvk {
/**
* \brief Device mutex
*
* Effectively implements a recursive spinlock
* which is used to lock the D3D10 device.
*/
class D3D10DeviceMutex {
public:
void lock();
void unlock();
bool try_lock();
private:
std::atomic<uint32_t> m_owner = { 0u };
uint32_t m_counter = { 0u };
};
/**
* \brief Device lock
*
@ -43,7 +19,7 @@ namespace dxvk {
D3D10DeviceLock()
: m_mutex(nullptr) { }
D3D10DeviceLock(D3D10DeviceMutex& mutex)
D3D10DeviceLock(sync::RecursiveSpinlock& mutex)
: m_mutex(&mutex) {
mutex.lock();
}
@ -69,7 +45,7 @@ namespace dxvk {
private:
D3D10DeviceMutex* m_mutex;
sync::RecursiveSpinlock* m_mutex;
};
@ -88,7 +64,8 @@ namespace dxvk {
D3D10Multithread(
IUnknown* pParent,
BOOL Protected);
BOOL Protected,
BOOL Force);
~D3D10Multithread();
@ -119,8 +96,10 @@ namespace dxvk {
IUnknown* m_parent;
BOOL m_protected;
BOOL m_enabled;
BOOL m_forced;
D3D10DeviceMutex m_mutex;
sync::RecursiveSpinlock m_mutex;
};

View File

@ -6,15 +6,14 @@ namespace dxvk {
class D3D10Device;
class D3D11Device;
class D3D11DeviceContext;
class D3D11Query;
class D3D10Query : public ID3D10Predicate {
public:
D3D10Query(D3D11Query* pParent, D3D10Device* pDevice)
: m_device(pDevice), m_d3d11(pParent) { }
D3D10Query(D3D11Query* pParent)
: m_d3d11(pParent) { }
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
@ -61,7 +60,6 @@ namespace dxvk {
private:
D3D10Device* m_device;
D3D11Query* m_d3d11;
};

View File

@ -1,319 +0,0 @@
#include "d3d10_reflection.h"
namespace dxvk {
D3D10ShaderReflectionType::D3D10ShaderReflectionType(
ID3D11ShaderReflectionType* d3d11)
: m_d3d11(d3d11) {
D3D11_SHADER_TYPE_DESC d3d11Desc;
m_d3d11->GetDesc(&d3d11Desc);
for (uint32_t i = 0; i < d3d11Desc.Members; i++)
m_members.emplace_back(m_d3d11->GetMemberTypeByIndex(i));
}
D3D10ShaderReflectionType::~D3D10ShaderReflectionType() {
}
HRESULT STDMETHODCALLTYPE D3D10ShaderReflectionType::GetDesc(
D3D10_SHADER_TYPE_DESC* pDesc) {
D3D11_SHADER_TYPE_DESC d3d11Desc;
HRESULT hr = m_d3d11->GetDesc(&d3d11Desc);
if (FAILED(hr))
return hr;
pDesc->Class = D3D10_SHADER_VARIABLE_CLASS(d3d11Desc.Class);
pDesc->Type = D3D10_SHADER_VARIABLE_TYPE (d3d11Desc.Type);
pDesc->Rows = d3d11Desc.Rows;
pDesc->Columns = d3d11Desc.Columns;
pDesc->Elements = d3d11Desc.Elements;
pDesc->Members = d3d11Desc.Members;
pDesc->Offset = d3d11Desc.Offset;
return S_OK;
}
ID3D10ShaderReflectionType* STDMETHODCALLTYPE D3D10ShaderReflectionType::GetMemberTypeByIndex(
UINT Index) {
return FindMemberType(m_d3d11->GetMemberTypeByIndex(Index));
}
ID3D10ShaderReflectionType* STDMETHODCALLTYPE D3D10ShaderReflectionType::GetMemberTypeByName(
const char* Name) {
return FindMemberType(m_d3d11->GetMemberTypeByName(Name));
}
const char* STDMETHODCALLTYPE D3D10ShaderReflectionType::GetMemberTypeName(
UINT Index) {
return m_d3d11->GetMemberTypeName(Index);
}
ID3D10ShaderReflectionType* D3D10ShaderReflectionType::FindMemberType(
ID3D11ShaderReflectionType* pMemberType) {
for (size_t i = 0; i < m_members.size(); i++) {
if (m_members[i].GetD3D11Iface() == pMemberType)
return &m_members[i];
}
return nullptr;
}
D3D10ShaderReflectionVariable::D3D10ShaderReflectionVariable(ID3D11ShaderReflectionVariable* d3d11)
: m_d3d11(d3d11), m_type(m_d3d11->GetType()) {
}
D3D10ShaderReflectionVariable::~D3D10ShaderReflectionVariable() {
}
HRESULT STDMETHODCALLTYPE D3D10ShaderReflectionVariable::GetDesc(
D3D10_SHADER_VARIABLE_DESC* pDesc) {
D3D11_SHADER_VARIABLE_DESC d3d11Desc;
HRESULT hr = m_d3d11->GetDesc(&d3d11Desc);
if (FAILED(hr))
return hr;
pDesc->Name = d3d11Desc.Name;
pDesc->StartOffset = d3d11Desc.StartOffset;
pDesc->Size = d3d11Desc.Size;
pDesc->uFlags = d3d11Desc.uFlags;
pDesc->DefaultValue = d3d11Desc.DefaultValue;
return S_OK;
}
ID3D10ShaderReflectionType* STDMETHODCALLTYPE D3D10ShaderReflectionVariable::GetType() {
return &m_type;
}
D3D10ShaderReflectionConstantBuffer::D3D10ShaderReflectionConstantBuffer(
ID3D11ShaderReflectionConstantBuffer* d3d11)
: m_d3d11(d3d11) {
D3D11_SHADER_BUFFER_DESC d3d11Desc;
m_d3d11->GetDesc(&d3d11Desc);
for (uint32_t i = 0; i < d3d11Desc.Variables; i++)
m_variables.emplace_back(m_d3d11->GetVariableByIndex(i));
}
D3D10ShaderReflectionConstantBuffer::~D3D10ShaderReflectionConstantBuffer() {
}
HRESULT STDMETHODCALLTYPE D3D10ShaderReflectionConstantBuffer::GetDesc(
D3D10_SHADER_BUFFER_DESC* pDesc) {
D3D11_SHADER_BUFFER_DESC d3d11Desc;
HRESULT hr = m_d3d11->GetDesc(&d3d11Desc);
if (FAILED(hr))
return hr;
pDesc->Name = d3d11Desc.Name;
pDesc->Type = D3D10_CBUFFER_TYPE(d3d11Desc.Type);
pDesc->Variables = d3d11Desc.Variables;
pDesc->Size = d3d11Desc.Size;
pDesc->uFlags = d3d11Desc.uFlags;
return S_OK;
}
ID3D10ShaderReflectionVariable* STDMETHODCALLTYPE D3D10ShaderReflectionConstantBuffer::GetVariableByIndex(
UINT Index) {
return FindVariable(m_d3d11->GetVariableByIndex(Index));
}
ID3D10ShaderReflectionVariable* STDMETHODCALLTYPE D3D10ShaderReflectionConstantBuffer::GetVariableByName(
LPCSTR Name) {
return FindVariable(m_d3d11->GetVariableByName(Name));
}
ID3D10ShaderReflectionVariable* D3D10ShaderReflectionConstantBuffer::FindVariable(
ID3D11ShaderReflectionVariable* pVariable) {
for (size_t i = 0; i < m_variables.size(); i++) {
if (m_variables[i].GetD3D11Iface() == pVariable)
return &m_variables[i];
}
return nullptr;
}
D3D10ShaderReflection::D3D10ShaderReflection(ID3D11ShaderReflection* d3d11)
: m_d3d11(d3d11) {
D3D11_SHADER_DESC d3d11Desc;
m_d3d11->GetDesc(&d3d11Desc);
for (uint32_t i = 0; i < d3d11Desc.ConstantBuffers; i++)
m_constantBuffers.emplace_back(m_d3d11->GetConstantBufferByIndex(i));
}
D3D10ShaderReflection::~D3D10ShaderReflection() {
}
HRESULT STDMETHODCALLTYPE D3D10ShaderReflection::QueryInterface(
REFIID riid,
void** ppvObject) {
if (ppvObject == nullptr)
return E_POINTER;
static const GUID IID_ID3D10ShaderReflection
= {0xd40e20b6,0xf8f7,0x42ad,{0xab,0x20,0x4b,0xaf,0x8f,0x15,0xdf,0xaa}};
if (riid == __uuidof(IUnknown)
|| riid == IID_ID3D10ShaderReflection) {
*ppvObject = ref(this);
return S_OK;
}
return E_NOINTERFACE;
}
HRESULT STDMETHODCALLTYPE D3D10ShaderReflection::GetDesc(
D3D10_SHADER_DESC* pDesc) {
D3D11_SHADER_DESC d3d11Desc;
HRESULT hr = m_d3d11->GetDesc(&d3d11Desc);
if (FAILED(hr))
return hr;
pDesc->Version = d3d11Desc.Version;
pDesc->Creator = d3d11Desc.Creator;
pDesc->Flags = d3d11Desc.Flags;
pDesc->ConstantBuffers = d3d11Desc.ConstantBuffers;
pDesc->BoundResources = d3d11Desc.BoundResources;
pDesc->InputParameters = d3d11Desc.InputParameters;
pDesc->OutputParameters = d3d11Desc.OutputParameters;
pDesc->InstructionCount = d3d11Desc.InstructionCount;
pDesc->TempRegisterCount = d3d11Desc.TempRegisterCount;
pDesc->TempArrayCount = d3d11Desc.TempArrayCount;
pDesc->DefCount = d3d11Desc.DefCount;
pDesc->DclCount = d3d11Desc.DclCount;
pDesc->TextureNormalInstructions = d3d11Desc.TextureNormalInstructions;
pDesc->TextureLoadInstructions = d3d11Desc.TextureLoadInstructions;
pDesc->TextureCompInstructions = d3d11Desc.TextureCompInstructions;
pDesc->TextureBiasInstructions = d3d11Desc.TextureBiasInstructions;
pDesc->TextureGradientInstructions = d3d11Desc.TextureGradientInstructions;
pDesc->FloatInstructionCount = d3d11Desc.FloatInstructionCount;
pDesc->IntInstructionCount = d3d11Desc.IntInstructionCount;
pDesc->UintInstructionCount = d3d11Desc.UintInstructionCount;
pDesc->StaticFlowControlCount = d3d11Desc.StaticFlowControlCount;
pDesc->DynamicFlowControlCount = d3d11Desc.DynamicFlowControlCount;
pDesc->MacroInstructionCount = d3d11Desc.MacroInstructionCount;
pDesc->ArrayInstructionCount = d3d11Desc.ArrayInstructionCount;
pDesc->CutInstructionCount = d3d11Desc.CutInstructionCount;
pDesc->EmitInstructionCount = d3d11Desc.EmitInstructionCount;
pDesc->GSOutputTopology = D3D10_PRIMITIVE_TOPOLOGY(d3d11Desc.GSOutputTopology);
pDesc->GSMaxOutputVertexCount = d3d11Desc.GSMaxOutputVertexCount;
return S_OK;
}
ID3D10ShaderReflectionConstantBuffer* STDMETHODCALLTYPE
D3D10ShaderReflection::GetConstantBufferByIndex(
UINT Index) {
return FindConstantBuffer(m_d3d11->GetConstantBufferByIndex(Index));
}
ID3D10ShaderReflectionConstantBuffer* STDMETHODCALLTYPE
D3D10ShaderReflection::GetConstantBufferByName(
LPCSTR Name) {
return FindConstantBuffer(m_d3d11->GetConstantBufferByName(Name));
}
HRESULT STDMETHODCALLTYPE D3D10ShaderReflection::GetInputParameterDesc(
UINT ParameterIndex,
D3D10_SIGNATURE_PARAMETER_DESC* pDesc) {
D3D11_SIGNATURE_PARAMETER_DESC d3d11Desc;
HRESULT hr = m_d3d11->GetInputParameterDesc(ParameterIndex, &d3d11Desc);
if (FAILED(hr))
return hr;
ConvertSignatureParameterDesc(&d3d11Desc, pDesc);
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D10ShaderReflection::GetOutputParameterDesc(
UINT ParameterIndex,
D3D10_SIGNATURE_PARAMETER_DESC* pDesc) {
D3D11_SIGNATURE_PARAMETER_DESC d3d11Desc;
HRESULT hr = m_d3d11->GetOutputParameterDesc(ParameterIndex, &d3d11Desc);
if (FAILED(hr))
return hr;
ConvertSignatureParameterDesc(&d3d11Desc, pDesc);
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D10ShaderReflection::GetResourceBindingDesc(
UINT ResourceIndex,
D3D10_SHADER_INPUT_BIND_DESC* pDesc) {
D3D11_SHADER_INPUT_BIND_DESC d3d11Desc;
HRESULT hr = m_d3d11->GetResourceBindingDesc(
ResourceIndex, &d3d11Desc);
if (FAILED(hr))
return hr;
pDesc->Name = d3d11Desc.Name;
pDesc->Type = D3D10_SHADER_INPUT_TYPE(d3d11Desc.Type);
pDesc->BindPoint = d3d11Desc.BindPoint;
pDesc->BindCount = d3d11Desc.BindCount;
pDesc->uFlags = d3d11Desc.uFlags;
pDesc->ReturnType = D3D10_RESOURCE_RETURN_TYPE(d3d11Desc.ReturnType);
pDesc->Dimension = D3D10_SRV_DIMENSION (d3d11Desc.Dimension);
pDesc->NumSamples = d3d11Desc.NumSamples;
return S_OK;
}
ID3D10ShaderReflectionConstantBuffer* D3D10ShaderReflection::FindConstantBuffer(
ID3D11ShaderReflectionConstantBuffer* pConstantBuffer) {
for (size_t i = 0; i < m_constantBuffers.size(); i++) {
if (m_constantBuffers[i].GetD3D11Iface() == pConstantBuffer)
return &m_constantBuffers[i];
}
return nullptr;
}
void D3D10ShaderReflection::ConvertSignatureParameterDesc(
const D3D11_SIGNATURE_PARAMETER_DESC* pSrcDesc,
D3D10_SIGNATURE_PARAMETER_DESC* pDstDesc) {
pDstDesc->SemanticName = pSrcDesc->SemanticName;
pDstDesc->SemanticIndex = pSrcDesc->SemanticIndex;
pDstDesc->Register = pSrcDesc->Register;
pDstDesc->SystemValueType = D3D10_NAME(pSrcDesc->SystemValueType);
pDstDesc->ComponentType = D3D10_REGISTER_COMPONENT_TYPE(pSrcDesc->ComponentType);
pDstDesc->Mask = pSrcDesc->Mask;
pDstDesc->ReadWriteMask = pSrcDesc->ReadWriteMask;
}
}

View File

@ -1,155 +0,0 @@
#pragma once
#include <vector>
#include "d3d10_include.h"
#include <d3d10shader.h>
#include <d3d11shader.h>
namespace dxvk {
class D3D10ShaderReflectionType : public ID3D10ShaderReflectionType {
public:
D3D10ShaderReflectionType(
ID3D11ShaderReflectionType* d3d11);
~D3D10ShaderReflectionType();
HRESULT STDMETHODCALLTYPE GetDesc(
D3D10_SHADER_TYPE_DESC* pDesc);
ID3D10ShaderReflectionType* STDMETHODCALLTYPE GetMemberTypeByIndex(
UINT Index);
ID3D10ShaderReflectionType* STDMETHODCALLTYPE GetMemberTypeByName(
const char* Name);
const char* STDMETHODCALLTYPE GetMemberTypeName(
UINT Index);
ID3D11ShaderReflectionType* GetD3D11Iface() {
return m_d3d11;
}
private:
ID3D11ShaderReflectionType* m_d3d11;
std::vector<D3D10ShaderReflectionType> m_members;
ID3D10ShaderReflectionType* FindMemberType(
ID3D11ShaderReflectionType* pMemberType);
};
class D3D10ShaderReflectionVariable : public ID3D10ShaderReflectionVariable {
public:
D3D10ShaderReflectionVariable(
ID3D11ShaderReflectionVariable* d3d11);
~D3D10ShaderReflectionVariable();
HRESULT STDMETHODCALLTYPE GetDesc(
D3D10_SHADER_VARIABLE_DESC* pDesc);
ID3D10ShaderReflectionType* STDMETHODCALLTYPE GetType();
ID3D11ShaderReflectionVariable* STDMETHODCALLTYPE GetD3D11Iface() {
return m_d3d11;
}
private:
ID3D11ShaderReflectionVariable* m_d3d11;
D3D10ShaderReflectionType m_type;
};
class D3D10ShaderReflectionConstantBuffer : public ID3D10ShaderReflectionConstantBuffer {
public:
D3D10ShaderReflectionConstantBuffer(
ID3D11ShaderReflectionConstantBuffer* d3d11);
~D3D10ShaderReflectionConstantBuffer();
HRESULT STDMETHODCALLTYPE GetDesc(
D3D10_SHADER_BUFFER_DESC* pDesc);
ID3D10ShaderReflectionVariable* STDMETHODCALLTYPE GetVariableByIndex(
UINT Index);
ID3D10ShaderReflectionVariable* STDMETHODCALLTYPE GetVariableByName(
LPCSTR Name);
ID3D11ShaderReflectionConstantBuffer* STDMETHODCALLTYPE GetD3D11Iface() {
return m_d3d11;
}
private:
ID3D11ShaderReflectionConstantBuffer* m_d3d11;
std::vector<D3D10ShaderReflectionVariable> m_variables;
ID3D10ShaderReflectionVariable* FindVariable(
ID3D11ShaderReflectionVariable* pVariable);
};
class D3D10ShaderReflection : public ComObject<ID3D10ShaderReflection> {
public:
D3D10ShaderReflection(ID3D11ShaderReflection* d3d11);
~D3D10ShaderReflection();
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject);
HRESULT STDMETHODCALLTYPE GetDesc(
D3D10_SHADER_DESC* pDesc);
ID3D10ShaderReflectionConstantBuffer* STDMETHODCALLTYPE GetConstantBufferByIndex(
UINT Index);
ID3D10ShaderReflectionConstantBuffer* STDMETHODCALLTYPE GetConstantBufferByName(
LPCSTR Name);
HRESULT STDMETHODCALLTYPE GetInputParameterDesc(
UINT ParameterIndex,
D3D10_SIGNATURE_PARAMETER_DESC* pDesc);
HRESULT STDMETHODCALLTYPE GetOutputParameterDesc(
UINT ParameterIndex,
D3D10_SIGNATURE_PARAMETER_DESC* pDesc);
HRESULT STDMETHODCALLTYPE GetResourceBindingDesc(
UINT ResourceIndex,
D3D10_SHADER_INPUT_BIND_DESC* pDesc);
private:
Com<ID3D11ShaderReflection> m_d3d11;
std::vector<D3D10ShaderReflectionConstantBuffer> m_constantBuffers;
ID3D10ShaderReflectionConstantBuffer* FindConstantBuffer(
ID3D11ShaderReflectionConstantBuffer* pConstantBuffer);
void ConvertSignatureParameterDesc(
const D3D11_SIGNATURE_PARAMETER_DESC* pSrcDesc,
D3D10_SIGNATURE_PARAMETER_DESC* pDstDesc);
};
}

View File

@ -1,435 +0,0 @@
#include "d3d10_state_block.h"
#define MAKE_STATE_TYPE(field, count) { offsetof(D3D10_STATE_BLOCK_MASK, field), count }
namespace dxvk {
static const std::array<std::pair<size_t, size_t>, 24> g_stateTypes = {{
MAKE_STATE_TYPE(SOBuffers, 1),
MAKE_STATE_TYPE(OMRenderTargets, 1),
MAKE_STATE_TYPE(OMDepthStencilState, 1),
MAKE_STATE_TYPE(OMBlendState, 1),
MAKE_STATE_TYPE(VS, 1),
MAKE_STATE_TYPE(VSSamplers, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT),
MAKE_STATE_TYPE(VSShaderResources, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT),
MAKE_STATE_TYPE(VSConstantBuffers, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT),
MAKE_STATE_TYPE(GS, 1),
MAKE_STATE_TYPE(GSSamplers, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT),
MAKE_STATE_TYPE(GSShaderResources, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT),
MAKE_STATE_TYPE(GSConstantBuffers, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT),
MAKE_STATE_TYPE(PS, 1),
MAKE_STATE_TYPE(PSSamplers, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT),
MAKE_STATE_TYPE(PSShaderResources, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT),
MAKE_STATE_TYPE(PSConstantBuffers, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT),
MAKE_STATE_TYPE(IAVertexBuffers, D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT),
MAKE_STATE_TYPE(IAIndexBuffer, 1),
MAKE_STATE_TYPE(IAInputLayout, 1),
MAKE_STATE_TYPE(IAPrimitiveTopology, 1),
MAKE_STATE_TYPE(RSViewports, 1),
MAKE_STATE_TYPE(RSScissorRects, 1),
MAKE_STATE_TYPE(RSRasterizerState, 1),
MAKE_STATE_TYPE(Predication, 1),
}};
// MinGW fails on __uuidof(ID3D10StateBlock), winelib builds fail to link
const GUID D3D10StateBlock::guid = {0x0803425a,0x57f5,0x4dd6,{0x94,0x65,0xa8,0x75,0x70,0x83,0x4a,0x08}};
D3D10StateBlock::D3D10StateBlock(
ID3D10Device* pDevice,
const D3D10_STATE_BLOCK_MASK* pMask)
: m_device(pDevice), m_mask(*pMask) {
}
D3D10StateBlock::~D3D10StateBlock() {
}
HRESULT STDMETHODCALLTYPE D3D10StateBlock::QueryInterface(
REFIID riid,
void** ppvObject) {
if (ppvObject == nullptr)
return E_POINTER;
*ppvObject = nullptr;
if (riid == __uuidof(IUnknown)
|| riid == D3D10StateBlock::guid) {
*ppvObject = ref(this);
return S_OK;
}
Logger::warn("D3D10StateBlock::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
return E_NOINTERFACE;
}
HRESULT STDMETHODCALLTYPE D3D10StateBlock::Capture() {
m_state = D3D10_STATE_BLOCK_STATE();
if (TestBit(&m_mask.VS, 0)) m_device->VSGetShader(&m_state.vs);
if (TestBit(&m_mask.GS, 0)) m_device->GSGetShader(&m_state.gs);
if (TestBit(&m_mask.PS, 0)) m_device->PSGetShader(&m_state.ps);
for (uint32_t i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; i++) {
if (TestBit(m_mask.VSSamplers, i)) m_device->VSGetSamplers(i, 1, &m_state.vsSso[i]);
if (TestBit(m_mask.GSSamplers, i)) m_device->GSGetSamplers(i, 1, &m_state.gsSso[i]);
if (TestBit(m_mask.PSSamplers, i)) m_device->PSGetSamplers(i, 1, &m_state.psSso[i]);
}
for (uint32_t i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; i++) {
if (TestBit(m_mask.VSShaderResources, i)) m_device->VSGetShaderResources(i, 1, &m_state.vsSrv[i]);
if (TestBit(m_mask.GSShaderResources, i)) m_device->GSGetShaderResources(i, 1, &m_state.gsSrv[i]);
if (TestBit(m_mask.PSShaderResources, i)) m_device->PSGetShaderResources(i, 1, &m_state.psSrv[i]);
}
for (uint32_t i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; i++) {
if (TestBit(m_mask.VSConstantBuffers, i)) m_device->VSGetConstantBuffers(i, 1, &m_state.vsCbo[i]);
if (TestBit(m_mask.GSConstantBuffers, i)) m_device->GSGetConstantBuffers(i, 1, &m_state.gsCbo[i]);
if (TestBit(m_mask.PSConstantBuffers, i)) m_device->PSGetConstantBuffers(i, 1, &m_state.psCbo[i]);
}
for (uint32_t i = 0; i < D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; i++) {
if (TestBit(m_mask.IAVertexBuffers, i)) {
m_device->IAGetVertexBuffers(i, 1,
&m_state.iaVertexBuffers[i],
&m_state.iaVertexOffsets[i],
&m_state.iaVertexStrides[i]);
}
}
if (TestBit(&m_mask.IAIndexBuffer, 0)) {
m_device->IAGetIndexBuffer(
&m_state.iaIndexBuffer,
&m_state.iaIndexFormat,
&m_state.iaIndexOffset);
}
if (TestBit(&m_mask.IAInputLayout, 0))
m_device->IAGetInputLayout(&m_state.iaInputLayout);
if (TestBit(&m_mask.IAPrimitiveTopology, 0))
m_device->IAGetPrimitiveTopology(&m_state.iaTopology);
if (TestBit(&m_mask.OMRenderTargets, 0)) {
m_device->OMGetRenderTargets(
D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT,
&m_state.omRtv[0], &m_state.omDsv);
}
if (TestBit(&m_mask.OMDepthStencilState, 0)) {
m_device->OMGetDepthStencilState(
&m_state.omDepthStencilState,
&m_state.omStencilRef);
}
if (TestBit(&m_mask.OMBlendState, 0)) {
m_device->OMGetBlendState(
&m_state.omBlendState,
m_state.omBlendFactor,
&m_state.omSampleMask);
}
if (TestBit(&m_mask.RSViewports, 0)) {
m_device->RSGetViewports(&m_state.rsViewportCount, nullptr);
m_device->RSGetViewports(&m_state.rsViewportCount, m_state.rsViewports);
}
if (TestBit(&m_mask.RSScissorRects, 0)) {
m_device->RSGetScissorRects(&m_state.rsScissorCount, nullptr);
m_device->RSGetScissorRects(&m_state.rsScissorCount, m_state.rsScissors);
}
if (TestBit(&m_mask.RSRasterizerState, 0))
m_device->RSGetState(&m_state.rsState);
if (TestBit(&m_mask.SOBuffers, 0)) {
m_device->SOGetTargets(
D3D10_SO_BUFFER_SLOT_COUNT,
&m_state.soBuffers[0],
&m_state.soOffsets[0]);
}
if (TestBit(&m_mask.Predication, 0))
m_device->GetPredication(&m_state.predicate, &m_state.predicateInvert);
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D10StateBlock::Apply() {
if (TestBit(&m_mask.VS, 0)) m_device->VSSetShader(m_state.vs.ptr());
if (TestBit(&m_mask.GS, 0)) m_device->GSSetShader(m_state.gs.ptr());
if (TestBit(&m_mask.PS, 0)) m_device->PSSetShader(m_state.ps.ptr());
for (uint32_t i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; i++) {
if (TestBit(m_mask.VSSamplers, i)) m_device->VSSetSamplers(i, 1, &m_state.vsSso[i]);
if (TestBit(m_mask.GSSamplers, i)) m_device->GSSetSamplers(i, 1, &m_state.gsSso[i]);
if (TestBit(m_mask.PSSamplers, i)) m_device->PSSetSamplers(i, 1, &m_state.psSso[i]);
}
for (uint32_t i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; i++) {
if (TestBit(m_mask.VSShaderResources, i)) m_device->VSSetShaderResources(i, 1, &m_state.vsSrv[i]);
if (TestBit(m_mask.GSShaderResources, i)) m_device->GSSetShaderResources(i, 1, &m_state.gsSrv[i]);
if (TestBit(m_mask.PSShaderResources, i)) m_device->PSSetShaderResources(i, 1, &m_state.psSrv[i]);
}
for (uint32_t i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; i++) {
if (TestBit(m_mask.VSConstantBuffers, i)) m_device->VSSetConstantBuffers(i, 1, &m_state.vsCbo[i]);
if (TestBit(m_mask.GSConstantBuffers, i)) m_device->GSSetConstantBuffers(i, 1, &m_state.gsCbo[i]);
if (TestBit(m_mask.PSConstantBuffers, i)) m_device->PSSetConstantBuffers(i, 1, &m_state.psCbo[i]);
}
for (uint32_t i = 0; i < D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; i++) {
if (TestBit(m_mask.IAVertexBuffers, i)) {
m_device->IASetVertexBuffers(i, 1,
&m_state.iaVertexBuffers[i],
&m_state.iaVertexOffsets[i],
&m_state.iaVertexStrides[i]);
}
}
if (TestBit(&m_mask.IAIndexBuffer, 0)) {
m_device->IASetIndexBuffer(
m_state.iaIndexBuffer.ptr(),
m_state.iaIndexFormat,
m_state.iaIndexOffset);
}
if (TestBit(&m_mask.IAInputLayout, 0))
m_device->IASetInputLayout(m_state.iaInputLayout.ptr());
if (TestBit(&m_mask.IAPrimitiveTopology, 0))
m_device->IASetPrimitiveTopology(m_state.iaTopology);
if (TestBit(&m_mask.OMRenderTargets, 0)) {
m_device->OMSetRenderTargets(
D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT,
&m_state.omRtv[0], m_state.omDsv.ptr());
}
if (TestBit(&m_mask.OMDepthStencilState, 0)) {
m_device->OMSetDepthStencilState(
m_state.omDepthStencilState.ptr(),
m_state.omStencilRef);
}
if (TestBit(&m_mask.OMBlendState, 0)) {
m_device->OMSetBlendState(
m_state.omBlendState.ptr(),
m_state.omBlendFactor,
m_state.omSampleMask);
}
if (TestBit(&m_mask.RSViewports, 0))
m_device->RSSetViewports(m_state.rsViewportCount, m_state.rsViewports);
if (TestBit(&m_mask.RSScissorRects, 0))
m_device->RSSetScissorRects(m_state.rsScissorCount, m_state.rsScissors);
if (TestBit(&m_mask.RSRasterizerState, 0))
m_device->RSSetState(m_state.rsState.ptr());
if (TestBit(&m_mask.SOBuffers, 0)) {
m_device->SOSetTargets(
D3D10_SO_BUFFER_SLOT_COUNT,
&m_state.soBuffers[0],
&m_state.soOffsets[0]);
}
if (TestBit(&m_mask.Predication, 0))
m_device->SetPredication(m_state.predicate.ptr(), m_state.predicateInvert);
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D10StateBlock::GetDevice(
ID3D10Device** ppDevice) {
Logger::err("D3D10StateBlock::GetDevice: Stub");
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE D3D10StateBlock::ReleaseAllDeviceObjects() {
// Not entirely sure if this is correct?
m_state = D3D10_STATE_BLOCK_STATE();
return S_OK;
}
BOOL D3D10StateBlock::TestBit(
const BYTE* pMask,
UINT Idx) {
uint32_t byte = Idx / 8;
uint32_t bit = Idx % 8;
return (pMask[byte] & (1 << bit)) != 0;
}
}
extern "C" {
using namespace dxvk;
HRESULT STDMETHODCALLTYPE D3D10CreateStateBlock(
ID3D10Device* pDevice,
D3D10_STATE_BLOCK_MASK* pStateBlockMask,
ID3D10StateBlock** ppStateBlock) {
InitReturnPtr(ppStateBlock);
if (!pDevice || !pStateBlockMask || !ppStateBlock)
return E_INVALIDARG;
*ppStateBlock = ref(new D3D10StateBlock(pDevice, pStateBlockMask));
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D10StateBlockMaskEnableCapture(
D3D10_STATE_BLOCK_MASK* pMask,
D3D10_DEVICE_STATE_TYPES StateType,
UINT StartIdx,
UINT Count) {
if (!pMask || !StateType || StateType > g_stateTypes.size())
return E_INVALIDARG;
auto pair = g_stateTypes[uint32_t(StateType) - 1];
auto mask = reinterpret_cast<BYTE*>(pMask) + pair.first;
if (StartIdx + Count > pair.second)
return E_INVALIDARG;
for (uint32_t i = StartIdx; i < StartIdx + Count; i++) {
uint32_t byte = i / 8;
uint32_t bit = i % 8;
mask[byte] |= 1 << bit;
}
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D10StateBlockMaskDisableCapture(
D3D10_STATE_BLOCK_MASK* pMask,
D3D10_DEVICE_STATE_TYPES StateType,
UINT StartIdx,
UINT Count) {
if (!pMask || !StateType || StateType > g_stateTypes.size())
return E_INVALIDARG;
auto pair = g_stateTypes[uint32_t(StateType) - 1];
auto mask = reinterpret_cast<BYTE*>(pMask) + pair.first;
if (StartIdx + Count > pair.second)
return E_INVALIDARG;
for (uint32_t i = StartIdx; i < StartIdx + Count; i++) {
uint32_t byte = i / 8;
uint32_t bit = i % 8;
mask[byte] &= ~(1 << bit);
}
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D10StateBlockMaskEnableAll(
D3D10_STATE_BLOCK_MASK* pMask) {
if (!pMask)
return E_INVALIDARG;
*pMask = D3D10_STATE_BLOCK_MASK();
for (size_t i = 0; i < g_stateTypes.size(); i++) {
D3D10StateBlockMaskEnableCapture(pMask,
D3D10_DEVICE_STATE_TYPES(i + 1),
0, g_stateTypes[i].second);
}
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D10StateBlockMaskDisableAll(
D3D10_STATE_BLOCK_MASK* pMask) {
if (!pMask)
return E_INVALIDARG;
*pMask = D3D10_STATE_BLOCK_MASK();
return S_OK;
}
BOOL STDMETHODCALLTYPE D3D10StateBlockMaskGetSetting(
D3D10_STATE_BLOCK_MASK* pMask,
D3D10_DEVICE_STATE_TYPES StateType,
UINT Idx) {
if (!pMask || !StateType || StateType > g_stateTypes.size())
return FALSE;
auto pair = g_stateTypes[uint32_t(StateType) - 1];
auto mask = reinterpret_cast<BYTE*>(pMask) + pair.first;
if (Idx >= pair.second)
return FALSE;
uint32_t byte = Idx / 8;
uint32_t bit = Idx % 8;
return (mask[byte] & (1 << bit)) != 0;
}
HRESULT STDMETHODCALLTYPE D3D10StateBlockMaskDifference(
D3D10_STATE_BLOCK_MASK* pA,
D3D10_STATE_BLOCK_MASK* pB,
D3D10_STATE_BLOCK_MASK* pResult) {
if (!pA || !pB || !pResult)
return E_INVALIDARG;
auto a = reinterpret_cast<const BYTE*>(pA);
auto b = reinterpret_cast<const BYTE*>(pB);
auto r = reinterpret_cast<BYTE*>(pResult);
for (size_t i = 0; i < sizeof(D3D10_STATE_BLOCK_MASK); i++)
r[i] = a[i] ^ b[i];
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D10StateBlockMaskIntersect(
D3D10_STATE_BLOCK_MASK* pA,
D3D10_STATE_BLOCK_MASK* pB,
D3D10_STATE_BLOCK_MASK* pResult) {
if (!pA || !pB || !pResult)
return E_INVALIDARG;
auto a = reinterpret_cast<const BYTE*>(pA);
auto b = reinterpret_cast<const BYTE*>(pB);
auto r = reinterpret_cast<BYTE*>(pResult);
for (size_t i = 0; i < sizeof(D3D10_STATE_BLOCK_MASK); i++)
r[i] = a[i] & b[i];
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D10StateBlockMaskUnion(
D3D10_STATE_BLOCK_MASK* pA,
D3D10_STATE_BLOCK_MASK* pB,
D3D10_STATE_BLOCK_MASK* pResult) {
if (!pA || !pB || !pResult)
return E_INVALIDARG;
auto a = reinterpret_cast<const BYTE*>(pA);
auto b = reinterpret_cast<const BYTE*>(pB);
auto r = reinterpret_cast<BYTE*>(pResult);
for (size_t i = 0; i < sizeof(D3D10_STATE_BLOCK_MASK); i++)
r[i] = a[i] | b[i];
return S_OK;
}
}

View File

@ -1,83 +0,0 @@
#pragma once
#include "d3d10_include.h"
namespace dxvk {
struct D3D10_STATE_BLOCK_STATE {
Com<ID3D10VertexShader> vs = { };
Com<ID3D10SamplerState> vsSso[D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT] = { };
Com<ID3D10ShaderResourceView> vsSrv[D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT] = { };
Com<ID3D10Buffer> vsCbo[D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT] = { };
Com<ID3D10GeometryShader> gs = { };
Com<ID3D10SamplerState> gsSso[D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT] = { };
Com<ID3D10ShaderResourceView> gsSrv[D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT] = { };
Com<ID3D10Buffer> gsCbo[D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT] = { };
Com<ID3D10PixelShader> ps = { };
Com<ID3D10SamplerState> psSso[D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT] = { };
Com<ID3D10ShaderResourceView> psSrv[D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT] = { };
Com<ID3D10Buffer> psCbo[D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT] = { };
Com<ID3D10Buffer> iaVertexBuffers[D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT] = { };
UINT iaVertexOffsets[D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT] = { };
UINT iaVertexStrides[D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT] = { };
Com<ID3D10Buffer> iaIndexBuffer = { };
DXGI_FORMAT iaIndexFormat = DXGI_FORMAT_UNKNOWN;
UINT iaIndexOffset = 0;
Com<ID3D10InputLayout> iaInputLayout = nullptr;
D3D10_PRIMITIVE_TOPOLOGY iaTopology = D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED;
Com<ID3D10RenderTargetView> omRtv[D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT] = { };
Com<ID3D10DepthStencilView> omDsv = { };
Com<ID3D10DepthStencilState> omDepthStencilState = { };
UINT omStencilRef = 0;
Com<ID3D10BlendState> omBlendState = { };
FLOAT omBlendFactor[4] = { };
UINT omSampleMask = 0;
UINT rsViewportCount = 0;
D3D10_VIEWPORT rsViewports[D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE] = { };
UINT rsScissorCount = 0;
RECT rsScissors [D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE] = { };
Com<ID3D10RasterizerState> rsState = { };
Com<ID3D10Buffer> soBuffers[D3D10_SO_BUFFER_SLOT_COUNT] = { };
UINT soOffsets[D3D10_SO_BUFFER_SLOT_COUNT] = { };
Com<ID3D10Predicate> predicate = { };
BOOL predicateInvert = FALSE;
};
class D3D10StateBlock : public ComObject<ID3D10StateBlock> {
public:
static const GUID guid;
D3D10StateBlock(
ID3D10Device* pDevice,
const D3D10_STATE_BLOCK_MASK* pMask);
~D3D10StateBlock();
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject);
HRESULT STDMETHODCALLTYPE Capture();
HRESULT STDMETHODCALLTYPE Apply();
HRESULT STDMETHODCALLTYPE GetDevice(
ID3D10Device** ppDevice);
HRESULT STDMETHODCALLTYPE ReleaseAllDeviceObjects();
private:
Com<ID3D10Device> m_device;
D3D10_STATE_BLOCK_MASK m_mask;
D3D10_STATE_BLOCK_STATE m_state;
static BOOL TestBit(
const BYTE* pMask,
UINT Idx);
};
}

View File

@ -111,7 +111,7 @@ namespace dxvk {
pDesc->ArraySize = d3d11Desc.ArraySize;
pDesc->Format = d3d11Desc.Format;
pDesc->Usage = D3D10_USAGE(d3d11Desc.Usage);
pDesc->BindFlags = d3d11Desc.BindFlags & 0x7F;
pDesc->BindFlags = d3d11Desc.BindFlags;
pDesc->CPUAccessFlags = d3d11Desc.CPUAccessFlags;
pDesc->MiscFlags = ConvertD3D11ResourceFlags(d3d11Desc.MiscFlags);
}
@ -224,7 +224,7 @@ namespace dxvk {
pDesc->Format = d3d11Desc.Format;
pDesc->SampleDesc = d3d11Desc.SampleDesc;
pDesc->Usage = D3D10_USAGE(d3d11Desc.Usage);
pDesc->BindFlags = d3d11Desc.BindFlags & 0x7F;
pDesc->BindFlags = d3d11Desc.BindFlags;
pDesc->CPUAccessFlags = d3d11Desc.CPUAccessFlags;
pDesc->MiscFlags = ConvertD3D11ResourceFlags(d3d11Desc.MiscFlags);
}
@ -337,7 +337,7 @@ namespace dxvk {
pDesc->MipLevels = d3d11Desc.MipLevels;
pDesc->Format = d3d11Desc.Format;
pDesc->Usage = D3D10_USAGE(d3d11Desc.Usage);
pDesc->BindFlags = d3d11Desc.BindFlags & 0x7F;
pDesc->BindFlags = d3d11Desc.BindFlags;
pDesc->CPUAccessFlags = d3d11Desc.CPUAccessFlags;
pDesc->MiscFlags = ConvertD3D11ResourceFlags(d3d11Desc.MiscFlags);
}

View File

@ -16,8 +16,8 @@ namespace dxvk {
public:
D3D10Texture1D(D3D11Texture1D* pParent, D3D10Device* pDevice)
: m_device(pDevice), m_d3d11(pParent) { }
D3D10Texture1D(D3D11Texture1D* pParent)
: m_d3d11(pParent) { }
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
@ -70,7 +70,6 @@ namespace dxvk {
private:
D3D10Device* m_device;
D3D11Texture1D* m_d3d11;
};
@ -82,8 +81,8 @@ namespace dxvk {
public:
D3D10Texture2D(D3D11Texture2D* pParent, D3D10Device* pDevice)
: m_device(pDevice), m_d3d11(pParent) { }
D3D10Texture2D(D3D11Texture2D* pParent)
: m_d3d11(pParent) { }
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
@ -136,7 +135,6 @@ namespace dxvk {
private:
D3D10Device* m_device;
D3D11Texture2D* m_d3d11;
};
@ -148,8 +146,8 @@ namespace dxvk {
public:
D3D10Texture3D(D3D11Texture3D* pParent, D3D10Device* pDevice)
: m_device(pDevice), m_d3d11(pParent) { }
D3D10Texture3D(D3D11Texture3D* pParent)
: m_d3d11(pParent) { }
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
@ -202,7 +200,6 @@ namespace dxvk {
private:
D3D10Device* m_device;
D3D11Texture3D* m_d3d11;
};

View File

@ -1,3 +1,5 @@
LIBRARY D3D10CORE.DLL
EXPORTS
D3D10CoreCreateDevice
D3D10CoreGetVersion
D3D10CoreRegisterLayers

View File

@ -1 +0,0 @@
@ stdcall D3D10CoreCreateDevice(ptr ptr long long ptr)

9
src/d3d10/d3d10core.sym Normal file
View File

@ -0,0 +1,9 @@
{
global:
D3D10CoreCreateDevice;
D3D10CoreGetVersion;
D3D10CoreRegisterLayers;
local:
*;
};

View File

@ -1,43 +1,37 @@
d3d10_res = wrc_generator.process('version10.rc')
d3d10_1_res = wrc_generator.process('version10_1.rc')
d3d10_core_res = wrc_generator.process('version10_core.rc')
d3d10_main_src = [
'd3d10_main.cpp',
'd3d10_reflection.cpp',
'd3d10_state_block.cpp',
d3d10_core_src = [
'd3d10_core.cpp',
]
d3d10_deps = [ lib_d3dcompiler_43, lib_dxgi ]
d3d10_deps += dxvk_winelib ? lib_d3d11 : d3d11_dep
d3d10_core_ld_args = []
d3d10_core_link_depends = []
d3d10_core_dll = shared_library('d3d10core'+dll_ext, d3d10_main_src, d3d10_core_res,
name_prefix : '',
dependencies : [ d3d10_deps, dxbc_dep, dxvk_dep ],
if platform == 'windows'
d3d10_d3d11_dep = lib_d3d11
else
d3d10_core_ld_args += [ '-Wl,--version-script', join_paths(meson.current_source_dir(), 'd3d10core.sym') ]
d3d10_core_link_depends += files('d3d10core.sym')
d3d10_d3d11_dep = d3d11_dep
endif
d3d10_core_dll = shared_library(dxvk_name_prefix+'d3d10core', d3d10_core_src, d3d10_core_res,
dependencies : [ d3d10_d3d11_dep ],
include_directories : dxvk_include_path,
install : true,
objects : not dxvk_msvc ? 'd3d10core'+def_spec_ext : [],
vs_module_defs : 'd3d10core'+def_spec_ext,
override_options : ['cpp_std='+dxvk_cpp_std])
link_args : d3d10_core_ld_args,
link_depends : [ d3d10_core_link_depends ],
kwargs : dxvk_so_version,
)
d3d10_dll = shared_library('d3d10'+dll_ext, d3d10_main_src, d3d10_res,
name_prefix : '',
dependencies : [ d3d10_deps, dxbc_dep, dxvk_dep ],
include_directories : dxvk_include_path,
install : true,
objects : not dxvk_msvc ? 'd3d10'+def_spec_ext : [],
vs_module_defs : 'd3d10'+def_spec_ext,
override_options : ['cpp_std='+dxvk_cpp_std])
d3d10_core_dep = declare_dependency(
link_with : [ d3d10_core_dll ],
)
d3d10_1_dll = shared_library('d3d10_1'+dll_ext, d3d10_main_src, d3d10_1_res,
name_prefix : '',
dependencies : [ d3d10_deps, dxbc_dep, dxvk_dep ],
include_directories : dxvk_include_path,
install : true,
objects : not dxvk_msvc ? 'd3d10_1'+def_spec_ext : [],
vs_module_defs : 'd3d10_1'+def_spec_ext,
override_options : ['cpp_std='+dxvk_cpp_std])
d3d10_dep = declare_dependency(
link_with : [ d3d10_dll, d3d10_1_dll, d3d10_core_dll ],
include_directories : [ dxvk_include_path ])
if platform != 'windows'
pkg.generate(d3d10_core_dll,
filebase: dxvk_pkg_prefix + 'd3d10core',
subdirs: 'dxvk',
)
endif

View File

@ -1,32 +0,0 @@
#include <windows.h>
// DLL version information.
VS_VERSION_INFO VERSIONINFO
FILEVERSION 10,0,17763,1
PRODUCTVERSION 10,0,17763,1
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080904b0"
BEGIN
VALUE "CompanyName", "DXVK"
VALUE "FileDescription", "Direct3D 10.1 Runtime"
VALUE "FileVersion", "10.0.17763.1 (WinBuild.160101.0800)"
VALUE "InternalName", "D3D10_1.dll"
VALUE "LegalCopyright", "zlib/libpng license"
VALUE "OriginalFilename", "D3D10_1.dll"
VALUE "ProductName", "DXVK"
VALUE "ProductVersion", "10.0.17763.1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0809, 1200
END
END

View File

@ -1,5 +1,6 @@
LIBRARY D3D11.DLL
EXPORTS
D3D11CoreCreateDevice
D3D11CreateDevice
D3D11CreateDeviceAndSwapChain
D3D11CoreCreateDevice @18
D3D11CreateDevice @22
D3D11CreateDeviceAndSwapChain @23
D3D11On12CreateDevice @24

View File

@ -1,3 +0,0 @@
@ stdcall D3D11CreateDevice(ptr long ptr long ptr long long ptr ptr ptr)
@ stdcall D3D11CreateDeviceAndSwapChain(ptr long ptr long ptr long long ptr ptr ptr ptr ptr)
@ stdcall D3D11CoreCreateDevice(ptr ptr long ptr long ptr)

10
src/d3d11/d3d11.sym Normal file
View File

@ -0,0 +1,10 @@
{
global:
D3D11CoreCreateDevice;
D3D11CreateDevice;
D3D11CreateDeviceAndSwapChain;
D3D11On12CreateDevice;
local:
*;
};

View File

@ -1,55 +1,142 @@
#include "d3d11_annotation.h"
#include "d3d11_context_def.h"
#include "d3d11_context_imm.h"
#include "d3d11_device.h"
#include "../util/util_misc.h"
#include "../util/util_win32_compat.h"
namespace dxvk {
D3D11UserDefinedAnnotation::D3D11UserDefinedAnnotation(ID3D11DeviceContext* ctx)
: m_container(ctx) { }
template <bool Register>
static void RegisterUserDefinedAnnotation(IDXVKUserDefinedAnnotation* annotation) {
using RegistrationFunctionType = void(__stdcall *)(IDXVKUserDefinedAnnotation*);
static const int16_t RegisterOrdinal = 28257;
static const int16_t UnregisterOrdinal = 28258;
HMODULE d3d9Module = ::LoadLibraryA("d3d9.dll");
if (!d3d9Module) {
Logger::info("Unable to find d3d9, some annotations may be missed.");
return;
}
D3D11UserDefinedAnnotation::~D3D11UserDefinedAnnotation() {
const int16_t ordinal = Register ? RegisterOrdinal : UnregisterOrdinal;
auto registrationFunction = reinterpret_cast<RegistrationFunctionType>(::GetProcAddress(d3d9Module,
reinterpret_cast<const char*>(static_cast<uintptr_t>(ordinal))));
if (!registrationFunction) {
Logger::info("Unable to find DXVK_RegisterAnnotation, some annotations may be missed.");
return;
}
registrationFunction(annotation);
}
ULONG STDMETHODCALLTYPE D3D11UserDefinedAnnotation::AddRef() {
template<typename ContextType>
D3D11UserDefinedAnnotation<ContextType>::D3D11UserDefinedAnnotation(
ContextType* container,
const Rc<DxvkDevice>& dxvkDevice)
: m_container(container), m_eventDepth(0),
m_annotationsEnabled(dxvkDevice->instance()->extensions().extDebugUtils) {
if (!IsDeferred && m_annotationsEnabled)
RegisterUserDefinedAnnotation<true>(this);
}
template<typename ContextType>
D3D11UserDefinedAnnotation<ContextType>::~D3D11UserDefinedAnnotation() {
if (!IsDeferred && m_annotationsEnabled)
RegisterUserDefinedAnnotation<false>(this);
}
template<typename ContextType>
ULONG STDMETHODCALLTYPE D3D11UserDefinedAnnotation<ContextType>::AddRef() {
return m_container->AddRef();
}
ULONG STDMETHODCALLTYPE D3D11UserDefinedAnnotation::Release() {
template<typename ContextType>
ULONG STDMETHODCALLTYPE D3D11UserDefinedAnnotation<ContextType>::Release() {
return m_container->Release();
}
HRESULT STDMETHODCALLTYPE D3D11UserDefinedAnnotation::QueryInterface(
template<typename ContextType>
HRESULT STDMETHODCALLTYPE D3D11UserDefinedAnnotation<ContextType>::QueryInterface(
REFIID riid,
void** ppvObject) {
return m_container->QueryInterface(riid, ppvObject);
}
INT STDMETHODCALLTYPE D3D11UserDefinedAnnotation::BeginEvent(
template<typename ContextType>
INT STDMETHODCALLTYPE D3D11UserDefinedAnnotation<ContextType>::BeginEvent(
D3DCOLOR Color,
LPCWSTR Name) {
// Currently not implemented
return -1;
if (!m_annotationsEnabled)
return -1;
D3D10DeviceLock lock = m_container->LockContext();
m_container->EmitCs([color = Color, labelName = dxvk::str::fromws(Name)](DxvkContext *ctx) {
VkDebugUtilsLabelEXT label;
label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
label.pNext = nullptr;
label.pLabelName = labelName.c_str();
DecodeD3DCOLOR(color, label.color);
ctx->beginDebugLabel(&label);
});
return m_eventDepth++;
}
INT STDMETHODCALLTYPE D3D11UserDefinedAnnotation::EndEvent() {
// Currently not implemented
return -1;
template<typename ContextType>
INT STDMETHODCALLTYPE D3D11UserDefinedAnnotation<ContextType>::EndEvent() {
if (!m_annotationsEnabled)
return -1;
D3D10DeviceLock lock = m_container->LockContext();
m_container->EmitCs([](DxvkContext *ctx) {
ctx->endDebugLabel();
});
return m_eventDepth--;
}
void STDMETHODCALLTYPE D3D11UserDefinedAnnotation::SetMarker(
template<typename ContextType>
void STDMETHODCALLTYPE D3D11UserDefinedAnnotation<ContextType>::SetMarker(
D3DCOLOR Color,
LPCWSTR Name) {
// Currently not implemented
if (!m_annotationsEnabled)
return;
D3D10DeviceLock lock = m_container->LockContext();
m_container->EmitCs([color = Color, labelName = dxvk::str::fromws(Name)](DxvkContext *ctx) {
VkDebugUtilsLabelEXT label;
label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
label.pNext = nullptr;
label.pLabelName = labelName.c_str();
DecodeD3DCOLOR(color, label.color);
ctx->insertDebugLabel(&label);
});
}
BOOL STDMETHODCALLTYPE D3D11UserDefinedAnnotation::GetStatus() {
// Currently not implemented
return FALSE;
template<typename ContextType>
BOOL STDMETHODCALLTYPE D3D11UserDefinedAnnotation<ContextType>::GetStatus() {
return m_annotationsEnabled;
}
}
template class D3D11UserDefinedAnnotation<D3D11DeferredContext>;
template class D3D11UserDefinedAnnotation<D3D11ImmediateContext>;
}

View File

@ -1,16 +1,31 @@
#pragma once
#include <type_traits>
#include "d3d11_include.h"
#include "../dxvk/dxvk_annotation.h"
#include "../dxvk/dxvk_device.h"
namespace dxvk {
class D3D11UserDefinedAnnotation : ID3DUserDefinedAnnotation {
class D3D11DeferredContext;
class D3D11ImmediateContext;
template<typename ContextType>
class D3D11UserDefinedAnnotation final : public IDXVKUserDefinedAnnotation {
constexpr static bool IsDeferred = std::is_same_v<ContextType, D3D11DeferredContext>;
public:
D3D11UserDefinedAnnotation(ID3D11DeviceContext* ctx);
D3D11UserDefinedAnnotation(
ContextType* container,
const Rc<DxvkDevice>& dxvkDevice);
~D3D11UserDefinedAnnotation();
D3D11UserDefinedAnnotation (const D3D11UserDefinedAnnotation&) = delete;
D3D11UserDefinedAnnotation& operator = (const D3D11UserDefinedAnnotation&) = delete;
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
@ -20,19 +35,22 @@ namespace dxvk {
void** ppvObject);
INT STDMETHODCALLTYPE BeginEvent(
D3DCOLOR Color,
LPCWSTR Name);
INT STDMETHODCALLTYPE EndEvent();
void STDMETHODCALLTYPE SetMarker(
D3DCOLOR Color,
LPCWSTR Name);
BOOL STDMETHODCALLTYPE GetStatus();
private:
ID3D11DeviceContext* m_container;
ContextType* m_container;
int32_t m_eventDepth;
bool m_annotationsEnabled;
};
}
}

View File

@ -6,7 +6,8 @@ namespace dxvk {
D3D11BlendState::D3D11BlendState(
D3D11Device* device,
const D3D11_BLEND_DESC1& desc)
: m_device(device), m_desc(desc), m_d3d10(this) {
: D3D11StateObject<ID3D11BlendState1>(device),
m_desc(desc), m_d3d10(this) {
// If Independent Blend is disabled, we must ignore the
// blend modes for render target 1 to 7. In Vulkan, all
// blend modes need to be identical in that case.
@ -34,8 +35,8 @@ namespace dxvk {
D3D11BlendState::~D3D11BlendState() {
}
HRESULT STDMETHODCALLTYPE D3D11BlendState::QueryInterface(REFIID riid, void** ppvObject) {
if (ppvObject == nullptr)
return E_POINTER;
@ -57,17 +58,15 @@ namespace dxvk {
return S_OK;
}
Logger::warn("D3D11BlendState::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
if (logQueryInterfaceError(__uuidof(ID3D11BlendState), riid)) {
Logger::warn("D3D11BlendState::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
}
return E_NOINTERFACE;
}
void STDMETHODCALLTYPE D3D11BlendState::GetDevice(ID3D11Device** ppDevice) {
*ppDevice = ref(m_device);
}
void STDMETHODCALLTYPE D3D11BlendState::GetDesc(D3D11_BLEND_DESC* pDesc) {
pDesc->AlphaToCoverageEnable = m_desc.AlphaToCoverageEnable;
pDesc->IndependentBlendEnable = m_desc.IndependentBlendEnable;
@ -91,7 +90,7 @@ namespace dxvk {
void D3D11BlendState::BindToContext(
const Rc<DxvkContext>& ctx,
DxvkContext* ctx,
uint32_t sampleMask) const {
// We handled Independent Blend during object creation
// already, so if it is disabled, all elements in the
@ -109,31 +108,6 @@ namespace dxvk {
}
D3D11_BLEND_DESC1 D3D11BlendState::DefaultDesc() {
D3D11_BLEND_DESC1 dstDesc;
dstDesc.AlphaToCoverageEnable = FALSE;
dstDesc.IndependentBlendEnable = FALSE;
// 1-7 must be ignored if IndependentBlendEnable is disabled so
// technically this is not needed, but since this structure is
// going to be copied around we'll initialize it nonetheless
for (uint32_t i = 0; i < 8; i++) {
dstDesc.RenderTarget[i].BlendEnable = FALSE;
dstDesc.RenderTarget[i].LogicOpEnable = FALSE;
dstDesc.RenderTarget[i].SrcBlend = D3D11_BLEND_ONE;
dstDesc.RenderTarget[i].DestBlend = D3D11_BLEND_ZERO;
dstDesc.RenderTarget[i].BlendOp = D3D11_BLEND_OP_ADD;
dstDesc.RenderTarget[i].SrcBlendAlpha = D3D11_BLEND_ONE;
dstDesc.RenderTarget[i].DestBlendAlpha = D3D11_BLEND_ZERO;
dstDesc.RenderTarget[i].BlendOpAlpha = D3D11_BLEND_OP_ADD;
dstDesc.RenderTarget[i].LogicOp = D3D11_LOGIC_OP_NOOP;
dstDesc.RenderTarget[i].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
}
return dstDesc;
}
D3D11_BLEND_DESC1 D3D11BlendState::PromoteDesc(const D3D11_BLEND_DESC* pSrcDesc) {
D3D11_BLEND_DESC1 dstDesc;
dstDesc.AlphaToCoverageEnable = pSrcDesc->AlphaToCoverageEnable;
@ -157,8 +131,6 @@ namespace dxvk {
HRESULT D3D11BlendState::NormalizeDesc(D3D11_BLEND_DESC1* pDesc) {
const D3D11_BLEND_DESC1 defaultDesc = DefaultDesc();
if (pDesc->AlphaToCoverageEnable)
pDesc->AlphaToCoverageEnable = TRUE;
@ -182,12 +154,12 @@ namespace dxvk {
rt->BlendOp, rt->BlendOpAlpha))
return E_INVALIDARG;
} else {
rt->SrcBlend = defaultDesc.RenderTarget[0].SrcBlend;
rt->DestBlend = defaultDesc.RenderTarget[0].DestBlend;
rt->BlendOp = defaultDesc.RenderTarget[0].BlendOp;
rt->SrcBlendAlpha = defaultDesc.RenderTarget[0].SrcBlendAlpha;
rt->DestBlendAlpha = defaultDesc.RenderTarget[0].DestBlendAlpha;
rt->BlendOpAlpha = defaultDesc.RenderTarget[0].BlendOpAlpha;
rt->SrcBlend = D3D11_BLEND_ONE;
rt->DestBlend = D3D11_BLEND_ZERO;
rt->BlendOp = D3D11_BLEND_OP_ADD;
rt->SrcBlendAlpha = D3D11_BLEND_ONE;
rt->DestBlendAlpha = D3D11_BLEND_ZERO;
rt->BlendOpAlpha = D3D11_BLEND_OP_ADD;
}
if (rt->LogicOpEnable) {
@ -200,7 +172,7 @@ namespace dxvk {
|| !ValidateLogicOp(rt->LogicOp))
return E_INVALIDARG;
} else {
rt->LogicOp = defaultDesc.RenderTarget[0].LogicOp;
rt->LogicOp = D3D11_LOGIC_OP_NOOP;
}
if (rt->RenderTargetWriteMask > D3D11_COLOR_WRITE_ENABLE_ALL)

View File

@ -11,7 +11,7 @@ namespace dxvk {
class D3D11Device;
class D3D11BlendState : public D3D11DeviceChild<ID3D11BlendState1> {
class D3D11BlendState : public D3D11StateObject<ID3D11BlendState1> {
public:
@ -21,14 +21,11 @@ namespace dxvk {
D3D11Device* device,
const D3D11_BLEND_DESC1& desc);
~D3D11BlendState();
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject) final;
void STDMETHODCALLTYPE GetDevice(
ID3D11Device **ppDevice) final;
void STDMETHODCALLTYPE GetDesc(
D3D11_BLEND_DESC* pDesc) final;
@ -36,15 +33,13 @@ namespace dxvk {
D3D11_BLEND_DESC1* pDesc) final;
void BindToContext(
const Rc<DxvkContext>& ctx,
DxvkContext* ctx,
UINT sampleMask) const;
D3D10BlendState* GetD3D10Iface() {
return &m_d3d10;
}
static D3D11_BLEND_DESC1 DefaultDesc();
static D3D11_BLEND_DESC1 PromoteDesc(
const D3D11_BLEND_DESC* pSrcDesc);
@ -53,7 +48,6 @@ namespace dxvk {
private:
D3D11Device* const m_device;
D3D11_BLEND_DESC1 m_desc;
std::array<DxvkBlendMode, 8> m_blendModes;

View File

@ -8,12 +8,14 @@ namespace dxvk {
D3D11Buffer::D3D11Buffer(
D3D11Device* pDevice,
const D3D11_BUFFER_DESC* pDesc)
: m_device (pDevice),
const D3D11_BUFFER_DESC* pDesc,
const D3D11_ON_12_RESOURCE_INFO* p11on12Info)
: D3D11DeviceChild<ID3D11Buffer>(pDevice),
m_desc (*pDesc),
m_resource (this),
m_d3d10 (this, pDevice->GetD3D10Interface()) {
DxvkBufferCreateInfo info;
m_resource (this, pDevice),
m_d3d10 (this) {
DxvkBufferCreateInfo info;
info.flags = 0;
info.size = pDesc->ByteWidth;
info.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT
| VK_BUFFER_USAGE_TRANSFER_DST_BIT;
@ -35,13 +37,14 @@ namespace dxvk {
if (pDesc->BindFlags & D3D11_BIND_CONSTANT_BUFFER) {
info.usage |= VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
info.stages |= m_device->GetEnabledShaderStages();
info.stages |= m_parent->GetEnabledShaderStages();
info.access |= VK_ACCESS_UNIFORM_READ_BIT;
}
if (pDesc->BindFlags & D3D11_BIND_SHADER_RESOURCE) {
info.usage |= VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT;
info.stages |= m_device->GetEnabledShaderStages();
info.usage |= VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT
| VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
info.stages |= m_parent->GetEnabledShaderStages();
info.access |= VK_ACCESS_SHADER_READ_BIT;
}
@ -52,64 +55,73 @@ namespace dxvk {
}
if (pDesc->BindFlags & D3D11_BIND_UNORDERED_ACCESS) {
info.usage |= VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT;
info.stages |= m_device->GetEnabledShaderStages();
info.usage |= VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT
| VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
info.stages |= m_parent->GetEnabledShaderStages();
info.access |= VK_ACCESS_SHADER_READ_BIT
| VK_ACCESS_SHADER_WRITE_BIT;
}
if (pDesc->CPUAccessFlags & D3D11_CPU_ACCESS_WRITE) {
info.stages |= VK_PIPELINE_STAGE_HOST_BIT;
info.access |= VK_ACCESS_HOST_WRITE_BIT;
}
if (pDesc->CPUAccessFlags & D3D11_CPU_ACCESS_READ) {
info.stages |= VK_PIPELINE_STAGE_HOST_BIT;
info.access |= VK_ACCESS_HOST_READ_BIT;
}
if (pDesc->MiscFlags & D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS) {
info.usage |= VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT;
info.stages |= VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT;
info.access |= VK_ACCESS_INDIRECT_COMMAND_READ_BIT;
}
if (pDesc->MiscFlags & (
D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS |
D3D11_RESOURCE_MISC_BUFFER_STRUCTURED))
info.usage |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
// Default constant buffers may get updated frequently, in which
// case mapping the buffer is faster than using update commands.
VkMemoryPropertyFlags memoryFlags = GetMemoryFlagsForUsage(pDesc->Usage);
if ((pDesc->Usage == D3D11_USAGE_DEFAULT) && (pDesc->BindFlags & D3D11_BIND_CONSTANT_BUFFER)) {
info.stages |= VK_PIPELINE_STAGE_HOST_BIT;
info.access |= VK_ACCESS_HOST_WRITE_BIT;
memoryFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
if (pDesc->MiscFlags & D3D11_RESOURCE_MISC_TILED) {
info.flags |= VK_BUFFER_CREATE_SPARSE_BINDING_BIT
| VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT
| VK_BUFFER_CREATE_SPARSE_ALIASED_BIT;
}
// AMD cards have a device-local, host-visible memory type where
// we can put dynamic resources that need fast access by the GPU
if (pDesc->Usage == D3D11_USAGE_DYNAMIC && pDesc->BindFlags)
memoryFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
// Create the buffer and set the entire buffer slice as mapped,
// so that we only have to update it when invalidating th buffer
m_buffer = m_device->GetDXVKDevice()->createBuffer(info, memoryFlags);
m_mapped = m_buffer->getSliceHandle();
// Set host read bit as necessary. We may internally read staging
// buffer contents even if the buffer is not marked for reading.
if (pDesc->CPUAccessFlags && pDesc->Usage != D3D11_USAGE_DYNAMIC) {
info.stages |= VK_PIPELINE_STAGE_HOST_BIT;
info.access |= VK_ACCESS_HOST_READ_BIT;
if (pDesc->CPUAccessFlags & D3D11_CPU_ACCESS_WRITE)
info.access |= VK_ACCESS_HOST_WRITE_BIT;
}
if (p11on12Info) {
m_11on12 = *p11on12Info;
DxvkBufferImportInfo importInfo;
importInfo.buffer = VkBuffer(m_11on12.VulkanHandle);
importInfo.offset = m_11on12.VulkanOffset;
if (m_desc.CPUAccessFlags)
m_11on12.Resource->Map(0, nullptr, &importInfo.mapPtr);
m_buffer = m_parent->GetDXVKDevice()->importBuffer(info, importInfo, GetMemoryFlags());
m_mapped = m_buffer->getSliceHandle();
m_mapMode = DetermineMapMode();
} else if (!(pDesc->MiscFlags & D3D11_RESOURCE_MISC_TILE_POOL)) {
// Create the buffer and set the entire buffer slice as mapped,
// so that we only have to update it when invalidating the buffer
m_buffer = m_parent->GetDXVKDevice()->createBuffer(info, GetMemoryFlags());
m_mapped = m_buffer->getSliceHandle();
m_mapMode = DetermineMapMode();
} else {
m_sparseAllocator = m_parent->GetDXVKDevice()->createSparsePageAllocator();
m_sparseAllocator->setCapacity(info.size / SparseMemoryPageSize);
m_mapped = DxvkBufferSliceHandle();
m_mapMode = D3D11_COMMON_BUFFER_MAP_MODE_NONE;
}
// For Stream Output buffers we need a counter
if (pDesc->BindFlags & D3D11_BIND_STREAM_OUTPUT)
m_soCounter = m_device->AllocXfbCounterSlice();
m_soCounter = CreateSoCounterBuffer();
}
D3D11Buffer::~D3D11Buffer() {
if (m_soCounter.defined())
m_device->FreeXfbCounterSlice(m_soCounter);
if (m_desc.CPUAccessFlags && m_11on12.Resource != nullptr)
m_11on12.Resource->Unmap(0, nullptr);
}
@ -142,17 +154,15 @@ namespace dxvk {
return S_OK;
}
Logger::warn("D3D11Buffer::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
if (logQueryInterfaceError(__uuidof(ID3D11Buffer), riid)) {
Logger::warn("D3D11Buffer::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
}
return E_NOINTERFACE;
}
void STDMETHODCALLTYPE D3D11Buffer::GetDevice(ID3D11Device** ppDevice) {
*ppDevice = m_device.ref();
}
UINT STDMETHODCALLTYPE D3D11Buffer::GetEvictionPriority() {
return DXGI_RESOURCE_PRIORITY_NORMAL;
}
@ -180,9 +190,7 @@ namespace dxvk {
UINT BindFlags,
DXGI_FORMAT Format) const {
// Check whether the given bind flags are supported
VkBufferUsageFlags usage = GetBufferUsageFlags(BindFlags);
if ((m_buffer->info().usage & usage) != usage)
if ((m_desc.BindFlags & BindFlags) != BindFlags)
return false;
// Structured buffer views use no format
@ -191,34 +199,180 @@ namespace dxvk {
// Check whether the given combination of buffer view
// type and view format is supported by the device
DXGI_VK_FORMAT_INFO viewFormat = m_device->LookupFormat(Format, DXGI_VK_FORMAT_MODE_ANY);
VkFormatFeatureFlags features = GetBufferFormatFeatures(BindFlags);
DXGI_VK_FORMAT_INFO viewFormat = m_parent->LookupFormat(Format, DXGI_VK_FORMAT_MODE_ANY);
VkFormatFeatureFlags2 features = GetBufferFormatFeatures(BindFlags);
return CheckFormatFeatureSupport(viewFormat.Format, features);
}
HRESULT D3D11Buffer::ValidateBufferProperties(
const D3D11_BUFFER_DESC* pDesc) {
HRESULT D3D11Buffer::NormalizeBufferProperties(D3D11_BUFFER_DESC* pDesc) {
// Zero-sized buffers are illegal
if (!pDesc->ByteWidth && !(pDesc->MiscFlags & D3D11_RESOURCE_MISC_TILE_POOL))
return E_INVALIDARG;
// Constant buffer size must be a multiple of 16
if ((pDesc->BindFlags & D3D11_BIND_CONSTANT_BUFFER)
&& (pDesc->ByteWidth & 0xF))
return E_INVALIDARG;
// Basic validation for structured buffers
if ((pDesc->MiscFlags & D3D11_RESOURCE_MISC_BUFFER_STRUCTURED)
&& ((pDesc->StructureByteStride == 0)
&& ((pDesc->MiscFlags & D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS)
|| (pDesc->StructureByteStride == 0)
|| (pDesc->StructureByteStride & 0x3)))
return E_INVALIDARG;
// Basic validation for raw buffers
if ((pDesc->MiscFlags & D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS)
&& (!(pDesc->BindFlags & (D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS))))
return E_INVALIDARG;
// Mip generation obviously doesn't work for buffers
if (pDesc->MiscFlags & D3D11_RESOURCE_MISC_GENERATE_MIPS)
return E_INVALIDARG;
// Basic validation for tiled buffers
if (pDesc->MiscFlags & D3D11_RESOURCE_MISC_TILED) {
if ((pDesc->MiscFlags & D3D11_RESOURCE_MISC_TILE_POOL)
|| (pDesc->Usage != D3D11_USAGE_DEFAULT)
|| (pDesc->CPUAccessFlags))
return E_INVALIDARG;
}
// Basic validation for tile pools
if (pDesc->MiscFlags & D3D11_RESOURCE_MISC_TILE_POOL) {
if ((pDesc->MiscFlags & ~D3D11_RESOURCE_MISC_TILE_POOL)
|| (pDesc->ByteWidth % SparseMemoryPageSize)
|| (pDesc->Usage != D3D11_USAGE_DEFAULT)
|| (pDesc->BindFlags)
|| (pDesc->CPUAccessFlags))
return E_INVALIDARG;
}
if (!(pDesc->MiscFlags & D3D11_RESOURCE_MISC_BUFFER_STRUCTURED))
pDesc->StructureByteStride = 0;
return S_OK;
}
HRESULT D3D11Buffer::GetDescFromD3D12(
ID3D12Resource* pResource,
const D3D11_RESOURCE_FLAGS* pResourceFlags,
D3D11_BUFFER_DESC* pBufferDesc) {
D3D12_RESOURCE_DESC desc12 = pResource->GetDesc();
pBufferDesc->ByteWidth = desc12.Width;
pBufferDesc->Usage = D3D11_USAGE_DEFAULT;
pBufferDesc->BindFlags = D3D11_BIND_SHADER_RESOURCE;
pBufferDesc->MiscFlags = 0;
pBufferDesc->CPUAccessFlags = 0;
pBufferDesc->StructureByteStride = 0;
if (desc12.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET)
pBufferDesc->BindFlags |= D3D11_BIND_RENDER_TARGET;
if (desc12.Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)
pBufferDesc->BindFlags |= D3D11_BIND_UNORDERED_ACCESS;
if (pResourceFlags) {
pBufferDesc->BindFlags = pResourceFlags->BindFlags;
pBufferDesc->MiscFlags |= pResourceFlags->MiscFlags;
pBufferDesc->CPUAccessFlags = pResourceFlags->CPUAccessFlags;
pBufferDesc->StructureByteStride = pResourceFlags->StructureByteStride;
}
return S_OK;
}
BOOL D3D11Buffer::CheckFormatFeatureSupport(
VkFormat Format,
VkFormatFeatureFlags Features) const {
VkFormatProperties properties = m_device->GetDXVKDevice()->adapter()->formatProperties(Format);
return (properties.bufferFeatures & Features) == Features;
VkFormatFeatureFlags2 Features) const {
DxvkFormatFeatures support = m_parent->GetDXVKDevice()->getFormatFeatures(Format);
return (support.buffer & Features) == Features;
}
VkMemoryPropertyFlags D3D11Buffer::GetMemoryFlags() const {
VkMemoryPropertyFlags memoryFlags = 0;
if (m_desc.MiscFlags & (D3D11_RESOURCE_MISC_TILE_POOL | D3D11_RESOURCE_MISC_TILED))
return VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
switch (m_desc.Usage) {
case D3D11_USAGE_IMMUTABLE:
memoryFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
break;
case D3D11_USAGE_DEFAULT:
memoryFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
if ((m_desc.BindFlags & D3D11_BIND_CONSTANT_BUFFER) || m_desc.CPUAccessFlags) {
memoryFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
}
if (m_desc.CPUAccessFlags & D3D11_CPU_ACCESS_READ) {
memoryFlags |= VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
memoryFlags &= ~VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
}
break;
case D3D11_USAGE_DYNAMIC:
memoryFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
if (m_desc.BindFlags)
memoryFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
break;
case D3D11_USAGE_STAGING:
memoryFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
| VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
break;
}
bool useCached = (m_parent->GetOptions()->cachedDynamicResources == ~0u)
|| (m_parent->GetOptions()->cachedDynamicResources & m_desc.BindFlags);
if ((memoryFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) && useCached) {
memoryFlags &= ~VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
memoryFlags |= VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
| VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
}
return memoryFlags;
}
Rc<DxvkBuffer> D3D11Buffer::CreateSoCounterBuffer() {
Rc<DxvkDevice> device = m_parent->GetDXVKDevice();
DxvkBufferCreateInfo info;
info.size = sizeof(D3D11SOCounter);
info.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT
| VK_BUFFER_USAGE_TRANSFER_SRC_BIT
| VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT
| VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT;
info.stages = VK_PIPELINE_STAGE_TRANSFER_BIT
| VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT
| VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT;
info.access = VK_ACCESS_TRANSFER_READ_BIT
| VK_ACCESS_TRANSFER_WRITE_BIT
| VK_ACCESS_INDIRECT_COMMAND_READ_BIT
| VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT
| VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT;
return device->createBuffer(info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
}
D3D11_COMMON_BUFFER_MAP_MODE D3D11Buffer::DetermineMapMode() {
return (m_buffer->memFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)
? D3D11_COMMON_BUFFER_MAP_MODE_DIRECT
: D3D11_COMMON_BUFFER_MAP_MODE_NONE;
}

View File

@ -1,17 +1,18 @@
#pragma once
#include "../dxvk/dxvk_cs.h"
#include "../dxvk/dxvk_device.h"
#include "../d3d10/d3d10_buffer.h"
#include "d3d11_device_child.h"
#include "d3d11_interfaces.h"
#include "d3d11_on_12.h"
#include "d3d11_resource.h"
namespace dxvk {
class D3D11Device;
class D3D11DeviceContext;
/**
@ -41,16 +42,15 @@ namespace dxvk {
D3D11Buffer(
D3D11Device* pDevice,
const D3D11_BUFFER_DESC* pDesc);
const D3D11_BUFFER_DESC* pDesc,
const D3D11_ON_12_RESOURCE_INFO* p11on12Info);
~D3D11Buffer();
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject) final;
void STDMETHODCALLTYPE GetDevice(
ID3D11Device **ppDevice) final;
void STDMETHODCALLTYPE GetType(
D3D11_RESOURCE_DIMENSION *pResourceDimension) final;
@ -69,30 +69,48 @@ namespace dxvk {
return &m_desc;
}
BOOL IsTilePool() const {
return bool(m_desc.MiscFlags & D3D11_RESOURCE_MISC_TILE_POOL);
}
D3D11_COMMON_BUFFER_MAP_MODE GetMapMode() const {
return (m_buffer->memFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)
? D3D11_COMMON_BUFFER_MAP_MODE_DIRECT
: D3D11_COMMON_BUFFER_MAP_MODE_NONE;
return m_mapMode;
}
Rc<DxvkBuffer> GetBuffer() const {
return m_buffer;
}
Rc<DxvkSparsePageAllocator> GetSparseAllocator() const {
return m_sparseAllocator;
}
DxvkBufferSlice GetBufferSlice() const {
return GetBufferSlice(0, m_desc.ByteWidth);
return DxvkBufferSlice(m_buffer, 0, m_desc.ByteWidth);
}
DxvkBufferSlice GetBufferSlice(VkDeviceSize offset) const {
return GetBufferSlice(offset, m_desc.ByteWidth - offset);
VkDeviceSize size = m_desc.ByteWidth;
offset = std::min(offset, size);
return DxvkBufferSlice(m_buffer, offset, size - offset);
}
DxvkBufferSlice GetBufferSlice(VkDeviceSize offset, VkDeviceSize length) const {
return DxvkBufferSlice(m_buffer, offset, length);
VkDeviceSize size = m_desc.ByteWidth;
offset = std::min(offset, size);
return DxvkBufferSlice(m_buffer, offset, std::min(length, size - offset));
}
VkDeviceSize GetRemainingSize(VkDeviceSize offset) const {
VkDeviceSize size = m_desc.ByteWidth;
offset = std::min(offset, size);
return size - offset;
}
DxvkBufferSlice GetSOCounter() {
return m_soCounter;
return m_soCounter != nullptr
? DxvkBufferSlice(m_soCounter)
: DxvkBufferSlice();
}
DxvkBufferSliceHandle AllocSlice() {
@ -112,31 +130,76 @@ namespace dxvk {
return &m_d3d10;
}
bool HasSequenceNumber() const {
return m_mapMode != D3D11_COMMON_BUFFER_MAP_MODE_NONE
&& !(m_desc.MiscFlags & D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS)
&& !(m_desc.BindFlags);
}
void TrackSequenceNumber(uint64_t Seq) {
m_seq = Seq;
}
uint64_t GetSequenceNumber() {
return HasSequenceNumber() ? m_seq
: DxvkCsThread::SynchronizeAll;
}
/**
* \brief Validates buffer description
* \brief Retrieves D3D11on12 resource info
* \returns 11on12 resource info
*/
D3D11_ON_12_RESOURCE_INFO Get11on12Info() const {
return m_11on12;
}
/**
* \brief Normalizes buffer description
*
* \param [in] pDesc Buffer description
* \returns \c S_OK if the parameters are valid
*/
static HRESULT ValidateBufferProperties(
const D3D11_BUFFER_DESC* pDesc);
static HRESULT NormalizeBufferProperties(
D3D11_BUFFER_DESC* pDesc);
/**
* \brief Initializes D3D11 buffer description from D3D12
*
* \param [in] pResource D3D12 resource
* \param [in] pResourceFlags D3D11 flag overrides
* \param [out] pBufferDesc D3D11 buffer description
* \returns \c S_OK if the parameters are valid
*/
static HRESULT GetDescFromD3D12(
ID3D12Resource* pResource,
const D3D11_RESOURCE_FLAGS* pResourceFlags,
D3D11_BUFFER_DESC* pBufferDesc);
private:
const Com<D3D11Device> m_device;
const D3D11_BUFFER_DESC m_desc;
D3D11_BUFFER_DESC m_desc;
D3D11_ON_12_RESOURCE_INFO m_11on12;
D3D11_COMMON_BUFFER_MAP_MODE m_mapMode;
Rc<DxvkBuffer> m_buffer;
DxvkBufferSlice m_soCounter;
DxvkBufferSliceHandle m_mapped;
Rc<DxvkBuffer> m_buffer;
Rc<DxvkBuffer> m_soCounter;
Rc<DxvkSparsePageAllocator> m_sparseAllocator;
DxvkBufferSliceHandle m_mapped;
uint64_t m_seq = 0ull;
D3D11DXGIResource m_resource;
D3D10Buffer m_d3d10;
D3D11DXGIResource m_resource;
D3D10Buffer m_d3d10;
BOOL CheckFormatFeatureSupport(
VkFormat Format,
VkFormatFeatureFlags Features) const;
VkFormatFeatureFlags2 Features) const;
VkMemoryPropertyFlags GetMemoryFlags() const;
Rc<DxvkBuffer> CreateSoCounterBuffer();
D3D11_COMMON_BUFFER_MAP_MODE DetermineMapMode();
};

View File

@ -5,7 +5,7 @@ namespace dxvk {
D3D11ClassLinkage::D3D11ClassLinkage(
D3D11Device* pDevice)
: m_device(pDevice) {
: D3D11DeviceChild<ID3D11ClassLinkage>(pDevice) {
}
@ -28,17 +28,15 @@ namespace dxvk {
return S_OK;
}
Logger::warn("D3D11ClassLinkage::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
if (logQueryInterfaceError(__uuidof(ID3D11ClassLinkage), riid)) {
Logger::warn("D3D11ClassLinkage::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
}
return E_NOINTERFACE;
}
void STDMETHODCALLTYPE D3D11ClassLinkage::GetDevice(ID3D11Device** ppDevice) {
*ppDevice = m_device.ref();
}
HRESULT STDMETHODCALLTYPE D3D11ClassLinkage::CreateClassInstance(
LPCSTR pClassTypeName,
UINT ConstantBufferOffset,

View File

@ -20,9 +20,6 @@ namespace dxvk {
REFIID riid,
void** ppvObject) final;
void STDMETHODCALLTYPE GetDevice(
ID3D11Device **ppDevice) final;
HRESULT STDMETHODCALLTYPE CreateClassInstance(
LPCSTR pClassTypeName,
UINT ConstantBufferOffset,
@ -36,10 +33,6 @@ namespace dxvk {
UINT InstanceIndex,
ID3D11ClassInstance **ppInstance);
private:
Com<D3D11Device> m_device;
};
}

View File

@ -37,6 +37,7 @@ namespace dxvk {
struct D3D11CmdDrawIndirectData : public D3D11CmdData {
uint32_t offset;
uint32_t count;
uint32_t stride;
};
}

View File

@ -1,12 +1,14 @@
#include "d3d11_cmdlist.h"
#include "d3d11_device.h"
#include "d3d11_buffer.h"
#include "d3d11_texture.h"
namespace dxvk {
D3D11CommandList::D3D11CommandList(
D3D11Device* pDevice,
UINT ContextFlags)
: m_device (pDevice),
: D3D11DeviceChild<ID3D11CommandList>(pDevice),
m_contextFlags(ContextFlags) { }
@ -28,52 +30,135 @@ namespace dxvk {
return S_OK;
}
Logger::warn("D3D11CommandList::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
if (logQueryInterfaceError(__uuidof(ID3D11CommandList), riid)) {
Logger::warn("D3D11CommandList::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
}
return E_NOINTERFACE;
}
void STDMETHODCALLTYPE D3D11CommandList::GetDevice(ID3D11Device **ppDevice) {
*ppDevice = ref(m_device);
}
UINT STDMETHODCALLTYPE D3D11CommandList::GetContextFlags() {
return m_contextFlags;
}
void D3D11CommandList::AddChunk(DxvkCsChunkRef&& Chunk) {
void D3D11CommandList::AddQuery(D3D11Query* pQuery) {
m_queries.emplace_back(pQuery);
}
uint64_t D3D11CommandList::AddChunk(DxvkCsChunkRef&& Chunk) {
m_chunks.push_back(std::move(Chunk));
return m_chunks.size() - 1;
}
void D3D11CommandList::EmitToCommandList(ID3D11CommandList* pCommandList) {
auto cmdList = static_cast<D3D11CommandList*>(pCommandList);
for (const auto& chunk : m_chunks)
cmdList->m_chunks.push_back(chunk);
uint64_t D3D11CommandList::AddCommandList(
D3D11CommandList* pCommandList) {
// This will be the chunk ID of the first chunk
// added, for the purpose of resource tracking.
uint64_t baseChunkId = m_chunks.size();
for (const auto& chunk : pCommandList->m_chunks)
m_chunks.push_back(chunk);
for (const auto& query : pCommandList->m_queries)
m_queries.push_back(query);
for (const auto& resource : pCommandList->m_resources) {
TrackedResource entry = resource;
entry.chunkId += baseChunkId;
m_resources.push_back(std::move(entry));
}
pCommandList->MarkSubmitted();
// Return ID of the last chunk added. The command list
// added can never be empty, so do not handle zero.
return m_chunks.size() - 1;
}
void D3D11CommandList::EmitToCsThread(
const D3D11ChunkDispatchProc& DispatchProc) {
for (const auto& query : m_queries)
query->DoDeferredEnd();
for (size_t i = 0, j = 0; i < m_chunks.size(); i++) {
// If there are resources to track for the current chunk,
// use a strong flush hint to dispatch GPU work quickly.
GpuFlushType flushType = GpuFlushType::ImplicitWeakHint;
if (j < m_resources.size() && m_resources[j].chunkId == i)
flushType = GpuFlushType::ImplicitStrongHint;
// Dispatch the chunk and capture its sequence number
uint64_t seq = DispatchProc(DxvkCsChunkRef(m_chunks[i]), flushType);
// Track resource sequence numbers for the added chunk
while (j < m_resources.size() && m_resources[j].chunkId == i)
TrackResourceSequenceNumber(m_resources[j++].ref, seq);
}
MarkSubmitted();
}
void D3D11CommandList::EmitToCsThread(DxvkCsThread* CsThread) {
for (const auto& chunk : m_chunks)
CsThread->dispatchChunk(DxvkCsChunkRef(chunk));
MarkSubmitted();
void D3D11CommandList::TrackResourceUsage(
ID3D11Resource* pResource,
D3D11_RESOURCE_DIMENSION ResourceType,
UINT Subresource,
uint64_t ChunkId) {
TrackedResource entry;
entry.ref = D3D11ResourceRef(pResource, Subresource, ResourceType);
entry.chunkId = ChunkId;
m_resources.push_back(std::move(entry));
}
void D3D11CommandList::TrackResourceSequenceNumber(
const D3D11ResourceRef& Resource,
uint64_t Seq) {
ID3D11Resource* iface = Resource.Get();
switch (Resource.GetType()) {
case D3D11_RESOURCE_DIMENSION_UNKNOWN:
break;
case D3D11_RESOURCE_DIMENSION_BUFFER: {
auto impl = static_cast<D3D11Buffer*>(iface);
impl->TrackSequenceNumber(Seq);
} break;
case D3D11_RESOURCE_DIMENSION_TEXTURE1D: {
auto impl = static_cast<D3D11Texture1D*>(iface)->GetCommonTexture();
impl->TrackSequenceNumber(Resource.GetSubresource(), Seq);
} break;
case D3D11_RESOURCE_DIMENSION_TEXTURE2D: {
auto impl = static_cast<D3D11Texture2D*>(iface)->GetCommonTexture();
impl->TrackSequenceNumber(Resource.GetSubresource(), Seq);
} break;
case D3D11_RESOURCE_DIMENSION_TEXTURE3D: {
auto impl = static_cast<D3D11Texture3D*>(iface)->GetCommonTexture();
impl->TrackSequenceNumber(Resource.GetSubresource(), Seq);
} break;
}
}
void D3D11CommandList::MarkSubmitted() {
if (m_submitted.exchange(true) && !m_warned.exchange(true)
&& m_device->GetOptions()->dcSingleUseMode) {
&& m_parent->GetOptions()->dcSingleUseMode) {
Logger::warn(
"D3D11: Command list submitted multiple times,\n"
" but d3d11.dcSingleUseMode is enabled");
}
}
}
}

View File

@ -1,9 +1,13 @@
#pragma once
#include <functional>
#include "d3d11_context.h"
namespace dxvk {
using D3D11ChunkDispatchProc = std::function<uint64_t (DxvkCsChunkRef&&, GpuFlushType)>;
class D3D11CommandList : public D3D11DeviceChild<ID3D11CommandList> {
public:
@ -18,32 +22,48 @@ namespace dxvk {
REFIID riid,
void** ppvObject) final;
void STDMETHODCALLTYPE GetDevice(
ID3D11Device **ppDevice) final;
UINT STDMETHODCALLTYPE GetContextFlags() final;
void AddChunk(
void AddQuery(
D3D11Query* pQuery);
uint64_t AddChunk(
DxvkCsChunkRef&& Chunk);
void EmitToCommandList(
ID3D11CommandList* pCommandList);
uint64_t AddCommandList(
D3D11CommandList* pCommandList);
void EmitToCsThread(
DxvkCsThread* CsThread);
const D3D11ChunkDispatchProc& DispatchProc);
void TrackResourceUsage(
ID3D11Resource* pResource,
D3D11_RESOURCE_DIMENSION ResourceType,
UINT Subresource,
uint64_t ChunkId);
private:
struct TrackedResource {
D3D11ResourceRef ref;
uint64_t chunkId;
};
UINT m_contextFlags;
D3D11Device* const m_device;
UINT const m_contextFlags;
std::vector<DxvkCsChunkRef> m_chunks;
std::vector<DxvkCsChunkRef> m_chunks;
std::vector<Com<D3D11Query, false>> m_queries;
std::vector<TrackedResource> m_resources;
std::atomic<bool> m_submitted = { false };
std::atomic<bool> m_warned = { false };
void TrackResourceSequenceNumber(
const D3D11ResourceRef& Resource,
uint64_t Seq);
void MarkSubmitted();
};
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -7,20 +7,9 @@ namespace dxvk {
D3D11Device* pParent,
const Rc<DxvkDevice>& Device,
UINT ContextFlags)
: D3D11DeviceContext(pParent, Device, GetCsChunkFlags(pParent)),
m_contextFlags(ContextFlags),
: D3D11CommonContext<D3D11DeferredContext>(pParent, Device, ContextFlags, GetCsChunkFlags(pParent)),
m_commandList (CreateCommandList()) {
ClearState();
}
D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE D3D11DeferredContext::GetType() {
return D3D11_DEVICE_CONTEXT_DEFERRED;
}
UINT STDMETHODCALLTYPE D3D11DeferredContext::GetContextFlags() {
return m_contextFlags;
ResetContextState();
}
@ -29,29 +18,143 @@ namespace dxvk {
void* pData,
UINT DataSize,
UINT GetDataFlags) {
Logger::err("D3D11: GetData called on a deferred context");
static bool s_errorShown = false;
if (!std::exchange(s_errorShown, true))
Logger::warn("D3D11: GetData called on a deferred context");
return DXGI_ERROR_INVALID_CALL;
}
void STDMETHODCALLTYPE D3D11DeferredContext::Begin(
ID3D11Asynchronous* pAsync) {
D3D10DeviceLock lock = LockContext();
if (unlikely(!pAsync))
return;
Com<D3D11Query, false> query(static_cast<D3D11Query*>(pAsync));
if (unlikely(!query->IsScoped()))
return;
auto entry = std::find(
m_queriesBegun.begin(),
m_queriesBegun.end(), query);
if (unlikely(entry != m_queriesBegun.end()))
return;
EmitCs([cQuery = query]
(DxvkContext* ctx) {
cQuery->Begin(ctx);
});
m_queriesBegun.push_back(std::move(query));
}
void STDMETHODCALLTYPE D3D11DeferredContext::End(
ID3D11Asynchronous* pAsync) {
D3D10DeviceLock lock = LockContext();
if (unlikely(!pAsync))
return;
Com<D3D11Query, false> query(static_cast<D3D11Query*>(pAsync));
if (query->IsScoped()) {
auto entry = std::find(
m_queriesBegun.begin(),
m_queriesBegun.end(), query);
if (likely(entry != m_queriesBegun.end())) {
m_queriesBegun.erase(entry);
} else {
EmitCs([cQuery = query]
(DxvkContext* ctx) {
cQuery->Begin(ctx);
});
}
}
m_commandList->AddQuery(query.ptr());
EmitCs([cQuery = std::move(query)]
(DxvkContext* ctx) {
cQuery->End(ctx);
});
}
void STDMETHODCALLTYPE D3D11DeferredContext::Flush() {
Logger::err("D3D11: Flush called on a deferred context");
static bool s_errorShown = false;
if (!std::exchange(s_errorShown, true))
Logger::warn("D3D11: Flush called on a deferred context");
}
void STDMETHODCALLTYPE D3D11DeferredContext::Flush1(
D3D11_CONTEXT_TYPE ContextType,
HANDLE hEvent) {
static bool s_errorShown = false;
if (!std::exchange(s_errorShown, true))
Logger::warn("D3D11: Flush1 called on a deferred context");
}
HRESULT STDMETHODCALLTYPE D3D11DeferredContext::Signal(
ID3D11Fence* pFence,
UINT64 Value) {
static bool s_errorShown = false;
if (!std::exchange(s_errorShown, true))
Logger::warn("D3D11: Signal called on a deferred context");
return DXGI_ERROR_INVALID_CALL;
}
HRESULT STDMETHODCALLTYPE D3D11DeferredContext::Wait(
ID3D11Fence* pFence,
UINT64 Value) {
static bool s_errorShown = false;
if (!std::exchange(s_errorShown, true))
Logger::warn("D3D11: Wait called on a deferred context");
return DXGI_ERROR_INVALID_CALL;
}
void STDMETHODCALLTYPE D3D11DeferredContext::ExecuteCommandList(
ID3D11CommandList* pCommandList,
BOOL RestoreContextState) {
D3D10DeviceLock lock = LockContext();
// Clear state so that the command list can't observe any
// current context state. The command list itself will clean
// up after execution to ensure that no state changes done
// by the command list are visible to the immediate context.
ResetCommandListState();
// Flush any outstanding commands so that
// we don't mess up the execution order
FlushCsChunk();
static_cast<D3D11CommandList*>(pCommandList)->EmitToCommandList(m_commandList.ptr());
// Record any chunks from the given command list into the
// current command list and deal with context state
auto commandList = static_cast<D3D11CommandList*>(pCommandList);
m_chunkId = m_commandList->AddCommandList(commandList);
// Restore deferred context state
if (RestoreContextState)
RestoreState();
RestoreCommandListState();
else
ClearState();
ResetContextState();
}
@ -60,18 +163,34 @@ namespace dxvk {
ID3D11CommandList **ppCommandList) {
D3D10DeviceLock lock = LockContext();
// End all queries that were left active by the app
FinalizeQueries();
// Clean up command list state so that the any state changed
// by this command list does not affect the calling context.
// This also ensures that the command list is never empty.
ResetCommandListState();
// Make sure all commands are visible to the command list
FlushCsChunk();
if (ppCommandList != nullptr)
if (ppCommandList)
*ppCommandList = m_commandList.ref();
// Create a clean command list, and if requested, restore all
// previously set context state. Otherwise, reset the context.
// Any use of ExecuteCommandList will reset command list state
// before the command list is actually executed.
m_commandList = CreateCommandList();
m_chunkId = 0;
if (RestoreDeferredContextState)
RestoreState();
RestoreCommandListState();
else
ClearState();
ResetContextState();
m_mappedResources.clear();
ResetStagingBuffer();
return S_OK;
}
@ -87,47 +206,35 @@ namespace dxvk {
if (unlikely(!pResource || !pMappedResource))
return E_INVALIDARG;
D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
pResource->GetType(&resourceDim);
if (MapType == D3D11_MAP_WRITE_DISCARD) {
D3D11DeferredContextMapEntry entry;
D3D11_RESOURCE_DIMENSION resourceDim;
pResource->GetType(&resourceDim);
D3D11_MAPPED_SUBRESOURCE mapInfo;
HRESULT status = resourceDim == D3D11_RESOURCE_DIMENSION_BUFFER
? MapBuffer(pResource, MapType, MapFlags, &entry)
: MapImage (pResource, Subresource, MapType, MapFlags, &entry);
? MapBuffer(pResource, &mapInfo)
: MapImage (pResource, Subresource, &mapInfo);
if (unlikely(FAILED(status))) {
*pMappedResource = D3D11_MAPPED_SUBRESOURCE();
return status;
}
// Adding a new map entry actually overrides the
// old one in practice because the lookup function
// scans the array in reverse order
m_mappedResources.push_back(entry);
// Fill mapped resource structure
pMappedResource->pData = entry.MapPointer;
pMappedResource->RowPitch = entry.RowPitch;
pMappedResource->DepthPitch = entry.DepthPitch;
AddMapEntry(pResource, Subresource, resourceDim, mapInfo);
*pMappedResource = mapInfo;
return S_OK;
} else if (MapType == D3D11_MAP_WRITE_NO_OVERWRITE) {
// The resource must be mapped with D3D11_MAP_WRITE_DISCARD
// before it can be mapped with D3D11_MAP_WRITE_NO_OVERWRITE.
auto entry = FindMapEntry(pResource, Subresource);
if (unlikely(entry == m_mappedResources.rend())) {
if (unlikely(!entry)) {
*pMappedResource = D3D11_MAPPED_SUBRESOURCE();
return E_INVALIDARG;
}
// Return same memory region as earlier
entry->MapType = D3D11_MAP_WRITE_NO_OVERWRITE;
pMappedResource->pData = entry->MapPointer;
pMappedResource->RowPitch = entry->RowPitch;
pMappedResource->DepthPitch = entry->DepthPitch;
*pMappedResource = entry->MapInfo;
return S_OK;
} else {
// Not allowed on deferred contexts
@ -140,37 +247,23 @@ namespace dxvk {
void STDMETHODCALLTYPE D3D11DeferredContext::Unmap(
ID3D11Resource* pResource,
UINT Subresource) {
D3D10DeviceLock lock = LockContext();
auto entry = FindMapEntry(pResource, Subresource);
if (unlikely(entry == m_mappedResources.rend())) {
Logger::err("D3D11DeferredContext::Unmap: Subresource not mapped");
return;
}
if (entry->MapType == D3D11_MAP_WRITE_DISCARD) {
D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
pResource->GetType(&resourceDim);
(resourceDim == D3D11_RESOURCE_DIMENSION_BUFFER)
? UnmapBuffer(pResource, &(*entry))
: UnmapImage (pResource, Subresource, &(*entry));
}
// No-op, updates are committed in Map
}
void STDMETHODCALLTYPE D3D11DeferredContext::SwapDeviceContextState(
ID3DDeviceContextState* pState,
ID3DDeviceContextState** ppPreviousState) {
Logger::err("D3D11: SwapDeviceContextState called on a deferred context");
static bool s_errorShown = false;
if (!std::exchange(s_errorShown, true))
Logger::warn("D3D11: SwapDeviceContextState called on a deferred context");
}
HRESULT D3D11DeferredContext::MapBuffer(
ID3D11Resource* pResource,
D3D11_MAP MapType,
UINT MapFlags,
D3D11DeferredContextMapEntry* pMapEntry) {
D3D11_MAPPED_SUBRESOURCE* pMappedResource) {
D3D11Buffer* pBuffer = static_cast<D3D11Buffer*>(pResource);
if (unlikely(pBuffer->GetMapMode() == D3D11_COMMON_BUFFER_MAP_MODE_NONE)) {
@ -178,23 +271,36 @@ namespace dxvk {
return E_INVALIDARG;
}
pMapEntry->pResource = pResource;
pMapEntry->Subresource = 0;
pMapEntry->MapType = D3D11_MAP_WRITE_DISCARD;
pMapEntry->RowPitch = pBuffer->Desc()->ByteWidth;
pMapEntry->DepthPitch = pBuffer->Desc()->ByteWidth;
pMappedResource->RowPitch = pBuffer->Desc()->ByteWidth;
pMappedResource->DepthPitch = pBuffer->Desc()->ByteWidth;
if (likely(pBuffer->Desc()->Usage == D3D11_USAGE_DYNAMIC && m_csFlags.test(DxvkCsChunkFlag::SingleUse))) {
if (likely(m_csFlags.test(DxvkCsChunkFlag::SingleUse))) {
// For resources that cannot be written by the GPU,
// we may write to the buffer resource directly and
// just swap in the buffer slice as needed.
pMapEntry->BufferSlice = pBuffer->AllocSlice();
pMapEntry->MapPointer = pMapEntry->BufferSlice.mapPtr;
auto bufferSlice = pBuffer->AllocSlice();
pMappedResource->pData = bufferSlice.mapPtr;
EmitCs([
cDstBuffer = pBuffer->GetBuffer(),
cPhysSlice = bufferSlice
] (DxvkContext* ctx) {
ctx->invalidateBuffer(cDstBuffer, cPhysSlice);
});
} else {
// For GPU-writable resources, we need a data slice
// to perform the update operation at execution time.
pMapEntry->DataSlice = AllocUpdateBufferSlice(pBuffer->Desc()->ByteWidth);
pMapEntry->MapPointer = pMapEntry->DataSlice.ptr();
auto dataSlice = AllocUpdateBufferSlice(pBuffer->Desc()->ByteWidth);
pMappedResource->pData = dataSlice.ptr();
EmitCs([
cDstBuffer = pBuffer->GetBuffer(),
cDataSlice = dataSlice
] (DxvkContext* ctx) {
DxvkBufferSliceHandle slice = cDstBuffer->allocSlice();
std::memcpy(slice.mapPtr, cDataSlice.ptr(), cDataSlice.length());
ctx->invalidateBuffer(cDstBuffer, slice);
});
}
return S_OK;
@ -204,11 +310,8 @@ namespace dxvk {
HRESULT D3D11DeferredContext::MapImage(
ID3D11Resource* pResource,
UINT Subresource,
D3D11_MAP MapType,
UINT MapFlags,
D3D11DeferredContextMapEntry* pMapEntry) {
const D3D11CommonTexture* pTexture = GetCommonTexture(pResource);
const Rc<DxvkImage> image = pTexture->GetImage();
D3D11_MAPPED_SUBRESOURCE* pMappedResource) {
D3D11CommonTexture* pTexture = GetCommonTexture(pResource);
if (unlikely(pTexture->GetMapMode() == D3D11_COMMON_TEXTURE_MAP_MODE_NONE)) {
Logger::err("D3D11: Cannot map a device-local image");
@ -218,113 +321,129 @@ namespace dxvk {
if (unlikely(Subresource >= pTexture->CountSubresources()))
return E_INVALIDARG;
VkFormat packedFormat = m_parent->LookupPackedFormat(
pTexture->Desc()->Format, pTexture->GetFormatMode()).Format;
VkFormat packedFormat = pTexture->GetPackedFormat();
auto formatInfo = imageFormatInfo(packedFormat);
auto formatInfo = lookupFormatInfo(packedFormat);
auto subresource = pTexture->GetSubresourceFromIndex(
formatInfo->aspectMask, Subresource);
VkExtent3D levelExtent = image->mipLevelExtent(subresource.mipLevel);
VkExtent3D blockCount = util::computeBlockCount(
levelExtent, formatInfo->blockSize);
VkExtent3D levelExtent = pTexture->MipLevelExtent(subresource.mipLevel);
VkDeviceSize eSize = formatInfo->elementSize;
VkDeviceSize xSize = blockCount.width * eSize;
VkDeviceSize ySize = blockCount.height * xSize;
VkDeviceSize zSize = blockCount.depth * ySize;
auto layout = pTexture->GetSubresourceLayout(formatInfo->aspectMask, Subresource);
auto dataSlice = AllocStagingBuffer(util::computeImageDataSize(packedFormat, levelExtent));
pMapEntry->pResource = pResource;
pMapEntry->Subresource = Subresource;
pMapEntry->MapType = D3D11_MAP_WRITE_DISCARD;
pMapEntry->RowPitch = xSize;
pMapEntry->DepthPitch = ySize;
pMapEntry->DataSlice = AllocUpdateBufferSlice(zSize);
pMapEntry->MapPointer = pMapEntry->DataSlice.ptr();
pMappedResource->RowPitch = layout.RowPitch;
pMappedResource->DepthPitch = layout.DepthPitch;
pMappedResource->pData = dataSlice.mapPtr(0);
UpdateImage(pTexture, &subresource,
VkOffset3D { 0, 0, 0 }, levelExtent,
std::move(dataSlice));
return S_OK;
}
void D3D11DeferredContext::UnmapBuffer(
ID3D11Resource* pResource,
const D3D11DeferredContextMapEntry* pMapEntry) {
D3D11Buffer* pBuffer = static_cast<D3D11Buffer*>(pResource);
if (likely(pBuffer->Desc()->Usage == D3D11_USAGE_DYNAMIC && m_csFlags.test(DxvkCsChunkFlag::SingleUse))) {
EmitCs([
cDstBuffer = pBuffer->GetBuffer(),
cPhysSlice = pMapEntry->BufferSlice
] (DxvkContext* ctx) {
ctx->invalidateBuffer(cDstBuffer, cPhysSlice);
});
} else {
EmitCs([
cDstBuffer = pBuffer->GetBuffer(),
cDataSlice = pMapEntry->DataSlice
] (DxvkContext* ctx) {
DxvkBufferSliceHandle slice = cDstBuffer->allocSlice();
std::memcpy(slice.mapPtr, cDataSlice.ptr(), cDataSlice.length());
ctx->invalidateBuffer(cDstBuffer, slice);
void D3D11DeferredContext::UpdateMappedBuffer(
D3D11Buffer* pDstBuffer,
UINT Offset,
UINT Length,
const void* pSrcData,
UINT CopyFlags) {
void* mapPtr = nullptr;
if (unlikely(CopyFlags == D3D11_COPY_NO_OVERWRITE)) {
auto entry = FindMapEntry(pDstBuffer, 0);
if (entry)
mapPtr = entry->MapInfo.pData;
}
if (likely(!mapPtr)) {
// The caller validates the map mode, so we can
// safely ignore the MapBuffer return value here
D3D11_MAPPED_SUBRESOURCE mapInfo;
MapBuffer(pDstBuffer, &mapInfo);
AddMapEntry(pDstBuffer, 0, D3D11_RESOURCE_DIMENSION_BUFFER, mapInfo);
mapPtr = mapInfo.pData;
}
std::memcpy(reinterpret_cast<char*>(mapPtr) + Offset, pSrcData, Length);
}
void D3D11DeferredContext::FinalizeQueries() {
for (auto& query : m_queriesBegun) {
m_commandList->AddQuery(query.ptr());
EmitCs([cQuery = std::move(query)]
(DxvkContext* ctx) {
cQuery->End(ctx);
});
}
}
void D3D11DeferredContext::UnmapImage(
ID3D11Resource* pResource,
UINT Subresource,
const D3D11DeferredContextMapEntry* pMapEntry) {
// TODO If the texture itself is mapped to host-visible
// memory, write the data slice directly to the image.
const D3D11CommonTexture* pTexture = GetCommonTexture(pResource);
EmitCs([
cImage = pTexture->GetImage(),
cSubresource = pTexture->GetSubresourceFromIndex(
VK_IMAGE_ASPECT_COLOR_BIT, Subresource),
cDataSlice = pMapEntry->DataSlice,
cDataPitchPerRow = pMapEntry->RowPitch,
cDataPitchPerLayer = pMapEntry->DepthPitch,
cPackedFormat = GetPackedDepthStencilFormat(pTexture->Desc()->Format)
] (DxvkContext* ctx) {
VkImageSubresourceLayers srLayers;
srLayers.aspectMask = cSubresource.aspectMask;
srLayers.mipLevel = cSubresource.mipLevel;
srLayers.baseArrayLayer = cSubresource.arrayLayer;
srLayers.layerCount = 1;
VkOffset3D mipLevelOffset = { 0, 0, 0 };
VkExtent3D mipLevelExtent = cImage->mipLevelExtent(srLayers.mipLevel);
if (cPackedFormat == VK_FORMAT_UNDEFINED) {
ctx->updateImage(
cImage, srLayers,
mipLevelOffset,
mipLevelExtent,
cDataSlice.ptr(),
cDataPitchPerRow,
cDataPitchPerLayer);
} else {
ctx->updateDepthStencilImage(
cImage, srLayers,
VkOffset2D { mipLevelOffset.x, mipLevelOffset.y },
VkExtent2D { mipLevelExtent.width, mipLevelExtent.height },
cDataSlice.ptr(),
cDataPitchPerRow,
cDataPitchPerLayer,
cPackedFormat);
}
});
m_queriesBegun.clear();
}
Com<D3D11CommandList> D3D11DeferredContext::CreateCommandList() {
return new D3D11CommandList(m_parent, m_contextFlags);
return new D3D11CommandList(m_parent, m_flags);
}
void D3D11DeferredContext::EmitCsChunk(DxvkCsChunkRef&& chunk) {
m_commandList->AddChunk(std::move(chunk));
m_chunkId = m_commandList->AddChunk(std::move(chunk));
}
uint64_t D3D11DeferredContext::GetCurrentChunkId() const {
return m_csChunk->empty() ? m_chunkId : m_chunkId + 1;
}
void D3D11DeferredContext::TrackTextureSequenceNumber(
D3D11CommonTexture* pResource,
UINT Subresource) {
m_commandList->TrackResourceUsage(
pResource->GetInterface(),
pResource->GetDimension(),
Subresource, GetCurrentChunkId());
}
void D3D11DeferredContext::TrackBufferSequenceNumber(
D3D11Buffer* pResource) {
m_commandList->TrackResourceUsage(pResource,
D3D11_RESOURCE_DIMENSION_BUFFER, 0,
GetCurrentChunkId());
}
D3D11DeferredContextMapEntry* D3D11DeferredContext::FindMapEntry(
ID3D11Resource* pResource,
UINT Subresource) {
// Recently mapped resources as well as entries with
// up-to-date map infos will be located at the end
// of the resource array, so scan in reverse order.
size_t size = m_mappedResources.size();
for (size_t i = 1; i <= size; i++) {
auto entry = &m_mappedResources[size - i];
if (entry->Resource.Get() == pResource
&& entry->Resource.GetSubresource() == Subresource)
return entry;
}
return nullptr;
}
void D3D11DeferredContext::AddMapEntry(
ID3D11Resource* pResource,
UINT Subresource,
D3D11_RESOURCE_DIMENSION ResourceType,
const D3D11_MAPPED_SUBRESOURCE& MapInfo) {
m_mappedResources.emplace_back(pResource,
Subresource, ResourceType, MapInfo);
}

View File

@ -1,28 +1,28 @@
#pragma once
#include "d3d11_buffer.h"
#include "d3d11_cmdlist.h"
#include "d3d11_context.h"
#include "d3d11_texture.h"
#include <algorithm>
#include <vector>
namespace dxvk {
struct D3D11DeferredContextMapEntry {
Com<ID3D11Resource> pResource;
UINT Subresource;
D3D11_MAP MapType;
UINT RowPitch;
UINT DepthPitch;
DxvkDataSlice DataSlice;
DxvkBufferSliceHandle BufferSlice;
void* MapPointer;
D3D11DeferredContextMapEntry() { }
D3D11DeferredContextMapEntry(
ID3D11Resource* pResource,
UINT Subresource,
D3D11_RESOURCE_DIMENSION ResourceType,
const D3D11_MAPPED_SUBRESOURCE& MappedResource)
: Resource(pResource, Subresource, ResourceType),
MapInfo(MappedResource) { }
D3D11ResourceRef Resource;
D3D11_MAPPED_SUBRESOURCE MapInfo;
};
class D3D11DeferredContext : public D3D11DeviceContext {
class D3D11DeferredContext : public D3D11CommonContext<D3D11DeferredContext> {
friend class D3D11CommonContext<D3D11DeferredContext>;
public:
D3D11DeferredContext(
@ -30,25 +30,39 @@ namespace dxvk {
const Rc<DxvkDevice>& Device,
UINT ContextFlags);
D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE GetType();
UINT STDMETHODCALLTYPE GetContextFlags();
HRESULT STDMETHODCALLTYPE GetData(
ID3D11Asynchronous* pAsync,
void* pData,
UINT DataSize,
UINT GetDataFlags);
ID3D11Asynchronous* pAsync,
void* pData,
UINT DataSize,
UINT GetDataFlags);
void STDMETHODCALLTYPE Begin(
ID3D11Asynchronous* pAsync);
void STDMETHODCALLTYPE End(
ID3D11Asynchronous* pAsync);
void STDMETHODCALLTYPE Flush();
void STDMETHODCALLTYPE Flush1(
D3D11_CONTEXT_TYPE ContextType,
HANDLE hEvent);
HRESULT STDMETHODCALLTYPE Signal(
ID3D11Fence* pFence,
UINT64 Value);
HRESULT STDMETHODCALLTYPE Wait(
ID3D11Fence* pFence,
UINT64 Value);
void STDMETHODCALLTYPE ExecuteCommandList(
ID3D11CommandList* pCommandList,
BOOL RestoreContextState);
ID3D11CommandList* pCommandList,
BOOL RestoreContextState);
HRESULT STDMETHODCALLTYPE FinishCommandList(
BOOL RestoreDeferredContextState,
ID3D11CommandList **ppCommandList);
BOOL RestoreDeferredContextState,
ID3D11CommandList** ppCommandList);
HRESULT STDMETHODCALLTYPE Map(
ID3D11Resource* pResource,
@ -65,10 +79,12 @@ namespace dxvk {
ID3DDeviceContextState* pState,
ID3DDeviceContextState** ppPreviousState);
D3D10DeviceLock LockContext() {
return D3D10DeviceLock();
}
private:
const UINT m_contextFlags;
// Command list that we're recording
Com<D3D11CommandList> m_commandList;
@ -77,43 +93,56 @@ namespace dxvk {
// number of mapped resources per command list.
std::vector<D3D11DeferredContextMapEntry> m_mappedResources;
// Begun and ended queries, will also be stored in command list
std::vector<Com<D3D11Query, false>> m_queriesBegun;
// Chunk ID within the current command list
uint64_t m_chunkId = 0ull;
HRESULT MapBuffer(
ID3D11Resource* pResource,
D3D11_MAP MapType,
UINT MapFlags,
D3D11DeferredContextMapEntry* pMapEntry);
D3D11_MAPPED_SUBRESOURCE* pMappedResource);
HRESULT MapImage(
ID3D11Resource* pResource,
UINT Subresource,
D3D11_MAP MapType,
UINT MapFlags,
D3D11DeferredContextMapEntry* pMapEntry);
void UnmapBuffer(
ID3D11Resource* pResource,
const D3D11DeferredContextMapEntry* pMapEntry);
void UnmapImage(
ID3D11Resource* pResource,
UINT Subresource,
const D3D11DeferredContextMapEntry* pMapEntry);
D3D11_MAPPED_SUBRESOURCE* pMappedResource);
void UpdateMappedBuffer(
D3D11Buffer* pDstBuffer,
UINT Offset,
UINT Length,
const void* pSrcData,
UINT CopyFlags);
void FinalizeQueries();
Com<D3D11CommandList> CreateCommandList();
void EmitCsChunk(DxvkCsChunkRef&& chunk);
uint64_t GetCurrentChunkId() const;
void TrackTextureSequenceNumber(
D3D11CommonTexture* pResource,
UINT Subresource);
void TrackBufferSequenceNumber(
D3D11Buffer* pResource);
D3D11DeferredContextMapEntry* FindMapEntry(
ID3D11Resource* pResource,
UINT Subresource);
void AddMapEntry(
ID3D11Resource* pResource,
UINT Subresource,
D3D11_RESOURCE_DIMENSION ResourceType,
const D3D11_MAPPED_SUBRESOURCE& MapInfo);
static DxvkCsChunkFlags GetCsChunkFlags(
D3D11Device* pDevice);
auto FindMapEntry(ID3D11Resource* pResource, UINT Subresource) {
return std::find_if(m_mappedResources.rbegin(), m_mappedResources.rend(),
[pResource, Subresource] (const D3D11DeferredContextMapEntry& entry) {
return entry.pResource == pResource
&& entry.Subresource == Subresource;
});
}
};
}

View File

@ -1,32 +1,46 @@
#include "d3d11_context.h"
#include <vector>
#include <utility>
#include <cstring>
#include "d3d11_device.h"
#include "d3d11_context_imm.h"
#include "d3d11_context_def.h"
#include "d3d11_cuda.h"
#include "../util/log/log.h"
namespace dxvk {
D3D11DeviceContextExt::D3D11DeviceContextExt(
D3D11DeviceContext* pContext)
template<typename ContextType>
D3D11DeviceContextExt<ContextType>::D3D11DeviceContextExt(
ContextType* pContext)
: m_ctx(pContext) {
}
ULONG STDMETHODCALLTYPE D3D11DeviceContextExt::AddRef() {
template<typename ContextType>
ULONG STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::AddRef() {
return m_ctx->AddRef();
}
ULONG STDMETHODCALLTYPE D3D11DeviceContextExt::Release() {
template<typename ContextType>
ULONG STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::Release() {
return m_ctx->Release();
}
HRESULT STDMETHODCALLTYPE D3D11DeviceContextExt::QueryInterface(
template<typename ContextType>
HRESULT STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::QueryInterface(
REFIID riid,
void** ppvObject) {
return m_ctx->QueryInterface(riid, ppvObject);
}
void STDMETHODCALLTYPE D3D11DeviceContextExt::MultiDrawIndirect(
template<typename ContextType>
void STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::MultiDrawIndirect(
UINT DrawCount,
ID3D11Buffer* pBufferForArgs,
UINT ByteOffsetForArgs,
@ -44,7 +58,8 @@ namespace dxvk {
}
void STDMETHODCALLTYPE D3D11DeviceContextExt::MultiDrawIndexedIndirect(
template<typename ContextType>
void STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::MultiDrawIndexedIndirect(
UINT DrawCount,
ID3D11Buffer* pBufferForArgs,
UINT ByteOffsetForArgs,
@ -62,7 +77,8 @@ namespace dxvk {
}
void STDMETHODCALLTYPE D3D11DeviceContextExt::MultiDrawIndirectCount(
template<typename ContextType>
void STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::MultiDrawIndirectCount(
UINT MaxDrawCount,
ID3D11Buffer* pBufferForCount,
UINT ByteOffsetForCount,
@ -83,7 +99,8 @@ namespace dxvk {
}
void STDMETHODCALLTYPE D3D11DeviceContextExt::MultiDrawIndexedIndirectCount(
template<typename ContextType>
void STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::MultiDrawIndexedIndirectCount(
UINT MaxDrawCount,
ID3D11Buffer* pBufferForCount,
UINT ByteOffsetForCount,
@ -104,7 +121,8 @@ namespace dxvk {
}
void STDMETHODCALLTYPE D3D11DeviceContextExt::SetDepthBoundsTest(
template<typename ContextType>
void STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::SetDepthBoundsTest(
BOOL Enable,
FLOAT MinDepthBounds,
FLOAT MaxDepthBounds) {
@ -121,17 +139,84 @@ namespace dxvk {
}
void STDMETHODCALLTYPE D3D11DeviceContextExt::SetBarrierControl(
template<typename ContextType>
void STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::SetBarrierControl(
UINT ControlFlags) {
D3D10DeviceLock lock = m_ctx->LockContext();
DxvkBarrierControlFlags flags;
if (ControlFlags & D3D11_VK_BARRIER_CONTROL_IGNORE_WRITE_AFTER_WRITE)
flags.set(DxvkBarrierControl::IgnoreWriteAfterWrite);
if (ControlFlags & D3D11_VK_BARRIER_CONTROL_IGNORE_GRAPHICS_UAV)
flags.set(DxvkBarrierControl::IgnoreGraphicsBarriers);
m_ctx->EmitCs([cFlags = flags] (DxvkContext* ctx) {
ctx->setBarrierControl(cFlags);
});
}
template<typename ContextType>
bool STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::LaunchCubinShaderNVX(IUnknown* hShader, uint32_t GridX, uint32_t GridY, uint32_t GridZ,
const void* pParams, uint32_t ParamSize, void* const* pReadResources, uint32_t NumReadResources, void* const* pWriteResources, uint32_t NumWriteResources) {
D3D10DeviceLock lock = m_ctx->LockContext();
CubinShaderWrapper* cubinShader = static_cast<CubinShaderWrapper*>(hShader);
CubinShaderLaunchInfo launchInfo;
const uint32_t maxResources = NumReadResources + NumWriteResources;
launchInfo.buffers.reserve(maxResources);
launchInfo.images.reserve(maxResources);
for (uint32_t i = 0; i < NumReadResources; i++)
launchInfo.insertResource(static_cast<ID3D11Resource*>(pReadResources[i]), DxvkAccess::Read);
for (uint32_t i = 0; i < NumWriteResources; i++)
launchInfo.insertResource(static_cast<ID3D11Resource*>(pWriteResources[i]), DxvkAccess::Write);
launchInfo.paramSize = ParamSize;
launchInfo.params.resize(launchInfo.paramSize);
std::memcpy(launchInfo.params.data(), pParams, ParamSize);
launchInfo.cuLaunchConfig[0] = reinterpret_cast<void*>(0x01); // CU_LAUNCH_PARAM_BUFFER_POINTER
launchInfo.cuLaunchConfig[1] = launchInfo.params.data();
launchInfo.cuLaunchConfig[2] = reinterpret_cast<void*>(0x02); // CU_LAUNCH_PARAM_BUFFER_SIZE
launchInfo.cuLaunchConfig[3] = &launchInfo.paramSize; // yes, this actually requires a pointer to a size_t containing the parameter size
launchInfo.cuLaunchConfig[4] = reinterpret_cast<void*>(0x00); // CU_LAUNCH_PARAM_END
launchInfo.nvxLaunchInfo.function = cubinShader->cuFunction();
launchInfo.nvxLaunchInfo.gridDimX = GridX;
launchInfo.nvxLaunchInfo.gridDimY = GridY;
launchInfo.nvxLaunchInfo.gridDimZ = GridZ;
launchInfo.nvxLaunchInfo.blockDimX = cubinShader->blockDim().width;
launchInfo.nvxLaunchInfo.blockDimY = cubinShader->blockDim().height;
launchInfo.nvxLaunchInfo.blockDimZ = cubinShader->blockDim().depth;
launchInfo.nvxLaunchInfo.sharedMemBytes = 0;
launchInfo.nvxLaunchInfo.paramCount = 0;
launchInfo.nvxLaunchInfo.pParams = nullptr;
launchInfo.nvxLaunchInfo.extraCount = 1;
launchInfo.nvxLaunchInfo.pExtras = launchInfo.cuLaunchConfig.data();
launchInfo.shader = cubinShader;
/* Need to capture by value in case this gets called from a deferred context */
m_ctx->EmitCs([cLaunchInfo = std::move(launchInfo)] (DxvkContext* ctx) {
ctx->launchCuKernelNVX(cLaunchInfo.nvxLaunchInfo, cLaunchInfo.buffers, cLaunchInfo.images);
});
// Track resource usage as necessary
for (uint32_t i = 0; i < NumReadResources; i++)
m_ctx->TrackResourceSequenceNumber(static_cast<ID3D11Resource*>(pReadResources[i]));
for (uint32_t i = 0; i < NumWriteResources; i++)
m_ctx->TrackResourceSequenceNumber(static_cast<ID3D11Resource*>(pWriteResources[i]));
return true;
}
template class D3D11DeviceContextExt<D3D11DeferredContext>;
template class D3D11DeviceContextExt<D3D11ImmediateContext>;
}

View File

@ -4,14 +4,16 @@
namespace dxvk {
class D3D11DeviceContext;
class D3D11DeferredContext;
class D3D11ImmediateContext;
class D3D11DeviceContextExt : public ID3D11VkExtContext {
template<typename ContextType>
class D3D11DeviceContextExt : public ID3D11VkExtContext1 {
public:
D3D11DeviceContextExt(
D3D11DeviceContext* pContext);
ContextType* pContext);
ULONG STDMETHODCALLTYPE AddRef();
@ -56,11 +58,23 @@ namespace dxvk {
void STDMETHODCALLTYPE SetBarrierControl(
UINT ControlFlags);
bool STDMETHODCALLTYPE LaunchCubinShaderNVX(
IUnknown* hShader,
uint32_t GridX,
uint32_t GridY,
uint32_t GridZ,
const void* pParams,
uint32_t paramSize,
void* const* pReadResources,
uint32_t NumReadResources,
void* const* pWriteResources,
uint32_t NumWriteResources);
private:
D3D11DeviceContext* m_ctx;
ContextType* m_ctx;
};
}

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,23 @@
#pragma once
#include <chrono>
#include "../util/util_time.h"
#include "../util/sync/sync_signal.h"
#include "d3d11_context.h"
#include "d3d11_state_object.h"
#include "d3d11_video.h"
namespace dxvk {
class D3D11Buffer;
class D3D11CommonTexture;
class D3D11ImmediateContext : public D3D11DeviceContext {
class D3D11ImmediateContext : public D3D11CommonContext<D3D11ImmediateContext> {
friend class D3D11CommonContext<D3D11ImmediateContext>;
friend class D3D11SwapChain;
friend class D3D11VideoContext;
friend class D3D11DXGIKeyedMutex;
public:
D3D11ImmediateContext(
@ -18,24 +25,36 @@ namespace dxvk {
const Rc<DxvkDevice>& Device);
~D3D11ImmediateContext();
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE GetType();
UINT STDMETHODCALLTYPE GetContextFlags();
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject);
HRESULT STDMETHODCALLTYPE GetData(
ID3D11Asynchronous* pAsync,
void* pData,
UINT DataSize,
UINT GetDataFlags);
ID3D11Asynchronous* pAsync,
void* pData,
UINT DataSize,
UINT GetDataFlags);
void STDMETHODCALLTYPE End(ID3D11Asynchronous *pAsync);
void STDMETHODCALLTYPE Begin(
ID3D11Asynchronous* pAsync);
void STDMETHODCALLTYPE End(
ID3D11Asynchronous* pAsync);
void STDMETHODCALLTYPE Flush();
void STDMETHODCALLTYPE Flush1(
D3D11_CONTEXT_TYPE ContextType,
HANDLE hEvent);
HRESULT STDMETHODCALLTYPE Signal(
ID3D11Fence* pFence,
UINT64 Value);
HRESULT STDMETHODCALLTYPE Wait(
ID3D11Fence* pFence,
UINT64 Value);
void STDMETHODCALLTYPE ExecuteCommandList(
ID3D11CommandList* pCommandList,
BOOL RestoreContextState);
@ -55,52 +74,49 @@ namespace dxvk {
ID3D11Resource* pResource,
UINT Subresource);
void STDMETHODCALLTYPE UpdateSubresource(
ID3D11Resource* pDstResource,
UINT DstSubresource,
const D3D11_BOX* pDstBox,
const void* pSrcData,
UINT SrcRowPitch,
UINT SrcDepthPitch);
void STDMETHODCALLTYPE UpdateSubresource1(
ID3D11Resource* pDstResource,
UINT DstSubresource,
const D3D11_BOX* pDstBox,
const void* pSrcData,
UINT SrcRowPitch,
UINT SrcDepthPitch,
UINT CopyFlags);
void STDMETHODCALLTYPE OMSetRenderTargets(
UINT NumViews,
ID3D11RenderTargetView* const* ppRenderTargetViews,
ID3D11DepthStencilView* pDepthStencilView);
void STDMETHODCALLTYPE OMSetRenderTargetsAndUnorderedAccessViews(
UINT NumRTVs,
ID3D11RenderTargetView* const* ppRenderTargetViews,
ID3D11DepthStencilView* pDepthStencilView,
UINT UAVStartSlot,
UINT NumUAVs,
ID3D11UnorderedAccessView* const* ppUnorderedAccessViews,
const UINT* pUAVInitialCounts);
void STDMETHODCALLTYPE SwapDeviceContextState(
ID3DDeviceContextState* pState,
ID3DDeviceContextState** ppPreviousState);
ID3DDeviceContextState* pState,
ID3DDeviceContextState** ppPreviousState);
void Acquire11on12Resource(
ID3D11Resource* pResource,
VkImageLayout SrcLayout);
void Release11on12Resource(
ID3D11Resource* pResource,
VkImageLayout DstLayout);
void SynchronizeCsThread(
uint64_t SequenceNumber);
D3D10Multithread& GetMultithread() {
return m_multithread;
}
D3D10DeviceLock LockContext() {
return m_multithread.AcquireLock();
}
void SynchronizeCsThread();
private:
DxvkCsThread m_csThread;
bool m_csIsBusy = false;
DxvkCsThread m_csThread;
uint64_t m_csSeqNum = 0ull;
std::chrono::high_resolution_clock::time_point m_lastFlush
= std::chrono::high_resolution_clock::now();
Com<D3D11DeviceContextState> m_stateObject;
uint32_t m_mappedImageCount = 0u;
VkDeviceSize m_maxImplicitDiscardSize = 0ull;
Rc<sync::CallbackFence> m_submissionFence;
uint64_t m_submissionId = 0ull;
DxvkSubmitStatus m_submitStatus;
uint64_t m_flushSeqNum = 0ull;
GpuFlushTracker m_flushTracker;
D3D10Multithread m_multithread;
D3D11VideoContext m_videoContext;
Com<D3D11DeviceContextState, false> m_stateObject;
HRESULT MapBuffer(
D3D11Buffer* pResource,
@ -119,16 +135,53 @@ namespace dxvk {
D3D11CommonTexture* pResource,
UINT Subresource);
void ReadbackImageBuffer(
D3D11CommonTexture* pResource,
UINT Subresource);
void UpdateDirtyImageRegion(
D3D11CommonTexture* pResource,
UINT Subresource,
const D3D11_COMMON_TEXTURE_REGION* pRegion);
void UpdateMappedBuffer(
D3D11Buffer* pDstBuffer,
UINT Offset,
UINT Length,
const void* pSrcData,
UINT CopyFlags);
void SynchronizeDevice();
void EndFrame();
bool WaitForResource(
const Rc<DxvkResource>& Resource,
UINT MapFlags);
const Rc<DxvkResource>& Resource,
uint64_t SequenceNumber,
D3D11_MAP MapType,
UINT MapFlags);
void EmitCsChunk(DxvkCsChunkRef&& chunk);
void FlushImplicit(BOOL StrongHint);
void TrackTextureSequenceNumber(
D3D11CommonTexture* pResource,
UINT Subresource);
void TrackBufferSequenceNumber(
D3D11Buffer* pResource);
uint64_t GetCurrentSequenceNumber();
uint64_t GetPendingCsChunks();
void ConsiderFlush(
GpuFlushType FlushType);
void ExecuteFlush(
GpuFlushType FlushType,
HANDLE hEvent,
BOOL Synchronize);
};
}

View File

@ -15,166 +15,336 @@
namespace dxvk {
/**
* \brief Per-stage state
*
* Stores an object of the given type for each shader stage.
* \tparam Object type
*/
template<typename T>
class D3D11ShaderStageState {
public:
T& operator [] (DxbcProgramType type) { return m_state[uint32_t(type)]; }
const T& operator [] (DxbcProgramType type) const { return m_state[uint32_t(type)]; }
/**
* \brief Calls reset method on all objects
*/
void reset() {
for (auto& state : m_state)
state.reset();
}
private:
std::array<T, 6> m_state = { };
};
/**
* \brief Constant buffer bindings
*
* Stores the bound buffer range from a runtime point of view,
* as well as the range that is actually bound to the context.
*/
struct D3D11ConstantBufferBinding {
Com<D3D11Buffer> buffer = nullptr;
Com<D3D11Buffer, false> buffer = nullptr;
UINT constantOffset = 0;
UINT constantCount = 0;
UINT constantBound = 0;
};
using D3D11ConstantBufferBindings = std::array<
D3D11ConstantBufferBinding, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT>;
struct D3D11ShaderStageCbvBinding {
std::array<D3D11ConstantBufferBinding, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT> buffers = { };
uint32_t maxCount = 0;
void reset() {
for (uint32_t i = 0; i < maxCount; i++)
buffers[i] = D3D11ConstantBufferBinding();
maxCount = 0;
}
};
using D3D11CbvBindings = D3D11ShaderStageState<D3D11ShaderStageCbvBinding>;
using D3D11SamplerBindings = std::array<
Com<D3D11SamplerState>, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT>;
/**
* \brief Shader resource bindings
*
* Stores bound shader resource views, as well as a bit
* set of views that are potentially hazardous.
*/
struct D3D11ShaderStageSrvBinding {
std::array<Com<D3D11ShaderResourceView, false>, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT> views = { };
DxvkBindingSet<D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT> hazardous = { };
uint32_t maxCount = 0;
void reset() {
for (uint32_t i = 0; i < maxCount; i++)
views[i] = nullptr;
hazardous.clear();
maxCount = 0;
}
};
using D3D11ShaderResourceBindings = std::array<
Com<D3D11ShaderResourceView>, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT>;
using D3D11SrvBindings = D3D11ShaderStageState<D3D11ShaderStageSrvBinding>;
/**
* \brief Sampler bindings
*
* Stores bound samplers.
*/
struct D3D11ShaderStageSamplerBinding {
std::array<D3D11SamplerState*, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT> samplers = { };
uint32_t maxCount = 0;
void reset() {
for (uint32_t i = 0; i < maxCount; i++)
samplers[i] = nullptr;
maxCount = 0;
}
};
using D3D11UnorderedAccessBindings = std::array<
Com<D3D11UnorderedAccessView>, D3D11_1_UAV_SLOT_COUNT>;
using D3D11SamplerBindings = D3D11ShaderStageState<D3D11ShaderStageSamplerBinding>;
/**
* \brief UAV bindings
*
* Stores bound UAVs. For compute shader UAVs,
* we also store a bit mask of bound UAVs.
*/
using D3D11ShaderStageUavBinding = std::array<Com<D3D11UnorderedAccessView, false>, D3D11_1_UAV_SLOT_COUNT>;
struct D3D11ContextStateVS {
Com<D3D11VertexShader> shader;
D3D11ConstantBufferBindings constantBuffers;
D3D11SamplerBindings samplers;
D3D11ShaderResourceBindings shaderResources;
struct D3D11UavBindings {
D3D11ShaderStageUavBinding views = { };
DxvkBindingSet<D3D11_1_UAV_SLOT_COUNT> mask = { };
uint32_t maxCount = 0;
void reset() {
for (uint32_t i = 0; i < maxCount; i++)
views[i] = nullptr;
mask.clear();
maxCount = 0;
}
};
struct D3D11ContextStateHS {
Com<D3D11HullShader> shader;
D3D11ConstantBufferBindings constantBuffers;
D3D11SamplerBindings samplers;
D3D11ShaderResourceBindings shaderResources;
};
struct D3D11ContextStateDS {
Com<D3D11DomainShader> shader;
D3D11ConstantBufferBindings constantBuffers;
D3D11SamplerBindings samplers;
D3D11ShaderResourceBindings shaderResources;
};
struct D3D11ContextStateGS {
Com<D3D11GeometryShader> shader;
D3D11ConstantBufferBindings constantBuffers;
D3D11SamplerBindings samplers;
D3D11ShaderResourceBindings shaderResources;
};
struct D3D11ContextStatePS {
Com<D3D11PixelShader> shader;
D3D11ConstantBufferBindings constantBuffers;
D3D11SamplerBindings samplers;
D3D11ShaderResourceBindings shaderResources;
D3D11UnorderedAccessBindings unorderedAccessViews;
};
struct D3D11ContextStateCS {
Com<D3D11ComputeShader> shader;
D3D11ConstantBufferBindings constantBuffers;
D3D11SamplerBindings samplers;
D3D11ShaderResourceBindings shaderResources;
D3D11UnorderedAccessBindings unorderedAccessViews;
};
/**
* \brief Input assembly state
*
* Stores vertex buffers, the index buffer, the
* input layout, and the dynamic primitive topology.
*/
struct D3D11VertexBufferBinding {
Com<D3D11Buffer> buffer = nullptr;
UINT offset = 0;
UINT stride = 0;
Com<D3D11Buffer, false> buffer = nullptr;
UINT offset = 0;
UINT stride = 0;
};
struct D3D11IndexBufferBinding {
Com<D3D11Buffer> buffer = nullptr;
UINT offset = 0;
DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN;
Com<D3D11Buffer, false> buffer = nullptr;
UINT offset = 0;
DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN;
};
struct D3D11ContextStateID {
Com<D3D11Buffer> argBuffer = nullptr;
Com<D3D11Buffer> cntBuffer = nullptr;
};
struct D3D11ContextStateIA {
Com<D3D11InputLayout> inputLayout;
D3D11_PRIMITIVE_TOPOLOGY primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
Com<D3D11InputLayout, false> inputLayout = nullptr;
D3D11_PRIMITIVE_TOPOLOGY primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
std::array<D3D11VertexBufferBinding, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT> vertexBuffers;
D3D11IndexBufferBinding indexBuffer;
std::array<D3D11VertexBufferBinding, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT> vertexBuffers = { };
D3D11IndexBufferBinding indexBuffer = { };
uint32_t maxVbCount = 0;
void reset() {
inputLayout = nullptr;
primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
for (uint32_t i = 0; i < maxVbCount; i++)
vertexBuffers[i] = D3D11VertexBufferBinding();
indexBuffer = D3D11IndexBufferBinding();
}
};
/**
* \brief Output merger state
*
* Stores RTV, DSV, and graphics UAV bindings, as well as related state.
*/
using D3D11RenderTargetViewBinding = std::array<Com<D3D11RenderTargetView, false>, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT>;
struct D3D11ContextStateOM {
std::array<Com<D3D11RenderTargetView, false>, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT> renderTargetViews;
Com<D3D11DepthStencilView, false> depthStencilView;
D3D11ShaderStageUavBinding uavs = { };
D3D11RenderTargetViewBinding rtvs = { };
Com<D3D11DepthStencilView, false> dsv = { };
Com<D3D11BlendState> cbState = nullptr;
Com<D3D11DepthStencilState> dsState = nullptr;
D3D11BlendState* cbState = nullptr;
D3D11DepthStencilState* dsState = nullptr;
FLOAT blendFactor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
UINT sampleMask = 0xFFFFFFFFu;
UINT stencilRef = 0u;
UINT sampleCount = 0u;
UINT sampleMask = D3D11_DEFAULT_SAMPLE_MASK;
UINT stencilRef = D3D11_DEFAULT_STENCIL_REFERENCE;
UINT maxRtv = 0u;
UINT maxUav = 0u;
void reset() {
for (uint32_t i = 0; i < maxUav; i++)
uavs[i] = nullptr;
for (uint32_t i = 0; i < maxRtv; i++)
rtvs[i] = nullptr;
dsv = nullptr;
cbState = nullptr;
dsState = nullptr;
for (uint32_t i = 0; i < 4; i++)
blendFactor[i] = 1.0f;
sampleCount = 0u;
sampleMask = D3D11_DEFAULT_SAMPLE_MASK;
stencilRef = D3D11_DEFAULT_STENCIL_REFERENCE;
maxRtv = 0;
maxUav = 0;
}
};
/**
* \brief Indirect draw state
*
* Stores the current indirct draw
* argument and draw count buffer.
*/
struct D3D11ContextStateID {
Com<D3D11Buffer, false> argBuffer = nullptr;
Com<D3D11Buffer, false> cntBuffer = nullptr;
void reset() {
argBuffer = nullptr;
cntBuffer = nullptr;
}
};
/**
* \brief Rasterizer state
*
* Stores viewport info and the rasterizer state object.
*/
struct D3D11ContextStateRS {
uint32_t numViewports = 0;
uint32_t numScissors = 0;
std::array<D3D11_VIEWPORT, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> viewports;
std::array<D3D11_RECT, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> scissors;
std::array<D3D11_VIEWPORT, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> viewports = { };
std::array<D3D11_RECT, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> scissors = { };
Com<D3D11RasterizerState> state;
D3D11RasterizerState* state = nullptr;
void reset() {
for (uint32_t i = 0; i < numViewports; i++)
viewports[i] = D3D11_VIEWPORT();
for (uint32_t i = 0; i < numScissors; i++)
scissors[i] = D3D11_RECT();
numViewports = 0;
numScissors = 0;
state = nullptr;
}
};
/**
* \brief Stream output binding
*
* Stores stream output buffers with offset.
*/
struct D3D11ContextSoTarget {
Com<D3D11Buffer> buffer;
UINT offset;
Com<D3D11Buffer, false> buffer = nullptr;
UINT offset = 0;
};
struct D3D11ContextStateSO {
std::array<D3D11ContextSoTarget, D3D11_SO_BUFFER_SLOT_COUNT> targets;
std::array<D3D11ContextSoTarget, D3D11_SO_BUFFER_SLOT_COUNT> targets = { };
void reset() {
for (uint32_t i = 0; i < targets.size(); i++)
targets[i] = D3D11ContextSoTarget();
}
};
/**
* \brief Predication state
*
* Stores predication info.
*/
struct D3D11ContextStatePR {
Com<D3D11Query> predicateObject = nullptr;
BOOL predicateValue = FALSE;
Com<D3D11Query, false> predicateObject = nullptr;
BOOL predicateValue = false;
void reset() {
predicateObject = nullptr;
predicateValue = false;
}
};
/**
* \brief Context state
*/
struct D3D11ContextState {
D3D11ContextStateCS cs;
D3D11ContextStateDS ds;
D3D11ContextStateGS gs;
D3D11ContextStateHS hs;
D3D11ContextStatePS ps;
D3D11ContextStateVS vs;
Com<D3D11VertexShader, false> vs;
Com<D3D11HullShader, false> hs;
Com<D3D11DomainShader, false> ds;
Com<D3D11GeometryShader, false> gs;
Com<D3D11PixelShader, false> ps;
Com<D3D11ComputeShader, false> cs;
D3D11ContextStateID id;
D3D11ContextStateIA ia;
D3D11ContextStateOM om;
D3D11ContextStateRS rs;
D3D11ContextStateSO so;
D3D11ContextStatePR pr;
D3D11CbvBindings cbv;
D3D11SrvBindings srv;
D3D11UavBindings uav;
D3D11SamplerBindings samplers;
};
/**
* \brief Maximum used binding numbers in a shader stage
*/
struct D3D11MaxUsedStageBindings {
uint32_t cbvCount : 5;
uint32_t srvCount : 9;
uint32_t uavCount : 7;
uint32_t samplerCount : 5;
uint32_t reserved : 6;
};
/**
* \brief Maximum used binding numbers for all context state
*/
struct D3D11MaxUsedBindings {
std::array<D3D11MaxUsedStageBindings, 6> stages;
uint32_t vbCount;
uint32_t soCount;
};
}

View File

@ -1,52 +0,0 @@
#include "d3d11_counter_buffer.h"
#include "d3d11_device.h"
namespace dxvk {
D3D11CounterBuffer::D3D11CounterBuffer(
const Rc<DxvkDevice>& Device,
const DxvkBufferCreateInfo& BufferInfo,
VkDeviceSize SliceLength)
: m_device (Device),
m_bufferInfo (BufferInfo),
m_sliceLength (SliceLength) {
}
D3D11CounterBuffer::~D3D11CounterBuffer() {
}
DxvkBufferSlice D3D11CounterBuffer::AllocSlice() {
std::lock_guard<std::mutex> lock(m_mutex);
if (m_freeSlices.size() == 0)
CreateBuffer();
DxvkBufferSlice slice = m_freeSlices.back();
m_freeSlices.pop_back();
return slice;
}
void D3D11CounterBuffer::FreeSlice(const DxvkBufferSlice& Slice) {
std::lock_guard<std::mutex> lock(m_mutex);
m_freeSlices.push_back(Slice);
}
void D3D11CounterBuffer::CreateBuffer() {
Rc<DxvkBuffer> buffer = m_device->createBuffer(m_bufferInfo,
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
VkDeviceSize sliceCount = m_bufferInfo.size / m_sliceLength;
for (uint32_t i = 0; i < sliceCount; i++) {
m_freeSlices.push_back(DxvkBufferSlice(
buffer, m_sliceLength * i, m_sliceLength));
}
}
}

View File

@ -1,63 +0,0 @@
#pragma once
#include "d3d11_include.h"
#include "../dxvk/dxvk_buffer.h"
#include "../dxvk/dxvk_device.h"
namespace dxvk {
class D3D11Device;
/**
* \brief D3D11 UAV counter slice allocator
*
* Thread safe allocator for buffer slices of
* the same size, which are typically used to
* store counters (such as UAV counters).
*/
class D3D11CounterBuffer : public RcObject {
public:
D3D11CounterBuffer(
const Rc<DxvkDevice>& Device,
const DxvkBufferCreateInfo& BufferInfo,
VkDeviceSize SliceLength);
~D3D11CounterBuffer();
/**
* \brief Allocates a counter slice
*
* Picks a slice from the free list or
* creates a new buffer if necessary.
* \returns The counter slice
*/
DxvkBufferSlice AllocSlice();
/**
* \brief Frees a counter slice
*
* Adds the given slice back to the
* free list so that it can be reused.
* \param [in] Slice the slice to free
*/
void FreeSlice(
const DxvkBufferSlice& Slice);
private:
Rc<DxvkDevice> m_device;
DxvkBufferCreateInfo m_bufferInfo;
VkDeviceSize m_sliceLength;
std::mutex m_mutex;
std::vector<DxvkBufferSlice> m_freeSlices;
void CreateBuffer();
};
}

51
src/d3d11/d3d11_cuda.cpp Normal file
View File

@ -0,0 +1,51 @@
#include "d3d11_cuda.h"
namespace dxvk {
CubinShaderWrapper::CubinShaderWrapper(const Rc<dxvk::DxvkDevice>& dxvkDevice, VkCuModuleNVX cuModule, VkCuFunctionNVX cuFunction, VkExtent3D blockDim)
: m_dxvkDevice(dxvkDevice), m_module(cuModule), m_function(cuFunction), m_blockDim(blockDim) { };
CubinShaderWrapper::~CubinShaderWrapper() {
VkDevice vkDevice = m_dxvkDevice->handle();
m_dxvkDevice->vkd()->vkDestroyCuFunctionNVX(vkDevice, m_function, nullptr);
m_dxvkDevice->vkd()->vkDestroyCuModuleNVX(vkDevice, m_module, nullptr);
};
HRESULT STDMETHODCALLTYPE CubinShaderWrapper::QueryInterface(REFIID riid, void **ppvObject) {
if (riid == __uuidof(IUnknown)) {
*ppvObject = ref(this);
return S_OK;
}
Logger::warn("CubinShaderWrapper::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
return E_NOINTERFACE;
}
void CubinShaderLaunchInfo::insertResource(ID3D11Resource* pResource, DxvkAccessFlags access) {
auto img = GetCommonTexture(pResource);
auto buf = GetCommonBuffer(pResource);
if (img)
insertUniqueResource(images, img->GetImage(), access);
if (buf)
insertUniqueResource(buffers, buf->GetBuffer(), access);
}
template<typename T>
void CubinShaderLaunchInfo::insertUniqueResource(std::vector<std::pair<T, DxvkAccessFlags>>& list, const T& resource, DxvkAccessFlags access) {
for (auto& entry : list) {
if (entry.first == resource) {
entry.second.set(access);
return;
}
}
list.push_back({ resource, access });
}
}

Some files were not shown because too many files have changed in this diff Show More