1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-12 22:08:59 +01:00
Commit Graph

1299 Commits

Author SHA1 Message Date
Philip Rebohle
58fa815926
[dxgi] Fixed error message formatting in DxgiDevice 2018-05-22 23:52:12 +02:00
Philip Rebohle
56e7389495
[dxgi] Stubbed out IDXGIFactory2 2018-05-22 23:52:03 +02:00
Philip Rebohle
5a61d81135
[dxgi] Stubbed out IDXGISwapChain1 2018-05-22 23:50:28 +02:00
Philip Rebohle
979ba2d7c6
[dxgi] Implemented IDXGIAdapter2 2018-05-22 23:48:07 +02:00
Philip Rebohle
a39b9cb131
[d3d11] Pre-clear buffers with D3D11_USAGE_DEFAULT
Some games may expect buffers, like images, to be pre-initialized.
2018-05-22 21:10:39 +02:00
Philip Rebohle
51104c104d
[d3d11] Refactor InitTexture method 2018-05-22 21:06:26 +02:00
Philip Rebohle
fb11acbc91
[dxbc] Implement geometry shader instancing
Required for Frostpunk (see #385).
2018-05-22 19:36:53 +02:00
Philip Rebohle
7f619d9051 [dxvk] Use only one extra thread for async pipeline compilation
With the benefits of asynchronous compilation being generally low and
compilation in advance not being feasible, there is no reason to create
more threads.
2018-05-22 00:32:44 +02:00
Philip Rebohle
425a5bca2e [d3d11] Optimized buffer mapping on deferred contexts 2018-05-22 00:11:32 +02:00
Joshua Ashton
5cc3afcf30 Fix tzcnt intrinsic on MSVC (#381) 2018-05-19 09:26:25 +02:00
Philip Rebohle
126c50a674
[dxbc] SampleMask does not depend on SampleRateShading
This was fixed in a later revision of the SPIR-V 1.0 specification.
2018-05-19 09:07:31 +02:00
Philip Rebohle
a6ace7908f
[dxbc] Do not emit empty 'else' blocks 2018-05-18 22:37:23 +02:00
Philip Rebohle
d1d829c09b
[vr] Query Vulkan extensions for OpenVR at runtime 2018-05-18 16:47:44 +02:00
Philip Rebohle
707967ac1d
[vr] Add OpenVR loader
Provides methods to query required Vulkan instance and device extensions.
2018-05-18 16:46:34 +02:00
Philip Rebohle
7408bc22b5
[dxvk] Remove ability to enable instance layers 2018-05-17 00:35:12 +02:00
Philip Rebohle
a30e1368b1
[dxvk] Implement name set merging 2018-05-17 00:35:04 +02:00
Philip Rebohle
796379a551
[dxvk] Refactor the way instance extensions are enabled 2018-05-17 00:34:48 +02:00
Philip Rebohle
d1eddbdc3f
[dxvk] Make vk::NameSet more versatile 2018-05-17 00:34:38 +02:00
Philip Rebohle
40b52758e3
[dxvk] Enumerate discrete GPUs before integrated GPUs
May help with games that do not run on Intel GPUs when
the Intel Vulkan driver is installed alongside the AMD
or Nvidia drivers.
2018-05-16 16:17:39 +02:00
Philip Rebohle
26b319b29b
[d3d11] Fallout 4: Force Flush on GetData calls 2018-05-14 02:40:59 +02:00
Philip Rebohle
a90c2843a7
[dxvk] Remove std::vector from DxvkDataBuffer
Vectors are zero-initialized upon resize, which is unnecessary
in this case and potentially impacts performance.
2018-05-13 21:34:38 +02:00
Philip Rebohle
516d7f091e
Merge branch 'disable-opt-bit' 2018-05-13 16:19:31 +02:00
Philip Rebohle
f42f7cc743
[dxvk] Make use of the asynchronous pipeline compiler optional
Users can enable this by setting DXVK_USE_PIPECOMPILER=1.
2018-05-13 16:02:23 +02:00
Philip Rebohle
2ee80ce1bd
[dxvk] Log start/stop of pipe compiler worker threads 2018-05-13 15:37:31 +02:00
Philip Rebohle
368eea7310
[dxvk] Use derivative pipelines again 2018-05-13 15:37:18 +02:00
Philip Rebohle
c17f4e2fc0
[dxvk] Increase update buffer size
Helps reduce the number of memory allocations further
when deferred contexts are used for rendering.
2018-05-13 14:45:50 +02:00
Philip Rebohle
9d4654f445
[dxvk] Fix update buffer allocation size 2018-05-13 11:12:54 +02:00
Philip Rebohle
3fc9466a07
[dxvk] Fix query scopes
Occlusion queries must begin and end in the same render pass.
Fixes a rendering issue in Shadow Warrior 2 on AMD drivers.
2018-05-12 19:46:08 +02:00
Philip Rebohle
5f3b65014f
[dxvk] Reset query pools on the init buffer 2018-05-12 19:45:42 +02:00
Philip Rebohle
3135359ee9
[dxvk] Create a separate command buffer for initialization tasks
We'll use this to reset query pools without having to spill
the active render pass. Required to fix a query-related bug.
2018-05-12 19:32:50 +02:00
Philip Rebohle
581e505f54
[dxbc] Fix bit scan instructions
firstbithi counts from the MSB rather than the LSB. Fixes
rendering issues in Hitman.
2018-05-12 01:39:23 +02:00
Philip Rebohle
b805560340
[dxvk] Do not log invalid pipeline state
Fixes some log spam in case games attempt to render geometry
with an invalid pipeline state vector.
2018-05-10 21:59:57 +02:00
Philip Rebohle
cfb4791872
[dxvk] Use VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT
Optimized versions of the pipelines will be compiled asynchronously.
2018-05-10 14:54:44 +02:00
Philip Rebohle
517a7532be
[dxvk] Added DxvkPipelineCompiler 2018-05-10 14:29:13 +02:00
Philip Rebohle
3b132196d3
[dxvk] Add ability to hold two pipeline handles to pipeline instances 2018-05-10 14:15:47 +02:00
Philip Rebohle
010fc6ad49
[dxvk] Implement DxvkGraphicsPipelineInstance
This should come in handy when compiling an optimized version of
a pipeline asynchronously. This can be extended to hold multiple
pipeline handles, i.e. one optimized one and one without opts.

Collateral damage: We're not using derivative pipelines anymore,
needs to be re-added at a later point.
2018-05-09 22:23:50 +02:00
Philip Rebohle
ec3b7e39af
[util] Fix includes 2018-05-09 20:37:49 +02:00
Philip Rebohle
c7d2957d8f
[util] Remove duplicate tzcnt function 2018-05-09 20:09:09 +02:00
Philip Rebohle
37456d583e
[dxvk] Move DxvkPipelineCache to DxvkPipeManager
Since the pipeline cache isn't used for anything else but compiling
pipelines, keeping this stuff together is much more useful.
2018-05-09 14:26:45 +02:00
Philip Rebohle
47b9fd8b19
[dxvk] Reimplement vertex buffer bindings
Reduces the number of Vulkan calls for vertex buffer bindings and
works around incorrect validation errors emitted when applications
do not use a consecutive range of vertex bindings. No performance
impact is expected in most games.
2018-05-09 13:01:52 +02:00
Philip Rebohle
b6d33e6289
[d3d11] D3D11SamplerState: Cosmetic changes 2018-05-09 11:55:05 +02:00
Philip Rebohle
5465ee8a85
[util] Add tzcnt function 2018-05-09 00:01:00 +02:00
Philip Rebohle
33e511485c
[hud] Fixed uninitialized depth bounds values 2018-05-07 21:53:32 +02:00
Philip Rebohle
cd92d0b992
[dxvk] Allow binding render targets of different sizes
In order to not cause Vulkan validation issues, we have
to reduce the framebuffer size. Fixes a regression in
Bioshock Infinite.
2018-05-07 20:46:20 +02:00
Philip Rebohle
3c611503d6
[dxgi] Fix reported VRAM size for 32-bit builds 2018-05-07 19:04:25 +02:00
Philip Rebohle
3e111086b2
[d3d11] Implement D3D11CoreCreateDevice
Some applications need this function to be present and it's better to
fail for them with an error code rather than crash because the entry
point does not exist in our DLLs.
2018-05-07 14:06:52 +02:00
Philip Rebohle
757be61b70
[dxgi] Use per-adapter format lookup tables
Allows Nvidia cards to use 24-bit depth buffers.
2018-05-06 13:12:30 +02:00
Philip Rebohle
fb3dbd8bcd
[d3d11] Relaxed view format compatibility check
Fixes regressions in multiple games. MSDN docs regarding
format compatibility are wrong in every way.
2018-05-05 20:16:01 +02:00
Philip Rebohle
f4a92a685f
[d3d11] Normalize render target and depth-stencil view types
Fixes a regression in Kingdom Come: Deliverance that was
introduced in a55bee9554.
2018-05-05 15:53:49 +02:00
Philip Rebohle
5a639797d2
[d3d11] Fix stencil component mapping in shader resource views
Fixes terrain rendering in Far Cry 5.
2018-05-05 15:15:09 +02:00
Philip Rebohle
8177898151
[d3d11] Validate image view format compatibility
Fixes Vulkan validation errors in Far Cry 5.
2018-05-05 15:13:35 +02:00
Philip Rebohle
e1a27faa4a
[dxgi] Added DXGI format family info 2018-05-05 12:57:22 +02:00
Philip Rebohle
a55bee9554
[d3d11] Validate render targets before setting them up
Mimicks what native D3D11 does. Fixes validation errors in
Nier:Automata with multisampling enabled in some situations.
2018-05-05 09:12:36 +02:00
Philip Rebohle
fb288d8713
[d3d11] Disable VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT for typed formats
Yields over 10% performance improvement on RADV in GPU-bound scenarios.
2018-05-05 00:49:43 +02:00
Philip Rebohle
fe24d76fd0
[dxgi] Report D3D10 support only when DXVK_FAKE_DX10_SUPPORT is set
Should fix a regression in Assassin's Creed 4: Black Flag.
2018-05-05 00:48:35 +02:00
Philip Rebohle
94b74667e9
[dxgi] Fix Fullscreen->Windowed transition (again)
We need to preserve the flags if the application changes them.
This is in line with what native DXGI does.
2018-05-04 21:55:38 +02:00
Philip Rebohle
c2c8d8be8a
[d3d11] Minor formatting fix 2018-05-04 21:52:34 +02:00
Philip Rebohle
6cbc133619 [dxgi] Use ShowWindow instead of redundant SetWindowPos call 2018-05-04 17:53:02 +02:00
Philip Rebohle
de803b3670 [dxgi] Report refresh rate as a multiple of 1000 Hz
More closely emulates what Windows dows.
2018-05-04 17:37:29 +02:00
Philip Rebohle
9cec1ecca3 [d3d11] Fix stage and access mask for default constant buffers 2018-05-04 10:23:36 +02:00
Philip Rebohle
ac1d505d14 [dxvk] Do not compute SHA-1 hash of generated shaders
We do not need this on this branch.
2018-05-04 00:16:39 +02:00
Philip Rebohle
ae0e5bccdd [dxvk] Make shader accessible from shader module 2018-05-03 23:56:28 +02:00
Philip Rebohle
33357f1f36 [dxvk] Compute SHA-1 hash of generated shaders 2018-05-03 23:56:22 +02:00
Philip Rebohle
3a3b1eda59 [dxvk] Move render pass out of pipeline state vector 2018-05-03 23:48:45 +02:00
Philip Rebohle
59d4f1a1fb [util] Add method to retrieve SHA1 hashes in 32-bit chunks 2018-05-03 23:47:42 +02:00
Philip Rebohle
77d0424d7f [dxgi] Advertize support for ID3D10Device and ID3D10Device1
We don't actually support these, but applications can reasonably
assume that D3D10 is supported if D3D11 is present. Closes #329.
2018-05-02 17:00:56 +02:00
Philip Rebohle
27d3a78d79 [dxbc] Omit empty source string in OpSource instruction
This parameter is optional and confuses RenderDoc if present.
2018-05-02 13:07:26 +02:00
Philip Rebohle
5683422208 Merge branch 'clearopt' 2018-05-02 00:45:17 +02:00
Philip Rebohle
e30a8299e6 [dxvk] Refactor DxvkFramebuffer and DxvkRenderpass 2018-05-02 00:45:10 +02:00
Philip Rebohle
41fca78d27 [dxgi] Add GetDevice method to IDXGIVkInteropSurface
Convenient way of getting the IDXGIVkInteropDevice from the surface
without having to go through several D3D interface queries.
2018-05-01 23:30:39 +02:00
Philip Rebohle
badb93334e [dxvk] Fix DxvkContext::transformImage
We have to spill the render pass before transforming the
image. We don't need the barrier if the old and new
layout are the same.
2018-05-01 23:29:58 +02:00
Philip Rebohle
5e02c1bb2f [dxvk] Move DxvkPipelineManager instance back to DxvkDevice 2018-05-01 16:56:33 +02:00
Philip Rebohle
d201a1f7c6 [dxvk] Made pipe manager and pipeline classes thread-safe 2018-05-01 16:45:28 +02:00
Philip Rebohle
cf1358b2f4 [dxvk] Fixed partial depth-stencil clear operations 2018-04-30 21:42:16 +02:00
Philip Rebohle
4c298d486d [dxgi] Restore display mode even when the window got destroyed 2018-04-30 20:15:35 +02:00
Philip Rebohle
46f2e4d864 [dxgi] CheckInterfaceSupport; Log interface queries 2018-04-30 20:01:50 +02:00
Philip Rebohle
370ff34e9f [d3d11] Fix sampler state validation for anisotropy
Fixes an issue where samplers are not created in Path of Exile.
2018-04-30 19:38:38 +02:00
Philip Rebohle
2626a26072 [d3d11] Fix sampler state validation for anisotropy
Fixes an issue where samplers are not created in Path of Exile.
2018-04-30 19:36:42 +02:00
Philip Rebohle
ba53cf92ac Revert "[dxvk] Refactor DxvkFramebuffer and DxvkRenderpass"
This reverts commit 1bbfe77013.
Breaks Path of Exile.
2018-04-30 18:47:35 +02:00
Philip Rebohle
5d5be87402 [dxvk] Oprimize render target clear operations
We can save one image layout transition when clearing a render
target by delaying clears until vkCmdBeginRenderPass is called.
2018-04-30 17:04:13 +02:00
Philip Rebohle
16a25db846 Merge branch 'master' of https://github.com/doitsujin/dxvk 2018-04-30 15:56:32 +02:00
Philip Rebohle
1bbfe77013 [dxvk] Refactor DxvkFramebuffer and DxvkRenderpass 2018-04-30 15:47:29 +02:00
ZeroFault
768a078250 [d3d11] Implement state block normalization (#333)
* [d3d11] implement stateblock normalization

* add const to default state description object

* fix code formatting

* Correct the blend state normalization

* add missing error return

* code cleanup and refactoring

* remove unecessary const qualifier and fix code formatting

* [d3d11] Cosmetic changes
2018-04-30 10:41:57 +02:00
Philip Rebohle
a32050374c [dxgi] Implement display mode changes
Allows games to change the screen resolution in fullscreen
mode. This is currently in a rough shape and some games may
not work as expected when selecting fullscreen mode.
2018-04-29 23:03:27 +02:00
Philip Rebohle
a3c561f9dc [dxgi] LeaveFullscreenMode: Correctly restore the window size 2018-04-29 17:26:00 +02:00
Philip Rebohle
1bcae90dd0 [dxvk] Fix image layouts for images using VK_IMAGE_TILING_LINEAR
We have to use VK_IMAGE_LAYOUT_GENERAL for those. On top of that,
we should avoid image transitions when the image is in GENERAL
layout anyway in order to save some time on the GPU.
2018-04-29 15:28:50 +02:00
Philip Rebohle
d5041337f5 [d3d11] Use linar tiling for textures if optimal tiling is not supported
Fixes texture creation issues in various Batman games.
2018-04-29 14:43:24 +02:00
Philip Rebohle
9aa73d1148 [dxvk] Set non-zero framebuffer size when there are no attachments
This is required for UAV-only rendering and will be required for
stream output in the future as well.
2018-04-29 11:19:18 +02:00
Philip Rebohle
7cb7e4a944 Merge branch 'master' of https://github.com/doitsujin/dxvk 2018-04-28 14:18:18 +02:00
Philip Rebohle
99813a7778 [d3d11] Use const ref pointer for device parameter
Closes #323.
2018-04-28 14:17:52 +02:00
pchome
4a74cd45d5 [clang-tidy] performance-move-const-arg fix (#324)
https://clang.llvm.org/extra/clang-tidy/checks/performance-move-const-arg.html
2018-04-28 14:13:23 +02:00
pchome
1dbf8bf2a1 [dxvk] Fix native build on *nix x86_64 systems (#328)
* [dxvk] Fix native build on *nix x86_64 systems

> /usr/include/c++/v1/algorithm:2633:1:
> note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('unsigned long' vs. 'unsigned long long')

winegcc, clang-tidy and other native build types/tools are affected.

http://en.cppreference.com/w/cpp/language/types#Data_models
> 64 bit systems:
> * LLP64 or 4/4/8 (int and long are 32-bit, pointer is 64-bit) 
>    * Win64 API 
> * LP64 or 4/8/8 (int is 32-bit, long and pointer are 64-bit) 
>    * Unix and Unix-like systems (Linux, Mac OS X) 

http://en.cppreference.com/w/cpp/types/integer#Function_macros_for_minimum-width_integer_constants
Macro `UINT64_C(1)` from `stdint.h` should literally interpret `1` to `1UL` or `1ULL`
```c
# if __WORDSIZE == 64
#  define UINT64_C(c)	c ## UL
# else
#  define UINT64_C(c)	c ## ULL
# endif
```

* [dxvk] Fix native build on *nix x86_64 systems

Use explicit template argument instead of 1ull or UINT64_C(1) macro.
2018-04-28 09:08:14 +02:00
pchome
78e8621d09 [clang-tidy] performance-for-range-copy fix (#322)
https://clang.llvm.org/extra/clang-tidy/checks/performance-for-range-copy.html
2018-04-28 01:14:57 +02:00
Philip Rebohle
1784b8c44d [d3d11] Merge interop API 2018-04-26 22:20:09 +02:00
Philip Rebohle
8cb3a266f7 [dxvk] Fix potential state tracking issue when updating render targets 2018-04-26 18:43:19 +02:00
Philip Rebohle
962a7f5766 [dxvk] Ignore redundant render target bindings
Further reduces render pass count if applications bind render targets
without using them, and then bind the old set of render targets again.
2018-04-26 15:30:18 +02:00
Philip Rebohle
1075990dbe [dxvk] Apply render target bindings at draw time
This should help reduce the number of redundant render pass spills,
especially in games which use deferred contexts for rendering. This
optimization mostly helps in GPU-bound scenarios.
2018-04-26 14:47:55 +02:00
Philip Rebohle
8606576d83 [hud] Do not explicitly use a framebuffer object 2018-04-26 13:24:42 +02:00
Philip Rebohle
5eaacf7459 [dxbc] Add gs_vertex_in to the entry point interface
Fixes invalid SPIR-V generated in the Blacksmith demo (#267).
2018-04-23 18:07:31 +02:00
Philip Rebohle
d91114d733 [dxvk] Rename renderPassBegin/End methods to start/spillRenderPass 2018-04-23 11:11:40 +02:00
Philip Rebohle
a5c43b5e59 [dxbc] Enable array texture hack for Dishonored 2
Partially fixes shadow rendering issues.
2018-04-23 11:09:48 +02:00
Philip Rebohle
01147492d5 [dxbc] Implemented Texture2D -> Texture2DArray mapping as a knob
Doing this for all applications is not necessary and degrades
performance in some cases.
2018-04-23 00:46:27 +02:00
Philip Rebohle
e53cb72e39 [dxbc] Make DxbcOptions a set of flags
This allows for game-specific workarounds and driver-specific
workarounds to be applied in an easier fashion.
2018-04-22 23:49:41 +02:00
Philip Rebohle
cfcca11fc5 [d3d11] CopySubresourceRegion: Fix block size alignment check
The source region size doesn't have to be aligned to the destination
block size. We should be checking whether the destination region is
aligned to the destination block size.
2018-04-22 23:00:31 +02:00
Philip Rebohle
4a71da3a1c [d3d11] Improved debug output for CopySubresourceRegion 2018-04-22 22:35:10 +02:00
Philip Rebohle
2f20a61342 [dxbc] Map 2D MS shader resource views to 2D MS Array views
Works around a game bug in Dragon Age: Inquisition, which binds
an MS image to a non-MS resource slot. Closes
2018-04-22 18:27:01 +02:00
Philip Rebohle
cd63ff6d76 [dxbc] Fix operand type of resinfo_rcp_float division
Fixes invalid SPIR-V generated for this instruction.
2018-04-22 16:43:16 +02:00
Philip Rebohle
f30923718f [dxbc] Fix texture component count for OpImageQueryLod
Not a bug, but we don't need the extra component when dealing with
array images.
2018-04-22 14:08:01 +02:00
Philip Rebohle
0bf97993c6 [dxbc] Fix layer count in resinfo instruction
For non-layered types, this instruction is supposed to return 0, not 1.
2018-04-22 08:34:07 +02:00
Philip Rebohle
f71f527b4d
[d3d11] Prevent mapping of depth-stencil textures
We currently don't support this, and copying data back and forth
with the wrong image aspect set crashes the RADV driver.
2018-04-21 20:34:41 +02:00
Philip Rebohle
dcb5b2a20c
[dxbc] Map 1D and 2D textures to their respective array type v2
We need to adjust the texture coordinate vectors as well, so that
some instructions continue to work properly.
2018-04-21 18:09:43 +02:00
Philip Rebohle
0318cc730a
Revert "[dxbc] Map 1D and 2D textures to their respective array type"
Broken. Requires some prep work in the shader compiler.
2018-04-21 15:38:39 +02:00
Philip Rebohle
906355b0da
[dxbc] Map 1D and 2D textures to their respective array type
As with cube textures, some games think it's a good idea to bind a
non-array view to a slot that expects an array view or vice versa.
Fixes clouds not appearing in TrackMania 2 Stadium (#191).
2018-04-21 14:15:10 +02:00
Philip Rebohle
0558a3b2c5
[d3d11] Fix incorrect cube face count calculation 2018-04-21 14:14:42 +02:00
Philip Rebohle
fd1c50d8d8
[dxbc] Fixed incorrect shader resource slot computation 2018-04-21 14:01:27 +02:00
ZeroFault
52f0d853c0 [d3d11] add some resource validation for copying resources (#305)
* [d3d11] add some resource validation for CopyResource and CopyResourceSubregion

combine if statement

* [d3d11] added copy extents validation for compressed formats

* correct return values

* fix incorrect logic operators

* set valid copy extents when possible

* [d3d11] Clamp copy region in CopySubresourceRegion

* [dxvk] Add helper methods to deal with block-compressed images

* [d3d11] Clean up validation in CopySubresourceRegion

* [d3d11] Improve error reporting and validation in CopyResource

* [d3d11] Fix inconsistent error messages
2018-04-20 23:35:29 +02:00
Philip Rebohle
50f1cf007d
[dxbc] Implement precise flag
May fix depth precision in Skyrim SE (issue #189).
2018-04-20 23:32:51 +02:00
Philip Rebohle
1ed1c43431
[d3d11] Wire up D3D11VkInteropSurface to D3D11Texture*D classes 2018-04-20 11:12:54 +02:00
Philip Rebohle
81a0fa4805
[d3d11] Implemented IDXGIVkInteropSurface for common textures 2018-04-20 10:38:39 +02:00
Joshua Ashton
90e7fe6791 Make hashes use correct types and fix narrowing warnings in spirv module. (#307)
* Fix narrowing warnings in spirv_module relating to enum's default width on x64

* Make hashes of states use correct types without casting.

* Fix narrowing conversion in d3d11_sampler.cpp
2018-04-20 01:10:58 +02:00
Philip Rebohle
62b0e34a73
[d3d11] Implement IDXGIVkInteropDevice for D3D11Device 2018-04-20 00:19:03 +02:00
Philip Rebohle
c2854e1fb9
[dxgi] Added IDXGIVkInteropSurface interface 2018-04-19 20:13:53 +02:00
Philip Rebohle
478a87f6d2
[dxgi] Added IDXGIVkInteropDevice interface 2018-04-19 15:46:57 +02:00
Philip Rebohle
a6a22cd00a
[dxvk] Export DxvkDeviceQueue from DxvkDevice
Access to the Vulkan queues provided by the DXVK device
is required for external Vulkan libraries to work.
2018-04-19 15:42:48 +02:00
Philip Rebohle
8eb78591a0
[dxbc] Scan pixel shader output register type at declaration time
Fixes invalid shaders being generated in the Blacksmith demo on
some GPUs. Works around a possible issue in the output signature
reader.

Commit #1000, yay.
2018-04-18 21:14:34 +02:00
Philip Rebohle
8125d53e58
[dxvk] Remove std::clamp usage
Breaks outdated compilers.
2018-04-18 17:49:11 +02:00
Philip Rebohle
adb0f5e16b
[dxgi] DxgiSwapchain: Check whether window is valid
Fixes a GPU hang when closing Dark Souls 3 as well as similar
undesired behaviour in other games that continue to use the
DXGI swap chain after the window has been destroyed.
2018-04-18 17:30:46 +02:00
Philip Rebohle
bb3e3c9e4f
[dxgi] GetDisplayModeList: Report DXGI_MODE_SCALING_UNSPECIFIED
This is what happens on Windows 10. In addition, we might have
to add CENTERED and STRETCHED entries for non-native modes.
2018-04-18 16:04:17 +02:00
Philip Rebohle
ffe3028285
[dxgi] GetDisplayModeList: Sort display mode list
Some games, including Dark Souls 3, rely on display modes
being returned in a specific order. This emulates Windows
10 behaviour.
2018-04-18 15:33:56 +02:00
Philip Rebohle
01061e43aa
[dxgi] GetDisplayModeList: Do not report modes as stretched
This is more in line with what Windows does. Games should now be
able to list more than just the monitor's maximum resolution again.
2018-04-18 15:33:15 +02:00
Philip Rebohle
05a96e96bb
[dxvk] Fix Nvidia driver version reporting 2018-04-17 23:34:16 +02:00
Philip Rebohle
669df2146b
Merge branch 'master' of https://github.com/doitsujin/dxvk 2018-04-17 22:23:46 +02:00
Philip Rebohle
fcdba67b88
[d3d11] Implement 2D<->3D image copies in CopySubresourceRegion 2018-04-17 22:22:49 +02:00
Vesim
b82ae16f8a [dxbc] Moved all operators in dxbc_names to dxvk namespace (#296) 2018-04-17 17:33:07 +02:00
Philip Rebohle
9a8263f465
[dxvk] Implement vertex binding divisors
Uses VK_EXT_vertex_attribute_divisor when available.
2018-04-17 17:24:16 +02:00
ZeroFault
a248ae985d [d3d11] nullptr check on Begin and End (#295) 2018-04-17 13:57:39 +02:00
Philip Rebohle
388fe02158
[hud] Added frametime graph
Enable with DXVK_HUD=frametimes.
2018-04-17 12:03:03 +02:00
Philip Rebohle
a4f9e5f0d5
[hud] Added line renderer 2018-04-17 10:01:06 +02:00
Philip Rebohle
8bfaae9350
[hud] Rename renderText -> render 2018-04-17 09:21:40 +02:00
Philip Rebohle
e38e1347d3
[hud] HudTextRenderer -> HudRenderer
Maintaining one class should be easier than creating
multiple renderer classes and having to switch between
them.
2018-04-17 09:20:18 +02:00
Philip Rebohle
75c928fc87
[dxbc] Remove is-bound check for constant buffer reads
We do not have to do this anymore since we'll bind a large
enough dummy buffer. Considerably reduces code size in shaders
which access a large number of shader constants.
2018-04-16 23:40:48 +02:00
Philip Rebohle
6f3454842f
[dxvk] Increase dummy buffer size to max uniform buffer size 2018-04-16 23:40:41 +02:00
Philip Rebohle
327cd5ff30
[dxvk] Enable VK_EXT_vertex_attribute_divisor if available
We will use this extension in order to implement vertex
binding divisors other than 1 for per-instance attributes.
Will be *required* as soon as support by wine and Vulkan
drivers is widely available.
2018-04-16 17:33:55 +02:00
Philip Rebohle
98b8d41016
[dxbc] Write shader name to the generated SPIR-V
Might help identifying shaders in debugging tools such as Renderdoc.
2018-04-15 21:00:08 +02:00
Philip Rebohle
08777e2c0e
[dxvk] Change stat couter type to uint64_t 2018-04-15 20:59:41 +02:00
Philip Rebohle
af19bba048
[dxgi] Remove support gamma-related ScaleAndOffsetSupported
Some games, including Heroes of the Storm (#287), do not set
the values correctly so it's better to ignore them altogether.
2018-04-15 20:12:41 +02:00
Philip Rebohle
256645724b
[dxvk] Destroy old swap chain before creating a new one
We no longer use the 'oldSwapchain' member in the swap chain description
to replace an existing swap chain, but rather destroy it altogether and
create a new swap chain. While this is less than optimal, it might help
solve some swap chain-related issues such as #277.
2018-04-15 15:36:10 +02:00
Philip Rebohle
24f0528b6f
[dxvk] Print memory heap size in megabytes 2018-04-15 10:53:46 +02:00
ShadowsFriend
d1206a8d9d [dxvk] Added memory information to adapter info (#279) 2018-04-15 10:22:32 +02:00
Philip Rebohle
31ed6e5cd3
[dxvk] Move render target set comparison to DxvkRenderTargets 2018-04-15 03:01:52 +02:00
Philip Rebohle
d523405a5a
[dxvk] Implement bindRenderTargets method
An alternative to manually creating a framebuffer object and binding
it via bindFramebuffer. Future optmizations can use this to bring
down the number of redundant render pass changes.
2018-04-15 01:09:53 +02:00
Philip Rebohle
56ce794438
Merge commit '87d14fb' 2018-04-14 23:23:27 +02:00
Philip Rebohle
87d14fb57f
[d3d11] Report TYPED_UAV only if both TBs and SIs are supported 2018-04-14 23:20:35 +02:00
Philip Rebohle
a6406e3b60
[dxvk] Recreate swap chain on presentation failure 2018-04-14 22:45:30 +02:00
Philip Rebohle
f07f610b6a
[d3d11] Improve format support queries
- Do not report MIP_AUTOGEN if the image format cannot
  be used as a color attachment
- Do not report SAMPLE_COMPARISON and GATHER_COMPARISON
  if the DXGI format has no corresponding depth format
- Only report image-related features if the image format
  can actually be used as a sampled image
2018-04-14 16:07:01 +02:00
Philip Rebohle
320cebb8f9
[dxvk] Improved memory allocation debug output 2018-04-14 13:03:14 +02:00
Philip Rebohle
8d3e60c2f1
[dxgi] Cosmetic changes 2018-04-14 12:02:55 +02:00
Philip Rebohle
a6767ebd52
[d3d11] Improved debug output of D3D11DeviceContext methods 2018-04-14 11:45:31 +02:00
Philip Rebohle
8dfe7088fd
[dxvk] Fixed silly typo 2018-04-13 17:06:58 +02:00
Philip Rebohle
15fca0b0b1
[dxvk] Improved debug output when resource creation fails 2018-04-13 17:03:35 +02:00
Philip Rebohle
ded6dec7eb
[dxgi] DxgiVkPresenter: use Microsoft-style API 2018-04-13 13:57:29 +02:00
Philip Rebohle
5d7c83855e
[dxgi] Use 1D texture to implement the gamma lookup table
This allows us to abuse hardware texture filters for linear
interpolation. Should fix an issue with the latest Nvidia
beta drivers.
2018-04-13 13:47:15 +02:00
Philip Rebohle
4a0c9dbaba
[d3d11] Validate texture sample count
Fixes incorrect return values in case a game tries to create
a texture with an unsupported number of samples.
2018-04-13 13:46:45 +02:00
Philip Rebohle
ebf474ae9e
[dxvk] Enable VK_KHR_sampler_mirror_clamp_to_edge
Fixes validation errors in The Witcher 3.
2018-04-13 13:46:20 +02:00
Philip Rebohle
8508994a63
[d3d11] Cap mip level count for textures and views
Some games do not compute the number of mip levels of
a texture or texture view correctly, so we should work
around this by capping it to the highest possible value.
2018-04-12 23:42:11 +02:00
Philip Rebohle
56a1433d3f
[d3d11] ClearUnorderedAccessViewUInt: Create temp view if necessary
If this method is used to clear a view with a floating point format,
we need to create a compatible view with an integer format in order
to clear the resource with the correct value. Fixes some calls to
this function in Rise of the Tomb Raider and other games.
2018-04-12 23:31:15 +02:00
pchome
f806c8eafc [dxgi] Use GetMonitorInfoW function explicitly (#271)
No `std::mbstowcs` string conversion needed than.
W/o this change I have different output when running `dxgi-factory.exe` compiled with MinGW:
* `Output 0:`
  ```
  \\.\DISPLAY1 (default)
  \\.\DISPLAY1 (DXVK MinGW)
  \            (DXVK winebuild)
  ```

With this patch all three variants are identical (`\\.\DISPLAY1`)

p.s. same problem in dxgi_adapter.cpp, but `deviceProp.deviceName` is vulkan structure parameter (char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]).
2018-04-12 20:12:48 +02:00
Philip Rebohle
db541d188f
[dxgi] Added static format mapping table 2018-04-12 17:49:14 +02:00
Philip Rebohle
3405b89494
[dxgi] Rename and move DXGI format lookup related structures
This is part of a major refactoring process regarding DXGI->Vulkan
format conversions. Since we don't patch format lookup tables any
longer, we can create a global lookup table.
2018-04-12 15:36:01 +02:00
Philip Rebohle
adb1789571
[dxbc] Fixed incorrect result vector dimension for OpImageQuerySize 2018-04-12 13:57:15 +02:00
Philip Rebohle
f5679211cd
[dxgi] Re-implement gamma control functions 2018-04-12 13:38:22 +02:00
Philip Rebohle
654e9e6fd8
[dxgi] Re-enable strong reference to DxgiAdapter in DxgiOutput 2018-04-12 01:51:28 +02:00
Philip Rebohle
c9c3bc12cc
Revert "[dxgi] Create persistent DxgiOutput object"
This reverts commit ad7f0971cf.
Causes crashes in Overwatch due to weird refcount behaviour.
2018-04-12 01:48:57 +02:00
Philip Rebohle
3c6eb91c63
[dxgi] Remove Output reference from DxgiSwapChain 2018-04-12 01:28:44 +02:00
Philip Rebohle
c88170966f
[dxgi] Remove gamma control methods from DxgiOutput 2018-04-12 01:15:40 +02:00
Philip Rebohle
015e67fc7c
[dxgi] Replaced ugly pointer cast by more reasonable code 2018-04-12 00:45:23 +02:00
Philip Rebohle
ef4a3c5bfc
[d3d11] Use meta clear for ClearUnorderedAccessView* methods 2018-04-11 23:39:12 +02:00
Philip Rebohle
9d84e1bfaa
[dxvk] Implement clearBufferView and clearImageView 2018-04-11 23:13:34 +02:00
Philip Rebohle
cce578d67a
[dxvk] Increase workgroup size for buffer clear shaders 2018-04-11 23:12:55 +02:00
Philip Rebohle
2f7dcd2caf
[dxgi] Disable gamma curve in presenter
Causes regressions in many games for unknown reasons.
2018-04-11 20:55:03 +02:00
Philip Rebohle
021ea64103
[dxbc] Remove Nvidia driver version check
Apparently this causes a regression in Overwatch for some.
2018-04-11 19:44:45 +02:00
Philip Rebohle
140dc27ea3
[dxvk] Create compute pipelines for meta clear ops 2018-04-11 18:58:01 +02:00
Philip Rebohle
7c1919eaa1
[dxvk] Added missing shader files 2018-04-11 18:57:31 +02:00
Philip Rebohle
ac8447b32e
[dxvk] Add separate clear shaders for array views
Creating one shader per image view type may help in case we
get an already compatible image view from the D3D11 application.
2018-04-11 17:16:18 +02:00
Philip Rebohle
676b0cb476
[dxvk] Added DxvkMetaClearObjects stub 2018-04-11 17:05:12 +02:00
Philip Rebohle
9970dfaeca
[dxvk] Add format info flag for integer formats 2018-04-11 16:21:59 +02:00
Philip Rebohle
6a0ab19049
[dxvk] Added meta shaders for image/buffer clear operations
The D3D11 ClearUnorderedAccessView* and ClearView functions
will have to be emulated using compute shaders rather than
clear operations, since Vulkan clear operations do not take
image views and their format into account.
2018-04-11 13:07:04 +02:00
Philip Rebohle
4797645bd2
[dxvk] Removed unused DxvkOptions 2018-04-11 13:06:43 +02:00
Philip Rebohle
8ea17e7a25
[dxbc] Implemented Nop instruction
Required for Metal Gear Solid V.
2018-04-11 01:49:39 +02:00
Philip Rebohle
f3544cc8e1
[dxbc] Fix __GL_NextGenCompiler check... 2018-04-11 01:17:07 +02:00
Philip Rebohle
3ff437ddbe
[dxbc] Re-enable Nvidia workarounds if __GL_NextGenCompiler is '0'
Fixes potential regressions when using the old SPIR-V compiler.
2018-04-11 00:26:42 +02:00
Philip Rebohle
1b6442b859
[dxbc] Disable Nvidia-specific workarounds for 396.18 and above 2018-04-11 00:20:24 +02:00
Philip Rebohle
a2f96f9728
[dxgi] Remove unnecessary debug output 2018-04-10 22:10:32 +02:00
Philip Rebohle
dd3f4c89ac
[dxgi] Implement gamma control methods for DxgiOutput 2018-04-10 22:07:25 +02:00
Philip Rebohle
ad7f0971cf
[dxgi] Create persistent DxgiOutput object 2018-04-10 22:07:00 +02:00
Philip Rebohle
f13011f487
[dxgi] Implement gamma ramp in presenter
Will be used to fake IDXGIOutput::SetGammaControl.
2018-04-10 20:44:55 +02:00
Philip Rebohle
41132b8c13
[dxgi] Re-implement presentation shaders in GLSL 2018-04-10 18:46:39 +02:00
Philip Rebohle
a28303c4bd
[dxvk] Optimize binding ID remapping
We don't need to iterate over the full shader code when creating
a new shader module. This optimization may slightly reduce the
initial pipeline creation time.
2018-04-10 12:48:46 +02:00
Philip Rebohle
5d1642af1f
[spirv] Track instruction offset in instruction iterator 2018-04-10 12:48:24 +02:00
Philip Rebohle
1fb22a6022
[dxbc] Refactored opcode controls 2018-04-10 08:01:54 +02:00
Philip Rebohle
5cb65a6c19
[dxbc] Fix sampleinfo_uint instruction 2018-04-09 22:52:59 +02:00
Philip Rebohle
d68d62f837
[dxvk] Removed on-disk pipeline cache
Drivers from both major vendors implement their own shader cache
already, and storing a cache per game causes more issues than it
solves. Should fix #261.
2018-04-09 19:38:32 +02:00
Philip Rebohle
8a4e1d11b7
[dxbc] Add missing component count to gs_layer variable type
Fixes an incorrect geometry shader in Overwatch.
2018-04-09 00:20:27 +02:00
Philip Rebohle
bd5254f8d3
[d3d11] Fixed compiler errors
Why the hell did my GCC not complain about this earlier?
2018-04-08 22:26:35 +02:00
Philip Rebohle
687ef77860
[dxvk] Enable sample rate shading if needed 2018-04-08 21:49:30 +02:00
Philip Rebohle
797d7ec81d
[dxbc] Enable CapabilitySampleRateShading capability when needed
Fixes SPIR-V validation errors in the Final Fantasy XV benchmark.
2018-04-08 21:06:58 +02:00
Philip Rebohle
4c3e77e9e3
[dxvk] Add missing format info for the *_422_UNORM formats 2018-04-08 20:40:12 +02:00
Philip Rebohle
e38cc4a0e0
[dxbc] Implement support for SV_PrimitiveID
Fixes some geometry/tessellation shaders in The Witcher 3.
2018-04-08 18:25:44 +02:00
Philip Rebohle
83a0eda4f6
[dxgi] Fixed packed 16-bit format mappings 2018-04-08 15:19:26 +02:00
pchome
acaf6c9e87 [d3d11] Fix compilation with WINE headers (#247)
All this structures are defined in WINE headers but `D3D11_FORMAT_SUPPORT2`.
2018-04-07 14:02:57 +02:00
pchome
62b99c9bd2 [util] Fix compilation with WINE headers (#246)
* [util] Define typeof keyword for WINE guiddef.h

GCC: `-std options disable certain keywords`
https://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html

MinGW: `#define __uuidof(type) __mingw_uuidof<__typeof(type)>()`
WINE: `#define __uuidof(type) __wine_uuidof<typeof(type)>()`

* [util] Fix compilation with WINE headers

Overall definitions are the same but `__wine_` prefix used in .

MinGW: _mingw.h + guiddef.h
WINE: guiddef.h
2018-04-07 14:01:13 +02:00
Philip Rebohle
00a452ed89
[d3d11] Implement DXBC shader module cache
If an application compiles the same shader multiple times, we should reuse
an already existing DxvkShaderModule instead of creating a new one. This
helps keep the number of DxvkGraphicsPipeline objects low in games such
as Rise of the Tomb Raider.
2018-04-06 17:54:02 +02:00
Philip Rebohle
bd17be472d
[dxbc] Reciprocate W component of SV_POSITION in pixel shaders
Fixes the fog effect in Nier:Automata, as well as some major
visual issues in Rise of the Tomb Raider, and potentially
other games.
2018-04-05 20:10:00 +02:00
Philip Rebohle
4d28f765df
[dxvk] Remove support for VK_AMD_rasterization_order
RADV will be doing this by default when it makes sense.
2018-04-04 15:09:24 +02:00
Philip Rebohle
492c7384bc
[dxbc] Implemented ImmAtomicCmpExch and AtomicCmpStore 2018-04-04 13:59:43 +02:00
Philip Rebohle
e06300d592
[d3d11] Fix multisample format support query for depth images
Fixes a crash in World of Warships when reflections are enabled.
2018-04-04 11:24:16 +02:00
pchome
6a6871ee42 [dxgi] Fix compilation with WINE headers (#236)
* [dxgi] Fix compilation with WINE headers

```gcc
error: cannot convert 'MONITORINFOEX* {aka tagMONITORINFOEXA*}' to 'LPMONITORINFO {aka tagMONITORINFO*}' for argument '2' to 'BOOL GetMonitorInfoA(HMONITOR, LPMONITORINFO)'
```
```clang
cannot initialize a parameter of type 'LPMONITORINFO' (aka 'tagMONITORINFO *') with an rvalue of type '::MONITORINFOEX *' (aka 'tagMONITORINFOEXA *')
```

This can be WINE bug but I don't want to dig now, firs suggestion is wrong "tag":
wine variant
```c
typedef struct tagMONITORINFO
{
...
} MONITORINFO, *LPMONITORINFO;

typedef struct tagMONITORINFOEXA
{   /* the 4 first entries are the same as MONITORINFO */
...
} MONITORINFOEXA, *LPMONITORINFOEXA;

typedef struct tagMONITORINFOEXW
{   /* the 4 first entries are the same as MONITORINFO */
...
} MONITORINFOEXW, *LPMONITORINFOEXW;

DECL_WINELIB_TYPE_AW(MONITORINFOEX)
DECL_WINELIB_TYPE_AW(LPMONITORINFOEX)
```  
VS
MinGW variant
```c
  typedef struct tagMONITORINFO {
...
  } MONITORINFO,*LPMONITORINFO;

  typedef struct tagMONITORINFOEXA : public tagMONITORINFO {
    CHAR szDevice[CCHDEVICENAME];
  } MONITORINFOEXA,*LPMONITORINFOEXA;

  typedef struct tagMONITORINFOEXW : public tagMONITORINFO {
    WCHAR szDevice[CCHDEVICENAME];
  } MONITORINFOEXW,*LPMONITORINFOEXW;

  __MINGW_TYPEDEF_AW(MONITORINFOEX)
  __MINGW_TYPEDEF_AW(LPMONITORINFOEX)
```

* [dxgi] Fix compilation with WINE headers

Use C++-style casts rather than C ones.
2018-04-03 21:11:26 +02:00
Philip Rebohle
89c3b60640 [dxvk] Removed upper limit for CS chunks
Since we are synchronizing once per frame anyway, there is no need to
artificially limit the number of chunks in flight. Applications which
use deferred contexts and submit a large number of CS chunks through
command lists may benefit from this optimization.
2018-04-03 20:06:25 +02:00
Philip Rebohle
7de27d4fd8 [d3d11] Flush immediate context on command list execution
This optimization may help keep the GPU busy in case there's
a large number of draw calls pending at the time a command
list from a deferred context is submitted for execution.
2018-04-03 19:53:37 +02:00
Philip Rebohle
0b2e88b087 [hud] Added <unordered_map> include to satisfy some compilers 2018-04-03 16:27:16 +02:00
Philip Rebohle
9ef4168867 [dxvk] Added support for pipeline-related stat counters 2018-04-03 15:52:39 +02:00
Philip Rebohle
561fa7440b [dxvk] Retrieve actual memory stats for the HUD 2018-04-03 15:32:00 +02:00
Philip Rebohle
fc3f45c082 [hud] Added stat counters to the HUD 2018-04-03 14:49:13 +02:00
Philip Rebohle
3ed03f7a3d [hud] Added configurable HUD
HUD elements can be enabled individually using a comma-separated
list. Supported options include:
- fps: Displays the framerate
- devinfo: Displays device info

Passing "1" has the same effect as "fps,devinfo".
2018-04-03 12:33:08 +02:00
Philip Rebohle
8aa8610221 [dxvk] Implement basic stat counters for draw calls, queue ops 2018-04-03 11:56:12 +02:00
Philip Rebohle
c9465b39d1 [util] Implement spin lock 2018-04-03 11:56:02 +02:00
Philip Rebohle
a5077952ea [dxvk] Reintroduce stat counters 2018-04-03 11:03:57 +02:00
Philip Rebohle
4b44d3ce39 [dxbc] Unify constants
Identical constants will now be reused. Considerably reduces code size.
2018-04-02 19:41:22 +02:00
Philip Rebohle
097eb89cfb [dxvk] Log pipeline state when pipeline compilation fails 2018-04-02 19:05:41 +02:00
Philip Rebohle
267daeccad [util] Add generic Logger::log method 2018-04-02 19:05:20 +02:00
pchome
311748ee09 [dxgi] Replace UINT_MAX with std::numeric_limits (#234)
`limits.h` required for `UINT_MAX` and not always used, so better to use standard C++ variant from `<limits>`.

Some compilers may simply return `UINT_MAX` value, gcc version: `max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__ * 2U + 1; }`.
2018-04-02 18:49:19 +02:00
pchome
e9c7dcfc76 [dxgi] Replace MSVC _countof macro with std::size (#231)
* [dxgi] Replace MSVC _countof macro with std::size

pro: crosscompiler
con: may not work for older clang/gcc/...

http://en.cppreference.com/w/cpp/iterator/size
For example `Run this code` mode produces errors for GCC-5.2(C++17) and clang-3.8(C++17). Local GCC-7.3 and clang-7 versions are ok. 
Not tested w/ MinGW64.

*  [dxgi] Replace MSVC _countof macro with std::size
2018-04-02 18:49:03 +02:00
Philip Rebohle
eb85f61084 [dxbc] Serialize hull shader fork/join phase invocations
We cannot run these in parallel in case the hull shader's output vertex
count, and thus the invocation count, is less than the fork/join phase
invocation count.
2018-04-02 16:22:19 +02:00
Philip Rebohle
2973c18055 [dxgi/d3d11] Remove COM_QUERY_INTERFACE macro, reset pointers
May fix some crashes in applications that rely on the returned
pointer being set to nullptr before returning.
2018-04-02 12:52:02 +02:00
Philip Rebohle
77010d96e4 [dxgi/d3d11] Set returned pointers to nullptr before returning
May solve issues with applications which check whether the returned
pointer is null rather than checking a function's return value.
2018-04-02 12:04:20 +02:00
Philip Rebohle
aeef93e1e4 Merge branch 'master' of https://github.com/doitsujin/dxvk 2018-04-02 10:58:49 +02:00
Philip Rebohle
d2c6ec5c41 [dxbc] Implement ImmAtomic*Min/Max instructions 2018-04-02 10:58:26 +02:00
Vesim987
a2f05467c7 [d3d11] Force CreateRenderTargetView to return S_OK with D3D11_RESOURCE_DIMENSION_BUFFER (#230)
It makes Battlefield 3 and Battlefield 4 working.
2018-03-31 21:47:54 +02:00
Philip Rebohle
99d9a5df0b [dxbc] Respect GloballyCoherent flag for UAVs 2018-03-31 16:41:19 +02:00
Philip Rebohle
770d94f796 [dxbc] Fix explicit memory barrier semantics
This imitates glslang behaviour for barrier instructions and
sets AcquireRelease semantics for all explicit memory barriers.
2018-03-30 17:59:57 +02:00
Philip Rebohle
47e78d0a95 [dxbc] Fixed type of atomic pointers into typed UAVs
Should fix a crash in the Nvidia driver.
2018-03-30 17:31:48 +02:00
Philip Rebohle
05e0f3d52d
[dxvk] Remove mutex from Dxvk(Graphics|Compute)Pipeline
Not needed anymore because the pipe manager itself won't be
accessed by multiple threads any longer.
2018-03-29 16:36:31 +02:00
Philip Rebohle
b286b518c5
[dxbc] Fix ForkInstanceId type in EmitHsForkJoinPhase 2018-03-29 14:05:38 +02:00
Philip Rebohle
2ab4710054
[dxbc] Run HS fork/join phases in parallel
May reduce execution time of hull shaders on the GPU by running
the fork/join phases in parallel, as originally intended. Tested
on RADV 18.0.99 with LLVM 6.0.0.
2018-03-29 13:29:50 +02:00
Philip Rebohle
6e27f12e22
[dxvk] Move DxvkPipelineManager object to DxvkContext
Since we create only one DxvkContext per D3D11Device, rather than
per D3D11DeviceContext as originally planned, there is no need to
keep the pipeline manager as a global thread-safe object. This may
slightly reduce CPU overhead.
2018-03-29 12:32:20 +02:00
Philip Rebohle
108bf2194f
[dxvk] Time pipeline creation in debug mode 2018-03-29 12:06:53 +02:00
notaz
5eefb8530d [general] More wine test suite fixes (#220)
* [dxgi] Implement freeing private data

Done by passing null as data.
Fixes wine private data test crash and passes them.

* [dxgi] Improve private data argument handling

Fixes 7 more wine tests.
2018-03-29 07:11:21 +02:00
Philip Rebohle
ae88f83b86
[d3d11] Introduce D3D11DeviceContainer
Refactored DxgiVkDevice, D3D11Device and D3D11Presenter
to behave more like aggregable objects, where the new
D3D11DeviceContainer class is the COM aggregate object.
Fixes the reference counting issue outlined in #210.
2018-03-28 21:24:52 +02:00
Philip Rebohle
8d3dcba8d5
[dxgi] Renamed private DXGI interfaces 2018-03-28 19:06:00 +02:00
Philip Rebohle
410cde3f17
[dxgi] Move device creation to DxgiAdapter
This is better than exporting new functions.
2018-03-28 18:58:53 +02:00
Philip Rebohle
6babc22ec0
[dxgi] Reset pointers before returning an error
Also fixes a refcount issue and minor code formatting issues.
2018-03-28 11:56:58 +02:00
Philip Rebohle
87f9bcfd75
[dxbc] Do not use locations >32 for tess control outputs
Fixes an assertion with latest mesa-git.
2018-03-28 11:55:29 +02:00
Philip Rebohle
1a8567a363
[d3d11] Fixed silly bug in blend state comparison 2018-03-28 11:55:03 +02:00
Philip Rebohle
057d74e57f
Merge branch 'master' of https://github.com/doitsujin/dxvk 2018-03-27 02:02:50 +02:00
notaz
5411689789 [dxgi] More argument handling improvements (#211)
Fixes 11 tests + a crash.
2018-03-27 01:58:33 +02:00
Philip Rebohle
a700e928ef
[dxbc] Enable MultiViewport capability if needed
Fixes invalid SPIR-V generated since  60d6416e5f.
2018-03-27 01:41:06 +02:00
Philip Rebohle
60d6416e5f
[dxbc] Implemnted SV_ViewportArrayIndex for geometry shaders
Required by Final Fantasy XIV.
2018-03-26 23:32:30 +02:00
Philip Rebohle
fc47fb8f6c
[dxvk] Do not create descriptor set layout/template if binding count is 0
Fixes a validation error in case an application renders geometry without
any active shader resource slots.
2018-03-26 23:13:33 +02:00
notaz
f02b44f440 [dxgi] Fix some argument checks (#205)
Changed according to wine's tests.
2018-03-26 07:38:37 +02:00
Philip Rebohle
675b1c5b8c
[d3d11] Implemented image mapping on deferred contexts
Also refactored buffer mapping to reduce code duplication.
Optimized the lookup function for a small performance gain
in games which map a lot of resources on deferred contexts.
2018-03-25 13:24:03 +02:00
Philip Rebohle
61c55d6f89
[d3d11] Get rid of redundant format query 2018-03-25 08:38:31 +02:00
Philip Rebohle
4e84a77896
[d3d11] Disable DO_NOT_WAIT flag by default
Apparently this breaks Elder Scrolls Online as well, so we'll
just enable it explicitly for games which benefit from this
optimization and disable it by default.
2018-03-25 00:54:42 +01:00
Philip Rebohle
4ed007e9f6
[d3d11] Add <unordered_map> include
Fixes #201.
2018-03-24 18:54:00 +01:00
Philip Rebohle
0900e1b5f9
[d3d11] Added missing files 2018-03-24 17:29:13 +01:00
Philip Rebohle
bd69e843c2
[d3d11] Added D3D11Options
Includes a per-app knob for Witcher 3 to disable D3D11_MAP_FLAG_DO_NOT_WAIT.
2018-03-24 17:02:24 +01:00
Philip Rebohle
ac94c42380
Revert "[dxbc] Do not emit per-vertex input block"
This reverts commit 4ce64bd886.

Fixes a regression in Sniper: Ghost Warrior 2 and Dishonored 2.
2018-03-24 16:23:31 +01:00
Philip Rebohle
54382ae319
[dxbc] Add experimental support for mixed resource types
HLSL tbuffers are translated to resources with a "mixed" format.
There is no documentation about which format the buffers actually
use, so we'll default to UINT and see what happens.
2018-03-24 14:21:13 +01:00
Philip Rebohle
19e0829a37
[dxgi] Enumerate scaled and centered display modes correctly
Fixes fullscreen mode in Dark Souls 3.
2018-03-24 13:42:23 +01:00
Philip Rebohle
87d6fde5c4
[dxgi] FindClosestMatchingMode: Fall back to 8-bit SRGB format
Fixes errors in various games which rely on this method.
2018-03-24 11:31:39 +01:00
Philip Rebohle
7f7eedac35
[dxbc] Implement SV_ClipDistance and SV_CullDistance 2018-03-24 11:29:07 +01:00
Philip Rebohle
4ce64bd886
[dxbc] Do not emit per-vertex input block
Instead, we can let the normal input registers do their thing.
2018-03-24 00:32:22 +01:00
Philip Rebohle
0ab27aa4e3
[dxbc] Check if the signature is nullptr before using it
Fixes a crash in The Witcher 3.
2018-03-23 21:38:21 +01:00
Philip Rebohle
31772af4a5
[dxbc] Count clipping and culling planes 2018-03-23 19:48:07 +01:00
Philip Rebohle
ba9e1f307d
[dxbc] Don't use rvalue references for file streams 2018-03-23 18:17:16 +01:00
Philip Rebohle
0a2fa590f5
[d3d11] Reset busy flag after emitting the Flush command
Fixes a general performance regression in games
that call WaitForResources a lot.
2018-03-23 11:54:19 +01:00
Philip Rebohle
e6d93d6cfb
[spirv] Emit image types only once
Fixes SPIR-V validation errors.
2018-03-23 01:10:12 +01:00
Philip Rebohle
abb90086d5
[dxvk] Use analyzer to determine UAV image type 2018-03-23 01:04:04 +01:00
Philip Rebohle
44d8d6b8c3
[dxvk] Fixed command buffer synchronization 2018-03-22 20:15:46 +01:00
Philip Rebohle
16caa10697
[dxbc] Add analyzer stub
Will be used to gather information for the compiler.
2018-03-22 20:01:57 +01:00
Philip Rebohle
085fd6a959
[d3d11] Remove unnecessary Map() check 2018-03-22 19:28:00 +01:00
Philip Rebohle
2566909917
[dxvk] Remove DxvkFence 2018-03-22 19:01:01 +01:00
Philip Rebohle
0bdae4f930
[dxvk] Move fence object into DxvkCommandList
Reduces command submission overhead by reusing fence objects
instead of creating new ones for each submission. Improves
error reporting in case the submission cannot be complete.
2018-03-22 18:57:33 +01:00
Philip Rebohle
d9b1995cf0
[d3d11] Do not forward D3D11_MAP_FLAG_DO_NOT_WAIT for mapped images
Workaround for a regression in The Witcher 3 that was introduced
in commit 53d557c2db. May have a
significant negative impact on performance in some games.
2018-03-22 14:12:43 +01:00
Philip Rebohle
b3aff7cd2e
[d3d11] Fix immediate context initialization
The old initialization code did not take either CSMT or
Deferred Contexts into account and could lead to illegal
calls to beginRecording.

Fixes a hang encountered in Dishonored 2.
2018-03-22 13:40:45 +01:00
Philip Rebohle
7f6c8dff95
[d3d11] Fix flush condition and CS thread synchronization
If chunks have been sent to the CS thread, we need to
flush even if the current chunk is empty.
2018-03-22 12:58:26 +01:00
Philip Rebohle
5eedbc0546
[dxgi] Always use 32-bit depth buffers instead of 24-bit
Support for 24-bit depth buffers seems poor even on GPUs which support
them, and there seem to be no issues with using 32-bit buffers in practice.
2018-03-22 11:09:23 +01:00
Philip Rebohle
53d557c2db
[d3d11] Implement D3D11_MAP_FLAG_DO_NOT_WAIT
Improves framerate in Dishonored 2 by up to 50%.
2018-03-22 11:02:14 +01:00
Philip Rebohle
9215cfdcf2
[dxvk] Minor 2018-03-22 11:01:54 +01:00
Philip Rebohle
5c2144b55d
[dxvk] Move tess state validation to validatePipelineState 2018-03-21 15:22:18 +01:00
Philip Rebohle
ec161823e5
[dxvk] Check whether renderpass is null before creating pipeline 2018-03-21 15:09:34 +01:00
Philip Rebohle
6f6e12a329
[util] Fix possible crash with null interfaces in private storage 2018-03-21 15:09:08 +01:00
Philip Rebohle
9ef94e28ac
[dxbc] Support UNorm/SNorm typed resources 2018-03-21 15:08:53 +01:00
Philip Rebohle
08806070ca
[d3d11] Fix CheckFeatureSupport return value 2018-03-21 15:08:34 +01:00
Philip Rebohle
efcd5c6b4d
[d3d11] Implement support for D3D11_FEATURE_FORMAT_SUPPORT2 2018-03-21 13:31:22 +01:00
Philip Rebohle
09151f3616
[d3d11] Lift shaderStorageImageReadWithoutFormat requirement 2018-03-21 12:57:29 +01:00
Philip Rebohle
584ee6b6f0
[dxbc] Lift ShaderStorageImageReadWithoutFormat requirement 2018-03-21 12:47:53 +01:00
Philip Rebohle
fcff10aae7
[dxbc] Set image format for UAVs when atomic operations are used
Fixes a violation of the Vulkan specification where atomic operations
would be used on storage images with SpvImageFormatUnknown. Should fix
driver crashes on Nvidia.

TODO: Fix data types for atomic operation instructions.
2018-03-21 12:11:18 +01:00
Philip Rebohle
c1a1ff3915
[d3d11] Implement remaining D3D11.1 feature queries 2018-03-21 04:58:31 +01:00
Philip Rebohle
17e981f360
[dxvk] Increase UAV slot count to 64 for the graphics pipeline
D3D11 raised this limit from 8 UAVs in the fragment shader to
64 UAVs in all graphics stages combined.
2018-03-21 04:56:33 +01:00
Philip Rebohle
bd71f256e5
[d3d11] Fixed constant buffer binding update 2018-03-21 03:26:31 +01:00