diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/arm/arm_interface.h | 4 | ||||
| -rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic.cpp | 8 | ||||
| -rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic.h | 2 | ||||
| -rw-r--r-- | src/core/arm/unicorn/arm_unicorn.cpp | 10 | ||||
| -rw-r--r-- | src/core/arm/unicorn/arm_unicorn.h | 2 | ||||
| -rw-r--r-- | src/core/file_sys/errors.h | 16 | ||||
| -rw-r--r-- | src/core/file_sys/vfs.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/vfs.h | 27 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_offset.cpp | 5 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_offset.h | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.h | 9 | ||||
| -rw-r--r-- | src/tests/core/arm/arm_test_common.cpp | 9 | ||||
| -rw-r--r-- | src/tests/core/arm/arm_test_common.h | 7 | ||||
| -rw-r--r-- | src/video_core/gpu.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/gpu.h | 9 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_manager.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_manager.h | 1 | ||||
| -rw-r--r-- | src/yuzu/debugger/graphics/graphics_surface.cpp | 6 |
21 files changed, 94 insertions, 50 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index 8416e73b0..28a99defe 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h | |||
| @@ -104,6 +104,10 @@ public: | |||
| 104 | 104 | ||
| 105 | virtual void SetTlsAddress(VAddr address) = 0; | 105 | virtual void SetTlsAddress(VAddr address) = 0; |
| 106 | 106 | ||
| 107 | virtual u64 GetTPIDR_EL0() const = 0; | ||
| 108 | |||
| 109 | virtual void SetTPIDR_EL0(u64 value) = 0; | ||
| 110 | |||
| 107 | /** | 111 | /** |
| 108 | * Saves the current CPU context | 112 | * Saves the current CPU context |
| 109 | * @param ctx Thread context to save | 113 | * @param ctx Thread context to save |
diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index 3572ee7b9..df47d5ee8 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp | |||
| @@ -196,6 +196,14 @@ void ARM_Dynarmic::SetTlsAddress(u64 address) { | |||
| 196 | cb->tpidrro_el0 = address; | 196 | cb->tpidrro_el0 = address; |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | u64 ARM_Dynarmic::GetTPIDR_EL0() const { | ||
| 200 | return cb->tpidr_el0; | ||
| 201 | } | ||
| 202 | |||
| 203 | void ARM_Dynarmic::SetTPIDR_EL0(u64 value) { | ||
| 204 | cb->tpidr_el0 = value; | ||
| 205 | } | ||
| 206 | |||
| 199 | void ARM_Dynarmic::SaveContext(ARM_Interface::ThreadContext& ctx) { | 207 | void ARM_Dynarmic::SaveContext(ARM_Interface::ThreadContext& ctx) { |
| 200 | ctx.cpu_registers = jit->GetRegisters(); | 208 | ctx.cpu_registers = jit->GetRegisters(); |
| 201 | ctx.sp = jit->GetSP(); | 209 | ctx.sp = jit->GetSP(); |
diff --git a/src/core/arm/dynarmic/arm_dynarmic.h b/src/core/arm/dynarmic/arm_dynarmic.h index ed724c3f1..a9891ac4f 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.h +++ b/src/core/arm/dynarmic/arm_dynarmic.h | |||
| @@ -34,6 +34,8 @@ public: | |||
| 34 | void SetCPSR(u32 cpsr) override; | 34 | void SetCPSR(u32 cpsr) override; |
| 35 | VAddr GetTlsAddress() const override; | 35 | VAddr GetTlsAddress() const override; |
| 36 | void SetTlsAddress(VAddr address) override; | 36 | void SetTlsAddress(VAddr address) override; |
| 37 | void SetTPIDR_EL0(u64 value) override; | ||
| 38 | u64 GetTPIDR_EL0() const override; | ||
| 37 | 39 | ||
| 38 | void SaveContext(ThreadContext& ctx) override; | 40 | void SaveContext(ThreadContext& ctx) override; |
| 39 | void LoadContext(const ThreadContext& ctx) override; | 41 | void LoadContext(const ThreadContext& ctx) override; |
diff --git a/src/core/arm/unicorn/arm_unicorn.cpp b/src/core/arm/unicorn/arm_unicorn.cpp index d2d699e9b..44a46bf04 100644 --- a/src/core/arm/unicorn/arm_unicorn.cpp +++ b/src/core/arm/unicorn/arm_unicorn.cpp | |||
| @@ -169,6 +169,16 @@ void ARM_Unicorn::SetTlsAddress(VAddr base) { | |||
| 169 | CHECKED(uc_reg_write(uc, UC_ARM64_REG_TPIDRRO_EL0, &base)); | 169 | CHECKED(uc_reg_write(uc, UC_ARM64_REG_TPIDRRO_EL0, &base)); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | u64 ARM_Unicorn::GetTPIDR_EL0() const { | ||
| 173 | u64 value{}; | ||
| 174 | CHECKED(uc_reg_read(uc, UC_ARM64_REG_TPIDR_EL0, &value)); | ||
| 175 | return value; | ||
| 176 | } | ||
| 177 | |||
| 178 | void ARM_Unicorn::SetTPIDR_EL0(u64 value) { | ||
| 179 | CHECKED(uc_reg_write(uc, UC_ARM64_REG_TPIDR_EL0, &value)); | ||
| 180 | } | ||
| 181 | |||
| 172 | void ARM_Unicorn::Run() { | 182 | void ARM_Unicorn::Run() { |
| 173 | if (GDBStub::IsServerEnabled()) { | 183 | if (GDBStub::IsServerEnabled()) { |
| 174 | ExecuteInstructions(std::max(4000000, 0)); | 184 | ExecuteInstructions(std::max(4000000, 0)); |
diff --git a/src/core/arm/unicorn/arm_unicorn.h b/src/core/arm/unicorn/arm_unicorn.h index a78a0acf2..af7943352 100644 --- a/src/core/arm/unicorn/arm_unicorn.h +++ b/src/core/arm/unicorn/arm_unicorn.h | |||
| @@ -28,6 +28,8 @@ public: | |||
| 28 | void SetCPSR(u32 cpsr) override; | 28 | void SetCPSR(u32 cpsr) override; |
| 29 | VAddr GetTlsAddress() const override; | 29 | VAddr GetTlsAddress() const override; |
| 30 | void SetTlsAddress(VAddr address) override; | 30 | void SetTlsAddress(VAddr address) override; |
| 31 | void SetTPIDR_EL0(u64 value) override; | ||
| 32 | u64 GetTPIDR_EL0() const override; | ||
| 31 | void SaveContext(ThreadContext& ctx) override; | 33 | void SaveContext(ThreadContext& ctx) override; |
| 32 | void LoadContext(const ThreadContext& ctx) override; | 34 | void LoadContext(const ThreadContext& ctx) override; |
| 33 | void PrepareReschedule() override; | 35 | void PrepareReschedule() override; |
diff --git a/src/core/file_sys/errors.h b/src/core/file_sys/errors.h index a152dbd33..fea0593c7 100644 --- a/src/core/file_sys/errors.h +++ b/src/core/file_sys/errors.h | |||
| @@ -20,13 +20,13 @@ enum { | |||
| 20 | constexpr ResultCode ERROR_PATH_NOT_FOUND(ErrorModule::FS, ErrCodes::NotFound); | 20 | constexpr ResultCode ERROR_PATH_NOT_FOUND(ErrorModule::FS, ErrCodes::NotFound); |
| 21 | 21 | ||
| 22 | // TODO(bunnei): Replace these with correct errors for Switch OS | 22 | // TODO(bunnei): Replace these with correct errors for Switch OS |
| 23 | constexpr ResultCode ERROR_INVALID_PATH(ResultCode(-1)); | 23 | constexpr ResultCode ERROR_INVALID_PATH(-1); |
| 24 | constexpr ResultCode ERROR_UNSUPPORTED_OPEN_FLAGS(ResultCode(-1)); | 24 | constexpr ResultCode ERROR_UNSUPPORTED_OPEN_FLAGS(-1); |
| 25 | constexpr ResultCode ERROR_INVALID_OPEN_FLAGS(ResultCode(-1)); | 25 | constexpr ResultCode ERROR_INVALID_OPEN_FLAGS(-1); |
| 26 | constexpr ResultCode ERROR_FILE_NOT_FOUND(ResultCode(-1)); | 26 | constexpr ResultCode ERROR_FILE_NOT_FOUND(-1); |
| 27 | constexpr ResultCode ERROR_UNEXPECTED_FILE_OR_DIRECTORY(ResultCode(-1)); | 27 | constexpr ResultCode ERROR_UNEXPECTED_FILE_OR_DIRECTORY(-1); |
| 28 | constexpr ResultCode ERROR_DIRECTORY_ALREADY_EXISTS(ResultCode(-1)); | 28 | constexpr ResultCode ERROR_DIRECTORY_ALREADY_EXISTS(-1); |
| 29 | constexpr ResultCode ERROR_FILE_ALREADY_EXISTS(ResultCode(-1)); | 29 | constexpr ResultCode ERROR_FILE_ALREADY_EXISTS(-1); |
| 30 | constexpr ResultCode ERROR_DIRECTORY_NOT_EMPTY(ResultCode(-1)); | 30 | constexpr ResultCode ERROR_DIRECTORY_NOT_EMPTY(-1); |
| 31 | 31 | ||
| 32 | } // namespace FileSys | 32 | } // namespace FileSys |
diff --git a/src/core/file_sys/vfs.cpp b/src/core/file_sys/vfs.cpp index 16c8ad90b..3f690f12a 100644 --- a/src/core/file_sys/vfs.cpp +++ b/src/core/file_sys/vfs.cpp | |||
| @@ -42,7 +42,7 @@ bool VfsFile::WriteByte(u8 data, size_t offset) { | |||
| 42 | return Write(&data, 1, offset) == 1; | 42 | return Write(&data, 1, offset) == 1; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | size_t VfsFile::WriteBytes(std::vector<u8> data, size_t offset) { | 45 | size_t VfsFile::WriteBytes(const std::vector<u8>& data, size_t offset) { |
| 46 | return Write(data.data(), data.size(), offset); | 46 | return Write(data.data(), data.size(), offset); |
| 47 | } | 47 | } |
| 48 | 48 | ||
diff --git a/src/core/file_sys/vfs.h b/src/core/file_sys/vfs.h index a5213e0cc..db3c77eac 100644 --- a/src/core/file_sys/vfs.h +++ b/src/core/file_sys/vfs.h | |||
| @@ -59,8 +59,7 @@ struct VfsFile : NonCopyable { | |||
| 59 | // Returns the number of bytes (sizeof(T)*number_elements) read successfully. | 59 | // Returns the number of bytes (sizeof(T)*number_elements) read successfully. |
| 60 | template <typename T> | 60 | template <typename T> |
| 61 | size_t ReadArray(T* data, size_t number_elements, size_t offset = 0) const { | 61 | size_t ReadArray(T* data, size_t number_elements, size_t offset = 0) const { |
| 62 | static_assert(std::is_trivially_copyable<T>::value, | 62 | static_assert(std::is_trivially_copyable_v<T>, "Data type must be trivially copyable."); |
| 63 | "Data type must be trivially copyable."); | ||
| 64 | 63 | ||
| 65 | return Read(reinterpret_cast<u8*>(data), number_elements * sizeof(T), offset); | 64 | return Read(reinterpret_cast<u8*>(data), number_elements * sizeof(T), offset); |
| 66 | } | 65 | } |
| @@ -69,8 +68,7 @@ struct VfsFile : NonCopyable { | |||
| 69 | // Returns the number of bytes read successfully. | 68 | // Returns the number of bytes read successfully. |
| 70 | template <typename T> | 69 | template <typename T> |
| 71 | size_t ReadBytes(T* data, size_t size, size_t offset = 0) const { | 70 | size_t ReadBytes(T* data, size_t size, size_t offset = 0) const { |
| 72 | static_assert(std::is_trivially_copyable<T>::value, | 71 | static_assert(std::is_trivially_copyable_v<T>, "Data type must be trivially copyable."); |
| 73 | "Data type must be trivially copyable."); | ||
| 74 | return Read(reinterpret_cast<u8*>(data), size, offset); | 72 | return Read(reinterpret_cast<u8*>(data), size, offset); |
| 75 | } | 73 | } |
| 76 | 74 | ||
| @@ -78,8 +76,7 @@ struct VfsFile : NonCopyable { | |||
| 78 | // Returns the number of bytes read successfully (sizeof(T)). | 76 | // Returns the number of bytes read successfully (sizeof(T)). |
| 79 | template <typename T> | 77 | template <typename T> |
| 80 | size_t ReadObject(T* data, size_t offset = 0) const { | 78 | size_t ReadObject(T* data, size_t offset = 0) const { |
| 81 | static_assert(std::is_trivially_copyable<T>::value, | 79 | static_assert(std::is_trivially_copyable_v<T>, "Data type must be trivially copyable."); |
| 82 | "Data type must be trivially copyable."); | ||
| 83 | return Read(reinterpret_cast<u8*>(data), sizeof(T), offset); | 80 | return Read(reinterpret_cast<u8*>(data), sizeof(T), offset); |
| 84 | } | 81 | } |
| 85 | 82 | ||
| @@ -88,33 +85,29 @@ struct VfsFile : NonCopyable { | |||
| 88 | virtual bool WriteByte(u8 data, size_t offset = 0); | 85 | virtual bool WriteByte(u8 data, size_t offset = 0); |
| 89 | // Writes a vector of bytes to offset in file and returns the number of bytes successfully | 86 | // Writes a vector of bytes to offset in file and returns the number of bytes successfully |
| 90 | // written. | 87 | // written. |
| 91 | virtual size_t WriteBytes(std::vector<u8> data, size_t offset = 0); | 88 | virtual size_t WriteBytes(const std::vector<u8>& data, size_t offset = 0); |
| 92 | 89 | ||
| 93 | // Writes an array of type T, size number_elements to offset in file. | 90 | // Writes an array of type T, size number_elements to offset in file. |
| 94 | // Returns the number of bytes (sizeof(T)*number_elements) written successfully. | 91 | // Returns the number of bytes (sizeof(T)*number_elements) written successfully. |
| 95 | template <typename T> | 92 | template <typename T> |
| 96 | size_t WriteArray(T* data, size_t number_elements, size_t offset = 0) { | 93 | size_t WriteArray(const T* data, size_t number_elements, size_t offset = 0) { |
| 97 | static_assert(std::is_trivially_copyable<T>::value, | 94 | static_assert(std::is_trivially_copyable_v<T>, "Data type must be trivially copyable."); |
| 98 | "Data type must be trivially copyable."); | ||
| 99 | |||
| 100 | return Write(data, number_elements * sizeof(T), offset); | 95 | return Write(data, number_elements * sizeof(T), offset); |
| 101 | } | 96 | } |
| 102 | 97 | ||
| 103 | // Writes size bytes starting at memory location data to offset in file. | 98 | // Writes size bytes starting at memory location data to offset in file. |
| 104 | // Returns the number of bytes written successfully. | 99 | // Returns the number of bytes written successfully. |
| 105 | template <typename T> | 100 | template <typename T> |
| 106 | size_t WriteBytes(T* data, size_t size, size_t offset = 0) { | 101 | size_t WriteBytes(const T* data, size_t size, size_t offset = 0) { |
| 107 | static_assert(std::is_trivially_copyable<T>::value, | 102 | static_assert(std::is_trivially_copyable_v<T>, "Data type must be trivially copyable."); |
| 108 | "Data type must be trivially copyable."); | 103 | return Write(reinterpret_cast<const u8*>(data), size, offset); |
| 109 | return Write(reinterpret_cast<u8*>(data), size, offset); | ||
| 110 | } | 104 | } |
| 111 | 105 | ||
| 112 | // Writes one object of type T to offset in file. | 106 | // Writes one object of type T to offset in file. |
| 113 | // Returns the number of bytes written successfully (sizeof(T)). | 107 | // Returns the number of bytes written successfully (sizeof(T)). |
| 114 | template <typename T> | 108 | template <typename T> |
| 115 | size_t WriteObject(const T& data, size_t offset = 0) { | 109 | size_t WriteObject(const T& data, size_t offset = 0) { |
| 116 | static_assert(std::is_trivially_copyable<T>::value, | 110 | static_assert(std::is_trivially_copyable_v<T>, "Data type must be trivially copyable."); |
| 117 | "Data type must be trivially copyable."); | ||
| 118 | return Write(&data, sizeof(T), offset); | 111 | return Write(&data, sizeof(T), offset); |
| 119 | } | 112 | } |
| 120 | 113 | ||
diff --git a/src/core/file_sys/vfs_offset.cpp b/src/core/file_sys/vfs_offset.cpp index 31fdd9aa1..217e02235 100644 --- a/src/core/file_sys/vfs_offset.cpp +++ b/src/core/file_sys/vfs_offset.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | ||
| 5 | #include <utility> | 6 | #include <utility> |
| 6 | 7 | ||
| 7 | #include "core/file_sys/vfs_offset.h" | 8 | #include "core/file_sys/vfs_offset.h" |
| @@ -75,7 +76,7 @@ bool OffsetVfsFile::WriteByte(u8 data, size_t r_offset) { | |||
| 75 | return false; | 76 | return false; |
| 76 | } | 77 | } |
| 77 | 78 | ||
| 78 | size_t OffsetVfsFile::WriteBytes(std::vector<u8> data, size_t r_offset) { | 79 | size_t OffsetVfsFile::WriteBytes(const std::vector<u8>& data, size_t r_offset) { |
| 79 | return file->Write(data.data(), TrimToFit(data.size(), r_offset), offset + r_offset); | 80 | return file->Write(data.data(), TrimToFit(data.size(), r_offset), offset + r_offset); |
| 80 | } | 81 | } |
| 81 | 82 | ||
| @@ -88,7 +89,7 @@ size_t OffsetVfsFile::GetOffset() const { | |||
| 88 | } | 89 | } |
| 89 | 90 | ||
| 90 | size_t OffsetVfsFile::TrimToFit(size_t r_size, size_t r_offset) const { | 91 | size_t OffsetVfsFile::TrimToFit(size_t r_size, size_t r_offset) const { |
| 91 | return std::max<size_t>(std::min<size_t>(size - r_offset, r_size), 0); | 92 | return std::clamp(r_size, size_t{0}, size - r_offset); |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 94 | } // namespace FileSys | 95 | } // namespace FileSys |
diff --git a/src/core/file_sys/vfs_offset.h b/src/core/file_sys/vfs_offset.h index 2e16e47eb..ded4827f5 100644 --- a/src/core/file_sys/vfs_offset.h +++ b/src/core/file_sys/vfs_offset.h | |||
| @@ -28,7 +28,7 @@ struct OffsetVfsFile : public VfsFile { | |||
| 28 | std::vector<u8> ReadBytes(size_t size, size_t offset) const override; | 28 | std::vector<u8> ReadBytes(size_t size, size_t offset) const override; |
| 29 | std::vector<u8> ReadAllBytes() const override; | 29 | std::vector<u8> ReadAllBytes() const override; |
| 30 | bool WriteByte(u8 data, size_t offset) override; | 30 | bool WriteByte(u8 data, size_t offset) override; |
| 31 | size_t WriteBytes(std::vector<u8> data, size_t offset) override; | 31 | size_t WriteBytes(const std::vector<u8>& data, size_t offset) override; |
| 32 | 32 | ||
| 33 | bool Rename(const std::string& name) override; | 33 | bool Rename(const std::string& name) override; |
| 34 | 34 | ||
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index f7e25cbf5..e307eec98 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp | |||
| @@ -56,6 +56,8 @@ void Scheduler::SwitchContext(Thread* new_thread) { | |||
| 56 | if (previous_thread) { | 56 | if (previous_thread) { |
| 57 | previous_thread->last_running_ticks = CoreTiming::GetTicks(); | 57 | previous_thread->last_running_ticks = CoreTiming::GetTicks(); |
| 58 | cpu_core->SaveContext(previous_thread->context); | 58 | cpu_core->SaveContext(previous_thread->context); |
| 59 | // Save the TPIDR_EL0 system register in case it was modified. | ||
| 60 | previous_thread->tpidr_el0 = cpu_core->GetTPIDR_EL0(); | ||
| 59 | 61 | ||
| 60 | if (previous_thread->status == ThreadStatus::Running) { | 62 | if (previous_thread->status == ThreadStatus::Running) { |
| 61 | // This is only the case when a reschedule is triggered without the current thread | 63 | // This is only the case when a reschedule is triggered without the current thread |
| @@ -87,6 +89,7 @@ void Scheduler::SwitchContext(Thread* new_thread) { | |||
| 87 | 89 | ||
| 88 | cpu_core->LoadContext(new_thread->context); | 90 | cpu_core->LoadContext(new_thread->context); |
| 89 | cpu_core->SetTlsAddress(new_thread->GetTLSAddress()); | 91 | cpu_core->SetTlsAddress(new_thread->GetTLSAddress()); |
| 92 | cpu_core->SetTPIDR_EL0(new_thread->GetTPIDR_EL0()); | ||
| 90 | cpu_core->ClearExclusiveState(); | 93 | cpu_core->ClearExclusiveState(); |
| 91 | } else { | 94 | } else { |
| 92 | current_thread = nullptr; | 95 | current_thread = nullptr; |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 53f2e861e..cd85c4b7c 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -312,6 +312,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, | |||
| 312 | thread->status = ThreadStatus::Dormant; | 312 | thread->status = ThreadStatus::Dormant; |
| 313 | thread->entry_point = entry_point; | 313 | thread->entry_point = entry_point; |
| 314 | thread->stack_top = stack_top; | 314 | thread->stack_top = stack_top; |
| 315 | thread->tpidr_el0 = 0; | ||
| 315 | thread->nominal_priority = thread->current_priority = priority; | 316 | thread->nominal_priority = thread->current_priority = priority; |
| 316 | thread->last_running_ticks = CoreTiming::GetTicks(); | 317 | thread->last_running_ticks = CoreTiming::GetTicks(); |
| 317 | thread->processor_id = processor_id; | 318 | thread->processor_id = processor_id; |
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 47881ec20..6218960d2 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -183,6 +183,14 @@ public: | |||
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | /* | 185 | /* |
| 186 | * Returns the value of the TPIDR_EL0 Read/Write system register for this thread. | ||
| 187 | * @returns The value of the TPIDR_EL0 register. | ||
| 188 | */ | ||
| 189 | u64 GetTPIDR_EL0() const { | ||
| 190 | return tpidr_el0; | ||
| 191 | } | ||
| 192 | |||
| 193 | /* | ||
| 186 | * Returns the address of the current thread's command buffer, located in the TLS. | 194 | * Returns the address of the current thread's command buffer, located in the TLS. |
| 187 | * @returns VAddr of the thread's command buffer. | 195 | * @returns VAddr of the thread's command buffer. |
| 188 | */ | 196 | */ |
| @@ -213,6 +221,7 @@ public: | |||
| 213 | s32 processor_id; | 221 | s32 processor_id; |
| 214 | 222 | ||
| 215 | VAddr tls_address; ///< Virtual address of the Thread Local Storage of the thread | 223 | VAddr tls_address; ///< Virtual address of the Thread Local Storage of the thread |
| 224 | u64 tpidr_el0; ///< TPIDR_EL0 read/write system register. | ||
| 216 | 225 | ||
| 217 | SharedPtr<Process> owner_process; ///< Process that owns this thread | 226 | SharedPtr<Process> owner_process; ///< Process that owns this thread |
| 218 | 227 | ||
diff --git a/src/tests/core/arm/arm_test_common.cpp b/src/tests/core/arm/arm_test_common.cpp index 7f9f27e19..539746246 100644 --- a/src/tests/core/arm/arm_test_common.cpp +++ b/src/tests/core/arm/arm_test_common.cpp | |||
| @@ -10,8 +10,6 @@ | |||
| 10 | 10 | ||
| 11 | namespace ArmTests { | 11 | namespace ArmTests { |
| 12 | 12 | ||
| 13 | static Memory::PageTable* page_table = nullptr; | ||
| 14 | |||
| 15 | TestEnvironment::TestEnvironment(bool mutable_memory_) | 13 | TestEnvironment::TestEnvironment(bool mutable_memory_) |
| 16 | : mutable_memory(mutable_memory_), test_memory(std::make_shared<TestMemory>(this)) { | 14 | : mutable_memory(mutable_memory_), test_memory(std::make_shared<TestMemory>(this)) { |
| 17 | 15 | ||
| @@ -67,10 +65,13 @@ boost::optional<bool> TestEnvironment::TestMemory::IsValidAddress(VAddr addr) { | |||
| 67 | } | 65 | } |
| 68 | 66 | ||
| 69 | boost::optional<u8> TestEnvironment::TestMemory::Read8(VAddr addr) { | 67 | boost::optional<u8> TestEnvironment::TestMemory::Read8(VAddr addr) { |
| 70 | auto iter = data.find(addr); | 68 | const auto iter = data.find(addr); |
| 69 | |||
| 71 | if (iter == data.end()) { | 70 | if (iter == data.end()) { |
| 72 | return addr; // Some arbitrary data | 71 | // Some arbitrary data |
| 72 | return static_cast<u8>(addr); | ||
| 73 | } | 73 | } |
| 74 | |||
| 74 | return iter->second; | 75 | return iter->second; |
| 75 | } | 76 | } |
| 76 | 77 | ||
diff --git a/src/tests/core/arm/arm_test_common.h b/src/tests/core/arm/arm_test_common.h index b66922d61..7fdbda494 100644 --- a/src/tests/core/arm/arm_test_common.h +++ b/src/tests/core/arm/arm_test_common.h | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | ||
| 6 | |||
| 5 | #include <tuple> | 7 | #include <tuple> |
| 6 | #include <unordered_map> | 8 | #include <unordered_map> |
| 7 | #include <vector> | 9 | #include <vector> |
| @@ -9,6 +11,10 @@ | |||
| 9 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 10 | #include "core/memory_hook.h" | 12 | #include "core/memory_hook.h" |
| 11 | 13 | ||
| 14 | namespace Memory { | ||
| 15 | struct PageTable; | ||
| 16 | } | ||
| 17 | |||
| 12 | namespace ArmTests { | 18 | namespace ArmTests { |
| 13 | 19 | ||
| 14 | struct WriteRecord { | 20 | struct WriteRecord { |
| @@ -79,6 +85,7 @@ private: | |||
| 79 | bool mutable_memory; | 85 | bool mutable_memory; |
| 80 | std::shared_ptr<TestMemory> test_memory; | 86 | std::shared_ptr<TestMemory> test_memory; |
| 81 | std::vector<WriteRecord> write_records; | 87 | std::vector<WriteRecord> write_records; |
| 88 | Memory::PageTable* page_table = nullptr; | ||
| 82 | }; | 89 | }; |
| 83 | 90 | ||
| 84 | } // namespace ArmTests | 91 | } // namespace ArmTests |
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index e36483145..a003bc9e3 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -20,7 +20,11 @@ GPU::GPU() { | |||
| 20 | 20 | ||
| 21 | GPU::~GPU() = default; | 21 | GPU::~GPU() = default; |
| 22 | 22 | ||
| 23 | const Tegra::Engines::Maxwell3D& GPU::Get3DEngine() const { | 23 | const Engines::Maxwell3D& GPU::Maxwell3D() const { |
| 24 | return *maxwell_3d; | ||
| 25 | } | ||
| 26 | |||
| 27 | Engines::Maxwell3D& GPU::Maxwell3D() { | ||
| 24 | return *maxwell_3d; | 28 | return *maxwell_3d; |
| 25 | } | 29 | } |
| 26 | 30 | ||
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 60930e997..a32148ecd 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -93,15 +93,14 @@ public: | |||
| 93 | /// Processes a command list stored at the specified address in GPU memory. | 93 | /// Processes a command list stored at the specified address in GPU memory. |
| 94 | void ProcessCommandList(GPUVAddr address, u32 size); | 94 | void ProcessCommandList(GPUVAddr address, u32 size); |
| 95 | 95 | ||
| 96 | /// Returns a const reference to the Maxwell3D GPU engine. | ||
| 97 | const Engines::Maxwell3D& Maxwell3D() const; | ||
| 98 | |||
| 96 | /// Returns a reference to the Maxwell3D GPU engine. | 99 | /// Returns a reference to the Maxwell3D GPU engine. |
| 97 | const Engines::Maxwell3D& Get3DEngine() const; | 100 | Engines::Maxwell3D& Maxwell3D(); |
| 98 | 101 | ||
| 99 | std::unique_ptr<MemoryManager> memory_manager; | 102 | std::unique_ptr<MemoryManager> memory_manager; |
| 100 | 103 | ||
| 101 | Engines::Maxwell3D& Maxwell3D() { | ||
| 102 | return *maxwell_3d; | ||
| 103 | } | ||
| 104 | |||
| 105 | private: | 104 | private: |
| 106 | /// Writes a single register in the engine bound to the specified subchannel | 105 | /// Writes a single register in the engine bound to the specified subchannel |
| 107 | void WriteReg(u32 method, u32 subchannel, u32 value, u32 remaining_params); | 106 | void WriteReg(u32 method, u32 subchannel, u32 value, u32 remaining_params); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index f75999557..65a2fd5e8 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -634,8 +634,8 @@ void RasterizerOpenGL::SamplerInfo::SyncWithConfig(const Tegra::Texture::TSCEntr | |||
| 634 | u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint program, | 634 | u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint program, |
| 635 | u32 current_bindpoint, | 635 | u32 current_bindpoint, |
| 636 | const std::vector<GLShader::ConstBufferEntry>& entries) { | 636 | const std::vector<GLShader::ConstBufferEntry>& entries) { |
| 637 | auto& gpu = Core::System::GetInstance().GPU(); | 637 | const auto& gpu = Core::System::GetInstance().GPU(); |
| 638 | auto& maxwell3d = gpu.Get3DEngine(); | 638 | const auto& maxwell3d = gpu.Maxwell3D(); |
| 639 | 639 | ||
| 640 | // Reset all buffer draw state for this stage. | 640 | // Reset all buffer draw state for this stage. |
| 641 | for (auto& buffer : state.draw.const_buffers[static_cast<size_t>(stage)]) { | 641 | for (auto& buffer : state.draw.const_buffers[static_cast<size_t>(stage)]) { |
| @@ -644,7 +644,7 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint progr | |||
| 644 | } | 644 | } |
| 645 | 645 | ||
| 646 | // Upload only the enabled buffers from the 16 constbuffers of each shader stage | 646 | // Upload only the enabled buffers from the 16 constbuffers of each shader stage |
| 647 | auto& shader_stage = maxwell3d.state.shader_stages[static_cast<size_t>(stage)]; | 647 | const auto& shader_stage = maxwell3d.state.shader_stages[static_cast<size_t>(stage)]; |
| 648 | 648 | ||
| 649 | for (u32 bindpoint = 0; bindpoint < entries.size(); ++bindpoint) { | 649 | for (u32 bindpoint = 0; bindpoint < entries.size(); ++bindpoint) { |
| 650 | const auto& used_buffer = entries[bindpoint]; | 650 | const auto& used_buffer = entries[bindpoint]; |
| @@ -700,8 +700,8 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint progr | |||
| 700 | 700 | ||
| 701 | u32 RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, GLuint program, u32 current_unit, | 701 | u32 RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, GLuint program, u32 current_unit, |
| 702 | const std::vector<GLShader::SamplerEntry>& entries) { | 702 | const std::vector<GLShader::SamplerEntry>& entries) { |
| 703 | auto& gpu = Core::System::GetInstance().GPU(); | 703 | const auto& gpu = Core::System::GetInstance().GPU(); |
| 704 | auto& maxwell3d = gpu.Get3DEngine(); | 704 | const auto& maxwell3d = gpu.Maxwell3D(); |
| 705 | 705 | ||
| 706 | ASSERT_MSG(current_unit + entries.size() <= std::size(state.texture_units), | 706 | ASSERT_MSG(current_unit + entries.size() <= std::size(state.texture_units), |
| 707 | "Exceeded the number of active textures."); | 707 | "Exceeded the number of active textures."); |
diff --git a/src/video_core/renderer_opengl/gl_shader_manager.cpp b/src/video_core/renderer_opengl/gl_shader_manager.cpp index 1aa437f76..e81fcbbc4 100644 --- a/src/video_core/renderer_opengl/gl_shader_manager.cpp +++ b/src/video_core/renderer_opengl/gl_shader_manager.cpp | |||
| @@ -10,8 +10,9 @@ | |||
| 10 | namespace GLShader { | 10 | namespace GLShader { |
| 11 | 11 | ||
| 12 | namespace Impl { | 12 | namespace Impl { |
| 13 | void SetShaderUniformBlockBinding(GLuint shader, const char* name, | 13 | static void SetShaderUniformBlockBinding(GLuint shader, const char* name, |
| 14 | Maxwell3D::Regs::ShaderStage binding, size_t expected_size) { | 14 | Maxwell3D::Regs::ShaderStage binding, |
| 15 | size_t expected_size) { | ||
| 15 | GLuint ub_index = glGetUniformBlockIndex(shader, name); | 16 | GLuint ub_index = glGetUniformBlockIndex(shader, name); |
| 16 | if (ub_index != GL_INVALID_INDEX) { | 17 | if (ub_index != GL_INVALID_INDEX) { |
| 17 | GLint ub_size = 0; | 18 | GLint ub_size = 0; |
diff --git a/src/video_core/renderer_opengl/gl_shader_manager.h b/src/video_core/renderer_opengl/gl_shader_manager.h index 4295c20a6..e29d551e1 100644 --- a/src/video_core/renderer_opengl/gl_shader_manager.h +++ b/src/video_core/renderer_opengl/gl_shader_manager.h | |||
| @@ -21,7 +21,6 @@ using Tegra::Engines::Maxwell3D; | |||
| 21 | 21 | ||
| 22 | namespace Impl { | 22 | namespace Impl { |
| 23 | void SetShaderUniformBlockBindings(GLuint shader); | 23 | void SetShaderUniformBlockBindings(GLuint shader); |
| 24 | void SetShaderSamplerBindings(GLuint shader); | ||
| 25 | } // namespace Impl | 24 | } // namespace Impl |
| 26 | 25 | ||
| 27 | /// Uniform structure for the Uniform Buffer Object, all vectors must be 16-byte aligned | 26 | /// Uniform structure for the Uniform Buffer Object, all vectors must be 16-byte aligned |
diff --git a/src/yuzu/debugger/graphics/graphics_surface.cpp b/src/yuzu/debugger/graphics/graphics_surface.cpp index 1fbca8ad0..c41ff693b 100644 --- a/src/yuzu/debugger/graphics/graphics_surface.cpp +++ b/src/yuzu/debugger/graphics/graphics_surface.cpp | |||
| @@ -336,9 +336,9 @@ void GraphicsSurfaceWidget::OnUpdate() { | |||
| 336 | // TODO: Store a reference to the registers in the debug context instead of accessing them | 336 | // TODO: Store a reference to the registers in the debug context instead of accessing them |
| 337 | // directly... | 337 | // directly... |
| 338 | 338 | ||
| 339 | auto& registers = gpu.Get3DEngine().regs; | 339 | const auto& registers = gpu.Maxwell3D().regs; |
| 340 | auto& rt = registers.rt[static_cast<size_t>(surface_source) - | 340 | const auto& rt = registers.rt[static_cast<size_t>(surface_source) - |
| 341 | static_cast<size_t>(Source::RenderTarget0)]; | 341 | static_cast<size_t>(Source::RenderTarget0)]; |
| 342 | 342 | ||
| 343 | surface_address = rt.Address(); | 343 | surface_address = rt.Address(); |
| 344 | surface_width = rt.width; | 344 | surface_width = rt.width; |