Compare commits

...

2315 Commits

Author SHA1 Message Date
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
531 changed files with 58444 additions and 55909 deletions

View File

@ -7,14 +7,9 @@ assignees: ''
---
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.
Please describe your issue as accurately as possible.
**Important:** When reporting an issue with a specific game or application, such as crashes or rendering issues, please include log files and, if possible, a D3D11/D3D9 Apitrace (see https://github.com/apitrace/apitrace) so that the issue can be reproduced.
In order to create a trace for **D3D11/D3D10**: Run `wine apitrace.exe trace -a dxgi YOURGAME.exe`.
In order to create a trace for **D3D9**: Follow https://github.com/Joshua-Ashton/d9vk/wiki/Making-a-Trace.
Preferably record the trace on Windows, or wined3d if possible.
**Reports with no log files will be ignored.**
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.
@ -28,7 +23,9 @@ Name of the game, settings used etc.
### 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
- d3d9.log:
- d3d11.log:
- dxgi.log:
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

View File

@ -1,8 +0,0 @@
dxvk:
script:
- chmod +x package-release.sh
- ./package-release.sh release build --no-package
artifacts:
name: "dxvk-${CI_COMMIT_REF_NAME}.${CI_COMMIT_SHA}"
paths:
- build/dxvk-release

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,5 +1,5 @@
Copyright (c) 2017-2020 Philip Rebohle
Copyright (c) 2019-2020 Joshua Ashton
Copyright (c) 2017 Philip Rebohle
Copyright (c) 2019 Joshua Ashton
zlib/libpng license

110
README.md
View File

@ -4,36 +4,50 @@ A Vulkan-based translation layer for Direct3D 9/10/11 which allows running 3D ap
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.
- `--with-d3d10`: Install the `d3d10{_1}.dll` helper libraries.
- `--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 `d3d9.log` or `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.46)
- [Mingw-w64](http://mingw-w64.org/) compiler and headers (at least version 6.0)
- [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
@ -57,19 +71,21 @@ ninja install
```
# 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 D3D9, 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.
### 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.
@ -78,47 +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.
- `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_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. 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'".
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.7.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++']
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]

468
dxvk.conf
View File

@ -1,3 +1,15 @@
# 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,
@ -19,6 +31,16 @@
# 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
# cause the app to adjust behaviour depending on the selected values.
#
@ -31,18 +53,51 @@
# 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.
@ -50,12 +105,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.
@ -65,7 +130,7 @@
#
# Supported values: Any non-negative number
# dxgi.syncInterval = -1
# dxgi.syncInterval = -1
# d3d9.presentInterval = -1
@ -82,17 +147,7 @@
#
# Supported values: Auto, True, False
# dxgi.tearFree = Auto
# d3d9.tearFree = Auto
# 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.
#
# Supported values: True, False
# d3d11.constantBufferRangeCheck = False
# dxvk.tearFree = Auto
# Assume single-use mode for command lists created on deferred contexts.
@ -108,9 +163,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
@ -131,6 +186,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.
@ -138,7 +203,27 @@
# Supported values: Any number between 0 and 16
# d3d11.samplerAnisotropy = -1
# d3d9.samplerAnisotropy = -1
# d3d9.samplerAnisotropy = -1
# 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.clampNegativeLodBias = False
# d3d9.clampNegativeLodBias = False
# Declares vertex positions as invariant in order to solve
@ -146,16 +231,26 @@
#
# Supported values: True, False
# d3d11.invariantPosition = False
# d3d9.invariantPosition = False
# d3d11.invariantPosition = True
# d3d9.invariantPosition = True
# Replaces NaN outputs from fragment shaders with zeroes for floating
# point render target. Used in some games to prevent artifacting.
# 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.enableRtOutputNanFixup = 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
@ -166,10 +261,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
@ -190,19 +354,43 @@
# dxvk.useRawSsbo = Auto
# Toggles early discard.
#
# 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.
#
# Changes memory chunk size.
#
# Can be used to override the maximum memory chunk size.
#
# Supported values:
# - Auto: Don't change the default
# - True, False: Always enable / disable
# - 0 to use the defaults
# - any positive integer to limit the chunk size, in MiB
# dxvk.useEarlyDiscard = Auto
# 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
@ -227,17 +415,6 @@
# d3d9.shaderModel = 3
# Evict Managed on Unlock
#
# Decides whether we should evict managed resources from
# system memory when they are unlocked entirely.
#
# Supported values:
# - True, False: Always enable / disable
# d3d9.evictManagedOnUnlock = False
# DPI Awareness
#
# Decides whether we should call SetProcessDPIAware on device
@ -290,19 +467,24 @@
# Value in Megabytes
#
# Supported values:
# - Any int32_t
# - 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
# Tristate
# Setting it to True will use a faster but less accurate approach that works for most games.
# Supported values:
# - True/False
# - 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 =
# d3d9.floatEmulation = Auto
# Enable dialog box mode
@ -319,7 +501,7 @@
#
# Supported values: -1 (application) and 0 to 16 (user override)
# d3d9.forceSwapchainMSAA = -1
# d3d9.forceSwapchainMSAA = -1
# Long Mad
@ -331,4 +513,184 @@
# 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,86 +0,0 @@
#ifndef VULKAN_H_
#define VULKAN_H_ 1
/*
** Copyright (c) 2015-2019 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_FUCHSIA
#include <zircon/types.h>
#include "vulkan_fuchsia.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_METAL_EXT
#include "vulkan_metal.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
#ifdef VK_USE_PLATFORM_GGP
#include <ggp_c/vulkan_types.h>
#include "vulkan_ggp.h"
#endif
#endif // VULKAN_H_

File diff suppressed because it is too large Load Diff

View File

@ -1,328 +0,0 @@
#ifndef VULKAN_WIN32_H_
#define VULKAN_WIN32_H_ 1
/*
** Copyright (c) 2015-2019 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.
**
*/
#ifdef __cplusplus
extern "C" {
#endif
#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 2
#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;
#define VK_EXT_full_screen_exclusive 1
#define VK_EXT_FULL_SCREEN_EXCLUSIVE_SPEC_VERSION 4
#define VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME "VK_EXT_full_screen_exclusive"
typedef enum VkFullScreenExclusiveEXT {
VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT = 0,
VK_FULL_SCREEN_EXCLUSIVE_ALLOWED_EXT = 1,
VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT = 2,
VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT = 3,
VK_FULL_SCREEN_EXCLUSIVE_BEGIN_RANGE_EXT = VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT,
VK_FULL_SCREEN_EXCLUSIVE_END_RANGE_EXT = VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT,
VK_FULL_SCREEN_EXCLUSIVE_RANGE_SIZE_EXT = (VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT - VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT + 1),
VK_FULL_SCREEN_EXCLUSIVE_MAX_ENUM_EXT = 0x7FFFFFFF
} VkFullScreenExclusiveEXT;
typedef struct VkSurfaceFullScreenExclusiveInfoEXT {
VkStructureType sType;
void* pNext;
VkFullScreenExclusiveEXT fullScreenExclusive;
} VkSurfaceFullScreenExclusiveInfoEXT;
typedef struct VkSurfaceCapabilitiesFullScreenExclusiveEXT {
VkStructureType sType;
void* pNext;
VkBool32 fullScreenExclusiveSupported;
} VkSurfaceCapabilitiesFullScreenExclusiveEXT;
typedef struct VkSurfaceFullScreenExclusiveWin32InfoEXT {
VkStructureType sType;
const void* pNext;
HMONITOR hmonitor;
} VkSurfaceFullScreenExclusiveWin32InfoEXT;
typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModes2EXT)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes);
typedef VkResult (VKAPI_PTR *PFN_vkAcquireFullScreenExclusiveModeEXT)(VkDevice device, VkSwapchainKHR swapchain);
typedef VkResult (VKAPI_PTR *PFN_vkReleaseFullScreenExclusiveModeEXT)(VkDevice device, VkSwapchainKHR swapchain);
typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupSurfacePresentModes2EXT)(VkDevice device, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, VkDeviceGroupPresentModeFlagsKHR* pModes);
#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModes2EXT(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
uint32_t* pPresentModeCount,
VkPresentModeKHR* pPresentModes);
VKAPI_ATTR VkResult VKAPI_CALL vkAcquireFullScreenExclusiveModeEXT(
VkDevice device,
VkSwapchainKHR swapchain);
VKAPI_ATTR VkResult VKAPI_CALL vkReleaseFullScreenExclusiveModeEXT(
VkDevice device,
VkSwapchainKHR swapchain);
VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModes2EXT(
VkDevice device,
const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
VkDeviceGroupPresentModeFlagsKHR* pModes);
#endif
#ifdef __cplusplus
}
#endif
#endif

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,109 +1,194 @@
project('dxvk', ['c', 'cpp'], version : 'v1.7.2', meson_version : '>= 0.46')
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')
dxvk_msvc=dxvk_compiler.get_id() == 'msvc'
# c++17 was added in 15.3, older version needs c++latest
if dxvk_compiler.get_id() == 'msvc' and dxvk_compiler.version().version_compare('<15.3')
dxvk_cpp_std='c++latest'
else
dxvk_cpp_std='c++17'
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
if dxvk_compiler.get_id() == 'clang'
if dxvk_compiler.has_argument('-Wno-unused-private-field')
add_project_arguments('-Wno-unused-private-field', language: 'cpp')
endif
if dxvk_compiler.has_argument('-Wno-microsoft-exception-spec')
add_project_arguments('-Wno-microsoft-exception-spec', language: 'cpp')
endif
endif
dep_displayinfo = dependency(
'libdisplay-info',
version: ['>= 0.0.0', '< 0.2.0'],
fallback: ['libdisplay-info', 'di_dep'],
default_options: ['default_library=static'],
)
dxvk_include_path = include_directories('./include')
if platform == 'windows'
dxvk_so_version = {'name_prefix': ''}
if (cpu_family == 'x86_64')
dxvk_library_path = meson.source_root() + '/lib'
else
dxvk_library_path = meson.source_root() + '/lib32'
endif
compiler_args += [
'-DNOMINMAX',
'-D_WIN32_WINNT=0xa00',
]
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_compiler.get_id() == 'msvc'
wrc = find_program('rc')
else
if cpu_family == 'x86_64'
wrc = find_program('x86_64-w64-mingw32-windres')
elif cpu_family == 'x86'
wrc = find_program('i686-w64-mingw32-windres')
# 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
error('Unsupported target architecture')
link_args += [
'/FILEALIGN:4096',
]
endif
endif
if cpu_family == 'x86'
if dxvk_compiler.has_link_argument('-Wl,--add-stdcall-alias')
add_global_link_arguments('-Wl,--add-stdcall-alias', language: 'cpp')
lib_d3d9 = cpp.find_library('d3d9')
lib_d3d11 = cpp.find_library('d3d11')
lib_dxgi = cpp.find_library('dxgi')
if dxvk_is_msvc
lib_d3dcompiler_47 = cpp.find_library('d3dcompiler')
else
lib_d3dcompiler_47 = cpp.find_library('d3dcompiler_47')
endif
if dxvk_compiler.has_link_argument('-Wl,--enable-stdcall-fixup')
add_global_link_arguments('-Wl,--enable-stdcall-fixup', language: 'cpp')
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
endif
lib_vulkan = dxvk_compiler.find_library('vulkan-1', dirs : dxvk_library_path)
lib_d3d9 = dxvk_compiler.find_library('d3d9')
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)
if dxvk_compiler.get_id() == 'msvc'
lib_d3dcompiler_47 = dxvk_compiler.find_library('d3dcompiler')
dxvk_name_prefix = ''
compiler_args += ['-DDXVK_WSI_WIN32']
else
lib_d3dcompiler_47 = dxvk_compiler.find_library('d3dcompiler_47')
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 = ''
dll_ext = ''
if dxvk_compiler.get_id() == 'msvc'
res_ext = '.res'
else
res_ext = '.o'
endif
def_spec_ext = '.def'
glsl_compiler = find_program('glslangValidator')
glsl_generator = generator(glsl_compiler,
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' ],
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@' ])
else
wrc_generator = generator(wrc,
output : [ '@BASENAME@' + res_ext ],
arguments : [ '-i', '@INPUT@', '-o', '@OUTPUT@' ])
endif
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,5 +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,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e
@ -10,7 +10,8 @@ if [ -z "$1" ] || [ -z "$2" ]; then
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,6 +24,7 @@ shift 2
opt_nopackage=0
opt_devbuild=0
opt_buildid=false
crossfile="build-win"
@ -35,6 +37,9 @@ while [ $# -gt 0 ]; do
opt_nopackage=1
opt_devbuild=1
;;
"--build-id")
opt_buildid=true
;;
*)
echo "Unrecognized option: $1" >&2
exit 1
@ -48,13 +53,18 @@ 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"
@ -67,11 +77,6 @@ function build_arch {
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"
@ -80,7 +85,6 @@ function package {
build_arch 64
build_arch 32
build_script
if [ $opt_nopackage -eq 0 ]; then
package

View File

@ -1,213 +0,0 @@
#!/bin/bash
# default directories
dxvk_lib32=${dxvk_lib32:-"x32"}
dxvk_lib64=${dxvk_lib64:-"x64"}
# 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] [--with-d3d10] [--symlink]"
exit 1
esac
# process arguments
shift
with_dxgi=true
with_d3d10=false
file_cmd="cp -v"
while (($# > 0)); do
case "$1" in
"--without-dxgi")
with_dxgi=false
;;
"--with-d3d10")
with_d3d10=true
;;
"--symlink")
file_cmd="ln -s -v"
;;
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
wine="wine"
wine64="wine64"
wineboot="wineboot"
# $PATH is the way for user to control where wine is located (including custom Wine versions).
# Pure 64-bit Wine (non Wow64) requries skipping 32-bit steps.
# In such case, wine64 and winebooot will be present, but wine binary will be missing,
# however it can be present in other PATHs, so it shouldn't be used, to avoid versions mixing.
wine_path=$(dirname "$(which $wineboot)")
wow64=true
if ! [ -f "$wine_path/$wine" ]; then
wine=$wine64
wow64=false
fi
# 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
win64_sys_path=$($wine64 winepath -u 'C:\windows\system32' 2> /dev/null)
win64_sys_path="${win64_sys_path/$'\r'/}"
if $wow64; then
win32_sys_path=$($wine winepath -u 'C:\windows\system32' 2> /dev/null)
win32_sys_path="${win32_sys_path/$'\r'/}"
fi
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 -v "${dstfile}" "${dstfile}.old"
else
rm -v "${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 -v "${dstfile}"
mv -v "${dstfile}.old" "${dstfile}"
return 0
else
return 1
fi
}
install() {
installFile "$win64_sys_path" "$dxvk_lib64" "$1"
inst64_ret="$?"
inst32_ret=-1
if $wow64; then
installFile "$win32_sys_path" "$dxvk_lib32" "$1"
inst32_ret="$?"
fi
if (( ($inst32_ret == 0) || ($inst64_ret == 0) )); then
overrideDll "$1"
fi
}
uninstall() {
uninstallFile "$win64_sys_path" "$dxvk_lib64" "$1"
uninst64_ret="$?"
uninst32_ret=-1
if $wow64; then
uninstallFile "$win32_sys_path" "$dxvk_lib32" "$1"
uninst32_ret="$?"
fi
if (( ($uninst32_ret == 0) || ($uninst64_ret == 0) )); then
restoreDll "$1"
fi
}
# skip dxgi during install if not explicitly
# enabled, but always try to uninstall it
if $with_dxgi || [ "$action" == "uninstall" ]; then
$action dxgi
fi
$action d3d9
if $with_d3d10 || [ "$action" == "uninstall" ]; then
$action d3d10
$action d3d10_1
fi
$action d3d10core
$action d3d11

View File

@ -1,29 +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
D3D10GetVersion
D3D10RegisterLayers

View File

@ -1,29 +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
D3D10GetVersion
D3D10RegisterLayers

View File

@ -9,10 +9,14 @@ extern "C" {
HRESULT __stdcall D3D11CoreCreateDevice(
IDXGIFactory* pFactory,
IDXGIAdapter* pAdapter,
D3D_DRIVER_TYPE DriverType,
HMODULE Software,
UINT Flags,
const D3D_FEATURE_LEVEL* pFeatureLevels,
UINT FeatureLevels,
ID3D11Device** ppDevice);
UINT SDKVersion,
ID3D11Device** ppDevice,
D3D_FEATURE_LEVEL* pFeatureLevel);
DLLEXPORT HRESULT __stdcall D3D10CoreCreateDevice(
@ -31,8 +35,8 @@ extern "C" {
if (FAILED(hr))
return hr;
hr = D3D11CoreCreateDevice(pFactory, pAdapter,
Flags, &FeatureLevel, 1, &d3d11Device);
hr = D3D11CoreCreateDevice(pFactory, pAdapter, D3D_DRIVER_TYPE_UNKNOWN,
nullptr, Flags, &FeatureLevel, 1, D3D11_SDK_VERSION, &d3d11Device, nullptr);
if (FAILED(hr))
return hr;

View File

@ -705,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);
}

View File

@ -1,9 +0,0 @@
#pragma once
#include "d3d10_include.h"
#ifdef _MSC_VER
struct __declspec(uuid("0803425a-57f5-4dd6-9465-a87570834a08")) ID3D10StateBlock;
#else
__CRT_UUID_DECL(ID3D10StateBlock, 0x0803425a,0x57f5,0x4dd6,0x94,0x65,0xa8,0x75,0x70,0x83,0x4a,0x08);
#endif

View File

@ -1,335 +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 D3D10CoreCreateDevice(
IDXGIFactory* pFactory,
IDXGIAdapter* pAdapter,
UINT Flags,
D3D_FEATURE_LEVEL FeatureLevel,
ID3D10Device** ppDevice);
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);
}
UINT64 STDMETHODCALLTYPE D3D10GetVersion() {
return 0xa000100041770ull;
}
HRESULT STDMETHODCALLTYPE D3D10RegisterLayers() {
return E_NOTIMPL;
}
}

View File

@ -1,12 +1,17 @@
#include <utility>
#include "d3d10_device.h"
namespace dxvk {
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) {
}
@ -47,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

@ -64,7 +64,8 @@ namespace dxvk {
D3D10Multithread(
IUnknown* pParent,
BOOL Protected);
BOOL Protected,
BOOL Force);
~D3D10Multithread();
@ -95,6 +96,8 @@ namespace dxvk {
IUnknown* m_parent;
BOOL m_protected;
BOOL m_enabled;
BOOL m_forced;
sync::RecursiveSpinlock m_mutex;

View File

@ -6,7 +6,6 @@ namespace dxvk {
class D3D10Device;
class D3D11Device;
class D3D11DeviceContext;
class D3D11Query;
class D3D10Query : public ID3D10Predicate {

View File

@ -1,326 +0,0 @@
#include "d3d10_reflection.h"
namespace dxvk {
D3D10ShaderReflectionType::D3D10ShaderReflectionType(
ID3D11ShaderReflectionType* d3d11)
: m_d3d11(d3d11) {
}
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) {
if (!pMemberType)
return nullptr;
auto entry = m_members.find(pMemberType);
if (entry == m_members.end()) {
entry = m_members.insert({ pMemberType,
std::make_unique<D3D10ShaderReflectionType>(pMemberType) }).first;
}
return entry->second.get();
}
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) {
}
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) {
if (!pVariable)
return nullptr;
auto entry = m_variables.find(pVariable);
if (entry == m_variables.end()) {
entry = m_variables.emplace(
std::piecewise_construct,
std::forward_as_tuple(pVariable),
std::forward_as_tuple(pVariable)).first;
}
return &entry->second;
}
D3D10ShaderReflection::D3D10ShaderReflection(ID3D11ShaderReflection* d3d11)
: m_d3d11(d3d11) {
}
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) {
if (!pConstantBuffer)
return nullptr;
auto entry = m_constantBuffers.find(pConstantBuffer);
if (entry == m_constantBuffers.end()) {
entry = m_constantBuffers.emplace(
std::piecewise_construct,
std::forward_as_tuple(pConstantBuffer),
std::forward_as_tuple(pConstantBuffer)).first;
}
return &entry->second;
}
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,163 +0,0 @@
#pragma once
#include <unordered_map>
#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::unordered_map<
ID3D11ShaderReflectionType*,
std::unique_ptr<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::unordered_map<
ID3D11ShaderReflectionVariable*,
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::unordered_map<
ID3D11ShaderReflectionConstantBuffer*,
D3D10ShaderReflectionConstantBuffer> m_constantBuffers;
ID3D10ShaderReflectionConstantBuffer* FindConstantBuffer(
ID3D11ShaderReflectionConstantBuffer* pConstantBuffer);
void ConvertSignatureParameterDesc(
const D3D11_SIGNATURE_PARAMETER_DESC* pSrcDesc,
D3D10_SIGNATURE_PARAMETER_DESC* pDstDesc);
};
}

View File

@ -1,432 +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),
}};
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 == __uuidof(ID3D10StateBlock)) {
*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,82 +0,0 @@
#pragma once
#include "d3d10_include.h"
#include "d3d10_interfaces.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:
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);
};
}

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

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

View File

@ -1,49 +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_core_src = [
'd3d10_core.cpp',
]
d3d10_main_src = [
'd3d10_main.cpp',
'd3d10_reflection.cpp',
'd3d10_state_block.cpp',
]
d3d10_core_ld_args = []
d3d10_core_link_depends = []
d3d10_core_dll = shared_library('d3d10core'+dll_ext, d3d10_core_src, d3d10_core_res,
name_prefix : '',
dependencies : [ d3d11_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_core_dep = declare_dependency(
link_with : [ d3d10_core_dll ])
link_with : [ d3d10_core_dll ],
)
d3d10_deps = [ lib_d3dcompiler_43, lib_dxgi, dxbc_dep, dxvk_dep, d3d10_core_dep ]
d3d10_dll = shared_library('d3d10'+dll_ext, d3d10_main_src, d3d10_res,
name_prefix : '',
dependencies : [ d3d10_deps ],
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_1_dll = shared_library('d3d10_1'+dll_ext, d3d10_main_src, d3d10_1_res,
name_prefix : '',
dependencies : [ d3d10_deps ],
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 Runtime"
VALUE "FileVersion", "10.0.17763.1 (WinBuild.160101.0800)"
VALUE "InternalName", "D3D10.dll"
VALUE "LegalCopyright", "zlib/libpng license"
VALUE "OriginalFilename", "D3D10.dll"
VALUE "ProductName", "DXVK"
VALUE "ProductVersion", "10.0.17763.1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0809, 1200
END
END

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

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,22 +35,6 @@ namespace dxvk {
D3D11BlendState::~D3D11BlendState() {
}
ULONG STDMETHODCALLTYPE D3D11BlendState::AddRef() {
ULONG refCount = m_refCount++;
if (!refCount)
m_device->AddRef();
return refCount + 1;
}
ULONG STDMETHODCALLTYPE D3D11BlendState::Release() {
ULONG refCount = --m_refCount;
if (!refCount)
m_device->Release();
return refCount;
}
HRESULT STDMETHODCALLTYPE D3D11BlendState::QueryInterface(REFIID riid, void** ppvObject) {
@ -73,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;
@ -107,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

View File

@ -11,7 +11,7 @@ namespace dxvk {
class D3D11Device;
class D3D11BlendState : public D3D11DeviceChild<ID3D11BlendState1, NoWrapper> {
class D3D11BlendState : public D3D11StateObject<ID3D11BlendState1> {
public:
@ -21,18 +21,11 @@ namespace dxvk {
D3D11Device* device,
const D3D11_BLEND_DESC1& desc);
~D3D11BlendState();
ULONG STDMETHODCALLTYPE AddRef() final;
ULONG STDMETHODCALLTYPE Release() final;
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject) final;
void STDMETHODCALLTYPE GetDevice(
ID3D11Device **ppDevice) final;
void STDMETHODCALLTYPE GetDesc(
D3D11_BLEND_DESC* pDesc) final;
@ -40,7 +33,7 @@ namespace dxvk {
D3D11_BLEND_DESC1* pDesc) final;
void BindToContext(
const Rc<DxvkContext>& ctx,
DxvkContext* ctx,
UINT sampleMask) const;
D3D10BlendState* GetD3D10Iface() {
@ -55,7 +48,6 @@ namespace dxvk {
private:
D3D11Device* const m_device;
D3D11_BLEND_DESC1 m_desc;
std::array<DxvkBlendMode, 8> m_blendModes;
@ -63,8 +55,6 @@ namespace dxvk {
DxvkLogicOpState m_loState;
D3D10BlendState m_d3d10;
std::atomic<uint32_t> m_refCount = { 0u };
static DxvkBlendMode DecodeBlendMode(
const D3D11_RENDER_TARGET_BLEND_DESC1& BlendDesc);

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_resource (this, pDevice),
m_d3d10 (this) {
DxvkBufferCreateInfo info;
DxvkBufferCreateInfo info;
info.flags = 0;
info.size = pDesc->ByteWidth;
info.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT
| VK_BUFFER_USAGE_TRANSFER_DST_BIT;
@ -35,17 +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 (m_device->GetOptions()->constantBufferRangeCheck)
info.usage |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
}
if (pDesc->BindFlags & D3D11_BIND_SHADER_RESOURCE) {
info.usage |= VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT
| VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
info.stages |= m_device->GetEnabledShaderStages();
info.stages |= m_parent->GetEnabledShaderStages();
info.access |= VK_ACCESS_SHADER_READ_BIT;
}
@ -58,7 +57,7 @@ namespace dxvk {
if (pDesc->BindFlags & D3D11_BIND_UNORDERED_ACCESS) {
info.usage |= VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT
| VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
info.stages |= m_device->GetEnabledShaderStages();
info.stages |= m_parent->GetEnabledShaderStages();
info.access |= VK_ACCESS_SHADER_READ_BIT
| VK_ACCESS_SHADER_WRITE_BIT;
}
@ -69,10 +68,50 @@ namespace dxvk {
info.access |= VK_ACCESS_INDIRECT_COMMAND_READ_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, GetMemoryFlags());
m_mapped = m_buffer->getSliceHandle();
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;
}
// 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)
@ -81,7 +120,8 @@ namespace dxvk {
D3D11Buffer::~D3D11Buffer() {
if (m_desc.CPUAccessFlags && m_11on12.Resource != nullptr)
m_11on12.Resource->Unmap(0, nullptr);
}
@ -114,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;
}
@ -161,8 +199,8 @@ 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);
}
@ -170,13 +208,9 @@ namespace dxvk {
HRESULT D3D11Buffer::NormalizeBufferProperties(D3D11_BUFFER_DESC* pDesc) {
// Zero-sized buffers are illegal
if (!pDesc->ByteWidth)
if (!pDesc->ByteWidth && !(pDesc->MiscFlags & D3D11_RESOURCE_MISC_TILE_POOL))
return E_INVALIDARG;
// We don't support tiled resources
if (pDesc->MiscFlags & (D3D11_RESOURCE_MISC_TILE_POOL | D3D11_RESOURCE_MISC_TILED))
return E_INVALIDARG;
// Constant buffer size must be a multiple of 16
if ((pDesc->BindFlags & D3D11_BIND_CONSTANT_BUFFER)
&& (pDesc->ByteWidth & 0xF))
@ -197,7 +231,25 @@ namespace dxvk {
// 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;
@ -205,17 +257,50 @@ namespace dxvk {
}
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;
@ -250,7 +335,11 @@ namespace dxvk {
break;
}
if (memoryFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT && m_device->GetOptions()->apitraceMode) {
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;
}
@ -260,7 +349,7 @@ namespace dxvk {
Rc<DxvkBuffer> D3D11Buffer::CreateSoCounterBuffer() {
Rc<DxvkDevice> device = m_device->GetDXVKDevice();
Rc<DxvkDevice> device = m_parent->GetDXVKDevice();
DxvkBufferCreateInfo info;
info.size = sizeof(D3D11SOCounter);
@ -278,6 +367,13 @@ namespace dxvk {
| 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;
}
D3D11Buffer* GetCommonBuffer(ID3D11Resource* pResource) {

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,26 +69,42 @@ 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() {
@ -114,6 +130,29 @@ 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 Retrieves D3D11on12 resource info
* \returns 11on12 resource info
*/
D3D11_ON_12_RESOURCE_INFO Get11on12Info() const {
return m_11on12;
}
/**
* \brief Normalizes buffer description
*
@ -123,26 +162,44 @@ namespace dxvk {
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;
Rc<DxvkBuffer> 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,63 +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) {
m_chunks.push_back(std::move(Chunk));
}
void D3D11CommandList::AddQuery(D3D11Query* pQuery) {
m_queries.emplace_back(pQuery);
}
void D3D11CommandList::EmitToCommandList(ID3D11CommandList* pCommandList) {
auto cmdList = static_cast<D3D11CommandList*>(pCommandList);
for (const auto& chunk : m_chunks)
cmdList->m_chunks.push_back(chunk);
for (const auto& query : m_queries)
cmdList->m_queries.push_back(query);
MarkSubmitted();
uint64_t D3D11CommandList::AddChunk(DxvkCsChunkRef&& Chunk) {
m_chunks.push_back(std::move(Chunk));
return m_chunks.size() - 1;
}
void D3D11CommandList::EmitToCsThread(DxvkCsThread* CsThread) {
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 (const auto& chunk : m_chunks)
CsThread->dispatchChunk(DxvkCsChunkRef(chunk));
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::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,36 +22,48 @@ namespace dxvk {
REFIID riid,
void** ppvObject) final;
void STDMETHODCALLTYPE GetDevice(
ID3D11Device **ppDevice) final;
UINT STDMETHODCALLTYPE GetContextFlags() final;
void AddChunk(
DxvkCsChunkRef&& Chunk);
void AddQuery(
D3D11Query* pQuery);
void EmitToCommandList(
ID3D11CommandList* pCommandList);
uint64_t AddChunk(
DxvkCsChunkRef&& Chunk);
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:
D3D11Device* const m_device;
UINT const m_contextFlags;
struct TrackedResource {
D3D11ResourceRef ref;
uint64_t chunkId;
};
UINT m_contextFlags;
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();
}
@ -146,14 +135,26 @@ namespace dxvk {
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();
}
@ -162,19 +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;
}
@ -190,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(std::move(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
@ -259,9 +263,7 @@ namespace dxvk {
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)) {
@ -269,18 +271,15 @@ 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(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.
auto bufferSlice = pBuffer->AllocSlice();
pMapEntry->MapPointer = bufferSlice.mapPtr;
pMappedResource->pData = bufferSlice.mapPtr;
EmitCs([
cDstBuffer = pBuffer->GetBuffer(),
@ -292,7 +291,7 @@ namespace dxvk {
// For GPU-writable resources, we need a data slice
// to perform the update operation at execution time.
auto dataSlice = AllocUpdateBufferSlice(pBuffer->Desc()->ByteWidth);
pMapEntry->MapPointer = dataSlice.ptr();
pMappedResource->pData = dataSlice.ptr();
EmitCs([
cDstBuffer = pBuffer->GetBuffer(),
@ -311,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");
@ -325,73 +321,56 @@ 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 dataSlice = AllocUpdateBufferSlice(zSize);
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->MapPointer = dataSlice.ptr();
EmitCs([
cImage = pTexture->GetImage(),
cSubresource = pTexture->GetSubresourceFromIndex(
VK_IMAGE_ASPECT_COLOR_BIT, Subresource),
cDataSlice = 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);
}
});
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::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());
@ -407,12 +386,64 @@ namespace dxvk {
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,26 +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;
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(
@ -28,10 +30,6 @@ namespace dxvk {
const Rc<DxvkDevice>& Device,
UINT ContextFlags);
D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE GetType();
UINT STDMETHODCALLTYPE GetContextFlags();
HRESULT STDMETHODCALLTYPE GetData(
ID3D11Asynchronous* pAsync,
void* pData,
@ -81,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;
@ -96,36 +96,53 @@ namespace dxvk {
// 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);
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

@ -2,18 +2,22 @@
#include "../util/util_time.h"
#include "../util/sync/sync_signal_win32.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(
@ -21,14 +25,10 @@ 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,
@ -74,57 +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::atomic<uint32_t> m_refCount = { 0 };
uint32_t m_mappedImageCount = 0u;
Rc<sync::Win32Fence> m_eventSignal;
uint64_t m_eventCount = 0;
VkDeviceSize m_maxImplicitDiscardSize = 0ull;
dxvk::high_resolution_clock::time_point m_lastFlush
= dxvk::high_resolution_clock::now();
Com<D3D11DeviceContextState> m_stateObject;
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,
@ -143,19 +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,
D3D11_MAP MapType,
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);
void SignalEvent(HANDLE hEvent);
};
}

View File

@ -15,128 +15,237 @@
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>;
using D3D11SamplerBindings = std::array<
D3D11SamplerState*, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT>;
struct D3D11ShaderResourceBindings {
std::array<Com<D3D11ShaderResourceView>, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT> views = { };
DxvkBindingSet<D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT> hazardous = { };
};
using D3D11UnorderedAccessBindings = std::array<
Com<D3D11UnorderedAccessView>, D3D11_1_UAV_SLOT_COUNT>;
struct D3D11ContextStateVS {
Com<D3D11VertexShader> shader = nullptr;
D3D11ConstantBufferBindings constantBuffers = { };
D3D11SamplerBindings samplers = { };
D3D11ShaderResourceBindings shaderResources = { };
};
struct D3D11ContextStateHS {
Com<D3D11HullShader> shader = nullptr;
D3D11ConstantBufferBindings constantBuffers = { };
D3D11SamplerBindings samplers = { };
D3D11ShaderResourceBindings shaderResources = { };
};
struct D3D11ContextStateDS {
Com<D3D11DomainShader> shader = nullptr;
D3D11ConstantBufferBindings constantBuffers = { };
D3D11SamplerBindings samplers = { };
D3D11ShaderResourceBindings shaderResources = { };
};
struct D3D11ContextStateGS {
Com<D3D11GeometryShader> shader = nullptr;
D3D11ConstantBufferBindings constantBuffers = { };
D3D11SamplerBindings samplers = { };
D3D11ShaderResourceBindings shaderResources = { };
};
struct D3D11ContextStatePS {
Com<D3D11PixelShader> shader = nullptr;
D3D11ConstantBufferBindings constantBuffers = { };
D3D11SamplerBindings samplers = { };
D3D11ShaderResourceBindings shaderResources = { };
D3D11UnorderedAccessBindings unorderedAccessViews = { };
};
struct D3D11ContextStateCS {
Com<D3D11ComputeShader> shader = nullptr;
D3D11ConstantBufferBindings constantBuffers = { };
D3D11SamplerBindings samplers = { };
D3D11ShaderResourceBindings shaderResources = { };
D3D11UnorderedAccessBindings unorderedAccessViews = { };
struct D3D11ShaderStageCbvBinding {
std::array<D3D11ConstantBufferBinding, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT> buffers = { };
DxvkBindingSet<D3D11_1_UAV_SLOT_COUNT> uavMask = { };
uint32_t maxCount = 0;
void reset() {
for (uint32_t i = 0; i < maxCount; i++)
buffers[i] = D3D11ConstantBufferBinding();
maxCount = 0;
}
};
using D3D11CbvBindings = D3D11ShaderStageState<D3D11ShaderStageCbvBinding>;
/**
* \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 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 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 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;
}
};
/**
* \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 = nullptr;
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 = { };
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 = { };
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;
@ -145,43 +254,97 @@ namespace dxvk {
std::array<D3D11_RECT, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> scissors = { };
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 = nullptr;
UINT offset = 0;
Com<D3D11Buffer, false> buffer = nullptr;
UINT offset = 0;
};
struct D3D11ContextStateSO {
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;
};
}

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 });
}
}

83
src/d3d11/d3d11_cuda.h Normal file
View File

@ -0,0 +1,83 @@
#pragma once
#include <utility>
#include <vector>
#include "../dxvk/dxvk_resource.h"
#include "../util/com/com_guid.h"
#include "../util/com/com_object.h"
#include "d3d11_buffer.h"
#include "d3d11_texture.h"
namespace dxvk {
class CubinShaderWrapper : public ComObject<IUnknown> {
public:
CubinShaderWrapper(const Rc<dxvk::DxvkDevice>& dxvkDevice, VkCuModuleNVX cuModule, VkCuFunctionNVX cuFunction, VkExtent3D blockDim);
~CubinShaderWrapper();
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
VkCuModuleNVX cuModule() const {
return m_module;
}
VkCuFunctionNVX cuFunction() const {
return m_function;
}
VkExtent3D blockDim() const {
return m_blockDim;
}
private:
Rc<DxvkDevice> m_dxvkDevice;
VkCuModuleNVX m_module;
VkCuFunctionNVX m_function;
VkExtent3D m_blockDim;
};
struct CubinShaderLaunchInfo {
CubinShaderLaunchInfo() = default;
CubinShaderLaunchInfo(CubinShaderLaunchInfo&& other) {
shader = std::move(other.shader);
params = std::move(other.params);
paramSize = std::move(other.paramSize);
nvxLaunchInfo = std::move(other.nvxLaunchInfo);
cuLaunchConfig = other.cuLaunchConfig;
buffers = std::move(other.buffers);
images = std::move(other.images);
other.cuLaunchConfig[1] = nullptr;
other.cuLaunchConfig[3] = nullptr;
other.nvxLaunchInfo.pExtras = nullptr;
// fix-up internally-pointing pointers
cuLaunchConfig[1] = params.data();
cuLaunchConfig[3] = &paramSize;
nvxLaunchInfo.pExtras = cuLaunchConfig.data();
}
Com<CubinShaderWrapper> shader;
std::vector<uint8_t> params;
size_t paramSize;
VkCuLaunchInfoNVX nvxLaunchInfo = { VK_STRUCTURE_TYPE_CU_LAUNCH_INFO_NVX };
std::array<void*, 5> cuLaunchConfig;
std::vector<std::pair<Rc<DxvkBuffer>, DxvkAccessFlags>> buffers;
std::vector<std::pair<Rc<DxvkImage>, DxvkAccessFlags>> images;
void insertResource(ID3D11Resource* pResource, DxvkAccessFlags access);
template<typename T>
static void insertUniqueResource(std::vector<std::pair<T, DxvkAccessFlags>>& list, const T& resource, DxvkAccessFlags access);
};
}

View File

@ -6,7 +6,8 @@ namespace dxvk {
D3D11DepthStencilState::D3D11DepthStencilState(
D3D11Device* device,
const D3D11_DEPTH_STENCIL_DESC& desc)
: m_device(device), m_desc(desc), m_d3d10(this) {
: D3D11StateObject<ID3D11DepthStencilState>(device),
m_desc(desc), m_d3d10(this) {
m_state.enableDepthTest = desc.DepthEnable;
m_state.enableDepthWrite = desc.DepthWriteMask == D3D11_DEPTH_WRITE_MASK_ALL;
m_state.enableStencilTest = desc.StencilEnable;
@ -19,22 +20,6 @@ namespace dxvk {
D3D11DepthStencilState::~D3D11DepthStencilState() {
}
ULONG STDMETHODCALLTYPE D3D11DepthStencilState::AddRef() {
ULONG refCount = m_refCount++;
if (!refCount)
m_device->AddRef();
return refCount + 1;
}
ULONG STDMETHODCALLTYPE D3D11DepthStencilState::Release() {
ULONG refCount = --m_refCount;
if (!refCount)
m_device->Release();
return refCount;
}
HRESULT STDMETHODCALLTYPE D3D11DepthStencilState::QueryInterface(REFIID riid, void** ppvObject) {
@ -52,27 +37,25 @@ namespace dxvk {
if (riid == __uuidof(ID3D10DeviceChild)
|| riid == __uuidof(ID3D10DepthStencilState)) {
*ppvObject = ref(this);
*ppvObject = ref(&m_d3d10);
return S_OK;
}
Logger::warn("D3D11DepthStencilState::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
if (logQueryInterfaceError(__uuidof(ID3D11DepthStencilState), riid)) {
Logger::warn("D3D11DepthStencilState::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
}
return E_NOINTERFACE;
}
void STDMETHODCALLTYPE D3D11DepthStencilState::GetDevice(ID3D11Device** ppDevice) {
*ppDevice = ref(m_device);
}
void STDMETHODCALLTYPE D3D11DepthStencilState::GetDesc(D3D11_DEPTH_STENCIL_DESC* pDesc) {
*pDesc = m_desc;
}
void D3D11DepthStencilState::BindToContext(const Rc<DxvkContext>& ctx) {
void D3D11DepthStencilState::BindToContext(DxvkContext* ctx) {
ctx->setDepthStencilState(m_state);
}

View File

@ -11,7 +11,7 @@ namespace dxvk {
class D3D11Device;
class D3D11DepthStencilState : public D3D11DeviceChild<ID3D11DepthStencilState, NoWrapper> {
class D3D11DepthStencilState : public D3D11StateObject<ID3D11DepthStencilState> {
public:
@ -21,23 +21,15 @@ namespace dxvk {
D3D11Device* device,
const D3D11_DEPTH_STENCIL_DESC& desc);
~D3D11DepthStencilState();
ULONG STDMETHODCALLTYPE AddRef() final;
ULONG STDMETHODCALLTYPE Release() final;
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject) final;
void STDMETHODCALLTYPE GetDevice(
ID3D11Device **ppDevice) final;
void STDMETHODCALLTYPE GetDesc(
D3D11_DEPTH_STENCIL_DESC* pDesc) final;
void BindToContext(
const Rc<DxvkContext>& ctx);
void BindToContext(DxvkContext* ctx);
D3D10DepthStencilState* GetD3D10Iface() {
return &m_d3d10;
@ -48,12 +40,9 @@ namespace dxvk {
private:
D3D11Device* const m_device;
D3D11_DEPTH_STENCIL_DESC m_desc;
DxvkDepthStencilState m_state;
D3D10DepthStencilState m_d3d10;
std::atomic<uint32_t> m_refCount = { 0u };
VkStencilOpState DecodeStencilOpState(
const D3D11_DEPTH_STENCILOP_DESC& StencilDesc,

File diff suppressed because it is too large Load Diff

View File

@ -15,9 +15,12 @@
#include "../util/com/com_private_data.h"
#include "d3d11_cmdlist.h"
#include "d3d11_cuda.h"
#include "d3d11_features.h"
#include "d3d11_initializer.h"
#include "d3d11_interfaces.h"
#include "d3d11_interop.h"
#include "d3d11_on_12.h"
#include "d3d11_options.h"
#include "d3d11_shader.h"
#include "d3d11_state.h"
@ -30,7 +33,6 @@ namespace dxvk {
class D3D11CommonShader;
class D3D11CommonTexture;
class D3D11Counter;
class D3D11DeviceContext;
class D3D11DXGIDevice;
class D3D11ImmediateContext;
class D3D11Predicate;
@ -259,7 +261,7 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE CreateFence(
UINT64 InitialValue,
D3D11_FENCE_FLAG Flags,
REFIID ReturnedInterface,
REFIID riid,
void** ppFence);
void STDMETHODCALLTYPE ReadFromSubresource(
@ -419,19 +421,23 @@ namespace dxvk {
D3D10Device* GetD3D10Interface() const {
return m_d3d10Device;
}
static bool CheckFeatureLevelSupport(
const Rc<DxvkInstance>& instance,
const Rc<DxvkAdapter>& adapter,
D3D_FEATURE_LEVEL featureLevel);
D3D11ImmediateContext* GetContext() const {
return m_context.ptr();
}
bool Is11on12Device() const;
static D3D_FEATURE_LEVEL GetMaxFeatureLevel(
const Rc<DxvkInstance>& Instance,
const Rc<DxvkAdapter>& Adapter);
static DxvkDeviceFeatures GetDeviceFeatures(
const Rc<DxvkAdapter>& adapter,
D3D_FEATURE_LEVEL featureLevel);
const Rc<DxvkAdapter>& Adapter);
private:
IDXGIObject* m_container;
D3D11DXGIDevice* m_container;
D3D_FEATURE_LEVEL m_featureLevel;
UINT m_featureFlags;
@ -446,15 +452,18 @@ namespace dxvk {
DxvkCsChunkPool m_csChunkPool;
D3D11Initializer* m_initializer = nullptr;
D3D11ImmediateContext* m_context = nullptr;
D3D10Device* m_d3d10Device = nullptr;
Com<D3D11ImmediateContext, false> m_context;
D3D11StateObjectSet<D3D11BlendState> m_bsStateObjects;
D3D11StateObjectSet<D3D11DepthStencilState> m_dsStateObjects;
D3D11StateObjectSet<D3D11RasterizerState> m_rsStateObjects;
D3D11StateObjectSet<D3D11SamplerState> m_samplerObjects;
D3D11ShaderModuleSet m_shaderModules;
D3D_FEATURE_LEVEL m_maxFeatureLevel;
D3D11DeviceFeatures m_deviceFeatures;
HRESULT CreateShaderModule(
D3D11CommonShader* pShaderModule,
DxvkShaderKey ShaderKey,
@ -464,33 +473,41 @@ namespace dxvk {
const DxbcModuleInfo* pModuleInfo);
HRESULT GetFormatSupportFlags(
DXGI_FORMAT Format,
UINT* pFlags1,
UINT* pFlags2) const;
DXGI_FORMAT Format,
UINT* pFlags1,
UINT* pFlags2) const;
BOOL GetImageTypeSupport(
VkFormat Format,
VkImageType Type) const;
VkFormat Format,
VkImageType Type,
VkImageCreateFlags Flags) const;
template<bool IsKmtHandle>
HRESULT OpenSharedResourceGeneric(
HANDLE hResource,
REFIID ReturnedInterface,
void** ppResource);
uint32_t GetViewPlaneIndex(
ID3D11Resource* pResource,
DXGI_FORMAT ViewFormat);
template<typename Void>
void CopySubresourceData(
Void* pData,
UINT RowPitch,
UINT DepthPitch,
ID3D11Resource* pResource,
D3D11CommonTexture* pTexture,
UINT Subresource,
const D3D11_BOX* pBox);
static D3D_FEATURE_LEVEL GetMaxFeatureLevel(
const Rc<DxvkInstance>& pInstance);
};
/**
* \brief Extended D3D11 device
*/
class D3D11DeviceExt : public ID3D11VkExtDevice {
class D3D11DeviceExt : public ID3D11VkExtDevice1 {
public:
@ -509,48 +526,208 @@ namespace dxvk {
BOOL STDMETHODCALLTYPE GetExtensionSupport(
D3D11_VK_EXTENSION Extension);
bool STDMETHODCALLTYPE GetCudaTextureObjectNVX(
uint32_t srvDriverHandle,
uint32_t samplerDriverHandle,
uint32_t* pCudaTextureHandle);
bool STDMETHODCALLTYPE CreateCubinComputeShaderWithNameNVX(
const void* pCubin,
uint32_t size,
uint32_t blockX,
uint32_t blockY,
uint32_t blockZ,
const char* pShaderName,
IUnknown** phShader);
bool STDMETHODCALLTYPE GetResourceHandleGPUVirtualAddressAndSizeNVX(
void* hObject,
uint64_t* gpuVAStart,
uint64_t* gpuVASize);
bool STDMETHODCALLTYPE CreateUnorderedAccessViewAndGetDriverHandleNVX(
ID3D11Resource* pResource,
const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc,
ID3D11UnorderedAccessView** ppUAV,
uint32_t* pDriverHandle);
bool STDMETHODCALLTYPE CreateShaderResourceViewAndGetDriverHandleNVX(
ID3D11Resource* pResource,
const D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc,
ID3D11ShaderResourceView** ppSRV,
uint32_t* pDriverHandle);
bool STDMETHODCALLTYPE CreateSamplerStateAndGetDriverHandleNVX(
const D3D11_SAMPLER_DESC* pSamplerDesc,
ID3D11SamplerState** ppSamplerState,
uint32_t* pDriverHandle);
private:
D3D11DXGIDevice* m_container;
D3D11Device* m_device;
void AddSamplerAndHandleNVX(
ID3D11SamplerState* pSampler,
uint32_t Handle);
ID3D11SamplerState* HandleToSamplerNVX(
uint32_t Handle);
void AddSrvAndHandleNVX(
ID3D11ShaderResourceView* pSrv,
uint32_t Handle);
ID3D11ShaderResourceView* HandleToSrvNVX(
uint32_t Handle);
dxvk::mutex m_mapLock;
std::unordered_map<uint32_t, ID3D11SamplerState*> m_samplerHandleToPtr;
std::unordered_map<uint32_t, ID3D11ShaderResourceView*> m_srvHandleToPtr;
};
/**
* \brief DXGI swap chain factory
* \brief D3D11 video device
*/
class WineDXGISwapChainFactory : public IWineDXGISwapChainFactory {
class D3D11VideoDevice : public ID3D11VideoDevice {
public:
WineDXGISwapChainFactory(
D3D11VideoDevice(
D3D11DXGIDevice* pContainer,
D3D11Device* pDevice);
~D3D11VideoDevice();
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject);
HRESULT STDMETHODCALLTYPE CreateSwapChainForHwnd(
IDXGIFactory* pFactory,
HWND hWnd,
const DXGI_SWAP_CHAIN_DESC1* pDesc,
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain);
HRESULT STDMETHODCALLTYPE CreateVideoDecoder(
const D3D11_VIDEO_DECODER_DESC* pVideoDesc,
const D3D11_VIDEO_DECODER_CONFIG* pConfig,
ID3D11VideoDecoder** ppDecoder);
HRESULT STDMETHODCALLTYPE CreateVideoProcessor(
ID3D11VideoProcessorEnumerator* pEnum,
UINT RateConversionIndex,
ID3D11VideoProcessor** ppVideoProcessor);
HRESULT STDMETHODCALLTYPE CreateAuthenticatedChannel(
D3D11_AUTHENTICATED_CHANNEL_TYPE ChannelType,
ID3D11AuthenticatedChannel** ppAuthenticatedChannel);
HRESULT STDMETHODCALLTYPE CreateCryptoSession(
const GUID* pCryptoType,
const GUID* pDecoderProfile,
const GUID* pKeyExchangeType,
ID3D11CryptoSession** ppCryptoSession);
HRESULT STDMETHODCALLTYPE CreateVideoDecoderOutputView(
ID3D11Resource* pResource,
const D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC* pDesc,
ID3D11VideoDecoderOutputView** ppVDOVView);
HRESULT STDMETHODCALLTYPE CreateVideoProcessorInputView(
ID3D11Resource* pResource,
ID3D11VideoProcessorEnumerator* pEnum,
const D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC* pDesc,
ID3D11VideoProcessorInputView** ppVPIView);
HRESULT STDMETHODCALLTYPE CreateVideoProcessorOutputView(
ID3D11Resource* pResource,
ID3D11VideoProcessorEnumerator* pEnum,
const D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC* pDesc,
ID3D11VideoProcessorOutputView** ppVPOView);
HRESULT STDMETHODCALLTYPE CreateVideoProcessorEnumerator(
const D3D11_VIDEO_PROCESSOR_CONTENT_DESC* pDesc,
ID3D11VideoProcessorEnumerator** ppEnum);
UINT STDMETHODCALLTYPE GetVideoDecoderProfileCount();
HRESULT STDMETHODCALLTYPE GetVideoDecoderProfile(
UINT Index,
GUID* pDecoderProfile);
HRESULT STDMETHODCALLTYPE CheckVideoDecoderFormat(
const GUID* pDecoderProfile,
DXGI_FORMAT Format,
BOOL* pSupported);
HRESULT STDMETHODCALLTYPE GetVideoDecoderConfigCount(
const D3D11_VIDEO_DECODER_DESC* pDesc,
UINT* pCount);
HRESULT STDMETHODCALLTYPE GetVideoDecoderConfig(
const D3D11_VIDEO_DECODER_DESC* pDesc,
UINT Index,
D3D11_VIDEO_DECODER_CONFIG* pConfig);
HRESULT STDMETHODCALLTYPE GetContentProtectionCaps(
const GUID* pCryptoType,
const GUID* pDecoderProfile,
D3D11_VIDEO_CONTENT_PROTECTION_CAPS* pCaps);
HRESULT STDMETHODCALLTYPE CheckCryptoKeyExchange(
const GUID* pCryptoType,
const GUID* pDecoderProfile,
UINT Index,
GUID* pKeyExchangeType);
HRESULT STDMETHODCALLTYPE SetPrivateData(
REFGUID Name,
UINT DataSize,
const void* pData);
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
REFGUID Name,
const IUnknown* pData);
private:
D3D11DXGIDevice* m_container;
D3D11Device* m_device;
};
/**
* \brief DXVK swap chain factory
*/
class DXGIVkSwapChainFactory : public IDXGIVkSwapChainFactory {
public:
DXGIVkSwapChainFactory(
D3D11DXGIDevice* pContainer,
D3D11Device* pDevice);
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject);
HRESULT STDMETHODCALLTYPE CreateSwapChain(
IDXGIVkSurfaceFactory* pSurfaceFactory,
const DXGI_SWAP_CHAIN_DESC1* pDesc,
IDXGIVkSwapChain** ppSwapChain);
private:
D3D11DXGIDevice* m_container;
D3D11Device* m_device;
};
/**
* \brief D3D11 device metadata shenanigans
@ -594,8 +771,11 @@ namespace dxvk {
D3D11DXGIDevice(
IDXGIAdapter* pAdapter,
const Rc<DxvkInstance>& pDxvkInstance,
const Rc<DxvkAdapter>& pDxvkAdapter,
ID3D12Device* pD3D12Device,
ID3D12CommandQueue* pD3D12Queue,
Rc<DxvkInstance> pDxvkInstance,
Rc<DxvkAdapter> pDxvkAdapter,
Rc<DxvkDevice> pDxvkDevice,
D3D_FEATURE_LEVEL FeatureLevel,
UINT FeatureFlags);
@ -664,6 +844,10 @@ namespace dxvk {
Rc<DxvkDevice> STDMETHODCALLTYPE GetDXVKDevice();
BOOL Is11on12Device() const {
return m_d3d11on12.Is11on12Device();
}
private:
Com<IDXGIAdapter> m_dxgiAdapter;
@ -675,14 +859,14 @@ namespace dxvk {
D3D11Device m_d3d11Device;
D3D11DeviceExt m_d3d11DeviceExt;
D3D11VkInterop m_d3d11Interop;
D3D11VideoDevice m_d3d11Video;
D3D11on12Device m_d3d11on12;
DXGIDXVKDevice m_metaDevice;
WineDXGISwapChainFactory m_wineFactory;
DXGIVkSwapChainFactory m_dxvkFactory;
uint32_t m_frameLatency = DefaultFrameLatency;
Rc<DxvkDevice> CreateDevice(D3D_FEATURE_LEVEL FeatureLevel);
};
}

View File

@ -5,11 +5,18 @@
#include "../util/com/com_private_data.h"
namespace dxvk {
template<typename Base, template<class> class Wrapper = ComObject>
class D3D11DeviceChild : public Wrapper<Base> {
class D3D11Device;
template<typename Base>
class D3D11DeviceObject : public Base {
public:
D3D11DeviceObject(D3D11Device* pDevice)
: m_parent(pDevice) {
}
HRESULT STDMETHODCALLTYPE GetPrivateData(
REFGUID guid,
@ -33,11 +40,91 @@ namespace dxvk {
return m_privateData.setInterface(
guid, pUnknown);
}
void STDMETHODCALLTYPE GetDevice(
ID3D11Device** ppDevice) final {
*ppDevice = ref(GetParentInterface());
}
protected:
ID3D11Device* GetParentInterface() const {
// We don't know the definition of ID3D11Device
// here, because D3D11Device includes this file.
return reinterpret_cast<ID3D11Device*>(m_parent);
}
D3D11Device* const m_parent;
private:
ComPrivateData m_privateData;
};
template<typename Base>
class D3D11DeviceChild : public D3D11DeviceObject<ComObject<Base>> {
public:
D3D11DeviceChild(D3D11Device* pDevice)
: D3D11DeviceObject<ComObject<Base>>(pDevice) {
}
ULONG STDMETHODCALLTYPE AddRef() {
uint32_t refCount = this->m_refCount++;
if (unlikely(!refCount)) {
this->AddRefPrivate();
this->GetParentInterface()->AddRef();
}
return refCount + 1;
}
ULONG STDMETHODCALLTYPE Release() {
uint32_t refCount = --this->m_refCount;
if (unlikely(!refCount)) {
auto* parent = this->GetParentInterface();
this->ReleasePrivate();
parent->Release();
}
return refCount;
}
};
template<typename Base>
class D3D11StateObject : public D3D11DeviceObject<Base> {
public:
D3D11StateObject(D3D11Device* pDevice)
: D3D11DeviceObject<Base>(pDevice) {
}
ULONG STDMETHODCALLTYPE AddRef() {
uint32_t refCount = this->m_refCount++;
if (unlikely(!refCount))
this->GetParentInterface()->AddRef();
return refCount + 1;
}
ULONG STDMETHODCALLTYPE Release() {
uint32_t refCount = --this->m_refCount;
if (unlikely(!refCount))
this->GetParentInterface()->Release();
return refCount;
}
private:
std::atomic<uint32_t> m_refCount = { 0u };
};
}

View File

@ -9,6 +9,8 @@ std::ostream& operator << (std::ostream& os, D3D_FEATURE_LEVEL e) {
ENUM_NAME(D3D_FEATURE_LEVEL_10_1);
ENUM_NAME(D3D_FEATURE_LEVEL_11_0);
ENUM_NAME(D3D_FEATURE_LEVEL_11_1);
ENUM_NAME(D3D_FEATURE_LEVEL_12_0);
ENUM_NAME(D3D_FEATURE_LEVEL_12_1);
ENUM_DEFAULT(e);
}
}

View File

@ -0,0 +1,401 @@
#include <array>
#include "d3d11_features.h"
namespace dxvk {
D3D11DeviceFeatures::D3D11DeviceFeatures() {
}
D3D11DeviceFeatures::D3D11DeviceFeatures(
const Rc<DxvkInstance>& Instance,
const Rc<DxvkAdapter>& Adapter,
const D3D11Options& Options,
D3D_FEATURE_LEVEL FeatureLevel)
: m_features (Adapter->features()),
m_properties (Adapter->devicePropertiesExt()) {
// Assume no TBDR. DXVK does not optimize for TBDR architectures
// anyway, and D3D11 does not really provide meaningful support.
m_architectureInfo.TileBasedDeferredRenderer = FALSE;
// D3D9 options. We unconditionally support all of these.
m_d3d9Options.FullNonPow2TextureSupport = TRUE;
m_d3d9Options1.FullNonPow2TextureSupported = TRUE;
m_d3d9Options1.DepthAsTextureWithLessEqualComparisonFilterSupported = TRUE;
m_d3d9Options1.SimpleInstancingSupported = TRUE;
m_d3d9Options1.TextureCubeFaceRenderTargetWithNonCubeDepthStencilSupported = TRUE;
m_d3d9Shadow.SupportsDepthAsTextureWithLessEqualComparisonFilter = TRUE;
m_d3d9SimpleInstancing.SimpleInstancingSupported = TRUE;
// D3D10 options. We unconditionally support compute shaders.
m_d3d10Options.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x = TRUE;
// D3D11.1 options. All of these are required for Feature Level 11_1.
auto sharedResourceTier = DetermineSharedResourceTier(Adapter, FeatureLevel);
bool hasDoublePrecisionSupport = m_features.core.features.shaderFloat64
&& m_features.core.features.shaderInt64;
m_d3d11Options.DiscardAPIsSeenByDriver = TRUE;
m_d3d11Options.FlagsForUpdateAndCopySeenByDriver = TRUE;
m_d3d11Options.ClearView = TRUE;
m_d3d11Options.CopyWithOverlap = TRUE;
m_d3d11Options.ConstantBufferPartialUpdate = TRUE;
m_d3d11Options.ConstantBufferOffsetting = TRUE;
m_d3d11Options.MapNoOverwriteOnDynamicConstantBuffer = TRUE;
m_d3d11Options.MapNoOverwriteOnDynamicBufferSRV = TRUE;
m_d3d11Options.ExtendedResourceSharing = sharedResourceTier > D3D11_SHARED_RESOURCE_TIER_0;
if (FeatureLevel >= D3D_FEATURE_LEVEL_10_0) {
m_d3d11Options.OutputMergerLogicOp = m_features.core.features.logicOp;
m_d3d11Options.MultisampleRTVWithForcedSampleCountOne = TRUE; // Not really
}
if (FeatureLevel >= D3D_FEATURE_LEVEL_11_0) {
m_d3d11Options.UAVOnlyRenderingForcedSampleCount = TRUE;
m_d3d11Options.SAD4ShaderInstructions = TRUE;
m_d3d11Options.ExtendedDoublesShaderInstructions = hasDoublePrecisionSupport;
}
// D3D11.2 options.
auto tiledResourcesTier = DetermineTiledResourcesTier(FeatureLevel);
m_d3d11Options1.TiledResourcesTier = tiledResourcesTier;
m_d3d11Options1.MinMaxFiltering = tiledResourcesTier >= D3D11_TILED_RESOURCES_TIER_2;
m_d3d11Options1.ClearViewAlsoSupportsDepthOnlyFormats = TRUE;
if (FeatureLevel >= D3D_FEATURE_LEVEL_11_0)
m_d3d11Options1.MapOnDefaultBuffers = TRUE;
// D3D11.3 options
m_d3d11Options2.TypedUAVLoadAdditionalFormats = DetermineUavExtendedTypedLoadSupport(Adapter, FeatureLevel);
m_d3d11Options2.ConservativeRasterizationTier = DetermineConservativeRasterizationTier(FeatureLevel);
m_d3d11Options2.TiledResourcesTier = tiledResourcesTier;
m_d3d11Options2.StandardSwizzle = FALSE;
m_d3d11Options2.UnifiedMemoryArchitecture = FALSE;
if (FeatureLevel >= D3D_FEATURE_LEVEL_11_0)
m_d3d11Options2.MapOnDefaultTextures = TRUE;
if (FeatureLevel >= D3D_FEATURE_LEVEL_11_1) {
m_d3d11Options2.ROVsSupported = m_features.extFragmentShaderInterlock.fragmentShaderPixelInterlock;
m_d3d11Options2.PSSpecifiedStencilRefSupported = m_features.extShaderStencilExport;
}
// More D3D11.3 options
if (FeatureLevel >= D3D_FEATURE_LEVEL_11_0) {
m_d3d11Options3.VPAndRTArrayIndexFromAnyShaderFeedingRasterizer =
m_features.vk12.shaderOutputViewportIndex &&
m_features.vk12.shaderOutputLayer;
}
// D3D11.4 options
m_d3d11Options4.ExtendedNV12SharedTextureSupported = sharedResourceTier > D3D11_SHARED_RESOURCE_TIER_0;
// More D3D11.4 options
m_d3d11Options5.SharedResourceTier = sharedResourceTier;
// Double-precision support
if (FeatureLevel >= D3D_FEATURE_LEVEL_11_0)
m_doubles.DoublePrecisionFloatShaderOps = hasDoublePrecisionSupport;
// These numbers are not accurate, but we have no real way to query these
m_gpuVirtualAddress.MaxGPUVirtualAddressBitsPerResource = 32;
m_gpuVirtualAddress.MaxGPUVirtualAddressBitsPerProcess = 40;
// Marker support only depends on the debug utils extension
m_marker.Profile = static_cast<bool>(Instance->extensions().extDebugUtils);
// DXVK will keep all shaders in memory once created, and all Vulkan
// drivers that we know of that can run DXVK have an on-disk cache.
m_shaderCache.SupportFlags = D3D11_SHADER_CACHE_SUPPORT_AUTOMATIC_INPROC_CACHE
| D3D11_SHADER_CACHE_SUPPORT_AUTOMATIC_DISK_CACHE;
// DXVK does not support min precision
m_shaderMinPrecision.PixelShaderMinPrecision = 0;
m_shaderMinPrecision.AllOtherShaderStagesMinPrecision = 0;
// Report native support for command lists by default. Deferred context
// usage can be beneficial for us as ExecuteCommandList has low overhead,
// and we avoid having to deal with known UpdateSubresource bugs this way.
m_threading.DriverConcurrentCreates = TRUE;
m_threading.DriverCommandLists = Options.exposeDriverCommandLists;
}
D3D11DeviceFeatures::~D3D11DeviceFeatures() {
}
HRESULT D3D11DeviceFeatures::GetFeatureData(
D3D11_FEATURE Feature,
UINT FeatureDataSize,
void* pFeatureData) const {
switch (Feature) {
case D3D11_FEATURE_ARCHITECTURE_INFO:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_architectureInfo);
case D3D11_FEATURE_D3D9_OPTIONS:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_d3d9Options);
case D3D11_FEATURE_D3D9_OPTIONS1:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_d3d9Options1);
case D3D11_FEATURE_D3D9_SHADOW_SUPPORT:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_d3d9Shadow);
case D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_d3d9SimpleInstancing);
case D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_d3d10Options);
case D3D11_FEATURE_D3D11_OPTIONS:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_d3d11Options);
case D3D11_FEATURE_D3D11_OPTIONS1:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_d3d11Options1);
case D3D11_FEATURE_D3D11_OPTIONS2:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_d3d11Options2);
case D3D11_FEATURE_D3D11_OPTIONS3:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_d3d11Options3);
case D3D11_FEATURE_D3D11_OPTIONS4:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_d3d11Options4);
case D3D11_FEATURE_D3D11_OPTIONS5:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_d3d11Options5);
case D3D11_FEATURE_DOUBLES:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_doubles);
case D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_gpuVirtualAddress);
case D3D11_FEATURE_MARKER_SUPPORT:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_marker);
case D3D11_FEATURE_SHADER_CACHE:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_shaderCache);
case D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_shaderMinPrecision);
case D3D11_FEATURE_THREADING:
return GetTypedFeatureData(FeatureDataSize, pFeatureData, &m_threading);
default:
Logger::err(str::format("D3D11: Unknown feature: ", Feature));
return E_INVALIDARG;
}
}
D3D_FEATURE_LEVEL D3D11DeviceFeatures::GetMaxFeatureLevel(
const Rc<DxvkInstance>& Instance,
const Rc<DxvkAdapter>& Adapter) {
D3D11Options options(Instance->config());
D3D11DeviceFeatures features(Instance, Adapter, options, D3D_FEATURE_LEVEL_12_1);
return features.GetMaxFeatureLevel();
}
D3D11_CONSERVATIVE_RASTERIZATION_TIER D3D11DeviceFeatures::DetermineConservativeRasterizationTier(
D3D_FEATURE_LEVEL FeatureLevel) {
if (FeatureLevel < D3D_FEATURE_LEVEL_11_1
|| !m_features.extConservativeRasterization)
return D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED;
// We don't really have a way to query uncertainty regions,
// so just check degenerate triangle behaviour
if (!m_properties.extConservativeRasterization.degenerateTrianglesRasterized)
return D3D11_CONSERVATIVE_RASTERIZATION_TIER_1;
// Inner coverage is required for Tier 3 support
if (!m_properties.extConservativeRasterization.fullyCoveredFragmentShaderInputVariable)
return D3D11_CONSERVATIVE_RASTERIZATION_TIER_2;
return D3D11_CONSERVATIVE_RASTERIZATION_TIER_3;
}
D3D11_SHARED_RESOURCE_TIER D3D11DeviceFeatures::DetermineSharedResourceTier(
const Rc<DxvkAdapter>& Adapter,
D3D_FEATURE_LEVEL FeatureLevel) {
static std::atomic<bool> s_errorShown = { false };
// Lie about supporting Tier 1 since that's the
// minimum required tier for Feature Level 11_1
if (!Adapter->features().khrExternalMemoryWin32) {
if (!s_errorShown.exchange(true))
Logger::warn("D3D11DeviceFeatures: External memory features not supported");
return D3D11_SHARED_RESOURCE_TIER_1;
}
// Check support for extended formats. Ignore multi-plane
// formats here since driver support varies too much.
std::array<VkFormat, 30> requiredFormats = {{
VK_FORMAT_R16G16B16A16_SFLOAT,
VK_FORMAT_R32G32B32A32_SFLOAT,
VK_FORMAT_R32G32B32A32_UINT,
VK_FORMAT_R32G32B32A32_SINT,
VK_FORMAT_R16G16B16A16_SFLOAT,
VK_FORMAT_R16G16B16A16_UNORM,
VK_FORMAT_R16G16B16A16_UINT,
VK_FORMAT_R16G16B16A16_SNORM,
VK_FORMAT_R16G16B16A16_SINT,
VK_FORMAT_A2B10G10R10_UNORM_PACK32,
VK_FORMAT_A2B10G10R10_UINT_PACK32,
VK_FORMAT_R8G8B8A8_UNORM,
VK_FORMAT_R8G8B8A8_SRGB,
VK_FORMAT_R8G8B8A8_UINT,
VK_FORMAT_R8G8B8A8_SNORM,
VK_FORMAT_R8G8B8A8_SINT,
VK_FORMAT_B8G8R8A8_UNORM,
VK_FORMAT_B8G8R8A8_SRGB,
VK_FORMAT_R32_SFLOAT,
VK_FORMAT_R32_UINT,
VK_FORMAT_R32_SINT,
VK_FORMAT_R16_SFLOAT,
VK_FORMAT_R16_UNORM,
VK_FORMAT_R16_UINT,
VK_FORMAT_R16_SNORM,
VK_FORMAT_R16_SINT,
VK_FORMAT_R8_UNORM,
VK_FORMAT_R8_UINT,
VK_FORMAT_R8_SNORM,
VK_FORMAT_R8_SINT,
}};
bool allKmtHandlesSupported = true;
bool allNtHandlesSupported = true;
for (auto f : requiredFormats) {
allKmtHandlesSupported &= CheckFormatSharingSupport(Adapter, f, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT);
allNtHandlesSupported &= CheckFormatSharingSupport(Adapter, f, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT);
}
// Again, lie about at least tier 1 support
if (!allKmtHandlesSupported) {
if (!s_errorShown.exchange(true))
Logger::warn("D3D11DeviceFeatures: Some formats not supported for resource sharing");
return D3D11_SHARED_RESOURCE_TIER_1;
}
// Tier 2 requires all the above formats to be shareable
// with NT handles in order to support D3D12 interop
if (!allNtHandlesSupported)
return D3D11_SHARED_RESOURCE_TIER_1;
// Tier 3 additionally requires R11G11B10 to be
// shareable with D3D12
if (!CheckFormatSharingSupport(Adapter, VK_FORMAT_B10G11R11_UFLOAT_PACK32, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT))
return D3D11_SHARED_RESOURCE_TIER_2;
return D3D11_SHARED_RESOURCE_TIER_3;
}
D3D11_TILED_RESOURCES_TIER D3D11DeviceFeatures::DetermineTiledResourcesTier(
D3D_FEATURE_LEVEL FeatureLevel) {
if (FeatureLevel < D3D_FEATURE_LEVEL_11_0
|| !m_features.core.features.sparseBinding
|| !m_features.core.features.sparseResidencyBuffer
|| !m_features.core.features.sparseResidencyImage2D
|| !m_features.core.features.sparseResidencyAliased
|| !m_properties.core.properties.sparseProperties.residencyStandard2DBlockShape)
return D3D11_TILED_RESOURCES_NOT_SUPPORTED;
if (FeatureLevel < D3D_FEATURE_LEVEL_11_1
|| !m_features.core.features.shaderResourceResidency
|| !m_features.core.features.shaderResourceMinLod
|| !m_features.vk12.samplerFilterMinmax
|| !m_properties.vk12.filterMinmaxSingleComponentFormats
|| !m_properties.core.properties.sparseProperties.residencyNonResidentStrict
|| m_properties.core.properties.sparseProperties.residencyAlignedMipSize)
return D3D11_TILED_RESOURCES_TIER_1;
if (!m_features.core.features.sparseResidencyImage3D
|| !m_properties.core.properties.sparseProperties.residencyStandard3DBlockShape)
return D3D11_TILED_RESOURCES_TIER_2;
return D3D11_TILED_RESOURCES_TIER_3;
}
BOOL D3D11DeviceFeatures::DetermineUavExtendedTypedLoadSupport(
const Rc<DxvkAdapter>& Adapter,
D3D_FEATURE_LEVEL FeatureLevel) {
static const std::array<VkFormat, 18> s_formats = {{
VK_FORMAT_R32_SFLOAT,
VK_FORMAT_R32_UINT,
VK_FORMAT_R32_SINT,
VK_FORMAT_R32G32B32A32_SFLOAT,
VK_FORMAT_R32G32B32A32_UINT,
VK_FORMAT_R32G32B32A32_SINT,
VK_FORMAT_R16G16B16A16_SFLOAT,
VK_FORMAT_R16G16B16A16_UINT,
VK_FORMAT_R16G16B16A16_SINT,
VK_FORMAT_R8G8B8A8_UNORM,
VK_FORMAT_R8G8B8A8_UINT,
VK_FORMAT_R8G8B8A8_SINT,
VK_FORMAT_R16_SFLOAT,
VK_FORMAT_R16_UINT,
VK_FORMAT_R16_SINT,
VK_FORMAT_R8_UNORM,
VK_FORMAT_R8_UINT,
VK_FORMAT_R8_SINT,
}};
if (FeatureLevel < D3D_FEATURE_LEVEL_11_0)
return FALSE;
for (auto f : s_formats) {
DxvkFormatFeatures features = Adapter->getFormatFeatures(f);
VkFormatFeatureFlags2 imgFeatures = features.optimal | features.linear;
if (!(imgFeatures & VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT))
return FALSE;
}
return TRUE;
}
BOOL D3D11DeviceFeatures::CheckFormatSharingSupport(
const Rc<DxvkAdapter>& Adapter,
VkFormat Format,
VkExternalMemoryHandleTypeFlagBits HandleType) {
DxvkFormatQuery query = { };
query.format = Format;
query.type = VK_IMAGE_TYPE_2D;
query.tiling = VK_IMAGE_TILING_OPTIMAL;
query.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
query.handleType = HandleType;
constexpr VkExternalMemoryFeatureFlags featureMask
= VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT
| VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT;
auto limits = Adapter->getFormatLimits(query);
return limits && (limits->externalFeatures & featureMask);
}
D3D_FEATURE_LEVEL D3D11DeviceFeatures::GetMaxFeatureLevel() const {
// Check Feature Level 11_0 features
if (!m_features.core.features.drawIndirectFirstInstance
|| !m_features.core.features.fragmentStoresAndAtomics
|| !m_features.core.features.multiDrawIndirect
|| !m_features.core.features.tessellationShader)
return D3D_FEATURE_LEVEL_10_1;
// Check Feature Level 11_1 features
if (!m_d3d11Options.OutputMergerLogicOp
|| !m_features.core.features.vertexPipelineStoresAndAtomics)
return D3D_FEATURE_LEVEL_11_0;
// Check Feature Level 12_0 features
if (m_d3d11Options2.TiledResourcesTier < D3D11_TILED_RESOURCES_TIER_2
|| !m_d3d11Options2.TypedUAVLoadAdditionalFormats)
return D3D_FEATURE_LEVEL_11_1;
// Check Feature Level 12_1 features
if (!m_d3d11Options2.ConservativeRasterizationTier
|| !m_d3d11Options2.ROVsSupported)
return D3D_FEATURE_LEVEL_12_0;
return D3D_FEATURE_LEVEL_12_1;
}
}

126
src/d3d11/d3d11_features.h Normal file
View File

@ -0,0 +1,126 @@
#pragma once
#include "d3d11_include.h"
#include "d3d11_options.h"
#include "../dxvk/dxvk_adapter.h"
#include "../dxvk/dxvk_instance.h"
namespace dxvk {
/**
* \brief Device features
*
* Stores D3D device feature structs.
*/
class D3D11DeviceFeatures {
public:
D3D11DeviceFeatures();
D3D11DeviceFeatures(
const Rc<DxvkInstance>& Instance,
const Rc<DxvkAdapter>& Adapter,
const D3D11Options& Options,
D3D_FEATURE_LEVEL FeatureLevel);
~D3D11DeviceFeatures();
/**
* \brief Retrieves feature support data
*
* \param [in] Feature D3D feature to query
* \param [in] FeatureDataSize Data size, in bytes
* \param [out] pFeatureData Data
* \returns Status of the operation
*/
HRESULT GetFeatureData(
D3D11_FEATURE Feature,
UINT FeatureDataSize,
void* pFeatureData) const;
/**
* \brief Queries tiled resources tier
* \returns Tiled resources tier
*/
D3D11_TILED_RESOURCES_TIER GetTiledResourcesTier() const {
return m_d3d11Options2.TiledResourcesTier;
}
/**
* \brief Queries conservative rasterization tier
* \returns Conservative rasterization tier
*/
D3D11_CONSERVATIVE_RASTERIZATION_TIER GetConservativeRasterizationTier() const {
return m_d3d11Options2.ConservativeRasterizationTier;
}
/**
* \brief Tests maximum supported feature level
*
* \param [in] Instance DXVK instance
* \param [in] Adapter DXVK adapter
* \returns Highest supported feature level
*/
static D3D_FEATURE_LEVEL GetMaxFeatureLevel(
const Rc<DxvkInstance>& Instance,
const Rc<DxvkAdapter>& Adapter);
private:
DxvkDeviceFeatures m_features;
DxvkDeviceInfo m_properties;
D3D11_FEATURE_DATA_ARCHITECTURE_INFO m_architectureInfo = { };
D3D11_FEATURE_DATA_D3D9_OPTIONS m_d3d9Options = { };
D3D11_FEATURE_DATA_D3D9_OPTIONS1 m_d3d9Options1 = { };
D3D11_FEATURE_DATA_D3D9_SHADOW_SUPPORT m_d3d9Shadow = { };
D3D11_FEATURE_DATA_D3D9_SIMPLE_INSTANCING_SUPPORT m_d3d9SimpleInstancing = { };
D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS m_d3d10Options = { };
D3D11_FEATURE_DATA_D3D11_OPTIONS m_d3d11Options = { };
D3D11_FEATURE_DATA_D3D11_OPTIONS1 m_d3d11Options1 = { };
D3D11_FEATURE_DATA_D3D11_OPTIONS2 m_d3d11Options2 = { };
D3D11_FEATURE_DATA_D3D11_OPTIONS3 m_d3d11Options3 = { };
D3D11_FEATURE_DATA_D3D11_OPTIONS4 m_d3d11Options4 = { };
D3D11_FEATURE_DATA_D3D11_OPTIONS5 m_d3d11Options5 = { };
D3D11_FEATURE_DATA_DOUBLES m_doubles = { };
D3D11_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT m_gpuVirtualAddress = { };
D3D11_FEATURE_DATA_MARKER_SUPPORT m_marker = { };
D3D11_FEATURE_DATA_SHADER_CACHE m_shaderCache = { };
D3D11_FEATURE_DATA_SHADER_MIN_PRECISION_SUPPORT m_shaderMinPrecision = { };
D3D11_FEATURE_DATA_THREADING m_threading = { };
template<typename T>
static HRESULT GetTypedFeatureData(UINT Size, void* pDstData, const T* pSrcData) {
if (Size != sizeof(T))
return E_INVALIDARG;
*(reinterpret_cast<T*>(pDstData)) = *pSrcData;
return S_OK;
}
D3D11_CONSERVATIVE_RASTERIZATION_TIER DetermineConservativeRasterizationTier(
D3D_FEATURE_LEVEL FeatureLevel);
D3D11_SHARED_RESOURCE_TIER DetermineSharedResourceTier(
const Rc<DxvkAdapter>& Adapter,
D3D_FEATURE_LEVEL FeatureLevel);
D3D11_TILED_RESOURCES_TIER DetermineTiledResourcesTier(
D3D_FEATURE_LEVEL FeatureLevel);
BOOL DetermineUavExtendedTypedLoadSupport(
const Rc<DxvkAdapter>& Adapter,
D3D_FEATURE_LEVEL FeatureLevel);
BOOL CheckFormatSharingSupport(
const Rc<DxvkAdapter>& Adapter,
VkFormat Format,
VkExternalMemoryHandleTypeFlagBits HandleType);
D3D_FEATURE_LEVEL GetMaxFeatureLevel() const;
};
}

105
src/d3d11/d3d11_fence.cpp Normal file
View File

@ -0,0 +1,105 @@
#include "d3d11_fence.h"
#include "d3d11_device.h"
#include "../util/util_win32_compat.h"
namespace dxvk {
D3D11Fence::D3D11Fence(
D3D11Device* pDevice,
UINT64 InitialValue,
D3D11_FENCE_FLAG Flags,
HANDLE hFence)
: D3D11DeviceChild<ID3D11Fence>(pDevice) {
DxvkFenceCreateInfo fenceInfo;
fenceInfo.initialValue = InitialValue;
m_flags = Flags;
if (Flags & D3D11_FENCE_FLAG_SHARED) {
fenceInfo.sharedType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE_BIT;
if (hFence == nullptr)
hFence = INVALID_HANDLE_VALUE;
fenceInfo.sharedHandle = hFence;
}
if (Flags & ~D3D11_FENCE_FLAG_SHARED)
Logger::err(str::format("Fence flags 0x", std::hex, Flags, " not supported"));
m_fence = pDevice->GetDXVKDevice()->createFence(fenceInfo);
}
D3D11Fence::~D3D11Fence() {
}
HRESULT STDMETHODCALLTYPE D3D11Fence::QueryInterface(
REFIID riid,
void** ppvObject) {
if (ppvObject == nullptr)
return E_POINTER;
*ppvObject = nullptr;
if (riid == __uuidof(IUnknown)
|| riid == __uuidof(ID3D11DeviceChild)
|| riid == __uuidof(ID3D11Fence)) {
*ppvObject = ref(this);
return S_OK;
}
if (logQueryInterfaceError(__uuidof(ID3D11Fence), riid)) {
Logger::warn("D3D11Fence: Unknown interface query");
Logger::warn(str::format(riid));
}
return E_NOINTERFACE;
}
HRESULT STDMETHODCALLTYPE D3D11Fence::CreateSharedHandle(
const SECURITY_ATTRIBUTES* pAttributes,
DWORD dwAccess,
LPCWSTR lpName,
HANDLE* pHandle) {
if (!(m_flags & D3D11_FENCE_FLAG_SHARED))
return E_INVALIDARG;
if (pAttributes)
Logger::warn(str::format("CreateSharedHandle: attributes ", pAttributes, " not handled"));
if (dwAccess)
Logger::warn(str::format("CreateSharedHandle: access ", dwAccess, " not handled"));
if (lpName)
Logger::warn(str::format("CreateSharedHandle: name ", dxvk::str::fromws(lpName), " not handled"));
HANDLE sharedHandle = m_fence->sharedHandle();
if (sharedHandle == INVALID_HANDLE_VALUE)
return E_INVALIDARG;
*pHandle = sharedHandle;
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D11Fence::SetEventOnCompletion(
UINT64 Value,
HANDLE hEvent) {
if (hEvent) {
m_fence->enqueueWait(Value, [hEvent] {
SetEvent(hEvent);
});
} else {
m_fence->wait(Value);
}
return S_OK;
}
UINT64 STDMETHODCALLTYPE D3D11Fence::GetCompletedValue() {
// TODO in the case of rewinds, the stored value may be higher.
// For shared fences, calling vkGetSemaphoreCounterValue here could alleviate the issue.
return m_fence->getValue();
}
}

49
src/d3d11/d3d11_fence.h Normal file
View File

@ -0,0 +1,49 @@
#pragma once
#include "../dxvk/dxvk_fence.h"
#include "../dxvk/dxvk_gpu_query.h"
#include "d3d11_device_child.h"
namespace dxvk {
class D3D11Fence : public D3D11DeviceChild<ID3D11Fence> {
public:
D3D11Fence(
D3D11Device* pDevice,
UINT64 InitialValue,
D3D11_FENCE_FLAG Flags,
HANDLE hFence);
~D3D11Fence();
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject);
HRESULT STDMETHODCALLTYPE CreateSharedHandle(
const SECURITY_ATTRIBUTES* pAttributes,
DWORD dwAccess,
LPCWSTR lpName,
HANDLE* pHandle);
HRESULT STDMETHODCALLTYPE SetEventOnCompletion(
UINT64 Value,
HANDLE hEvent);
UINT64 STDMETHODCALLTYPE GetCompletedValue();
Rc<DxvkFence> GetFence() const {
return m_fence;
}
private:
Rc<DxvkFence> m_fence;
D3D11_FENCE_FLAG m_flags;
};
}

View File

@ -3,6 +3,7 @@
#include "d3d11_gdi.h"
#include "../util/util_gdi.h"
#include "../util/util_win32_compat.h"
namespace dxvk {
@ -149,11 +150,8 @@ namespace dxvk {
HRESULT D3D11GDISurface::CreateReadbackResource() {
auto tex = GetCommonTexture(m_resource);
Com<ID3D11Device> device;
Com<ID3D11DeviceContext> context;
Com<ID3D11Device> device;
m_resource->GetDevice(&device);
device->GetImmediateContext(&context);
D3D11_RESOURCE_DIMENSION dim = { };
m_resource->GetType(&dim);

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