In OGLConfig.cpp, `std::views::reverse` is used rather than sorting using `std::ranges::greater` in order to parallel other instances of reverse iteration in the function.
This is a minor improvement to add line numbers to the LOG_VULKAN_ERROR
define. Basically error logs for Vulkan will now look like:
```
// This
25:03:347 VideoBackends/Vulkan/VulkanLoader.cpp:247 E[Video]: (WaitForCommandBufferCompletion:278) vkWaitForFences failed: (2: VK_TIMEOUT)
// Instead of
15:45:154 VideoBackends/Vulkan/VulkanLoader.cpp:247 E[Video]: (WaitForCommandBufferCompletion) vkWaitForFences failed: (2: VK_TIMEOUT)
```
To ensure memory safety, callers of GetPointer have to perform a bounds
check. But how is this bounds check supposed to be performed?
GetPointerForRange contained one implementation of a bounds check, but
it was cumbersome, and it also isn't obvious why it's correct.
To make doing the right thing easier, this commit changes GetPointer to
return a span that tells the caller how many bytes it's allowed to
access.
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.
It was reported that some games (Zelda Wind Waker and Zelda Twilight Princess but others may also exhibit the issue) have graphical issues with the max pixel samplers set to 16 on some Android devices (ex: Pixel6); since this was increased for a performance heavy feature (custom shaders) just disable it for now. In the future, this could be handled more elegantly
Fixes a build failure with clang 17.
The destructor needs to be in the cpp file, since we have a forward
declared std::unique_ptr type as part of the class. So technically the
default inline destructor could invoke without seeing the full data type
definition.
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.
As far as I can tell, it has nothing to do with the mipmap/half_scale functionality, but does change based on the width of the destination texture (and the destination texture is half the width if half_scale is set). The comment that was there (which dates back to the initial megacommit) seems to not have accounted for the width aspect; it was first used as an actual stride in bbbe898839 (the first commit that used it at all).