summaryrefslogtreecommitdiff
path: root/src/common (follow)
Commit message (Collapse)AuthorAgeFilesLines
* log: Add logging class for Cheat EngineGravatar Zach Hilman2019-09-212-0/+2
| | | This is better than just using something like Common.Filesystem or Common.Memory
* shader_ir: Implement VOTEGravatar ReinUsesLisp2019-08-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement VOTE using Nvidia's intrinsics. Documentation about these can be found here https://developer.nvidia.com/reading-between-threads-shader-intrinsics Instead of using portable ARB instructions I opted to use Nvidia intrinsics because these are the closest we have to how Tegra X1 hardware renders. To stub VOTE on non-Nvidia drivers (including nouveau) this commit simulates a GPU with a warp size of one, returning what is meaningful for the instruction being emulated: * anyThreadNV(value) -> value * allThreadsNV(value) -> value * allThreadsEqualNV(value) -> true ballotARB, also known as "uint64_t(activeThreadsNV())", emits VOTE.ANY Rd, PT, PT; on nouveau's compiler. This doesn't match exactly to Nvidia's code VOTE.ALL Rd, PT, PT; Which is emulated with activeThreadsNV() by this commit. In theory this shouldn't really matter since .ANY, .ALL and .EQ affect the predicates (set to PT on those cases) and not the registers.
* Common/Alignment: Add noexcept where required.Gravatar Fernando Sahmkow2019-07-191-5/+5
|
* Kernel: Address FeedbackGravatar Fernando Sahmkow2019-07-191-3/+2
|
* Common: Correct alignment allocator to work on C++14 or higher.Gravatar Fernando Sahmkow2019-07-191-37/+19
|
* VM_Manager: Align allocated memory to 256bytesGravatar Fernando Sahmkow2019-07-191-0/+79
| | | | | | This commit ensures that all backing memory allocated for the Guest CPU is aligned to 256 bytes. This due to how gpu memory works and the heavy constraints it has in the alignment of physical memory.
* shader_ir: Implement a new shader scannerGravatar Fernando Sahmkow2019-07-091-0/+2
|
* texture_cache: Address FeedbackGravatar Fernando Sahmkow2019-07-053-10/+22
|
* common/alignment: Address feedbackGravatar ReinUsesLisp2019-06-241-2/+3
|
* shader: Decode SUST and implement backing image functionalityGravatar ReinUsesLisp2019-06-201-0/+1
|
* texture_cache: Optimize GetMipBlockHeight and GetMipBlockDepthGravatar Fernando Sahmkow2019-06-201-0/+44
|
* video_core: Use un-shifted block sizes to avoid integer divisionsGravatar ReinUsesLisp2019-06-201-0/+5
| | | | | | | | | | | | Instead of storing all block width, height and depths in their shifted form: block_width = 1U << block_shift; Store them like they are provided by the emulated hardware (their block_shift form). This way we can avoid doing the costly Common::AlignUp operation to align texture sizes and drop CPU integer divisions with bitwise logic (defined in Common::AlignBits).
* Reduce amount of size calculations.Gravatar Fernando Sahmkow2019-06-201-0/+11
|
* common/hex_util: Reserve std::string memory ahead of timeGravatar Lioncash2019-06-121-0/+5
| | | | | | | | Avoids potentially performing multiple reallocations (depending on the size of the input data) by reserving the necessary amount of memory ahead of time. This is trivially doable, so there's no harm in it.
* common/hex_util: Combine HexVectorToString() and HexArrayToString()Gravatar Lioncash2019-06-122-11/+7
| | | | | | These can be generified together by using a concept type to designate them. This also has the benefit of not making copies of potentially very large arrays.
* cmake: Add missing shader hash file entriesGravatar ReinUsesLisp2019-06-061-0/+3
|
* common/math_util: Provide a template deduction guide for Common::RectangleGravatar Lioncash2019-05-311-0/+3
| | | | | | | | | | | | | | Allows for things such as: auto rect = Common::Rectangle{0, 0, 0, 0}; as opposed to being required to explicitly write out the underlying type, such as: auto rect = Common::Rectangle<int>{0, 0, 0, 0}; The only requirement for the deduction is that all constructor arguments be the same type.
* Merge pull request #1931 from DarkLordZach/mii-database-1Gravatar bunnei2019-05-303-0/+83
|\ | | | | mii: Implement MiiManager backend and several mii service commands
| * mii: Implement Delete and Destroy fileGravatar Zach Hilman2019-04-251-5/+6
| |
| * mii_manager: Cleanup and optimizationGravatar Zach Hilman2019-04-252-3/+5
| |
| * common: Extract UUID to its own classGravatar Zach Hilman2019-04-253-0/+80
| | | | | | Since the Mii database uses UUIDs very similar to the Accounts database, it makes no sense to not share code between them.
* | common/file_util: Remove unnecessary return at end of void StripTailDirSlashes()Gravatar Lioncash2019-05-231-6/+8
| | | | | | | | While we're at it, also invert the conditional into a guard clause.
* | common/file_util: Make GetCurrentDir() return a std::optionalGravatar Lioncash2019-05-232-3/+4
| | | | | | | | | | | | | | | | | | | | | | nullptr was being returned in the error case, which, at a glance may seem perfectly OK... until you realize that std::string has the invariant that it may not be constructed from a null pointer. This means that if this error case was ever hit, then the application would most likely crash from a thrown exception in std::string's constructor. Instead, we can change the function to return an optional value, indicating if a failure occurred.
* | common/file_util: Remove duplicated documentation commentsGravatar Lioncash2019-05-231-25/+0
| | | | | | | | | | These are already present within the header, so they don't need to be repeated in the cpp file.
* | common/file_util: Make ReadFileToString and WriteStringToFile consistentGravatar Lioncash2019-05-232-5/+5
| | | | | | | | | | | | | | | | | | | | | | Makes the parameter ordering consistent, and also makes the filename parameter a std::string. A std::string would be constructed anyways with the previous code, as IOFile's only constructor with a filepath is one taking a std::string. We can also make WriteStringToFile's string parameter utilize a std::string_view for the string, making use of our previous changes to IOFile.
* | common/file_util: Remove unnecessary c_str() callsGravatar Lioncash2019-05-231-2/+2
| | | | | | | | | | | | The file stream open functions have supported std::string overloads since C++11, so we don't need to use c_str() here. Same behavior, less code.
* | common/file_util: Make IOFile's WriteString take a std::string_viewGravatar Lioncash2019-05-231-2/+2
| | | | | | | | | | | | We don't need to force the usage of a std::string here, and can instead use a std::string_view, which allows writing out other forms of strings (e.g. C-style strings) without any unnecessary heap allocations.
* | common/zstd_compression: Remove #pragma once directive from source fileGravatar Lioncash2019-05-041-2/+0
|/ | | | | Introduced in 72477731ed20c56a4d6f18a22f43224fab667cef. This is only necessary within header files.
* common/{lz4_compression, zstd_compression}: Add missing header guardsGravatar Lioncash2019-04-152-0/+4
| | | | These two files were missing the #pragma once directive.
* Merge pull request #2391 from lioncash/scopeGravatar bunnei2019-04-121-1/+1
|\ | | | | common/scope_exit: Replace std::move with std::forward in ScopeExit()
| * common/scope_exit: Replace std::move with std::forward in ScopeExit()Gravatar Lioncash2019-04-111-1/+1
| | | | | | | | | | | | The template type here is actually a forwarding reference, not an rvalue reference in this case, so it's more appropriate to use std::forward to preserve the value category of the type being moved.
* | common/swap: Improve codegen of the default swap fallbacksGravatar Lioncash2019-04-121-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Uses arithmetic that can be identified more trivially by compilers for optimizations. e.g. Rather than shifting the halves of the value and then swapping and combining them, we can swap them in place. e.g. for the original swap32 code on x86-64, clang 8.0 would generate: mov ecx, edi rol cx, 8 shl ecx, 16 shr edi, 16 rol di, 8 movzx eax, di or eax, ecx ret while GCC 8.3 would generate the ideal: mov eax, edi bswap eax ret now both generate the same optimal output. MSVC used to generate the following with the old code: mov eax, ecx rol cx, 8 shr eax, 16 rol ax, 8 movzx ecx, cx movzx eax, ax shl ecx, 16 or eax, ecx ret 0 Now MSVC also generates a similar, but equally optimal result as clang/GCC: bswap ecx mov eax, ecx ret 0 ==== In the swap64 case, for the original code, clang 8.0 would generate: mov eax, edi bswap eax shl rax, 32 shr rdi, 32 bswap edi or rax, rdi ret (almost there, but still missing the mark) while, again, GCC 8.3 would generate the more ideal: mov rax, rdi bswap rax ret now clang also generates the optimal sequence for this fallback as well. This is a case where MSVC unfortunately falls short, despite the new code, this one still generates a doozy of an output. mov r8, rcx mov r9, rcx mov rax, 71776119061217280 mov rdx, r8 and r9, rax and edx, 65280 mov rax, rcx shr rax, 16 or r9, rax mov rax, rcx shr r9, 16 mov rcx, 280375465082880 and rax, rcx mov rcx, 1095216660480 or r9, rax mov rax, r8 and rax, rcx shr r9, 16 or r9, rax mov rcx, r8 mov rax, r8 shr r9, 8 shl rax, 16 and ecx, 16711680 or rdx, rax mov eax, -16777216 and rax, r8 shl rdx, 16 or rdx, rcx shl rdx, 16 or rax, rdx shl rax, 8 or rax, r9 ret 0 which is pretty unfortunate.
* | common/swap: Mark byte swapping free functions with [[nodiscard]] and noexceptGravatar Lioncash2019-04-111-11/+11
| | | | | | | | | | | | | | | | Allows the compiler to inform when the result of a swap function is being ignored (which is 100% a bug in all usage scenarios). We also mark them noexcept to allow other functions using them to be able to be marked as noexcept and play nicely with things that potentially inspect "nothrowability".
* | common/swap: Simplify swap function ifdefsGravatar Lioncash2019-04-111-48/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Including every OS' own built-in byte swapping functions is kind of undesirable, since it adds yet another build path to ensure compilation succeeds on. Given we only support clang, GCC, and MSVC for the time being, we can utilize their built-in functions directly instead of going through the OS's API functions. This shrinks the overall code down to just if (msvc) use msvc's functions else if (clang or gcc) use clang/gcc's builtins else use the slow path
* | common/swap: Remove 32-bit ARM pathGravatar Lioncash2019-04-111-13/+0
|/ | | | | We don't plan to support host 32-bit ARM execution environments, so this is essentially dead code.
* Merge pull request #2300 from FernandoS27/null-shaderGravatar bunnei2019-04-071-0/+18
|\ | | | | shader_cache: Permit a Null Shader in case of a bad host_ptr.
| * Permit a Null Shader in case of a bad host_ptr.Gravatar Fernando Sahmkow2019-04-071-0/+18
| |
* | Merge pull request #2098 from FreddyFunk/disk-cache-zstdGravatar bunnei2019-04-073-1/+98
|\ \ | | | | | | gl_shader_disk_cache: Use Zstandard for compression
| * | common/zstd_compression: simplify decompression interfaceGravatar unknown2019-03-292-10/+9
| | |
| * | common/zstd_compression: Add Zstandard wrapperGravatar unknown2019-03-293-0/+98
| | |
| * | common: Link libzstd_staticGravatar unknown2019-03-291-1/+1
| | |
* | | common/multi_level_queue: Silence truncation warning in iterator operator++Gravatar Lioncash2019-04-051-1/+1
| | |
* | | common/bit_util: Make CountLeading/CountTrailing functions have the same ↵Gravatar Lioncash2019-04-051-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | return types Makes the return type consistently uniform (like the intrinsics we're wrapping). This also conveniently silences a truncation warning within the kernel multi_level_queue.
* | | common/lz4_compression: Remove #pragma once directive from the cpp fileGravatar Lioncash2019-04-031-2/+0
| | | | | | | | | | | | | | | | | | | | | Introduced within 798d76f4c7018174e58702fb06a042dc8c84f0be, this only really has an effect within header files. Silences a -Wpragma-once-outside-header warning with clang.
* | | Merge pull request #2093 from FreddyFunk/disk-cache-better-compressionGravatar bunnei2019-04-033-0/+136
|\| | | | | | | | Better LZ4 compression utilization for the disk based shader cache and the yuzu build system
| * | Addressed feedbackGravatar unknown2019-03-295-81/+135
| | |
| * | gl_shader_disk_cache: Use better compression for transferable and ↵Gravatar unknown2019-03-292-8/+24
| | | | | | | | | | | | precompiled shader disk chache files
| * | data_compression: Move LZ4 compression from video_core/gl_shader_disk_cache ↵Gravatar unknown2019-03-293-0/+66
| | | | | | | | | | | | to common/data_compression
* | | general: Use deducation guides for std::lock_guard and std::unique_lockGravatar Lioncash2019-04-014-14/+14
| | | | | | | | | | | | | | | | | | | | | Since C++17, the introduction of deduction guides for locking facilities means that we no longer need to hardcode the mutex type into the locks themselves, making it easier to switch mutex types, should it ever be necessary in the future.
* | | Merge pull request #2303 from lioncash/threadGravatar bunnei2019-03-302-41/+0
|\ \ \ | |/ / |/| | common/thread: Remove unused functions