Commit Graph

471 Commits

Author SHA1 Message Date
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 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 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 687ef77860
[dxvk] Enable sample rate shading if needed 2018-04-08 21:49:30 +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 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 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 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 097eb89cfb [dxvk] Log pipeline state when pipeline compilation fails 2018-04-02 19:05:41 +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 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
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
Philip Rebohle ba9e1f307d
[dxbc] Don't use rvalue references for file streams 2018-03-23 18:17:16 +01:00
Philip Rebohle 44d8d6b8c3
[dxvk] Fixed command buffer synchronization 2018-03-22 20:15:46 +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 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 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 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
Sebastian Wick 4518b1b76e Shader cache (#188)
* [util] Adds getTempDirectory() function

Will be used by on-disk pipeline caching

* [dxvk] Implement on-disk shader caching

Saving the pipeline cache to disk when the application exits
should be sufficient but the DxvkPipelineCache destructor isn't
reliably called on exit (ref-counting issue?).
As a workaround every frame we check and save the cache if the
size increased by some amount or after one minute elapsed.

* [dxvk] Periodically update shader cache file in separate thread
2018-03-21 02:45:11 +01:00
Philip Rebohle 894444d43d
[dxvk] Remove old debug code 2018-03-20 22:36:02 +01:00
Philip Rebohle 42d49d7603
[dxvk] Respect bufferImageGranularity for non-linear images
May fix aliasing issues on GPUs where the bufferImageGranularity limit
is greater than the alignment requirement of non-linear resources.
2018-03-20 20:24:11 +01:00
Philip Rebohle f762811af0
[dxvk] Use multiple free lists for physical buffer slices
Reduces lock contention and slightly improves performance in games
that rely heavily on the buffer renaming mechanism if the lock
protecting the original free list was contested.
2018-03-19 14:53:59 +01:00
Philip Rebohle 0eaa3fea3b
[dxvk] Implement thread-safe buffer renaming
This is required for resource mapping on deferred contexts.
May also fix a potential synchronization issue where a buffer
could be mapped multiple times before the CS thread would mark
the physical buffer as used, which would result in invalid data.
2018-03-19 02:18:44 +01:00
Philip Rebohle 94aa650f3e
[dxvk] Enable the use of VK_KHR_descriptor_update_template
Reduces the CPU overhead of descriptor set updates, which usually
happen once per draw call. Gains seem to be minor in most games,
some outliers show significantly better performance (i.e. Tomb Raider).
2018-03-17 23:50:03 +01:00
Philip Rebohle 0f800c6c51
[dxvk] Added Vulkan function pointers for VK_KHR_descriptor_update_template 2018-03-17 22:35:50 +01:00
Philip Rebohle 52a9a4f406
[dxvk] Reimplemented clearRenderTarget
Closer to the D3D11 API. We cannot use the normal clearColorImage and
clearDepthStencilImage methods in case the game uses a 2D array view
for a 3D image. Fixes some validation issues in Hellblade.
2018-03-17 17:59:43 +01:00
Philip Rebohle 3b43c1c183
[dxgi] Support more formats in the presenter
Should surpress "Unsupported format" warnings in games
based on Unreal Engine 4 and Frostbite Engine.
2018-03-17 09:20:06 +01:00
Guy1524 b3cd7547ca Move Custom PCI ID to DXGI 2018-03-16 19:40:26 -04:00
Philip Rebohle c931b4ba87
[dxvk] Implement proper compute pipeline lookup
Fixes correctness issues and potential GPU lockups in case
a compute shader resource is not bound at dispatch time.
2018-03-16 01:25:18 +01:00
Philip Rebohle 9b3908823a
[dxvk] Fixed depth image layout regression 2018-03-16 01:05:30 +01:00
Philip Rebohle 25cae39cdb
[spirv] Remove SPIR-V tools integration
SPIR-V tools did not turn out to be useful, but increased the
binary size by a significant amount and caused build problems.

- spirv-opt: Far too slow for the intended purpose, and Nvidia
             specific shader issues have been reported and fixed.
- spirv-val: Not much value in practice since shaders can be
             written to a directory and validated manually.
2018-03-13 14:32:03 +01:00
Philip Rebohle 8e9d0878e6
[dxvk] Remove RenderDoc workaround
RenderDoc 1.0 cannot be used with DXVK anymore,
which makes the workaround obsolete.
2018-03-13 11:43:23 +01:00
Philip Rebohle 887e514442
[dxvk] Use dummy viewport if requested viewport size is 0
Fixes a bunch of validation errors in various games,
including The Witcher 3.
2018-03-12 13:14:27 +01:00
Philip Rebohle a4a8e0d6c8
[dxvk] Add memory flag query to DxvkImage 2018-03-10 17:41:42 +01:00
Philip Rebohle fb36b56891
[dxvk] Removed stat counters 2018-03-10 17:37:10 +01:00
Guy1524 1bad90ae96 Add Custom PCI Vendor and Device ID Support (#137)
* Add Custom PCI Vendor and Device ID Support

Allow the user to configure DXVK to use a custom PCI Vendor and Device ID, so that the program behaves the same on different cards.

* Remove AMD/NVIDIA/INTEL Shortcuts

* Remove extra semicolon

* Return DxvkGpuVendor to being an enum class

* Fixed hexadecimal output
2018-03-10 15:05:32 +01:00
Philip Rebohle 5ef0f31c66
[dxvk/d3d11] Refactored resource binding
Slightly reduces overhead of D3D11 *SetShaderResources methods.
2018-03-10 11:16:52 +01:00
Philip Rebohle 220c3301cf
[dxvk] Tweaked command stream chunk sizes and submission
Improves overall frame rate and latency in situations where the
application's render thread cannot keep up with the CS thread.
Considerable frametime improvements in NieR:Automata and
slightly higher frame rates in The Witcher 3.
2018-03-09 12:31:35 +01:00
Philip Rebohle 8d443cb50d
[dxvk] Reduced overhead of depth image descriptor layout check 2018-03-09 12:30:39 +01:00
Philip Rebohle 85d28f7328
[d3d11] Implemented ClearUnorderedAccessViewUint for raw and structured buffers 2018-03-07 16:29:13 +01:00
Philip Rebohle 360bf3ee4c
[dxvk] Recreate buffer views if necessary
Fixes broken animations and artifacts in The Witcher 3.
2018-03-07 13:54:28 +01:00
Philip Rebohle ad017c2556
[dxvk] Implemented physical buffer view 2018-03-07 13:32:17 +01:00
Philip Rebohle b494bb2ac1
[d3d11] Fixed potential sync issue in Map() 2018-03-07 10:37:27 +01:00
Philip Rebohle 6e981b91b6
[dxvk] Add adapter logging 2018-03-07 00:23:06 +01:00
Mikhail Paulyshka 9deb73a2a7 Add support for MSVC, attempt 3 (#130)
* [dxvk] fixes for MSVC

* nullptr -> int is illegal conversion for MSVC. nullptr was replaced with VK_NULL_HANDLE
* MSVC does not support source code strings longer than 65535 chars. String was replaced with array of chars.

* [utils] fixes for MSVC

* __mingw_uuidof() does not exists in MSVC
* apply GCC pragma only for GCC
* added missing header

* [dxbc] fixes for MSVC

*added missing header

* [dxgi] fixes for MSVC

* user __declspec(uuid()) instead of _mingw_uuidof()
* do not use DLLEXPORT macro for MSVC

* [d3d11] fixes for MSVC

* replace WINBOOL with BOOL
* do not declare D3D11 structs for MSVC
* do not use DLLEXPORT macro for MSVC

* [meson] fix build scripts for MSVC

* change cpp version from c++1z to c++latest for MSVC
* set -DOMINMAX definition for MSVC
* disable test and wine_utils for MSVC
* use .def files instead of __declspec(dllexport) for MSVC (bypass 'C2375: redefinition; different linkage' error)
* fix .def files for MinGW
* add --enable-stdcall-fixup linker flag for MinGW
2018-03-06 18:34:34 +01:00
Philip Rebohle 1cbe6829eb
Revert "Add MSVC support (#123)"
This reverts commit c63d4361a0.
2018-03-05 14:32:28 +01:00
Mikhail Paulyshka c63d4361a0 Add MSVC support (#123)
* [utils] fixes for MSVC

* __mingw_uuidof() does not exists in MSVC
* apply GCC pragma only for GCC
* added missing header

* [dxvk] fixes for MSVC

* nullptr -> int is illegal conversion for MSVC. nullptr was replaced with VK_NULL_HANDLE
* MSVC does not support source code strings longer than 65535 chars. String was replaced with array of chars.

* [dxbc] fixes for MSVC

*added missing header

* [dxgi] fixes for MSVC

* user __declspec(uuid()) instead of _mingw_uuidof()

* [d3d11] fixes for MSVC

* replace WINBOOL with BOOL
* do not declare D3D11 structs

* [meson] fix build scripts for MSVC

* change cpp version from 1z to 17 for MSVC
* set -DOMINMAX definition for MSVC
* disable test and wine_utils for MSVC
* use .def files instead of __declspec(dllexport) (bypass 'C2375: redefinition; different linkage' error)
2018-03-05 14:28:51 +01:00
Philip Rebohle 9f01ad1f7f
[dxvk] Fix typo 2018-03-02 17:28:17 +01:00
Philip Rebohle 49d2cee930
[dxvk] Fix Nvidia driver version number 2018-03-02 16:35:28 +01:00
Philip Rebohle 349817c52e
[dxvk] Do not enable HUD if DXVK_HUD is 0
Fixes #107.
2018-03-02 10:36:46 +01:00
ZeroFault fae9916708 Debug logging for compute shaders (#115)
* Add debug logging for compute shaders

* remove redundant nullptr check
2018-03-02 10:33:06 +01:00
Philip Rebohle e0fbfdf0e2
[dxvk] Use linked list for CS chunks
Improves memory efficiency and CPU overhead of the CSMT implementation
when the average number of bytes per command entry is less than 64 bytes.
2018-03-02 10:31:08 +01:00
Philip Rebohle 83eb34d71c
[dxvk] Replaced exception by error message 2018-03-01 08:23:55 +01:00
Philip Rebohle dbe3662bfc
[dxvk] Fixed potential memory allocation issue 2018-03-01 07:29:05 +01:00
Philip Rebohle bdfbd3e81c
[dxvk] Implemented new workaround for query-related lockups
vkGetQueryPoolResults may never return if VK_QUERY_RESULT_WAIT_BIT is
set, and may return queries as not available when they should in fact
be available. This would cause indefinite hangs, so instead we return
fake data to query objects if retrieving query data fails.
2018-02-28 12:39:16 +01:00
Philip Rebohle 97409c3380
[dxvk] Added workaround for RADV query problem
In some cases, this should allow games which use occlusion queries
to run rather than enter an infinite loop in GetData().
2018-02-28 06:12:31 +01:00
Philip Rebohle e5c0030f06
[dxvk] Fall back to host memory if no device memory is available 2018-02-27 12:36:44 +01:00
Philip Rebohle 757bb2bad7
[dxvk] Mark events and queries as available by default
Fixes a lockup in World of Warships, which waits for an event query
to be signaled without actually ever calling End() for that query.
2018-02-27 10:14:53 +01:00
Philip Rebohle ced02ba061
[dxvk] Fixed potential null pointer access when creating descriptor set 2018-02-25 00:30:07 +01:00
Philip Rebohle ce020e5bc9
[dxvk] Fixed 32-bit compilation issue, derp 2018-02-25 00:18:30 +01:00
Philip Rebohle e8c98eac95
[dxvk] Implement proper graphics and compute state validation
Fixes crashes in various games, including Fallout 4.
2018-02-24 23:56:12 +01:00
Gabriel Majeri f582c4e1ce Throw error if requested layer is not installed (#100)
* Warn if requested layer is not enabled

* Replace warning with hard error
2018-02-24 22:07:31 +01:00
Philip Rebohle e4dae74865
[dxvk] Validate tessellation state for graphics pipeline
This should help with freezes as long as Tessellation is
not properly implemented.
2018-02-23 12:55:23 +01:00
Philip Rebohle 4c693fc262
[spirv] Added experimental spirv-tools integration
Added support for the validator in order to make debugging easier,
as well as the optimizer, which may help Nvidia users run DXVK.
2018-02-22 18:06:00 +01:00
Philip Rebohle b419b3dfbd
[dxvk] Implemented typeless resolve
This should allow a large number of Unity-based games to
render at least a menu.
2018-02-21 01:04:28 +01:00
Philip Rebohle cb3daaf856
[dxvk] Change resolveImage interface to accept an explicit format 2018-02-20 22:26:23 +01:00
Philip Rebohle 43dbc9f1d6
[dxvk] Support depth-to-color image copies and vice versa
Fixes validation errors and depth of field effect in Neptunia VII
and potentially other games which do not use all depth images for
rendering.
2018-02-20 13:08:50 +01:00
Philip Rebohle e89c7e9276 [d3d11] Added test case for occlusion queries and small improvements 2018-02-19 11:27:14 +01:00
Philip Rebohle 5fea615ed7 [dxvk] Implement backend part for event queries 2018-02-18 22:57:45 +01:00
Philip Rebohle 5334ff57bf [d3d11] Wired up D3D11Query to backend 2018-02-18 22:34:23 +01:00
Philip Rebohle 7ddd2500d1 [dxvk] Added query tracker 2018-02-18 20:11:05 +01:00
Philip Rebohle 43200010c1 [dxvk] Implemented query allocation 2018-02-18 17:14:02 +01:00
Philip Rebohle 746c90e860
[dxvk] Add DxvkEvent class
Will be used to back D3D11 event queries.
2018-02-15 13:26:05 +01:00
Philip Rebohle dd237d866d
[dxvk] Make query pools more usable as query allocators 2018-02-15 13:25:18 +01:00
Philip Rebohle 0c2058e8c4
[dxvk] Introduced DxvkComputePipelineStateInfo
Will be used to re-compile compute pipelines against the current
state, just like graphics pipelines. May fix GPU lockups etc.
2018-02-14 17:54:35 +01:00
Philip Rebohle ba707f95b7
[dxvk] Do not commit compute barriers for unbound resources
Fixes a crash in Neptunia VII.
2018-02-14 16:18:18 +01:00
Philip Rebohle 7bbb6ea93b
[dxvk] More query stuff 2018-02-14 03:16:39 +01:00
Philip Rebohle 54cfdbdc51
[dxvk] Implemented more query and query pool methods 2018-02-13 13:43:27 +01:00
Philip Rebohle 5beae25bdf
[dxvk] Implemented virtual query class and query pool stub 2018-02-12 16:36:42 +01:00
Philip Rebohle 8a4fa0b1b8
[dxvk] Added Query stub 2018-02-08 19:32:53 +01:00
Philip Rebohle 807dd72656
[hud] Use buffer invalidation instead of synchronization
The previously used synchronization may have had a negative impact on
performance, whereas the new approach is similar to what D3D11 apps do.
2018-02-08 12:48:54 +01:00
Philip Rebohle 7f409f446a
[dxvk] Improve internal framebuffer APIs
Removes an unnecessary dynamic memory allocation in favour
of a stack-allocated array.
2018-02-07 16:46:39 +01:00
Philip Rebohle ad6c45d6b1
[dxvk] Improve debuggability of shader compiler issues
When using DXVK_LOG_LEVEL=debug, the graphics pipeline manager now
prints the names of the shaders used by the pipeline. This shall
help debug driver crashes in vkCreate*Pipelines.
2018-02-07 16:44:30 +01:00
Philip Rebohle 0f13914ff0
[dxvk] Fixed MSAA issue in render pass info 2018-02-07 13:14:52 +01:00
Philip Rebohle b31ebbb690
[d3d11] Add support for DSV read-only flags
Games need this in order to use the depth buffer as both
a framebuffer attachment and a shader resource.
2018-02-06 17:31:23 +01:00
Philip Rebohle 0437e5652b
[dxvk] Add index buffer and vertex buffer usage flags to dummy buffer 2018-02-05 19:09:04 +01:00
Philip Rebohle 6f6ecb441d
[dxvk] Add hack to allow RenderDoc to function on AMD GPUs 2018-02-05 12:12:50 +01:00
Philip Rebohle f69d2481a0
[dxvk] Unbind incompatible resources 2018-02-05 08:58:15 +01:00
Philip Rebohle 6f1ed72b78
[dxvk] Reduced resource binding overhead a bit 2018-02-04 23:59:34 +01:00
Philip Rebohle 201cb88d27
[dxbc] Remove push constant block for now
This needs some more work.
2018-02-03 10:36:17 +01:00
Philip Rebohle 14d5054893
[dxvk] Initial work on instance data fetch rates
Adds a pipeline flag to indicate that instanced
draw calls need to be emulated.
2018-02-01 20:15:25 +01:00
Philip Rebohle b860915aed
[dxvk] Set dummy vertex buffer size to the maximum binding stride 2018-02-01 14:31:10 +01:00
Philip Rebohle c66492a90f
[dxvk] Initialize dummy resources to zero
Read access to unbound images and buffers usually yields
a result vector that contains zeroes in all components.
2018-02-01 14:26:38 +01:00
Philip Rebohle d4a0581f8f
[dxvk] Bind dummy resource for unbound vertex and index buffers
Allows GTA V to run, although heavy rendering artifacts remain.
2018-02-01 13:29:57 +01:00
Philip Rebohle e47c244ac3
[dxvk] Use logger instead of exception when compiling pipelines
The exception is never caught because it is called from DXVK code,
not D3D code.
2018-01-31 00:48:39 +01:00
Philip Rebohle 4e1f9364e1
[dxvk] Fixed incorrect barriers for depth-stencil images
Certain clear and copy operations would emit invalid barriers
when operating on only one aspect of a depth-stencil image.
2018-01-30 15:44:18 +01:00
Philip Rebohle fb641a3dc8
[dxvk] Create dummy sampler 2018-01-29 20:54:09 +01:00
Philip Rebohle 9fbddf57df
[dxvk] Emit dynamic state after binding a graphics pipeline
Fixes issues with stencil references becoming undefined under
certain circumstances. This issue was encountered in Heroes
of the Storm.
2018-01-29 20:01:49 +01:00
Philip Rebohle cea86472bf
[dxvk] Fixed incorrect buffer create info 2018-01-29 11:44:02 +01:00
Philip Rebohle 52e8918b57
[d3d11] Added support for tessellation patch primitives 2018-01-29 11:31:00 +01:00
Philip Rebohle d74be35e8c
[dxvk] Refactored physical buffer
Class is now much more generic, which should make things
easier for the upcomping deferred context implementation
2018-01-29 00:01:00 +01:00
Philip Rebohle 7e5a511fa0
[dxvk] Minor CS improvement 2018-01-29 00:00:19 +01:00
Philip Rebohle c6f4cf7330
[general] Make use of C++ zero initialization 2018-01-28 19:37:22 +01:00
Philip Rebohle d1f76b96af
[dxvk] Added dummy resources for descriptors
This should finally shut up validation layers and also allows
the branches in texture sample operations to be removed.
2018-01-27 19:25:41 +01:00
Philip Rebohle 4e780f4f60
[dxvk] Fixed incorrect framebuffer attachment formats 2018-01-27 12:26:31 +01:00
Philip Rebohle d3fe3622cc
[dxvk] Do not dispatch compute shaders if no pipeline is bound
Fixes crashes in Tomb Raider 2013.
2018-01-25 12:57:43 +01:00
Philip Rebohle e4d49aeb66
[dxvk] Fixed reported size of staging buffers
Fixes staging slice allocation in Tomb Raider (2013),
and potentially other games which allocate large staging
buffers.
2018-01-24 15:44:40 +01:00
Philip Rebohle f53ada57f9
[dxvk] Fixed potentially problematic image barriers 2018-01-23 19:00:48 +01:00
Philip Rebohle a1a7bb9092
[dxvk] DxvkBindingLayout -> DxvkPipelineLayout 2018-01-23 17:40:36 +01:00
Philip Rebohle e198bd2d55
[d3d11] Sub-allocate from larger update buffers for UpdateSubresources
Reduces the allocation overhead when applications frequently
call UpdateSubresources to update small buffers and textures.
2018-01-23 16:43:55 +01:00
Philip Rebohle 226afa96c9
Revert "[dxvk] Use VK_IMAGE_LAYOUT_GENERAL for all render targets"
Actually this did not fix Homefront entirely and causes severe
performance degradation if textures are SHADER_READ_ONLY_OPTIMAL.
2018-01-23 14:19:52 +01:00
Philip Rebohle 21e9173415
[dxvk] Use VK_IMAGE_LAYOUT_GENERAL for all render targets
This is a workaround for rendering issues in some games where render
targets get seemingly randomly cleared for unknown reasons. Fixes
Homefront.
2018-01-23 13:27:41 +01:00
Philip Rebohle 3148155c35
[d3d11] Implemented CS chunk submission for deferred contexts
Changes were necessary due to the fact that chunks in deferred
contexts are not directly submitted to the CS thread.
2018-01-23 12:03:26 +01:00
Philip Rebohle 0900dfd0e3
[dxvk] Removed explicit image barriers for render passes
Instead, the color format and layout will now be set in
the render pass description. This slows down render pass
lookups but may improve efficiency and work around driver
bugs.
2018-01-22 19:21:46 +01:00
Philip Rebohle 05f0008891
[hud] Changed vertex buffer format
Should fix the HUD on Nvidia cards, which do not
support SRGB conversion for vertex input data.
2018-01-22 01:20:07 +01:00
Philip Rebohle 847d50d812
Merge branch 'csmt' 2018-01-21 18:06:13 +01:00
Philip Rebohle 7c3a9beb22
[dxvk] Recycle CS chunks 2018-01-21 12:59:43 +01:00
Clément Guérin f88a1d5dce [dxvk] fix missing renderPassEnd calls
vkCmdBlitImage and vkCmdResolveImage need to be called outside a render
pass. flatten logic.

this fixes mipmap generation with Trackmania.
2018-01-20 19:50:49 -08:00
Philip Rebohle 70b639784b
Revert "[d3d11] Temporary fix for Presenter <-> CS thread sync issue"
This reverts commit 3118012ada.
2018-01-21 02:57:36 +01:00
Philip Rebohle 3118012ada
[d3d11] Temporary fix for Presenter <-> CS thread sync issue 2018-01-21 02:48:36 +01:00
Philip Rebohle b7a00e32ec
[dxvk] Limit size of the CS command queue
Prevents memory leaks and fixes stuttering in Heaven.
2018-01-21 00:49:07 +01:00
Philip Rebohle aaffc8e26f
[dxvk] Fixed incorrect image packing behaviour 2018-01-21 00:04:17 +01:00
Philip Rebohle 6ab7897127
[d3d11] Enabled command stream thread 2018-01-20 23:12:03 +01:00
Philip Rebohle aaf7b05625
[d3d11] Use EmitCs for buffer mapping 2018-01-20 22:28:15 +01:00
Philip Rebohle f25b3c8b32
[d3d11] Use EmitCs for resource updates 2018-01-20 21:42:11 +01:00
Philip Rebohle a84e45bdd2
[dxvk] Added convenience functions to work with compressed image sizes 2018-01-20 20:31:47 +01:00
Philip Rebohle 2dd24a14d2
[dxvk] Refactored blend constants
This will make things a little less painful when capturing
blend constants in a lambda function, as required for CSMT.
2018-01-20 15:41:06 +01:00
Philip Rebohle 0789c5f10d
[dxvk] Remove command dispatch methods from CS thread
This was bad design. The user of this API should record commands
into a chunk manually and decude what to do with it once it's full.
2018-01-20 14:59:50 +01:00
Philip Rebohle f88adc4e82
[d3d11] Implemented mipmap generation 2018-01-20 09:46:54 +01:00
Philip Rebohle a644eebfd7
[d3d11] Fixed initialization of compressed images 2018-01-19 18:11:20 +01:00
Philip Rebohle 2a364c557b
[d3d11] Implemented image mapping for reads 2018-01-19 18:09:49 +01:00
Philip Rebohle 3bb7b45c33
[dxvk] Use strict rasterization order when depth test is disabled 2018-01-19 09:01:28 +01:00
Philip Rebohle 7d721797fe
[dxvk] To not attempt to clear compressed image
The current code violates the rules for vkCmdClearImage if
the destination image is compressed.
2018-01-19 01:36:22 +01:00
Philip Rebohle a0acbeec72
[dxvk] Optimized buffer renaming
Helps applications which frequently update buffers
through either Map()/Unmap() or UpdateSubresource.
2018-01-19 00:20:05 +01:00
Philip Rebohle ec0ff35b96
[dxvk] Fixed offset in buffer to image copy 2018-01-18 19:09:21 +01:00
Philip Rebohle 82ffa88efd
[dxvk] Fixed DxvkPhysicalBufferSlice initialization 2018-01-18 18:53:33 +01:00
Philip Rebohle 9334873188
[dxvk] Cleaned up DxvkBufferSlice and added documentation 2018-01-18 18:50:44 +01:00
Philip Rebohle 6e6c290e01
[d3d11] Use DxvkPhysicalBufferSlice for resource copies and buffer views 2018-01-18 18:33:13 +01:00
Philip Rebohle 3212fc7444
[dxvk] Use DxvkPhysicalBufferSlice for indirect draws and buffer binding 2018-01-18 18:01:47 +01:00
Philip Rebohle f41a7c7c87
[dxvk] Use DxvkPhysicalBufferSlice for buffer memory barriers 2018-01-18 17:32:34 +01:00
Philip Rebohle a87ae8aba4
[dxvk] Added DxvkPhysicalBuffer to back virtual buffers
This is the first step to optimizing buffer updates for applications
that frequently invalidate buffers. The goal is to reduce the number
of buffer allocations per frame and reduce the cost of invalidation.
2018-01-18 15:52:57 +01:00
Philip Rebohle 9acc4a1a82
[d3d11] Map default constant buffers to host memory
Improves performance in applications that use UpdateSubresources
to frequently update constant buffers, such as Unigine Heaven,
Unigine Valley and Homefront.
2018-01-18 11:55:27 +01:00
Philip Rebohle 601aa54139
[dxvk] End render pass before a staged image upload
Fixes Heaven. Also removes an unnecessary error check
2018-01-18 08:50:14 +01:00
Philip Rebohle d3f84688cc
[dxvk] Make use of VK_AMD_rasterization_order
May slightly improve GPU performance in some scenarios.
2018-01-16 15:00:19 +01:00
Philip Rebohle 27573e9b25
[dxvk] Added app and device specific options 2018-01-16 13:58:57 +01:00
Philip Rebohle bc5dfc1cad
[dxvk] Refactored device extension handling
Support for extensions can now be queried from the device
object in an efficient way. This will allow the backend to
use optional extensions for the purpose of optimization.
2018-01-16 13:24:36 +01:00
Philip Rebohle 86db5aab67
[dxvk] Increased queued command submission limit
Potentially reduces the number of sync points when a game
is primarily GPU limited. Improves performance in Nier by
a few frames per second.
2018-01-14 11:23:14 +01:00
Philip Rebohle e05c961b9e [dxvk] Limit vkCmdUpdateBuffer size to 4kB
This should help prevent issues with command buffers becoming
too big. Larger uploads will use a staging buffer instead.
2018-01-13 23:41:36 +01:00
Philip Rebohle c1f16d36bd [dxvk] Implemented local pipeline cache 2018-01-13 22:18:32 +01:00
Philip Rebohle 745ded47e0 [dxgi] Removed remaining SDL code 2018-01-13 16:36:04 +01:00
Philip Rebohle 96a97aa0c4 [dxvk] Added HUD
Experimental version of a HUD which displays information
about the hardware, driver version, and frames per second.
2018-01-13 03:53:33 +01:00
Philip Rebohle 38fa9ce9c9 [dxvk] Removed unused resource warning 2018-01-12 14:49:08 +01:00
Philip Rebohle 5dd9fea011 [dxvk] Implemented input layout validation
Checks whether all input slots consumed by the vertex shader
are provided by the input layout, and disables rendering in
case the state validation fails. This should hopefully fix
GPU lockups in Nier:Automata.
2018-01-12 14:25:26 +01:00
Philip Rebohle 1164ed30c3 [dxvk] Minor fixes 2018-01-12 12:51:39 +01:00
Philip Rebohle d1d5f10520 [dxvk] Added debug messages for unbound resources 2018-01-11 21:40:04 +01:00
Philip Rebohle a875e045c5 [dxvk] Moved descriptor set updates into DxvkContext 2018-01-11 20:31:18 +01:00
Philip Rebohle 30eb43a284 [dxvk] Minor memory management tweaks 2018-01-11 19:06:58 +01:00
Philip Rebohle 32078033c6 [d3d11] Fixed UAV counter buffer binding 2018-01-11 17:12:39 +01:00
Philip Rebohle c1d6c20066 [d3d11] Implemented D3D11 parts of append/consume buffers 2018-01-11 12:23:55 +01:00
Philip Rebohle 8bccbbccc8 [dxvk] Using derivative graphics pipelines 2018-01-10 22:54:00 +01:00
Philip Rebohle 3ab75c8538 [dxvk] Fixed potential bugs in vertex buffer binding code 2018-01-10 21:53:13 +01:00
Philip Rebohle ed642a57a7 [dxvk] Simplified state-based pipeline lookup 2018-01-10 21:28:20 +01:00
Philip Rebohle 9c90c1ac00 [dxvk] Optimized pipeline state updates 2018-01-10 20:40:10 +01:00
Philip Rebohle 74722fa693 [dxvk] Implementing unbound resource handling (4/4)
The shader compiler now queries whether a constant buffer or texture is
bound before trying to access it for reading. This is not yet implemented
for image fetch operations, atomic operations, or buffer load/store ops.
2018-01-10 18:58:17 +01:00
Philip Rebohle fe02c5d6b9 [dxvk] Implementing unbound resource handling (3/4)
The shader compiler will now generate specialization constants
for shader resources, uniform access views, and constant buffers.
2018-01-10 13:44:04 +01:00
Philip Rebohle b22d56ac06 [dxvk] Implementing unbound resource handling (2/4)
Refactored pipeline binding and descriptor set updates so that
no descriptor info gets written for unbound resources.
2018-01-10 12:13:46 +01:00
Philip Rebohle c64103c73f [dxvk] Implementing unbound resource handling (1/4)
In order to emulate D3D11 behaviour when a resource is not bound,
we use specialization constants. This requires further changes in
the shader compiler.
2018-01-10 11:44:40 +01:00
Philip Rebohle 38ee8f4f95 [dxvk] Unbound resource prep work 2018-01-10 10:23:51 +01:00
Philip Rebohle ee796b966d [dxvk] Reduced staging buffer size
Allocating as much memory as we did was wasteful. The new limit may
still be too generous for most applications, but this will require
more testing.
2018-01-10 10:22:33 +01:00
Philip Rebohle da867d4bca [dxvk] Replaced DxvkResourceType by VkImageViewType 2018-01-09 20:35:29 +01:00
Philip Rebohle 3419d55dee [dxvk] Tweaked descriptor allocation 2018-01-09 20:04:50 +01:00
Philip Rebohle e2d9693ac3 [dxvk] Fixed compressed texture upload
Fixes issues with particles being overly bright in Nier:Automata.
2018-01-09 19:08:23 +01:00
Philip Rebohle c7e33e636e [dxvk] Fixed vertex buffer binding issue
If an application binds vertex buffers before changing the input layout,
it might happen that the vertex buffers are not bound correctly to the
Vulkan command buffer. This issue is now resolved.
2018-01-08 20:23:21 +01:00
Philip Rebohle cb748c786a [dxvk] Added missing image barrier after compute shader execution 2018-01-08 19:07:57 +01:00
Philip Rebohle 9024f8bb2c [dxvk] Inlined all frequently called DxvkCmdList methods 2018-01-08 14:21:50 +01:00
Philip Rebohle 7912f6c604 [dxbc] Track dimension of resource slots
This shall help binding dummy resources in case an application
binds none or an incompatible resource to a slot.
2018-01-08 13:39:37 +01:00
Philip Rebohle 5cfbb74455 [dxvk] Added new convenient buffer slice constructor 2018-01-07 21:46:26 +01:00
Philip Rebohle f4cd90d6fa [dxbc] Implemented vendor-specific workarounds in an attemt to fix Nvidia 2018-01-07 20:05:27 +01:00
Philip Rebohle 4e06f498dd [d3d11] Fixed several mip level-related bugs
- When a D3D11 texture was created with a mip level count of zero,
  DXVK would compute the correct number of mip levels, but not write
  them back to the description field.
- Framebuffers would always use the size of the top level, not the
  mip levels that were actually attached to the framebuffer.
- Several image copy operations did not handle mip levels other
  than the top mip level correctly.
2018-01-06 02:09:07 +01:00
Philip Rebohle e7bf76f5ef [d3d11] Re-implemented image mapping
Image mapping now returns the map pointer of a separate
buffer, rather than the the image itself. This fixes
issues with applications that ignore the RowPitch
and/or DepthPitch fields of the MappedSubresource struct.
2018-01-05 03:01:19 +01:00
Philip Rebohle 75152ae16f [dxvk] Made VK_KHR_maintenance2 optional
Unlike VK_KHR_maintenance1, not all D3D11 applications rely on
features provided by this extension. Keeping this optional helps
with RenderDoc, which does not expose the extension.
2018-01-03 02:38:55 +01:00
Philip Rebohle d4db877cdc [dxvk] Fixed staging buffer alignment
Four-byte alignment is required in order to avoid illegal
vkCmdCopyBufferToImage calls. We align staging buffer slices to
a full cache line in order to improve performance.
2018-01-01 23:32:08 +01:00
Philip Rebohle 21582b955a [dxvk] Require VK_KHR_maintenance2
This extension helps with some compatibility issues that are
somewhat inevitable during the D3D11->Vulkan translation.
2018-01-01 23:27:51 +01:00
Philip Rebohle fd2bb610eb [d3d11] Implemented indirect draws and dispatch 2017-12-31 01:31:08 +01:00