Commit Graph

82 Commits

Author SHA1 Message Date
Cameron Gutman
58f9b2a83b Use opaque black in ClearRenderTargetView()
Intel's old Gen9 performance guide says it's a little faster.
2025-12-01 22:39:28 -06:00
Cameron Gutman
f0821d9543 Use D3D11_COPY_DISCARD when updating our video texture
This ensures the driver knows it doesn't have to synchronize with the previous texture data.
2025-11-24 18:49:19 -06:00
Cameron Gutman
4164a222ae Consolidate D3D11 constant buffers now that all shaders need a CSC constant buffer 2025-11-24 18:47:14 -06:00
Cameron Gutman
245cd7f1a8 Don't trim the alignment padding with CopySubresourceRegion()
The shader already handles trimming for the bound output texture case.
2025-11-24 01:44:51 -06:00
Cameron Gutman
7116efd8de Switch D3D11VA to the shared functions for CSC matrix generation and chroma co-siting 2025-11-05 22:26:27 -06:00
ns6089
af37002a60 Select correct color matrix for 10-bit SDR 2025-11-05 00:13:25 -06:00
ns6089
fd314db27e Use correct chroma co-siting offsets in D3D11
Introduced in f67272b153
2025-11-04 23:50:27 -06:00
Cameron Gutman
f67272b153 Handle chroma co-siting in the D3D11 shaders 2025-11-01 22:42:51 -05:00
Cameron Gutman
50223dbdb8 Fix accuracy issues in YUV to RGB conversion of 10-bit content in D3D11VA
See #1667 for details.
2025-11-01 18:45:02 -05:00
Cameron Gutman
351aaa6759 Add an enum type for each renderer 2025-02-18 18:58:04 -06:00
Cameron Gutman
92ee4a3046 Don't use the bind path for UMA GPUs
It turns out to be very marginally slower on RDNA2 iGPUs.
2024-09-12 21:32:36 -05:00
Cameron Gutman
6ec0c79899 Revert "Remove FL 11.0 restriction for D3D11VA"
Even with a fix for the Intel IVB rendering issue, there are still problems on
other older cards that make it not really worth it to enable D3D11VA.

The big benefit of D3D11VA is independent flip in windowed mode using
overlays and that isn't supported on those old cards anyway.

This reverts commit 7074463d0f.
2024-09-12 21:29:40 -05:00
Cameron Gutman
25132a1f7b Enable decoder texture binding for all FL11.1 iGPUs
Since those GPUs don't benefit from the fence hack, restrict that to Intel only.
2024-08-31 00:36:25 -05:00
Cameron Gutman
7074463d0f Remove FL 11.0 restriction for D3D11VA 2024-08-30 23:03:36 -05:00
Cameron Gutman
99311403fa Move dummy fence into renderVideo()
The workaround only seems to work with a new fence each time.
2024-08-30 22:42:53 -05:00
Cameron Gutman
8b50eea485 Wait on a dummy fence before using textures shared with the decoder 2024-08-30 22:22:30 -05:00
Cameron Gutman
f756be87ff Fix YUV444 hardware decoding on Windows systems without an Intel GPU present 2024-08-30 16:31:58 -05:00
Cameron Gutman
8e2aa87c4f Avoid using D3D11VA on very old Intel GPUs
Fixes #1348
Fixes #1381
2024-08-16 00:32:46 -05:00
Cameron Gutman
665352ec95 Remove support for Intel's vendor-specific HEVC RExt profiles
These aren't supported upstream (and probably never will be) and recent
Intel drivers for Tiger Lake and later support the Microsoft standard
HEVC RExt profiles now.
2024-08-13 00:50:32 -05:00
Cameron Gutman
ab791cf4c8 Add support for the official DXVA HEVC Rext GUIDs defined in the Win11 24H2 SDK 2024-08-02 21:22:43 -05:00
Cameron Gutman
9227ebfec9 Fix compiler warnings introduced by ComPtr refactoring 2024-08-02 21:15:18 -05:00
Cameron Gutman
f138827cdf Add handling for AV1 High profile in D3D11VA/DXVA2
This doesn't seem to be supported by FFmpeg or any actual hardware yet
2024-07-30 23:21:49 -05:00
Cameron Gutman
e25919e0f9 Use for each loop to destroy objects in arrays
Also fixes incorrect release of m_VideoPixelShaders objects
2024-07-30 22:58:59 -05:00
Cameron Gutman
9e811f54f1 Use ComPtr for lifetime management in D3D11VA 2024-07-30 22:29:38 -05:00
Cameron Gutman
0bb0d27d64 Implement YUV 4:4:4 decoding with D3D11VA on Intel GPUs 2024-07-30 21:12:11 -05:00
Cameron Gutman
778eb07c5f Reject YUV444 rendering using D3D11VA until it properly supported 2024-07-26 01:19:26 -05:00
Cameron Gutman
335ed0e8e6 Only sample directly from the video decoder output texture on Intel GPUs
This technique seems to actually make performance worse on some AMD GPUs (RX 480)
and causes rendering errors on others (HD 5570). These might be AMD-specific bugs
but let's not risk a behavior change for AMD/NVIDIA where nobody was having perf
issues with the old copy method anyway.
2024-06-29 14:44:08 -05:00
Cameron Gutman
0abb9fd7c2 Revert "Avoid using D3D11VA on older AMD TeraScale GPUs"
This reverts commit 93408386ae.
2024-06-29 14:12:03 -05:00
Cameron Gutman
1a1ce05959 Revert "Use a Texture2DArray in HLSL to match the SRVs"
This reverts commit d389f9a6e9.
2024-06-29 14:07:41 -05:00
Cameron Gutman
93408386ae Avoid using D3D11VA on older AMD TeraScale GPUs 2024-06-28 20:24:47 -05:00
Cameron Gutman
415b512c75 Require FL 11.0 for the D3D11VA renderer
We would probably be okay with 10.0 (SM4), but let's not risk
encountering GPU driver bugs like we do on old AMD cards.
2024-06-28 19:56:00 -05:00
Cameron Gutman
d389f9a6e9 Use a Texture2DArray in HLSL to match the SRVs 2024-06-27 19:46:27 -05:00
Cameron Gutman
94943d2865 Clamp chroma texcoords to avoid sampling alignment padding
This resolves #885 without the massive perf hit on lower end Intel GPUs.
2024-06-22 16:19:26 -05:00
Cameron Gutman
c3bd7edc4e Revert "Use a separate texture for rendering to avoid blending in the alignment padding"
This kills performance on some Intel iGPUs (particularly Atom chips like N100),
so let's remove the copy and solve this issue a different way instead.

This reverts commit a6fccf93d1.
2024-06-22 12:35:00 -05:00
Cameron Gutman
b6bb96223d Revert "Remove manual hwframe ctx setup for D3D11VA"
We need this back to avoid the copy that's tanking performance on Intel iGPUs.

This reverts commit 2cef09471b.
2024-06-22 12:34:10 -05:00
Cameron Gutman
f2535f1e6e Avoid D3D9 fallback on lack of codec support unless a D3D11 FL11.0 GPU wasn't found
We'd rather not waste time (and risk crashes) loading the D3D9 driver if the GPU doesn't have the physical decoding hardware at all.
2024-03-26 23:59:18 -05:00
Cameron Gutman
e20d56041e Fix rare race condition in overlay update code 2023-12-31 15:21:18 -06:00
Cameron Gutman
114074bfd8 Don't set HDR metadata on the DXGI swapchain
This is no longer recommended by Microsoft due inconsistencies with display support for HDR metadata.
2023-12-31 15:15:06 -06:00
Cameron Gutman
2cef09471b Remove manual hwframe ctx setup for D3D11VA
It was apparently never necessary, since FFmpeg's default behavior of
avcodec_get_hw_frames_parameters() + av_hwframe_ctx_init() makes a
context that exactly matches the one we constructed manually.
2023-12-22 02:45:11 -06:00
Cameron Gutman
7551e90899 Adjust AV1 surface alignment to match FFmpeg behavior 2023-09-08 23:13:29 -05:00
Cameron Gutman
1a2f1ed620 Enable AV1 RFI on all decoders capable of HEVC RFI 2023-08-13 16:41:48 -05:00
Cameron Gutman
7404e5fce2 Prefer D3D11VA for FSE V-Sync off 2023-08-03 19:41:35 -05:00
Cameron Gutman
dc5414bd0d Force immediate destruction of the D3D11 swapchain
Possible fix for #959
2023-08-03 19:18:07 -05:00
Cameron Gutman
a81c6a1c5e Initial work on AV1 support 2023-07-03 00:45:36 -05:00
Cameron Gutman
8a0142bd0f Plumb HDR metadata and horizontal scrolling with Sunshine 2023-01-16 21:51:18 -06:00
Cameron Gutman
a6fccf93d1 Use a separate texture for rendering to avoid blending in the alignment padding
Fixes #885
2022-10-26 21:48:55 -05:00
Cameron Gutman
9e4337babf Revert "Increase the number of decoder surfaces for DXVA2/D3D11VA"
This reverts commit 02c781b8f4.
2022-10-15 14:32:12 -05:00
Cameron Gutman
02c781b8f4 Increase the number of decoder surfaces for DXVA2/D3D11VA
We forgot to take into account frames buffered within Moonlight itself
2022-10-14 21:20:35 -05:00
Cameron Gutman
9e8a4cab7b Enable HEVC RFI for DXVA2 and D3D11VA 2022-10-04 22:56:21 -05:00
Cameron Gutman
99885f5b4b Centralize colorspace and color range handling 2022-09-24 12:28:23 -05:00