summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexLoaderARM64.cpp
AgeCommit message (Collapse)Author
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-12-16JitArm64: Use enum class for LogicalImm size parameterJosJuice
This should prevent issues like the one fixed in the previous commit from happening again.
2023-10-31Jit64: Recompile asm routines on cache clearJosJuice
This is needed so that the checks added in the previous commit will be reevaluated if the value of m_enable_dcache changes. JitArm64 was already recompiling its asm routines on cache clear by necessity. It doesn't have the same setup as Jit64 where the asm routines are in a separate region, so clearing the JitArm64 cache results in the asm routines being cleared too.
2023-02-12VertexLoader: Add more info to m_vertex_size == m_src_ofs assertionPokechu22
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-18VertexLoaderARM64: Fix direct normal+tangent+binormal with index3 setPokechu22
Fixes https://bugs.dolphin-emu.org/issues/12952
2022-09-18VertexLoaderARM64: Specify the register to use as a parameter to ReadVertexPokechu22
This also means that both a register and a vertex are always specified, though right now if the register is scratch1_reg the offset is always 0.
2022-09-18VertexLoaderARM64: Merge GetAddressImm into GetVertexAddrPokechu22
This way it more closely matches VertexLoaderX64, and is in general easier to understand.
2022-09-18VertexLoaderARM64: Always use unscaled load/store instructionsPokechu22
The source and destination offsets will always be less than 255, so we can get rid of a lot of the complexity by doing this.
2022-09-18VertexLoaderARM64: Use EnumMap for normal scalesPokechu22
2022-05-18Rename CP and XF normal component count enums and update their descriptionsPokechu22
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-22VertexLoader: Convert count register to remaining registerPokechu22
This more accurately represents what's going on, and also ends at 0 instead of 1, making some indexing operations easier. This also changes it so that position_matrix_index_cache actually starts from index 0 instead of index 1.
2022-04-22Convert vertex loader position cache to std::arrayPokechu22
2022-04-22VertexLoaderARM64: Fix z-freeze position matrix indexPokechu22
Before, it would always write to index 0 (which is unused). Now it writes to the correct index.
2021-12-18Eliminate VarType for ComponentFormatPokechu22
2021-12-18VideoCommon: Move VertexLoaderManager logic out of CPStatePokechu22
2021-12-18Refactor OpcodeDecoding and FIFO analyzer to use callbacksPokechu22
2021-12-18Create and use CPArray enum classPokechu22
2021-09-30fix unused variable warningShawn Hoffman
2021-07-12JitArm64: Stop using hand-encoded logical immediatesJosJuice
2021-07-10JitArm64: Encode logical immediates at compile-time where possibleJosJuice
Manually encoding and decoding logical immediates is error-prone. Using ORRI2R and friends lets us avoid doing the work manually, but in exchange, there is a runtime performance penalty. It's probably rather small, but still, it would be nice if we could let the compiler do the work at compile-time. And that's exactly what this commit does, so now I have no excuse for trying to manually write logical immediates anymore.
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-05-22Apple M1: RAII Wrapper for JITPageWrite*Execute*()Skyler Saleh
Added RAII wrapper around the the JITPageWriteEnableExecuteDisable() and JITPageWriteDisableExecuteEnable() to make it so that it is harder to forget to pair the calls in all code branches as suggested by leoetlino.
2021-05-22Apple M1 Support for MacOSSkyler Saleh
This commit adds support for compiling Dolphin for ARM on MacOS so that it can run natively on the M1 processors without running through Rosseta2 emulation providing a 30-50% performance speedup and less hitches from Rosseta2. It consists of several key changes: - Adding support for W^X allocation(MAP_JIT) for the ARM JIT - Adding the machine context and config info to identify the M1 processor - Additions to the build system and docs to support building universal binaries - Adding code signing entitlements to access the MAP_JIT functionality - Updating the MoltenVK libvulkan.dylib to a newer version with M1 support
2021-05-07Move vertex size and component calculation to VertexLoaderBasePokechu22
2021-05-07Remove VertexLoaderBase::IsInitializedPokechu22
It is no longer relevant for the current set of loaders after 70305425462843af192489da00389559cd6f5834. If it becomes relevant again, a static function named IsUsable or IsCompatibleWithCurrentMachine or something would be a better approach.
2021-05-07Eliminate TVtxAttrPokechu22
2021-05-07Extract VertexLoaderARM64::GetLoadSize into a new functionPokechu22
2021-03-26Refactor CP array constants slightlyPokechu22
2021-03-13Arm64Gen: Convert ARM64Reg to enum classDentomologist
Most changes are just adding ARM64Reg:: in front of the constants.
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-17Arm64Emitter: Convert ShiftType to enum classDentomologist
2021-01-15Arm64Emitter: Convert IndexType to enum classDentomologist
2019-12-28Compile fixes for Windows-on-ARM64Stenzek
2018-05-27VertexLoaderArm: Fix 565 color format.degasus
Copy & paste error for enforcing A=255. It was copied from the 888X format, which stores the output data in another register.
2018-04-12Reformat all the things!spycrab
2016-09-27Merge pull request #4210 from degasus/armMarkus Wick
JitArm64: Small cleanup + speedups.
2016-09-26VertexLoaderArm64: Mark register allocation as static const.degasus
2016-09-17VertexLoaderJit: Fix out-of-bounds access for zfreeze.degasus
This fixes a GCC6.1 warning.
2016-06-24Reformat all the things. Have fun with merge conflicts.Pierre Bourdon
2016-01-17VideoCommon: Header cleanupLioncash
Also remedies places where the video backends and core rely on things being indirectly included.
2015-09-06General: Replace GC_ALIGN macros with alignasLioncash
Standard supported alignment -> out with compiler-specific.
2015-09-04[AArch64] Minor improves to the vertex loader JITRyan Houdek
Just some minor improvements noticed by dumping the vertex loader blocks.
2015-06-20[AArch64] Fix a couple of bugs in the vertex loaderRyan Houdek
In particular this fixes the 6666 colour format We were loading from the wrong location and it was causing /terrible/ colour changes. This also fixes a bug in the all the colour formats(except 888) where the unaligned path was loading in to the wrong register.
2015-06-07[AArch64] Implement ZFreeze cacheRyan Houdek
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-25Set copyright year to when a file was createdTillmann Karras