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

223 Commits

Author SHA1 Message Date
Philip Rebohle
e4c5880ac6
[util] Fix Win32 thread helper
- Implements move semantics for thread objects properly.
  This is necessary in order to avoid closing the thread
  handle multiple times, and to avoid passing invalid
  pointers to the thread function in some cases.
- More closely emulates the behaviour of std::thread.
2018-07-22 01:28:35 +02:00
Philip Rebohle
64ffcbc9ef
[util] Code cleanup for winegcc stuff 2018-07-21 12:51:50 +02:00
Mikhail Paulyshka
f38ee85a39 [build] Fix compilation on MSVC (#505)
* [build] do not use shared_library/objects property with MSVC

* [util] use ./com/com_include.h instead of windef.h

It is required for Windows 10 SDK.

* [util] store thread procedure lambda in std::function

* [dxgi] fix annoying MSVC warning

warning C4099: 'IDXGIVkInteropDevice': type name first seen using 'class' now seen using 'struct'
2018-07-21 12:43:33 +02:00
Jacek Caban
6d16bb4c87 Don't use std::thread.
Wine needs to setup each thread that has an access to Windows APIs. It means that in winelib builds, we can't let standard C++ library create threads and need to use Wine for that instead. I wrote a thin wrapper around Windows thread functions so that the rest of code just has to use new dxvk::thread class instead of std::thread.
2018-07-19 08:55:34 +02:00
Jacek Caban
cea1f15eab [util] Don't use std::wstring.
std::wstring is problematic, because wchar_t on other platforms might not be what we need. -fshort-wchar can mitigate that partially, but it's more problematic for stdc++ classes.
2018-07-19 08:55:34 +02:00
Jacek Caban
c2c10cc207 [util] Reimplement fromws using WideCharToMultiByte and system codepage.
Also, using UTF-8 for convertion may not be what's intended, esp. if such strings end up being passed back to system API (eg. open file). The patch uses CP_ACP on mingw build (which is how Windows APIs will interpret it) or CP_UNIXCP on Wine (which is Wine extension to convert to whatever glibc and other host libs expect).

It's also needed for the next patch.
2018-07-19 08:55:34 +02:00
Jacek Caban
02ae42c7de [util] Remove getTempDirectory
It's not used anywhere.
2018-07-19 08:55:34 +02:00
Philip Rebohle
2aa6b04fd9
[dxvk] Fix tzcnt return value when source value is 0 2018-07-09 13:32:43 +02:00
Philip Rebohle
79a1703aea
[util] Set thread names for DXVK's own threads
Makes it easier to identify the command stream thread and the
queue processing thread easier when using a wine build that
supports SetThreadDescription.
2018-06-21 15:12:04 +02:00
Philip Rebohle
518c260ad6
[util] Add == and != operator to Flags 2018-06-06 23:09:23 +02:00
Joshua Ashton
5cc3afcf30 Fix tzcnt intrinsic on MSVC (#381) 2018-05-19 09:26:25 +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
5465ee8a85
[util] Add tzcnt function 2018-05-09 00:01:00 +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
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
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
fc3f45c082 [hud] Added stat counters to the HUD 2018-04-03 14:49:13 +02:00
Philip Rebohle
c9465b39d1 [util] Implement spin lock 2018-04-03 11:56:02 +02:00
Philip Rebohle
267daeccad [util] Add generic Logger::log method 2018-04-02 19:05:20 +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
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
8d3dcba8d5
[dxgi] Renamed private DXGI interfaces 2018-03-28 19:06:00 +02:00
Philip Rebohle
6f6e12a329
[util] Fix possible crash with null interfaces in private storage 2018-03-21 15:09:08 +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
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
Clément Guérin
858107278f [util] fix GUID printing 2018-02-24 22:48:40 -08:00
Philip Rebohle
54cfdbdc51
[dxvk] Implemented more query and query pool methods 2018-02-13 13:43:27 +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
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
ca53eaf878
[general] Minor COM pointer improvements 2018-01-29 16:31:25 +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
Raffarti
feae2988d6 Improvements for log files (#22)
* Improvements for log files
 - Added exec name to log files
 - Added DXVK_LOG_PATH environment variable to specify the log folder
* Remove .exe from log name
* log: add log level none
* log: corrected type for string position
2018-01-23 13:36:31 +01:00
Philip Rebohle
27573e9b25
[dxvk] Added app and device specific options 2018-01-16 13:58:57 +01:00
Philip Rebohle
8805958736
[util] Fixed message logging to file 2018-01-16 12:32:09 +01:00
Philip Rebohle
18835c324e
[util] Added getExeName() function
This will allow DXVK to apply game-specific
features or workarounds in the future.
2018-01-16 11:33:34 +01:00
Philip Rebohle
1a40a272bd
[util] Fixed compiler issue with older GCC versions 2018-01-15 13:08:23 +01:00
Philip Rebohle
a0fafe3043 [util] Log level can now be controlled manually 2018-01-12 00:05:09 +01:00
Philip Rebohle
2c5b1c151f [d3d11] Refactored texture creation 2017-12-19 16:01:50 +01:00
Philip Rebohle
2b6cb25675 [d3d11] Implemented D3D11_APPEND_ALIGNED_ELEMENT 2017-12-18 23:24:10 +01:00
Philip Rebohle
9827ace3b0 [d3d11] Fixed buffer bindings with non-zero offsets 2017-12-14 19:07:08 +01:00
Philip Rebohle
2a266eaad4 [general] Added 32-bit support 2017-12-12 12:50:52 +01:00
Philip Rebohle
9a86178604 [d3d11] Fixed severe reference-counting issue in state objects 2017-12-10 00:55:30 +01:00
Philip Rebohle
3d6e88428a [com] ... yeah, almost. 2017-12-09 23:20:31 +01:00
Philip Rebohle
fa1ef8248e [com] Fixed crashes caused by reentrant Release() 2017-12-09 22:20:40 +01:00
Philip Rebohle
4a4f5bea29 [util] Added missing files 2017-12-08 11:18:23 +01:00
Philip Rebohle
9e1cf8396b [dxvk] Added environment variable to toggle debug layers 2017-12-08 01:32:02 +01:00
Philip Rebohle
69b938118d [general] Fixed write conflicts in logger 2017-12-06 23:36:11 +01:00
Philip Rebohle
5944410d2c [tests] Removed dxvk dependency for d3d11 and dxgi tests 2017-12-06 19:06:23 +01:00
Philip Rebohle
9017af51ec [utils] Added SHA-1 implementation for shader code hashing 2017-12-06 18:13:51 +01:00
Philip Rebohle
c7e1131864 [d3d11] Implemented rasterizer state creation 2017-12-06 13:16:54 +01:00
Philip Rebohle
cf33315c0c [d3d11] Some cleanup work 2017-12-04 13:39:37 +01:00
Philip Rebohle
b389c9ea1f [d3d11] Experimental implementation of OMSetRenderTargets and ClearRenderTargetView 2017-11-29 20:19:40 +01:00
Philip Rebohle
b35f0c64b4 [dxgi] Refactored swap chain <-> device communication 2017-11-29 16:23:33 +01:00
Philip Rebohle
a956c1b8ac [dxgi] Added DxgiResource for image and buffer creation 2017-11-29 15:16:07 +01:00
Philip Rebohle
ad9f71fa02 [dxgi] Implemented DxgiSwapChain::GetBuffer and more of Present 2017-11-29 07:55:44 +01:00
Philip Rebohle
0cdc13d785 [dxgi] Renamed private DXGI interfaces 2017-11-27 15:51:53 +01:00
Philip Rebohle
4052951542 [dxbc] Removed most of the DXBC compiler again 2017-11-07 15:10:38 +01:00
Philip Rebohle
bc8cc76888 [dxbc] Added operand index decoder, entry point declaration 2017-10-29 02:35:16 +02:00
Philip Rebohle
6954cfd84c [dxbc] Added helper classes for DXBC decoding 2017-10-21 17:58:58 +02:00
Philip Rebohle
bb5b588d23 [dxbc] Added DXBC to SPIR-V compiler stub 2017-10-16 17:50:09 +02:00
Philip Rebohle
56ed80621d [util] Flag class 2017-10-11 21:44:02 +02:00
Philip Rebohle
5d99a37d69 [dxgi] Implemented DxgiDevice 2017-10-11 15:31:36 +02:00
Philip Rebohle
7e4e7dd395 [dxgi] Moved private storage out of DXGI library 2017-10-11 09:41:19 +02:00
Philip Rebohle
9b8fda512a [dxvk] Added COM helpers 2017-10-11 00:41:56 +02:00
Philip Rebohle
2ee51ea4b2 [dxvk] Added debug tracing 2017-10-11 00:27:33 +02:00
Philip Rebohle
46845e60be [dxvk] Re-implemented logger 2017-10-10 23:44:06 +02:00
Philip Rebohle
00e63d71a9 Initial commit 2017-10-10 23:32:13 +02:00