summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software/SWVertexLoader.cpp
AgeCommit message (Collapse)Author
2026-01-25Remove unused importsMartino Fontana
Yellow squiggly lines begone! Done automatically on .cpp files through `run-clang-tidy`, with manual corrections to the mistakes. If an import is directly used, but is technically unnecessary since it's recursively imported by something else, it is *not* removed. The tool doesn't touch .h files, so I did some of them by hand while fixing errors due to old recursive imports. Not everything is removed, but the cleanup should be substantial enough. Because this done on Linux, code that isn't used on it is mostly untouched. (Hopefully no open PR is depending on these imports...)
2025-08-10VideoSW: reuse Common::Vec2/3/4Tillmann Karras
2025-03-12VideoCommon: Rename Renderer to EFBInterface.Jordan Woyak
2024-10-12Cache normals in addition to binormals and tangentsPokechu22
Fixes LIT (https://bugs.dolphin-emu.org/issues/13635). The text does not include normals, but has lighting enabled. With the previous default of (0, 0, 0), lighting was always black (as dot(X, (0, 0, 0)) is always 0). It seems like the normal from the map in the background (0, 0, 1) is re-used. LIT also has the vertex color enabled while vertex color is not specified, the same as SMS's debug cubes; the default MissingColorValue GameINI value of solid white seems to work correctly in this case.
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-01-31Move BoundingBox out of RenderBaseScott Mansell
They were essentially just pass-though methods
2022-12-28VideoCommon: De-globalize VertexShaderManager class.Admiral H. Curtiss
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-08-29SW/Tev: Replace Tev::SetRegColor with Tev::SetKonstColorsPokechu22
2022-05-18Show a panic alert if the CP matrix indices don't match the XF matrix indicesPokechu22
This almost certainly never happens, but if it does we want to know.
2022-04-22VideoCommon: Handle emboss texgen with only a single normalPokechu22
Fixes a large number of effects in Rogue Squadron 2 and 3.
2022-04-22VideoCommon: Rename norm0/norm1/norm2 to normal/tangent/binormalPokechu22
2022-04-08Software: Fix zfreeze with CullMode::AllPokechu22
2021-12-18Eliminate VarType for ComponentFormatPokechu22
2021-12-18Convert OpcodeDecoder::Opcode and OpcodeDecoder::Primitive to enum classPokechu22
2021-12-18Remove parameters to SWVertexLoader::SetFormatPokechu22
They haven't been used since efbe5bc4b65.
2021-10-04VideoCommon: Abstract bounding boxTechjar
This moves much of the duplicated bounding box code into VideoCommon, leaving only the specific buffer implementations in each backend.
2021-07-05treewide: convert GPLv2+ license info to SPDX tagsPierre Bourdon
SPDX standardizes how source code conveys its copyright and licensing information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX tags are adopted in many large projects, including things like the Linux kernel.
2021-06-09Hack to hide debug cubes in Super Mario SunshinePokechu22
... while not breaking other games.
2021-03-06Convert CPMemory to BitField and enum classPokechu22
Additionally, VCacheEnhance has been added to UVAT_group1. According to YAGCD, this field is always 1. TVtxDesc also now has separate low and high fields whose hex values correspond with the proper registers, instead of having one 33-bit value. This change was made in a way that should be backwards-compatible.
2021-01-03Software: Remove normalization special casePokechu22
The special case doesn't appear to make a significant difference in any games, and the current implementation has a (minor, fixable) issue that breaks Super Mario Sunshine (both with a failed assertion (https://bugs.dolphin-emu.org/issues/11742) and a rendering issue (https://bugs.dolphin-emu.org/issues/7476)). Hardware testing wasn't able to reproduce the special case, either, so it may just not exist. PR #9315 contains a fixed implementation of the special case on all video backends, and can serve as a basis for it being reintroduced if it is found to exist under more specific circumstances. For now, I don't see a reason to keep it present.
2020-11-20Software: Use same logic for colors as hardware backendsStenzek
2020-11-09Software: Migrate logging over to fmtLioncash
Migrates the software backend over to the fmt-capable logger.
2019-12-05VideoCommon/IndexGenerator: Eliminate static stateLioncash
Now that we've extracted all of the stateless functions that can be hidden, it's time to make the index generator a regular class with active data members. This can just be a member that sits within the vertex manager base class. By deglobalizing the state of the index generator we also get rid of the wonky dual-initializing that was going on within the OpenGL backend. Since the renderer is always initialized before the vertex manager, we now only call Init() once throughout the execution lifecycle.
2019-07-10VideoCommon/Statistics: Rename stats global to g_statsLioncash
Makes the global variable follow our convention of prefixing g_ on global variables to make it obvious in surrounding code that it's not a local variable.
2019-07-10VideoCommon/Statistics: Normalize statistic variable namesLioncash
Normalizes all variables related to statistics so that they follow our coding style. These are relatively low traffic areas, so this modification isn't too noisy.
2019-02-19Move most backend functionality to VideoCommonStenzek
2018-12-04Use main buffers for utility drawsStenzek
2018-10-14VideoCommon: Clean up class-memaccess warningsTechjar
2018-03-14Assert: Uppercase assertion macrosLioncash
Macros should be all upper-cased. This is also kind of a wart that's been sticking out for quite a while now (we avoid prefixing underscores).
2017-09-11Renderer: Move cull mode to a rasterization state objectStenzek
Also moves logic for primitive handling to VideoCommon.
2017-09-09SWVertexLoader: Remove GetIndexBuffer()Lioncash
It's only ever used in one place internally and is arguably unnecessary.
2017-09-09SWVertexLoader: Normalize class variable namesLioncash
Follows our coding style.
2017-08-22SW NativeVertexFormat: Utilize std::array where applicableLioncash
Gets rid of some hardcoded looping bounds, and also simplifies code in some places, sometimes allowing for removal of a loop altogether.
2017-07-30NativeVertexFormat: Drop unused virtual method SetupVertexPointersStenzek
2017-02-18VertexManagerBase: Make CreateNativeVertexFormat return a unique_ptrLioncash
Much safer as opposed to just returning raw allocated memory.
2017-02-08OpcodeDecoding: Convert #defines into enum constantsLioncash
Gets several constants out of global scope.
2017-01-04VideoCommon: Make dst_alpha state implicit.degasus
2016-09-24Software: Clean out unnecessary includes/fwd declsLioncash
2016-09-22SWVertexLoader: Value initialize SetupUnit instanceLioncash
2016-08-22VertexManager: Correct variable naming schemeLioncash
Altered to indicate regular class members
2016-06-24Reformat all the things. Have fun with merge conflicts.Pierre Bourdon
2016-04-30VideoSW: Fix special case.degasus
I have no clue what this special case shall be, but accessing g_main_cp_state within Flush() is not allowed. We likely still have a bad behavior, but now it only depends on the current state, not on the next one after flushing.
2016-03-06VideoSW: Drop SetTevReg for colors.degasus
2016-03-06VideoSW: Drop SetScissor().degasus
Just access the global state directly.
2016-03-06VideoSW: Drop SetViewOffset.degasus
Just use the global state.
2016-01-31VideoCommon: Convert some DataReader includes into forward declarationsLioncash
Gets rid of some indirect inclusions in cpp files. Also this will reduce the amount of rebuilt files if changes occur in the DataReader header.
2016-01-17VideoCommon: Header cleanupLioncash
Also remedies places where the video backends and core rely on things being indirectly included.
2016-01-06VideoSW: Use more VideoCommondegasus
Now we require lots of empty functions, but this removes by far more duplicated code.
2015-12-28VideoSW: Clear Vertex data before usagedegasus
This must have no effect, everything else is usage of uninitialized memory.