summaryrefslogtreecommitdiff
path: root/Source/UnitTests/VideoCommon/VertexLoaderTest.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-06-07Merge pull request #13023 from tygyh/Replace-ties-with-structured-bindingsJordan Woyak
UnitTests: Replace ties with structured bindings
2025-04-23VertexLoaderTest: Replace `std::tie` with structured bindingsDr. Dystopia
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-08-20Replace ties with structured bindings - UnitTestsDr. Dystopia
2024-08-16Merge pull request #13015 from tygyh/Use-boolean-literalsTilka
Replace boolean constants with boolean literals
2024-08-15Use 'contains' methodmitaclaw
2024-08-15Replace boolean constants with boolean literalsDr. Dystopia
2024-08-14Remove self-comparisonDr. Dystopia
2024-05-03Replace Common::BitCast with std::bit_castPokechu22
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-11VertexLoaderTest: Resolve -Wdangling-else warningsLioncash
The ways the assertion macros expand end up generating -Wdangling-else warnings. Trivial enough to fix by just bracing the if statements.
2023-12-02VertexLoaderTest: Add test for skipped texture coordinatesPokechu22
Jimmie Johnson's Anything with an Engine is known to use texture coordinate 7 (and only texture coordinate 7) in some cases. There are a lot of possible edge-cases, so this test brute-forces all combinations with coordinates 0, 1, and 2.
2023-12-02VertexLoaderTest: Add test for skipped colorsPokechu22
This test fails with the non-JIT vertex loader due to an issue fixed in a later commit in this PR. (Note that the non-JIT vertex loader is only used on machines where no JIT is available or if COMPARE_VERTEXLOADERS is enabled in VertexLoaderBase.cpp.)
2023-01-20Externals: Convert gtest to a submodule and update to v1.12.1Pokechu22
2022-11-22VertexLoader: Eliminate use of DataReaderPokechu22
DataReader is generally jank - it has a start and end pointer, but the end pointer is generally not used, and all of the vertex loaders mostly bypassed it anyways. Wrapper code (the vertex loaer test, as well as Fifo.cpp and OpcodeDecoding.cpp) still uses it, as does the software vertex loader (which is not a subclass of VertexLoader). These can probably be eliminated later.
2022-09-18VertexLoaderTest: Add NormalAllPokechu22
This currently fails for direct with NormalIndex3 enabled (see https://bugs.dolphin-emu.org/issues/12952). The goal of this test is to be able to confidently say that that bug has been fixed.
2022-09-18VertexLoaderTest: Add DirectAllComponentsPokechu22
We have one that does a similar thing, but only to measure speed and uses indices. This one verifies accuracy (and uses the largest possible input size by using direct components).
2022-05-18Rename CP and XF normal component count enums and update their descriptionsPokechu22
2021-12-18Create and use CPArray enum classPokechu22
2021-07-06Merge pull request #9595 from Dentomologist/fix_vertex_loader_test_warningsLéo Lam
VertexLoaderTest: Fix memset assignment warning
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-09Eliminate TVtxDesc.GetLegacyHexPokechu22
2021-05-07Move vertex size and component calculation to VertexLoaderBasePokechu22
2021-04-06UnitTests: Use MathUtil::SaturatingCast to avoid UBLéo Lam
[conv.fpint]/1: > A prvalue of a floating-point type can be converted to a prvalue of > an integer type. The conversion truncates; that is, the fractional > part is discarded. The behavior is undefined if the truncated value > cannot be represented in the destination type.
2021-03-26Refactor CP array constants slightlyPokechu22
2021-03-18VertexLoaderTest: Fix memset assignment warningDentomologist
Initialize and assign members of TVtxDesc and VAT structs directly instead of using memset. Fixes -Wclass-memaccess warning from gcc on Debian.
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.
2018-06-12UnitTests/VertexLoaderTest: Fix compilation on newer GTest versionsspycrab
2018-05-10FloatUtils: Remove IntDouble and IntFloatLioncash
Type punning via unions in C++ invokes undefined behavior. Instead, leverage BitCast, our variant of C++2a's std::bit_cast
2018-05-07Common: Move floating-point utility functions to FloatUtils.h/.cppLioncash
Keeps all of the floating-point utility functions in their own file to keep them all together. This also provides a place for other general-purpose floating-point functions to be added in the future, which will be necessary when improving the flag-setting within the interpreter.
2017-03-31VertexLoaderTest: fix maybe-uninitialized warningMichael Maltese
Fixes warning: ``` ../Source/UnitTests/VideoCommon/VertexLoaderTest.cpp:222:15: error: variable 'f' may be uninitialized when used here [-Werror,-Wconditional-uninitialized] ExpectOut(f * scale); ^ ../Source/UnitTests/VideoCommon/VertexLoaderTest.cpp:198:12: note: initialize the variable 'f' to silence this warning float f, g; ^ = 0.0 ../Source/UnitTests/VideoCommon/VertexLoaderTest.cpp:223:15: error: variable 'g' may be uninitialized when used here [-Werror,-Wconditional-uninitialized] ExpectOut(g * scale); ^ ../Source/UnitTests/VideoCommon/VertexLoaderTest.cpp:198:15: note: initialize the variable 'g' to silence this warning float f, g; ^ = 0.0 ```
2016-06-24Reformat all the things. Have fun with merge conflicts.Pierre Bourdon
2016-03-30VertexLoaderTest: Amend code to fix new warnings in Visual StudioLioncash
Fixes warning C4334
2015-12-22VertexLoaderBase: Get rid of explicit delete and newLioncash
2015-05-30Clean up cached_arraybases. Update VideoSW to new scheme.Scott Mansell
Move ownership of cached_arraybases from CPMemory to VertexLoaderManager to better match it usage.
2015-05-25Merge pull request #2274 from degasus/disable_bboxRyan Houdek
Disable bbox
2015-05-25Add missing license headersTillmann Karras
2015-05-25BBox: remove now unreachable SW bbox implementationdegasus
2015-03-18VertexLoaders: make positions more compactTillmann Karras
2015-03-18UnitTests: rewrite vertex loader testsTillmann Karras
The position attribute now has complete coverage.
2015-02-25Formatting/Whitespace CleanupStevoisiak
Various fixes to formatting and whitespace
2015-02-16Convert our vertex loader unit test to the new RunVertices arguments ↵Ryan Houdek
arrangement.
2015-01-20VertexLoaderX64: support VAT.ByteDequant=0Tillmann Karras
2014-12-21VideoCommon: split VertexLoaderBase from VertexLoaderdegasus
2014-12-21VertexLoader: remove inlined gettersdegasus
They just blow up the code.
2014-12-21VideoLoader: remove VAT_*_FRACBITSdegasus
They are used to remove the flush amounts, but as we don't flush anymore on vertex loader changes (only on native vertex format right now), this optimization is now unneeded. This will allow us to hard code the frac factors within the vertex loaders.
2014-12-09UnitTests: fix VertexLoaderTestdegasus
2014-09-28Rejigger some FIFO buffer variables to be more rational.comex
videoBuffer -> s_video_buffer size -> s_video_buffer_write_ptr g_pVideoData -> g_video_buffer_read_ptr (impl moved to Fifo.cpp) This eradicates the wonderful use of 'size' as a global name, and makes it clear that s_video_buffer_write_ptr and g_video_buffer_read_ptr are the two ends of the FIFO buffer s_video_buffer. Oh, and remove a useless namespace {}.
2014-08-02VertexLoader: Add more tests, including a few small benchmarksPierre Bourdon