Commit graph

1236 commits

Author SHA1 Message Date
bunnei
bb966d3e33 common: common_funcs: Add useful kernel macro R_SUCCEED_IF. 2021-01-28 21:42:26 -08:00
bunnei
2fb77adb9f common: common_funcs: Add a few more useful macros for kernel code. 2021-01-28 21:42:25 -08:00
bunnei
28b822fe38
Merge pull request #5778 from ReinUsesLisp/shader-dir
renderer_opengl: Avoid precompiled cache and force NV GL cache directory
2021-01-27 11:34:21 -08:00
bunnei
1e9b1d439f
common: Add missing include to bit_util.h 2021-01-21 15:30:28 -08:00
Lioncash
6ff2db181f bit_util: Unify implementations of MostSignificantBit32/MostSignificantBit64
We can use the standardized CLZ facilities to perform this. This also
allows us to make utilizing functions constexpr and eliminate the
inclusion of an intrinsics header.
2021-01-21 04:07:58 -05:00
ReinUsesLisp
51512d01d8 renderer_opengl: Avoid precompiled cache and force NV GL cache directory
Setting __GL_SHADER_DISK_CACHE_PATH we can force the cache directory to
be in yuzu's user directory to stop commonly distributed malware from
deleting our driver shader cache. And by setting
__GL_SHADER_DISK_CACHE_SKIP_CLEANUP we can have an unbounded shader
cache size.

This has only been implemented on Windows, mostly because previous tests
didn't seem to work on Linux.

Disable the precompiled cache on Nvidia's driver. There's no need to
hide information the driver already has in its own cache.
2021-01-21 00:41:03 -03:00
bunnei
e8401964b4
Merge pull request #5360 from ReinUsesLisp/enforce-memclass-access
core: Silence Wclass-memaccess warnings and enforce it
2021-01-17 00:55:10 -08:00
bunnei
a7fd61fcce
Merge pull request #5275 from FernandoS27/fast-native-clock
X86/NativeClock: Improve performance of clock calculations on hot path.
2021-01-15 23:01:42 -08:00
bunnei
8def504d73
Merge pull request #5336 from lioncash/tree
common/tree: Convert defines over to templates
2021-01-15 21:46:25 -08:00
LC
8be9e5b48b
Merge pull request #5358 from ReinUsesLisp/rename-insert-padding
common/common_funcs: Rename INSERT_UNION_PADDING_{BYTES,WORDS} to _NOINIT
2021-01-15 16:19:46 -05:00
ReinUsesLisp
f8650a9580 core: Silence Wclass-memaccess warnings
This requires making several types trivial and properly initialize
them whenever they are called.
2021-01-15 16:31:19 -03:00
ReinUsesLisp
3ff978aa4f common/common_funcs: Rename INSERT_UNION_PADDING_{BYTES,WORDS} to _NOINIT
INSERT_PADDING_BYTES_NOINIT is more descriptive of the underlying behavior.
2021-01-15 16:27:28 -03:00
bunnei
f728a504aa
Merge pull request #5355 from lioncash/timer
common/timer: Remove
2021-01-15 09:42:33 -08:00
LC
9754a8145c
Merge pull request #5357 from ReinUsesLisp/alignment-log2
common/alignment: Rename AlignBits to AlignUpLog2 and use constraints
2021-01-15 03:12:36 -05:00
Lioncash
8620de6b20 common/bit_util: Replace CLZ/CTZ operations with standardized ones
Makes for less code that we need to maintain.
2021-01-15 02:15:32 -05:00
ReinUsesLisp
89c15dd115 common/alignment: Upgrade to use constraints instead of static asserts 2021-01-15 04:13:39 -03:00
ReinUsesLisp
fe494a0ccd common/alignment: Rename AlignBits to AlignUpLog2
AlignUpLog2 describes what the function does better than AlignBits.
2021-01-15 04:13:33 -03:00
Lioncash
91084d9396 common/timer: Remove
This is a leftover from citra and dolphin that isn't used at all,
particularly given the <chrono> header exists.
2021-01-15 01:55:33 -05:00
ReinUsesLisp
95fa57f007 common/color: Remove
This is a leftover from Citra we no longer use.
2021-01-15 03:47:43 -03:00
bunnei
0fb19e9bef
Merge pull request #5280 from FearlessTobi/port-5666
Port citra-emu/citra#5666: "Rotate previous log file to "citra_log.txt.old""
2021-01-12 22:16:57 -08:00
Lioncash
b15e1a3501 common/tree: Convert defines over to templates
Reworks the tree header to operate off of templates as opposed to a
series of defines.

This allows all tree facilities to obey namespacing rules, and also
allows this code to be used within modules once compiler support is in
place.

This also gets rid to use a macro to define functions and structs for
necessary data types. With templates, these will be generated when
they're actually used, eliminating the need for the separate
declaration.
2021-01-12 16:46:36 -05:00
Lioncash
197b5d19bc common/tree: Remove unused splay tree defines
Makes for less code to take care of.
2021-01-12 02:32:41 -05:00
Lioncash
703c57a119 common/parent_of_member: Replace TYPED_STORAGE define with template alias
Provides the same construct, but makes it obey namespacing.
2021-01-11 18:26:04 -05:00
bunnei
92d5c63f01 common: common_funcs: Add R_UNLESS macro. 2021-01-11 14:23:16 -08:00
bunnei
fb43b8efd2 common: Introduce useful tree structures. 2021-01-11 14:23:16 -08:00
ReinUsesLisp
c190586597 common/div_ceil: Return numerator type
Fixes instances where DivCeil(u32, u64) would surprisingly return u64,
instead of the more natural u32.
2021-01-09 03:16:10 -03:00
FearlessTobi
beb951770a Address review comments 2021-01-04 04:36:50 +01:00
xperia64
fd5776aac2 Delete the old log file before rotating (#5675) 2021-01-04 04:33:34 +01:00
bunnei
bf8bd60ab3 Fix the old log file to work with the log parser. 2021-01-03 01:44:52 +01:00
xperia64
f478a57737 Rotate previous log file to '.old' if it exists 2021-01-03 01:44:42 +01:00
Morph
a745d87971 general: Fix various spelling errors 2021-01-02 10:23:41 -05:00
Fernando Sahmkow
53d92318b8 X86/NativeClock: Reimplement RTDSC access to be lock free. 2021-01-02 04:00:27 +01:00
Fernando Sahmkow
d4f871cb6a X86/NativeClock: Improve performance of clock calculations on hot path. 2021-01-02 00:43:47 +01:00
MerryMage
6d30745d77 memory: Remove MemoryHook 2021-01-01 11:34:38 +00:00
bunnei
eb318ffffc
Merge pull request #5249 from ReinUsesLisp/lock-free-pages
core/memory: Read and write page table atomically
2021-01-01 02:54:01 -08:00
bunnei
25d607f5f6
Merge pull request #5208 from bunnei/service-threads
Service threads
2020-12-30 22:06:05 -08:00
ReinUsesLisp
b3587102d1 core/memory: Read and write page table atomically
Squash attributes into the pointer's integer, making them an uintptr_t
pair containing 2 bits at the bottom and then the pointer. These bits
are currently unused thanks to alignment requirements.

Configure Dynarmic to mask out these bits on pointer reads.

While we are at it, remove some unused attributes carried over from
Citra.

Read/Write and other hot functions use a two step unpacking process that
is less readable to stop MSVC from emitting an extra AND instruction in
the hot path:

 mov         rdi,rcx
 shr         rdx,0Ch
 mov         r8,qword ptr [rax+8]
 mov         rax,qword ptr [r8+rdx*8]
 mov         rdx,rax
-and         al,3
 and         rdx,0FFFFFFFFFFFFFFFCh
 je          Core::Memory::Memory::Impl::Read<unsigned char>
 mov         rax,qword ptr [vaddr]
 movzx       eax,byte ptr [rdx+rax]
2020-12-29 21:54:49 -03:00
bunnei
69e82d01d5 common: ThreadWorker: Add class to help do asynchronous work. 2020-12-29 16:46:29 -08:00
comex
388cf58b31 k_priority_queue: Fix concepts use
- For `std::same_as`, add missing include of `<concepts>`.

- For `std::convertible_to`, create a replacement in `common/concepts.h`
  and use that instead.

  This would also be found in `<concepts>`, but unlike `std::same_as`,
  `std::convertible_to` is not yet implemented in libc++, LLVM's STL
  implementation - not even in master.  (In fact, `std::same_as` is the
  *only* concept currently implemented.  For some reason.)
2020-12-29 14:33:41 -05:00
bunnei
1279c7ce7a
Merge pull request #5131 from bunnei/scheduler-rewrite
Rewrite Kernel scheduler based on Atmosphere
2020-12-20 20:57:54 -08:00
lat9nq
292dd642ce cmake: Fix generating CMake configs and linking with Boost
Fixes regression by 761206cf81, causing
yuzu to not build on Linux with any version of Boost except a cached
1.73 Conan version from before about a day ago.

Moves the Boost requirement out of the `REQUIRED_LIBS` psuedo-2D-array
for Conan to instead be manually configured, using Conan as a fallback
solution if the system does not meet our requirements.

Requires any update from the linux-fresh container in order to build.

**DO NOT MERGE** until someone with the MSVC toolchain can verify this
works there, too.
2020-12-13 01:28:51 -05:00
bunnei
761206cf81
common: Update CMakeList to fix build issue with Boost. 2020-12-12 11:50:07 -08:00
Morph
4de079b256 Revert "Merge pull request #5173 from lioncash/common-fs"
This reverts commit ce5fcb6bb2, reversing
changes made to 6f41763061.
2020-12-11 20:24:22 -05:00
Morph
8941cdb7d2 Revert "Merge pull request #5174 from ReinUsesLisp/fs-fix"
This reverts commit 5fe55b16a1, reversing
changes made to e94dd7e2c4.
2020-12-11 20:24:22 -05:00
Morph
0195038c07 Revert "Merge pull request #5179 from ReinUsesLisp/fs-path"
This reverts commit 4e94d0d53a, reversing
changes made to 6d6115475b.
2020-12-11 20:21:46 -05:00
Morph
ac3ec5ed13 Revert "Merge pull request #5181 from Morph1984/5174-review"
This reverts commit cdb36aef9e, reversing
changes made to 5e9b77129f.
2020-12-11 20:21:21 -05:00
Morph
ec8548b414 common/file_util: Simplify the behavior of CreateFullPath 2020-12-09 19:28:11 -05:00
ReinUsesLisp
bab9cae71f common/file_util: Let std::filesystem cast from UTF16 to std::string
Fix invalid encoding paths when iterating over a directory on Windows.
2020-12-09 18:52:36 -03:00
ReinUsesLisp
5329834376 common/file_util: Fix and deprecate CreateFullPath, add CreateDirs
Fix CreateFullPath to have its intended previous behavior (whatever
that was), and deprecate it in favor of the new CreateDirs function.

Unlike CreateDir, CreateDirs is marked as [[nodiscard]] to avoid new
code ignoring its result value.
2020-12-09 05:42:03 -03:00
ReinUsesLisp
52f13f2339 common/file_util: Succeed on CreateDir when the directory exists 2020-12-09 05:21:08 -03:00
Lioncash
20aad9e01a file_util: Migrate remaining file handling functions over to std::filesystem
Converts creation and deletion functions over to std::filesystem,
simplifying our file-handling code.

Notably with this, CopyDir will now function on Windows.
2020-12-09 01:24:05 -05:00
Lioncash
0e54aa17e6 file_util: Migrate Exists() and IsDirectory() over to std::filesystem
Greatly simplifies our file-handling code for these functions.
2020-12-08 18:36:53 -05:00
LC
69af6ada2f
Merge pull request #5136 from lioncash/video-shadow3
video_core: Resolve more variable shadowing scenarios pt.3
2020-12-07 00:06:53 -05:00
bunnei
d2c0c94f0b common: BitSet: Various style fixes based on code review feedback. 2020-12-06 00:27:13 -08:00
bunnei
8d3e06349e hle: kernel: Separate KScheduler from GlobalSchedulerContext class. 2020-12-06 00:03:24 -08:00
bunnei
8dbfa4e1a4 common: Port BitSet from Mesosphere. 2020-12-06 00:03:24 -08:00
Lioncash
f95602f152 video_core: Resolve more variable shadowing scenarios pt.3
Cleans out the rest of the occurrences of variable shadowing and makes
any further occurrences of shadowing compiler errors.
2020-12-05 16:02:23 -05:00
Lioncash
2c375013dd xbyak_abi: Shorten std::size_t to size_t
Makes for less reading.
2020-12-05 00:43:55 -05:00
Lioncash
b126267442 xbyak_abi: Avoid implicit sign conversions 2020-12-05 00:43:41 -05:00
bunnei
69aaad9b96
Merge pull request #4996 from bunnei/use-4jits
Kernel: Refactor to use 4-instances of Dynarmic & various cleanups and improvements
2020-12-03 15:32:45 -08:00
bunnei
88089c8754
Merge pull request #5000 from lioncash/audio-error
audio_core: Make shadowing and unused parameters errors
2020-12-02 23:08:43 -08:00
Lioncash
1ea6bdef05 audio_core: Make shadowing and unused parameters errors
Moves the audio code closer to enabling warnings as errors in general.
2020-12-03 00:54:31 -05:00
bunnei
24cae76d16 common: fiber: Use VirtualBuffer for stack memory.
- This will be aligned by default, and helps memory usage.
2020-11-29 01:31:52 -08:00
bunnei
c042a89113 common: fiber: Use boost::context instead of native fibers on Windows. 2020-11-29 01:31:51 -08:00
ReinUsesLisp
630823e363 common: Add Common::DivCeil and Common::DivCeilLog2
Add an equivalent to 'Common::AlignUp(n, d) / d' and a log2 alternative.
2020-11-25 23:37:56 -03:00
bunnei
5d1447897a
Merge pull request #4451 from slashiee/extended-logging
logging/settings: Increase maximum log size to 100 MB and add extended logging option
2020-11-23 13:34:15 -08:00
bunnei
c47c3d723f
Merge pull request #4951 from bunnei/olsc-stub
hle: service: Stub OLSC Initialize and SetSaveDataBackupSettingEnabled functions.
2020-11-20 14:06:37 -08:00
ReinUsesLisp
3f2e605dd1 common/bit_cast: Add function matching std::bit_cast without constexpr
Add a std::bit_cast-like function archiving the same runtime results as
the standard function, without compile time support.

This allows us to use bit_cast while we wait for compiler support, it
can be trivially replaced in the future.
2020-11-20 01:52:37 -03:00
bunnei
6e37676482 hle: service: Stub OLSC Initialize and SetSaveDataBackupSettingEnabled functions.
- Used by Animal Cross: New Horizons v1.6.0 update, minimal stub gets this update working.
2020-11-19 12:36:09 -08:00
Lioncash
412044960a virtual_buffer: Do nothing on resize() calls with same sizes
Prevents us from churning memory by freeing and reallocating a memory
block that would have already been adequate as is.
2020-11-19 07:54:03 -05:00
Lioncash
0ca91ced2d virtual_buffer: Add compile-time type-safety guarantees with VirtualBuffer
VirtualBuffer makes use of VirtualAlloc (on Windows) and mmap() (on
other platforms). Neither of these ensure that non-trivial objects are
properly constructed in the allocated memory.

To prevent potential undefined behavior occurring due to that, we can
add a static assert to loudly complain about cases where that is done.
2020-11-17 20:09:58 -05:00
Lioncash
b3c8997829 page_table: Allow page tables to be moved
Makes page tables and virtual buffers able to be moved, but not copied,
making the interface more flexible.

Previously, with the destructor specified, but no move assignment or
constructor specified, they wouldn't be implicitly generated.
2020-11-17 20:08:20 -05:00
Lioncash
3cfd962ef4 page_table: Add missing doxygen parameters to Resize()
Resolves two -Wdocumentation warnings.
2020-11-17 19:45:20 -05:00
Lioncash
0890451c55 page_table: Remove unnecessary header inclusions
Prevents indirect inclusions for these headers.
2020-11-17 19:43:27 -05:00
Lioncash
00fb79b2f3 common/fiber: Move all member variables into impl class
Hides all of the implementation details for users of the class. This has
the benefit of reducing includes and also making the fiber classes
movable again.
2020-11-06 20:36:32 -05:00
Lioncash
6f006d051e General: Fix clang build
Allows building on clang to work again
2020-11-05 10:07:16 -05:00
Lioncash
4a4b685a04 common: Enable warnings as errors
Cleans up common so that we can enable warnings as errors.
2020-11-02 15:50:58 -05:00
bunnei
8aa9ae5ba5
Merge pull request #4868 from lioncash/discard-error
General: Make ignoring a discarded return value an error
2020-10-30 00:35:40 -07:00
Lioncash
26547d3e3b General: Make ignoring a discarded return value an error
Allows our CI to catch more potential bugs. This also removes the
[[nodiscard]] attribute of IOFile's Open member function. There are
cases where a file may want to be opened, but have the status of it
checked at a later time.
2020-10-30 00:13:21 -04:00
Lioncash
8049b8beb6 common/stream: Be explicit with copy and move operators 2020-10-29 22:57:35 -04:00
ReinUsesLisp
cdb2480d39 common/fiber: Take shared_ptr<Fiber> by copy in YieldTo
YieldTo does not intend to modify the passed shared_ptrs.
Pass it by copy to keep a reference count while this function executes.
2020-10-28 02:02:44 -03:00
ameerj
eb67a45ca8 video_core: NVDEC Implementation
This commit aims to implement the NVDEC (Nvidia Decoder) functionality, with video frame decoding being handled by the FFmpeg library.

The process begins with Ioctl commands being sent to the NVDEC and VIC (Video Image Composer) emulated devices. These allocate the necessary GPU buffers for the frame data, along with providing information on the incoming video data. A Submit command then signals the GPU to process and decode the frame data.

To decode the frame, the respective codec's header must be manually composed from the information provided by NVDEC, then sent with the raw frame data to the ffmpeg library.

Currently, H264 and VP9 are supported, with VP9 having some minor artifacting issues related mainly to the reference frame composition in its uncompressed header.

Async GPU is not properly implemented at the moment.

Co-Authored-By: David <25727384+ogniK5377@users.noreply.github.com>
2020-10-26 23:07:36 -04:00
Lioncash
ea20b5c970 core: Fix clang build pt.3
Should finally resolve building with clang.
2020-10-21 22:14:23 -04:00
bunnei
3d592972dc
Revert "core: Fix clang build" 2020-10-20 19:07:39 -07:00
LC
88d5140cf2
Merge pull request #4796 from lioncash/clang
core: Fix clang build
2020-10-20 19:19:12 -04:00
Lioncash
be1954e04c core: Fix clang build
Recent changes to the build system that made more warnings be flagged as
errors caused building via clang to break.

Fixes #4795
2020-10-17 19:50:39 -04:00
Lioncash
046c0c91a3 input_common/CMakeLists: Make some warnings errors
Makes the input_common code warnings consistent with the rest of the
codebase.
2020-10-15 19:37:51 -04:00
Lioncash
39c8d18feb core/CMakeLists: Make some warnings errors
Makes our error coverage a little more consistent across the board by
applying it to Linux side of things as well. This also makes it more
consistent with the warning settings in other libraries in the project.

This also updates httplib to 0.7.9, as there are several warning
cleanups made that allow us to enable several warnings as errors.
2020-10-13 13:16:49 -04:00
bunnei
3446eb79b5
Merge pull request #4731 from lat9nq/mingw-zstd-fix
common: Use system zstd on Linux
2020-10-07 17:57:14 -07:00
ReinUsesLisp
771a9c21cc common/wall_clock: Add virtual destructors
From -fsanitize=address, this code wasn't calling the proper destructor.
Adding virtual destructors for each inherited class and the base class
fixes this bug.

While we are at it, mark the functions as final.
2020-09-30 02:53:34 -03:00
lat9nq
2cbce77b92 CMakeLists: use system zstd on Linux
From what I understand, this tells CMake to use the system, not conan,
version of zstd. Required to build on the coming MinGW Docker container.
2020-09-28 21:11:39 -04:00
lat9nq
9d665cb8db CMakeLists: fix for finding zstd on linux-mingw 2020-09-28 20:28:47 -04:00
bunnei
94a25b75a0
Merge pull request #4611 from lioncash/xbyak2
externals: Update Xbyak to 5.96
2020-09-03 20:24:27 -04:00
bunnei
40c230e0fa
Merge pull request #4578 from lioncash/xor
common_funcs: Add missing XOR operators to DECLARE_ENUM_FLAG_OPERATORS
2020-09-03 17:11:51 -04:00
Morph
45ecd601be input_common/motion_input: Make use of Common::PI constant
Also amend the copyright notice to yuzu's instead of Dolphin's, which was mistakenly copy-pasted from another file.
2020-09-02 11:58:15 -04:00
bunnei
f64917a852
Merge pull request #4570 from german77/motionInput
input_common: Add a basic class for motion devices
2020-09-02 11:09:18 -04:00
bunnei
ad9ce67b52
Merge pull request #4588 from ReinUsesLisp/tsan-event
common/thread: Fix data race in is_set
2020-08-31 21:21:38 -04:00
LC
b5ed2d408c
Merge pull request #4461 from comex/thread-names
Fix thread naming on Linux, which limits names to 15 bytes.
2020-08-31 15:31:48 -04:00
Lioncash
a5dcccfdd2 externals: Update Xbyak to 5.96
I made a request on the Xbyak issue tracker to allow some constructors
to be constexpr in order to avoid static constructors from needing to
execute for some of our register constants.

This request was implemented, so this updates Xbyak so that we can make
use of it.
2020-08-30 05:09:48 -04:00
german
2d207ec609 Implement a basic class for motion devices 2020-08-27 17:19:21 -05:00