Commit Graph

86 Commits

Author SHA1 Message Date
Filoppi a2702c6e27 Video: implement color correction to match the NTSC and PAL color spaces (and gamma) that GC and Wii targeted.
To further increase the accuracy of the post process phase, I've added (scRGB) HDR support, which is necessary
to fully display the PAL and NTSC-J color spaces, and also to improve the quality of post process texture samplings and
do them in linear space instead of gamma space (which is very important when playing at low resolutions).
For SDR, the quality is also slightly increased, at least if any post process runs, as the buffer is now
R10G10B10A2 (on Vulkan, DX11 and DX12) if supported; previously it was R8G8B8A8 but the alpha bits were wasted.

Gamma correction is arguably the most important thing as Dolphin on Windows outputted in "sRGB" (implicitly)
as that's what Windows expects by default, though sRGB gamma is very different from the gamma commonly used
by video standards dating to the pre HDR era (roughly gamma 2.35).

Additionally, the addition of HDR support (which is pretty straight forward and minimal), added support for
our own custom AutoHDR shaders, which would allow us to achieve decent looking HDR in Dolphin games without
having to use SpecialK or Windows 11 AutoHDR. Both of which don't necessarily play nice with older games
with strongly different and simpler lighting. HDR should also be supported in Linux.
Development of my own AutoHDR shader is almost complete and will come next.

This has been carefully tested and there should be no regression in any of the different features that Dolphin
offers, like multisampling, stereo rendering, other post processes, etc etc.

Fixes: https://bugs.dolphin-emu.org/issues/8941

Co-authored-by: EndlesslyFlowering <EndlesslyFlowering@protonmail.com>
Co-authored-by: Dogway <lin_ares@hotmail.com>
2023-06-19 01:34:42 +03:00
Pokechu22 23cdb5c576 VideoBackends/D3D11: Include HRESULT in error messages 2022-01-09 12:44:15 -08:00
Pierre Bourdon e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
Shawn Hoffman 5770ff01f3 rename D3DCommon/Common to D3DCommon/D3DCommon 2021-01-27 14:29:48 -08:00
Lioncash 139d4fc76e General: Convert PanicAlerts over to fmt equivalent
Converts lingering panic alert calls over to the fmt-capable ones.
2020-12-02 13:38:33 -05:00
Lioncash 2345d5f98d D3D: Migrate logging over to fmt
Migrates the logging over to the fmt-capable logger.
2020-11-09 03:02:00 -05:00
Silent ff00873610
D3D11: Query for output merger logic op support and use logic op code only if supported
Previously code assumed that if DX11.1 runtime is supported, logic ops will,
but Windows 7 SP1 with a Platform Update supports DX11.1 runtime without logic ops.
This created pretty jarring visual artifacts, which now should be gone OR replaced
with much less jarring errors.
2019-07-29 16:47:39 +02:00
Silent 88db577c17
D3D11: Correctly poll ALL possible AA levels. 2019-07-29 16:39:06 +02:00
Silent 799c52463e
Fixes for WRL usage - QueryInterface is explicitly mentioned as not to be used with WRL ComPtr 2019-07-26 19:38:58 +02:00
Stenzek 9316e25652 D3DCommon: Fallback to base CreateSwapChain on failure
It appears that some older drivers do not support
CreateSwapChainForHwnd, resulting in DXGI_ERROR_INVALID_CALL. For these
cases, fall back to the base CreateSwapChain() from DXGI 1.0.

In theory this should also let us run on Win7 without the platform
update, but in reality we require the newer shader compiler so this
probably won't work regardless. Also any hardware of this vintage is
unlikely to run Dolphin well.
2019-06-08 20:11:49 +10:00
Lioncash a9663669dc Common/CommonFuncs: Remove now-unneccessary ArraySize function
Since C++17, non-member std::size() is present in the standard library
which also operates on regular C arrays. Given that, we can just replace
usages of ArraySize with that where applicable.

In many cases, we can just change the actual C array ArraySize() was
called on into a std::array and just use its .size() member function
instead.

In some other cases, we can collapse the loops they were used in, into a
ranged-for loop, eliminating the need for en explicit bounds query.
2019-06-01 10:07:57 -04:00
Pokechu22 69d9d9f87a Also free when initialization fails, and move to end 2019-05-26 19:59:29 -07:00
Pokechu22 19fb3bb4fe DX11: Fix access violation on closing dolphin 2019-05-26 15:01:05 -07:00
Stenzek 025767c929 D3D: Set optional features after creating the device
Fixes feature level 10.0 devices crashing during runtime.
2019-04-28 15:26:49 +10:00
Stenzek d0d010f854 D3D11: Make stateman a unique_ptr 2019-03-29 19:55:00 +10:00
Stenzek 3d8014beb5 D3D11: Use D3DCommon where appropriate 2019-03-29 19:52:38 +10:00
Stenzek f039149198 Move most backend functionality to VideoCommon 2019-02-19 16:57:54 +10:00
Stenzek b01df8670f Renderer: Fix throttle-disable (TAB) hotkey when vsync is enabled 2019-01-27 12:31:12 +10:00
Stenzek eb284b5d66 VideoBackends: Pass window system info from host on creation 2018-10-20 21:11:34 +10:00
Stenzek 640bfb8135 VideoConfig: Add a field for indicating logic op support in the backend 2018-05-26 00:07:20 +10:00
Stenzek e8ff2b2006 D3D: Support compiling compute shaders 2018-02-22 19:11:25 +10:00
Stenzek de632fc9c8 Renderer: Handle resize events on-demand instead of polling
We now differentiate between a resize event and surface change/destroyed
event, reducing the overhead for resizes in the Vulkan backend. It is
also now now safe to change the surface multiple times if the video thread
is lagging behind.
2018-02-20 01:15:55 +10:00
Lioncash 1e7096dd27 D3DBase: Mark file-scope variables as internally linked where applicable 2017-11-30 23:46:46 -05:00
Stenzek c5a89b6483 D3D: Remove BeginFrame/EndFrame
These functions did not do anything anyway. There is also no need to
present the backbuffer when shutting down.
2017-11-22 18:47:04 +10:00
Lioncash 5337e58284 VideoConfig: Make StereoMode an enum class
Makes for more strongly-typed identifiers (and doesn't pollute
surrounding namespaces)
2017-11-18 23:19:53 -05:00
Jules Blok 347fd065df D3DBase: Support the "allow tearing" DXGI flags.
This makes sure our framerate is unlocked when we disable V-Sync.
2017-09-04 23:12:52 +02:00
Anthony ee6930a231 Merge pull request #6013 from stenzek/d3d-logic-op
D3D: Implement logic op support
2017-09-03 19:26:50 -07:00
Anthony 26e777d80b Merge pull request #5337 from stenzek/d3d-common-blending-state
D3D: Use blending state from VideoCommon
2017-09-03 19:25:46 -07:00
Jules Blok 8906b26ea5 D3DBase: Use the correct version of CreateDXGIFactory. 2017-09-03 14:33:06 +02:00
Stenzek 99d61906cc Merge pull request #5948 from Armada651/d3d-explicit-stereo
D3DBase: Only use a stereo swapchain if quad-buffering is enabled.
2017-09-03 21:07:24 +10:00
Stenzek c9d649d27c D3D: Use Direct3D 11.1 where supported 2017-09-03 16:33:47 +10:00
Stenzek c90b0bf532 D3D11: Create debug device when validation layer is enabled in options 2017-09-03 14:14:19 +10:00
Lioncash 64de8a9d0b D3D: Eliminate redundant ID3D11DeviceChild* casts 2017-09-02 14:45:14 -04:00
Jules Blok f4f6782ae6 D3DBase: Only use a stereo swapchain if quad-buffering is enabled. 2017-08-20 18:25:49 +02:00
Stenzek 57f34d748b D3DBase: Raise error if d3dcompiler_47.dll cannot be loaded
Previously we were falling back to an earlier version of the compiler.
The older version cannot compile our ubershaders without various
graphical issues.
2017-08-02 19:54:55 +10:00
Stenzek 63305e9173 HiresTextures: Support loading BC7 (BPTC) from DDS files 2017-08-01 11:59:38 +10:00
Stenzek 4bf5625895 D3D: Uber shader support 2017-07-30 17:43:59 +10:00
Jules Blok 3fc9a48da0 D3DBase: Use the swapchain discard mode when possible. 2017-07-10 14:25:28 +02:00
Jules Blok 65495a1297 D3D: Resize the swapchain when the fullscreen state is changed 2017-07-10 14:24:11 +02:00
Jules Blok 07c5dcd739 D3DBase: Set the fullscreen state in Create() 2017-07-10 14:03:04 +02:00
Jules Blok 0f13c61daa D3DBase: Only create a stereo swapchain when needed. 2017-07-10 01:24:43 +02:00
Jules Blok 77a318789a D3DBase: Implement Windows 7 swapchain fallback. 2017-07-10 01:02:29 +02:00
Jules Blok 938939136e D3DBase: Only use temporary mono when supported by the swapchain. 2017-07-10 01:02:05 +02:00
Jules Blok b485329353 D3DBase: Set the monoscopic flag when we don't use stereoscopy. 2017-07-05 22:43:39 +02:00
Jules Blok 2ab068d3f2 D3DBase: Always create a stereo swapchain. 2017-07-05 22:43:39 +02:00
Jules Blok 179602e921 D3D: Add quad-buffer stereoscopy support. 2017-07-05 22:43:39 +02:00
Jules Blok 6863abb31d D3DBase: Switch to a flip-model swap chain. 2017-07-05 22:43:39 +02:00
Jules Blok c399e2bc40 D3DBase: Upgrade to DXGI 1.2.
This effectively drops for Vista and Windows 7 without the Platform Update in this backend.
2017-07-05 22:43:39 +02:00
Shawn Hoffman 5480efdff2 video: change multisample/AA setting to u32 2017-06-07 20:20:25 -07:00
Shawn Hoffman ab4a785f1b d3d: silence variable shadowing warning 2017-06-07 20:09:43 -07:00