278 Commits

Author SHA1 Message Date
f240e20e3f Make overriding explicit and remove redundant virtual specifiers on overriding destructors - Core & UnitTests 2025-05-01 15:00:37 +02:00
79a1e480ca Enable anisotropic filtering when the game requests it 2025-03-17 20:46:19 -05:00
8c7ab286f5 Merge pull request #13181 from tygyh/Replace-'reinterpret_cast'
Replace 'reinterpret_cast' with 'static_cast'
2025-03-15 15:31:38 +01:00
5b36c13bfb VideoCommon: Rename Renderer to EFBInterface. 2025-03-12 21:09:16 -05:00
c18c039089 VideoCommon: Move backend_info out of VideoConfig struct. 2025-03-09 01:42:45 -06:00
c9bd6a13a9 VideoBackends: Use DXGI 1.6 and D3D11_4 2025-02-02 09:02:35 +01:00
64514bd8d4 D3D12: Fix out of bounds root parameter index when per-pixel lighting is disabled 2025-01-14 22:30:31 -08:00
6d44afc7dd Replace 'reinterpret_cast' with 'static_cast' 2024-11-08 07:26:47 +01:00
7e1a9490c0 VideoBackends:Vulkan: Don't try to present if swapchain acquire failed 2024-10-02 19:22:16 -05:00
9602f36248 Remove redundant semicolons 2024-08-20 14:59:54 +02:00
a3951dc2d7 Fix out of bounds accesses for invalid vertex component formats
On all platforms, this would result in out of bounds accesses when getting the component sizes (which uses stuff from VertexLoader_Position.h/VertexLoader_TextCoord.h/VertexLoader_Normal.h). On platforms other than x64 and ARM64, this would also be out of bounds accesses when getting function pointers for the non-JIT vertex loader (in VertexLoader_Position.cpp etc.). Usually both of these would get data from other entries in the same multi-dimensional array, but the last few entries would be truly out of bounds. This does mean that an out of bounds function pointer can be called on platforms that don't have a JIT vertex loader, but it is limited to invalid component formats with values 5/6/7 due to the size of the bitfield the formats come from, so it seems unlikely that this could be exploited in practice.

This issue affects a few games; Def Jam: Fight for New York (https://bugs.dolphin-emu.org/issues/12719) and Fifa Street are known to be affected.

I have not done any hardware testing for this PR specifically, though I *think* I previously determined that at least a value of 5 behaves the same as float (4). That's what I implemented in any case. I did previously determine that both Def Jam: Fight for New York and Fifa Street use an invalid normal format, but don't actually have lighting enabled when that normal vector is used, so it doesn't change rendering in practice.

The color component format also has two invalid values, but VertexLoader_Color.h/.cpp do check for those invalid ones and return a default value instead of doing an out of bounds access.
2024-04-04 12:50:34 -07:00
Mai
bcd74a81a9 Merge pull request #12370 from iwubcode/more_samplers
VideoBackends / VideoCommon: update max pixel shader samplers from 8 to 16
2023-12-17 14:50:23 -05:00
12dd15c8dd VideoBackends / VideoCommon: add type enum to dictate whether a texture is a 2D texture, a texture array, or a cube map; support 2D texture type across backends
Co-authored-by: TellowKrinkle <tellowkrinkle@gmail.com>
2023-12-15 11:06:02 -06:00
ac862b04ab VideoBackends / VideoCommon: update max pixel shader samplers from 8 to 16, this allows us to support more samplers than the native Wii/GC 2023-12-10 18:14:02 -06:00
5f6c76af51 VideoCommon: Use std::span for BoundingBox::Write()
Crosses off a lingering TODO.

Also amends a few nearby cases where a u32 cast was being repromoted to
size_t.
2023-12-09 16:33:21 -05:00
b6d321bfb1 VideoBackends / VideoCommon: add new uniform buffer object for custom shader materials (slot 3, geometry shader buffer moves to slot 4 if available) 2023-10-06 02:17:42 -05:00
89e2fc1dd3 VideoBackends: update SRVDescriptorTable size in DX12 to use pixel sampler constant 2023-08-13 17:23:26 -05:00
5512d19d4b Merge pull request #12061 from iwubcode/cubemap_backends_only
VideoBackends: add support for cube maps for OGL, Vulkan, and D3D
2023-08-10 18:36:48 -04:00
83f307ec7e D3D12: Only use framebuffer integer descriptor if allocated
Verify that DXFramebuffer's integer RTV descriptor's cpu_handle has been
allocated before using it, and if it hasn't use the non-integer RTV
descriptor instead. This fixes a Dolphin crash in Twilight Princess, and
possibly other games (Issue 13312).

As an optimization to save space in the descriptor heap, DXFramebuffer's
integer descriptor is only initialized if the given abstract texture
format has different integer and non-integer RTV formats. This
previously wasn't accounted for by GetIntRTVDescriptorArray, which could
cause DX12::Gfx::BindFramebuffer to call OMSetRenderTargets with an
invalid descriptor which would lead to a crash.

Triggering the bug was fortunately rare because integer formats are only
used when blending is disabled and logic ops are enabled. Furthermore,
the standard integer abstract format is RGBA8 which has different
integer and non-integer RTV formats, causing the integer descriptor to
be initialized and avoiding the bug.

The crash started appearing in a2702c6 because it changed the
swapchain's abstract texture format from RGBA8 to RGB10_A2. Unlike
RGBA8, RGB10_A2 has the same integer and non-integer RTV formats and so
the bug can be triggered if the other requirements are met.
2023-08-04 13:17:33 -07:00
e892b7f1ac VideoBackends: add support for cube maps for OGL, Vulkan, and D3D 2023-07-21 19:09:40 -05:00
3627398cf5 VideoBackends: support multiple compute images for some backends (D3D, OGL, Vulkan) 2023-06-28 17:15:31 -05:00
02909bd1a5 Merge pull request #11850 from Filoppi/post_process_fixes
Video: implement color correction to match the Wii/GC NTSC/PAL color spaces (and gamma)
2023-06-23 18:08:23 +02:00
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
ba74902bca VideoBackends: fix d3d12 validation layer error introduced by multi-output texture breaking logic ops support 2023-06-17 01:48:59 -05:00
8f51a9d2d8 Merge pull request #11699 from Pokechu22/gl-check-maximum-samples
OpenGL: Check the list of supported AA modes instead of hardcoding
2023-06-09 15:07:07 +02:00
092773ad0c Merge pull request #11859 from iwubcode/backend-multi-output
VideoBackends: add support to allow rendering to multiple output targets
2023-06-09 13:40:21 +02:00
c63f0f37cd VideoCommon: Pass WindowSystemInfo to InitBackendInfo 2023-06-08 22:07:39 -07:00
80d12e3e88 Video: Fix crash when getting the AA modes
DX12 would often crash when starting and stopping the emulation many times, due to the device enumerator failing for some reason. Checking for success fixes it.
2023-06-08 02:46:08 +03:00
834f8f7b5c VideoBackends: add support to allow rendering to multiple output textures 2023-06-03 14:52:31 -05:00
get
a5d06fde4b Embrace nullptr over NULL and 0 2023-04-15 16:07:05 -05:00
aac9647ba2 Divide by MSAA for PerfQuery in all backends. 2023-03-14 02:13:25 +01:00
af313f8419 VideoCommon: add constant value to set the allowed maximum number of pixel samplers 2023-02-10 00:46:11 -06:00
d0c6b6c9ed VideoCommon: store the configuration used to create the AbstractPipeline on the pipeline itself, so that it's easy to duplicate pipelines with slightly altered configuration 2023-02-09 02:13:53 -06:00
ccf92a3e56 Merge pull request #11522 from phire/KillRendererWithFire
Kill Renderer (with phire)
2023-02-09 19:59:16 +13:00
4422af1272 Cleanup headers 2023-02-09 18:36:20 +13:00
31cfe8250d Lint fixes 2023-02-09 18:36:20 +13:00
11de923dcb Move xfb tracking and IR scaling out of RenderBase 2023-02-09 18:36:20 +13:00
e009002411 Refactor ClearRegion
And fix bug where opengl was getting the wrong coordinates
2023-02-09 18:36:20 +13:00
3ae78b8e76 Also use events for config changed 2023-01-31 19:41:24 +13:00
8ad59f8ccf Add AbstractGfx for DX12 2023-01-31 19:41:24 +13:00
8bc8e43dd6 Add virtual Initialize() to PerfQueryBase
Both DX12 and Vulkan already had one.
2023-01-31 19:41:24 +13:00
0d4537d60f Move Presenting, Dumping and ImGui out of Renderer 2023-01-31 18:45:21 +13:00
606c18210d TextureCache: Refactor with smart pointers
The whole ownership model was getting a bit of a mess, with a some
of special cases to deal with. And I'm planning to make it even more
complex in the future.
So here is some upfront work to convert it over to reference counted
pointers.
2023-01-31 18:29:47 +13:00
7bea39b39e VideoBackends: add a way to load data into a specific level AND layer, default to layer 0 2023-01-27 18:46:53 -06:00
cb0a603c72 VideoCommon: De-globalize GeometryShaderManager class. 2022-12-29 15:33:19 +01:00
50625728e0 VideoCommon: De-globalize VertexShaderManager class. 2022-12-28 15:52:29 +01:00
725bd64ec2 VideoCommon: De-globalize PixelShaderManager class. 2022-12-27 20:13:24 +01:00
fb8aa9744e Merge pull request #11286 from K0bin/vk-query-fix
VideoBackends: Query fixes and cleanups
2022-12-19 03:15:48 -05:00
35a6d16d9e VideoBackends: Rename query_type to query_group 2022-11-29 23:14:23 +01:00
57b2ea663e VideoBackends:D3D12: Set query type 2022-11-29 23:14:23 +01:00