summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software
AgeCommit message (Collapse)Author
2024-04-20VideoCommon: Use GetSpanForAddress safely in texture decodingJosJuice
Now only VertexLoader remains... But that one might be tricky.
2024-04-20Memmap: Replace GetPointer with GetSpanForAddressJosJuice
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.
2024-04-04Fix out of bounds accesses for invalid vertex component formatsPokechu22
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.
2023-12-12Software/SWGfx: Default destructor in cpp fileLioncash
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.
2023-12-09VideoCommon: Use std::span for BoundingBox::Write()Lioncash
Crosses off a lingering TODO. Also amends a few nearby cases where a u32 cast was being repromoted to size_t.
2023-12-09Fix out of bound write in EfbCopy::ClearEfbtimetravelthree
2023-11-11Rename bpmem.copyMipMapStrideChannels to bpmem.copyDestStridePokechu22
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 bbbe898839467c312c31456334540c20fedc7be3 (the first commit that used it at all).
2023-06-09Merge pull request #11699 from Pokechu22/gl-check-maximum-samplesAdmiral H. Curtiss
OpenGL: Check the list of supported AA modes instead of hardcoding
2023-06-08VideoCommon: Pass WindowSystemInfo to InitBackendInfoPokechu22
2023-06-03VideoBackends: add support to allow rendering to multiple output texturesiwubcode
2023-03-02Software: Implement GetSurfaceInfo()Pokechu22
Before, it used a fallback where it returned a default object, where the width and height were set to 0. Presenter::Initialize() used GetSurfaceInfo to set the backbuffer size, then used that size when initializing the on-screen UI (even for the software renderer, where the on-screen UI isn't currently present), which meant that ImGui got a window size of 0 and thus resulted in a failed assertion. Although BindBackbuffer checks for size changes, it doesn't help because ImGui has already been initialized, and the size hasn't actually changed since initialization occured. Fixes one aspect of https://bugs.dolphin-emu.org/issues/13172.
2023-02-15Fix uninitialized variable warnings (C26495)Pokechu22
2023-02-09Software/Tev: Fix member shadowing warningsPokechu22
2023-02-09Merge pull request #11522 from phire/KillRendererWithFireScott Mansell
Kill Renderer (with phire)
2023-02-09Lint fixesScott Mansell
2023-02-09Lint fixesScott Mansell
2023-02-09Refactor ClearRegionScott Mansell
And fix bug where opengl was getting the wrong coordinates
2023-01-31Move ConfigChanged out of RenderBaseScott Mansell
There is this nice VideoConfig file that's perfect for it
2023-01-31Move BoundingBox out of RenderBaseScott Mansell
They were essentially just pass-though methods
2023-01-31Handle VideoSoftware's present fallback betterScott Mansell
Not a good idea to abuse bSupportsPostProcessing
2023-01-31Don't set common globals from Video BackendsScott Mansell
2023-01-31Implement AbstractGfx for Software & NullScott Mansell
2023-01-31Move Presenting, Dumping and ImGui out of RendererScott Mansell
2023-01-31Refactor to remove virtual from RenderXFBToScreenScott Mansell
Slightly simplifies the upcoming refactor
2023-01-31TextureCache: Refactor with smart pointersScott Mansell
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-27VideoBackends: add a way to load data into a specific level AND layer, ↵iwubcode
default to layer 0
2022-12-29Merge pull request #11389 from Pokechu22/sw-no-alpha-1-hackJMC47
Software: Remove alpha=1 blending special-case
2022-12-28Software: Remove alpha=1 blending special-casePokechu22
This was added in #10394 for both the hardware and software backends to work around an issue with Mario Kart Wii, Fortune Street, and Baten Kaitos. However, it seems like the software renderer handles blending well enough that we don't need this (and in any case, it's easy to change blending in the software renderer). Some experimentation with #11387 (not pushed) showed that the software renderer's logic would also produce correct results on the hardware backends with this hack removed, but would require fbfetch (currently); if a better solution is found the hack can also be removed from the hardware backends.
2022-12-28VideoCommon: De-globalize VertexShaderManager class.Admiral H. Curtiss
2022-12-27VideoCommon: De-globalize PixelShaderManager class.Admiral H. Curtiss
2022-12-11VideoCommon/PixelEngine: Refactor to class, move to Core::System.Admiral H. Curtiss
2022-12-03HW/Memmap: Refactor Memory to class, move to Core::System.Admiral H. Curtiss
2022-10-29VideoCommon/Statistics: Require semicolons after statistics macrosPokechu22
This is clearer and reduces IntelliSense problems.
2022-09-26Software: Fix mipmaps and uneven strides in SWTexturePokechu22
I think this is only used for texture dumping, but this resolves some failed assertions and glitchy results.
2022-09-26Software: Remove dedicated texture/frame dumping infrastructurePokechu22
Texture dumping can already be done using VideoCommon's system (and in fact the same setting already enabled *both* of these). Dumping objects/TEV stages/texture fetches doesn't currently have an equivalent, but could be added to the FIFO player instead.
2022-09-19VideoCommon: Add dynamic vertex loader to ubershadersTellowKrinkle
2022-08-29BPMemory: Make TevKSel more clearPokechu22
It stores both the konst selection value for alpha and color channels (for two tev stages per ksel), and half of a swap table row (there are 4 total swap tables, which can be used for swizzling the rasterized color and the texture color, and indices selecting which tables to use are stored per tev stage in the alpha combiner). Since these are indexed very differently, the old code was hard to follow.
2022-08-29SW/Rasterizer: Use RAS1_IREF::getTexCoord and getTexMapPokechu22
2022-08-29SW/Tev: Replace Tev::SetRegColor with Tev::SetKonstColorsPokechu22
2022-08-29SW/Tev: Use std::clamp for Clamp255 and Clamp1024Pokechu22
2022-08-29SW/Tev: Remove Tev::InitPokechu22
2022-08-29SW/Tev: Use EnumMap for scale/bias tablesPokechu22
2022-08-29SW/Tev: Use EnumMap for RegPokechu22
2022-08-29SW/Tev: Use TevColorRef/TevAlphaRef instead of raw s16 pointersPokechu22
2022-08-28SW/Rasterizer: Fix indirect stage using texture coordinates/maps >= 4Pokechu22
The masking was incorrect. This affects the main menu of The Last Avatar, though that menu also relies on copy filter functionality that is not correctly handled in the software renderer so the difference is not obvious; that game shuffles textures across all indices for some reason, so this issue would presumably result in subtle flickering.
2022-07-21VideoBackends:Metal: MSAA supportTellowKrinkle
2022-07-17Merge pull request #10747 from tellowkrinkle/LateUIDFixupJMC47
Add a post-cache shader UID fixup pass
2022-07-16Software: Use hardware-verified numbers for RGB->YUV conversionPokechu22
2022-07-16Restructure parameters to TetxureConverterShaderGen/TextureConversionShaderPokechu22
This will be used for later refactoring for increased accuracy.
2022-07-13VideoCommon: Better driver bug handlingTellowKrinkle
Adds a pass to process driver deficiencies between UID caching and use, allowing a full view of the whole pipeline, since some bugs/workarounds involve interactions between blend modes and the pixel shader