Commit Graph

96 Commits

Author SHA1 Message Date
Admiral H. Curtiss 5c2f73986a
Merge pull request #12537 from TellowKrinkle/MTLSubgroup
VideoCommon: More specific subgroup op bugs
2024-05-21 22:17:22 +02:00
Pokechu22 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
Sam Belliveau 153d0201a8 Add HDR to Metal 2024-03-10 03:25:33 -04:00
TellowKrinkle b7a451fc87 VideoCommon: Post to analytics when bug is overridden 2024-01-28 23:24:23 -06:00
TellowKrinkle 99f0c3fa01 VideoCommon: Add ability for backends to override bugs 2024-01-28 23:24:22 -06:00
TellowKrinkle 463269f704 VideoBackends:Multiple: Split up BUG_BROKEN_SUBGROUP_OPS
We now use subgroup ops for more than just a minor performance optimization
2024-01-28 23:20:39 -06:00
TellowKrinkle 6243e50b21 VideoBackends:MTL: Use SPIRV 1.5
Allows non-constant simd broadcast, which is used by the ascii art shader
2024-01-27 18:47:13 -06: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
Mai f589c04aa7
Merge pull request #12372 from iwubcode/texture_usage_flag
VideoBackends / VideoCommon: add type enum to dictate how the texture is used; support texture 2d
2023-12-17 14:40:39 -05:00
iwubcode 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
OatmealDome 438c48912b MTLStateTracker: Increase fragment buffer array size to 3 2023-12-14 14:17:07 -05:00
iwubcode 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
Lioncash 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
TellowKrinkle 394dd02d0a VideoBackends:Metal: Support multiple compute textures 2023-11-29 18:45:11 -06:00
TellowKrinkle a399dc43a1 VideoBackends:Metal: Align utility uniform sizes
Prevents complaining from validation layers
2023-11-29 18:45:11 -06:00
Pierre de La Morinerie 0ecfaf3b9e
Metal: enable concurrent compilation only if available
Bug: https://bugs.dolphin-emu.org/issues/13404

On macOS 13.6 / Intel HD 5000, Dolphin crashes with this message:

> -[MTLIGAccelDevice setShouldMaximizeConcurrentCompilation:]: unrecognized selector

This should be available on all macOS 13.3+ systems – but when using OCLP drivers,
some devices use an older version of Metal.framework, which doesn't expose the selector.

This concerns Intel Ivy Bridge, Haswell and Nvidia Kepler when using OCLP on macOS 13.3
or newer.
(See
34676702f4/docs/PATCHEXPLAIN.md?plain=1#L354C1-L354C83)

As the behavior is an optional optimization anyway, perform a dynamic
detection to avoid crashing if the feature is not available.
2023-11-24 15:09:25 +01:00
iwubcode 713454b7d7 Metal: update binding mapping for SPRV due to change for custom shader uniforms in other backends (Metal is still not supported)
Co-authored-by: TellowKrinkle <tellowkrinkle@gmail.com>
2023-10-06 02:17:43 -05:00
OatmealDome 3e9c9a3e8d
Merge pull request #12004 from TellowKrinkle/MetalMultiTarget
VideoBackends:Metal: Multi render target support
2023-09-03 23:31:38 -04:00
iwubcode 3627398cf5 VideoBackends: support multiple compute images for some backends (D3D, OGL, Vulkan) 2023-06-28 17:15:31 -05:00
TellowKrinkle fc4036af80 VideoBackends:Metal: Multi render target support 2023-06-28 00:11:37 -05:00
OatmealDome 7752e247f7
Merge pull request #11911 from TellowKrinkle/MTLParallelCompilation
VideoBackends:Metal: Enable shouldMaximizeConcurrentCompilation when available
2023-06-10 19:39:24 +02:00
Admiral H. Curtiss 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
Admiral H. Curtiss 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
Pokechu22 c63f0f37cd VideoCommon: Pass WindowSystemInfo to InitBackendInfo 2023-06-08 22:07:39 -07:00
TellowKrinkle e7f4b7679b VideoBackends:Metal: Enable shouldMaximizeConcurrentCompilation when available 2023-06-08 18:57:41 -05:00
Admiral H. Curtiss 3dbdf0472d
Merge pull request #11901 from Filoppi/add_texture_types
Video: add R10B10G10A2 and R16G16B16A16F texture types
2023-06-08 15:28:15 +02:00
Filoppi cdc53c046b Video: add R10B10G10A2 and R16G16B16A16F texture types (needed by PR 11850) 2023-06-08 03:17:20 +03:00
iwubcode 834f8f7b5c VideoBackends: add support to allow rendering to multiple output textures 2023-06-03 14:52:31 -05:00
TellowKrinkle 0ee12b6164 VideoBackends:Metal: Allocate bounding box uploads on a cpu buffer
AMD Metal drivers have a goofy bug where the bbox buffer stops being coherent with the cpu if you copy to it from a private (gpu) buffer and don't do anything else with it in that command buffer.
2023-05-28 17:08:08 -05:00
OatmealDome 28f1a4cec1
Merge pull request #11757 from TellowKrinkle/BCniOS
Enable BCn texture support on iOS where available
2023-04-29 08:54:18 +02:00
TellowKrinkle 9cc3ba6fc6 VideoBackends:Metal: Enable BCn support on iOS 2023-04-28 20:35:54 -05:00
OatmealDome 8aae296d4e
Merge pull request #11759 from TellowKrinkle/MTLPerfQueryFixes
VideoBackends:Metal: Fix perf queries
2023-04-18 22:15:50 +02:00
TellowKrinkle 09c80513cd VideoBackends:Metal: Fix perf queries
Fixes an issue where perf queries could end up including counts from previous queries
2023-04-14 00:25:31 -05:00
TellowKrinkle ed177bdbd7 VideoBackends:Metal: Use max pixel samplers constant 2023-04-08 02:12:31 +02:00
Admiral H. Curtiss ddd2b598da
Return quarter value for PerfQuery in all backends. 2023-03-14 02:08:20 +01:00
JMC47 258151fe5a
Merge pull request #11523 from degasus/OGL_KHR_subgroup
VideoBackend/OGL: Prefer KHR_shader_subgroup over NV_shader_thread.
2023-02-10 04:47:20 -05:00
degasus 4b2aa948e6 VideoBackend/OGL: Prefer KHR_subgroup over NV_shader_thread.
While the NV extension is totally fine, the KHR extension should be able to support more hardware.

For NVIDIA, the hardware either supports both or neither, it just needs a driver from the last two years.
For AMD, the drivers from late 2022-12 seems to bring support for the KHR extension.
For Intel, the KHR is also supported for some years.
2023-02-09 13:27:02 +01:00
iwubcode 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
Scott Mansell ccf92a3e56
Merge pull request #11522 from phire/KillRendererWithFire
Kill Renderer (with phire)
2023-02-09 19:59:16 +13:00
Scott Mansell 60f2b5af7b Apply suggestions from code review
Co-authored-by: Mai <mathew1800@gmail.com>
Co-authored-by: BhaaL <bhaalsen@gmail.com>
Co-authored-by: iwubcode <iwubcode@users.noreply.github.com>
2023-02-09 18:36:20 +13:00
Scott Mansell cf9a6f8477 Lint fixes 2023-02-09 18:36:20 +13:00
Scott Mansell 4422af1272 Cleanup headers 2023-02-09 18:36:20 +13:00
Scott Mansell 31cfe8250d Lint fixes 2023-02-09 18:36:20 +13:00
Scott Mansell 11de923dcb Move xfb tracking and IR scaling out of RenderBase 2023-02-09 18:36:20 +13:00
Scott Mansell e009002411 Refactor ClearRegion
And fix bug where opengl was getting the wrong coordinates
2023-02-09 18:36:20 +13:00
Pierre Bourdon c92de420ef
lint: update to clang-format-13 2023-02-02 04:56:08 +01:00
Scott Mansell e98ab0784d
Merge pull request #11501 from iwubcode/abstract_texture_load_specify_layer
VideoBackends: add a way to load data into a specific level AND layer
2023-02-01 00:03:59 +13:00
Scott Mansell 3ae78b8e76 Also use events for config changed 2023-01-31 19:41:24 +13:00
Scott Mansell eaae5b4a45 Implement AbstactGfx for Metal 2023-01-31 19:41:24 +13:00
Scott Mansell 0d4537d60f Move Presenting, Dumping and ImGui out of Renderer 2023-01-31 18:45:21 +13:00