diff options
Diffstat (limited to 'src')
30 files changed, 169 insertions, 139 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index c5031544d..4f6c45085 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -148,10 +148,8 @@ add_library(core STATIC | |||
| 148 | hle/service/filesystem/fsp_srv.h | 148 | hle/service/filesystem/fsp_srv.h |
| 149 | hle/service/friend/friend.cpp | 149 | hle/service/friend/friend.cpp |
| 150 | hle/service/friend/friend.h | 150 | hle/service/friend/friend.h |
| 151 | hle/service/friend/friend_a.cpp | 151 | hle/service/friend/interface.cpp |
| 152 | hle/service/friend/friend_a.h | 152 | hle/service/friend/interface.h |
| 153 | hle/service/friend/friend_u.cpp | ||
| 154 | hle/service/friend/friend_u.h | ||
| 155 | hle/service/hid/hid.cpp | 153 | hle/service/hid/hid.cpp |
| 156 | hle/service/hid/hid.h | 154 | hle/service/hid/hid.h |
| 157 | hle/service/lm/lm.cpp | 155 | hle/service/lm/lm.cpp |
diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index d23adb28a..57b8634b9 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp | |||
| @@ -102,8 +102,8 @@ public: | |||
| 102 | u64 tpidr_el0 = 0; | 102 | u64 tpidr_el0 = 0; |
| 103 | }; | 103 | }; |
| 104 | 104 | ||
| 105 | std::unique_ptr<Dynarmic::A64::Jit> ARM_Dynarmic::MakeJit() { | 105 | std::unique_ptr<Dynarmic::A64::Jit> ARM_Dynarmic::MakeJit() const { |
| 106 | const auto page_table = Core::CurrentProcess()->vm_manager.page_table.pointers.data(); | 106 | auto** const page_table = Core::CurrentProcess()->vm_manager.page_table.pointers.data(); |
| 107 | 107 | ||
| 108 | Dynarmic::A64::UserConfig config; | 108 | Dynarmic::A64::UserConfig config; |
| 109 | 109 | ||
diff --git a/src/core/arm/dynarmic/arm_dynarmic.h b/src/core/arm/dynarmic/arm_dynarmic.h index 350f61fd2..14c072601 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.h +++ b/src/core/arm/dynarmic/arm_dynarmic.h | |||
| @@ -50,7 +50,7 @@ public: | |||
| 50 | void PageTableChanged() override; | 50 | void PageTableChanged() override; |
| 51 | 51 | ||
| 52 | private: | 52 | private: |
| 53 | std::unique_ptr<Dynarmic::A64::Jit> MakeJit(); | 53 | std::unique_ptr<Dynarmic::A64::Jit> MakeJit() const; |
| 54 | 54 | ||
| 55 | friend class ARM_Dynarmic_Callbacks; | 55 | friend class ARM_Dynarmic_Callbacks; |
| 56 | std::unique_ptr<ARM_Dynarmic_Callbacks> cb; | 56 | std::unique_ptr<ARM_Dynarmic_Callbacks> cb; |
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index f5bd27a75..7fb0da408 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h | |||
| @@ -300,6 +300,14 @@ public: | |||
| 300 | template <typename First, typename... Other> | 300 | template <typename First, typename... Other> |
| 301 | void Pop(First& first_value, Other&... other_values); | 301 | void Pop(First& first_value, Other&... other_values); |
| 302 | 302 | ||
| 303 | template <typename T> | ||
| 304 | T PopEnum() { | ||
| 305 | static_assert(std::is_enum_v<T>, "T must be an enum type within a PopEnum call."); | ||
| 306 | static_assert(!std::is_convertible_v<T, int>, | ||
| 307 | "enum type in PopEnum must be a strongly typed enum."); | ||
| 308 | return static_cast<T>(Pop<std::underlying_type_t<T>>()); | ||
| 309 | } | ||
| 310 | |||
| 303 | /** | 311 | /** |
| 304 | * @brief Reads the next normal parameters as a struct, by copying it | 312 | * @brief Reads the next normal parameters as a struct, by copying it |
| 305 | * @note: The output class must be correctly packed/padded to fit hardware layout. | 313 | * @note: The output class must be correctly packed/padded to fit hardware layout. |
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 3f1de3258..feb7b88d2 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp | |||
| @@ -19,7 +19,7 @@ namespace Kernel { | |||
| 19 | /// Returns the number of threads that are waiting for a mutex, and the highest priority one among | 19 | /// Returns the number of threads that are waiting for a mutex, and the highest priority one among |
| 20 | /// those. | 20 | /// those. |
| 21 | static std::pair<SharedPtr<Thread>, u32> GetHighestPriorityMutexWaitingThread( | 21 | static std::pair<SharedPtr<Thread>, u32> GetHighestPriorityMutexWaitingThread( |
| 22 | SharedPtr<Thread> current_thread, VAddr mutex_addr) { | 22 | const SharedPtr<Thread>& current_thread, VAddr mutex_addr) { |
| 23 | 23 | ||
| 24 | SharedPtr<Thread> highest_priority_thread; | 24 | SharedPtr<Thread> highest_priority_thread; |
| 25 | u32 num_waiters = 0; | 25 | u32 num_waiters = 0; |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 7b41c9cfd..da7cacb57 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -165,11 +165,14 @@ static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64 | |||
| 165 | using ObjectPtr = SharedPtr<WaitObject>; | 165 | using ObjectPtr = SharedPtr<WaitObject>; |
| 166 | std::vector<ObjectPtr> objects(handle_count); | 166 | std::vector<ObjectPtr> objects(handle_count); |
| 167 | 167 | ||
| 168 | for (int i = 0; i < handle_count; ++i) { | 168 | for (u64 i = 0; i < handle_count; ++i) { |
| 169 | Handle handle = Memory::Read32(handles_address + i * sizeof(Handle)); | 169 | const Handle handle = Memory::Read32(handles_address + i * sizeof(Handle)); |
| 170 | auto object = g_handle_table.Get<WaitObject>(handle); | 170 | const auto object = g_handle_table.Get<WaitObject>(handle); |
| 171 | if (object == nullptr) | 171 | |
| 172 | if (object == nullptr) { | ||
| 172 | return ERR_INVALID_HANDLE; | 173 | return ERR_INVALID_HANDLE; |
| 174 | } | ||
| 175 | |||
| 173 | objects[i] = object; | 176 | objects[i] = object; |
| 174 | } | 177 | } |
| 175 | 178 | ||
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 3e1c2c0a0..0b158e015 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -35,7 +35,7 @@ static constexpr u128 DEFAULT_USER_ID{1ull, 0ull}; | |||
| 35 | 35 | ||
| 36 | class IProfile final : public ServiceFramework<IProfile> { | 36 | class IProfile final : public ServiceFramework<IProfile> { |
| 37 | public: | 37 | public: |
| 38 | IProfile(u128 user_id) : ServiceFramework("IProfile"), user_id(user_id) { | 38 | explicit IProfile(u128 user_id) : ServiceFramework("IProfile"), user_id(user_id) { |
| 39 | static const FunctionInfo functions[] = { | 39 | static const FunctionInfo functions[] = { |
| 40 | {0, nullptr, "Get"}, | 40 | {0, nullptr, "Get"}, |
| 41 | {1, &IProfile::GetBase, "GetBase"}, | 41 | {1, &IProfile::GetBase, "GetBase"}, |
diff --git a/src/core/hle/service/apm/interface.h b/src/core/hle/service/apm/interface.h index 85258a666..fa68c7d93 100644 --- a/src/core/hle/service/apm/interface.h +++ b/src/core/hle/service/apm/interface.h | |||
| @@ -19,7 +19,4 @@ private: | |||
| 19 | std::shared_ptr<Module> apm; | 19 | std::shared_ptr<Module> apm; |
| 20 | }; | 20 | }; |
| 21 | 21 | ||
| 22 | /// Registers all AM services with the specified service manager. | ||
| 23 | void InstallInterfaces(SM::ServiceManager& service_manager); | ||
| 24 | |||
| 25 | } // namespace Service::APM | 22 | } // namespace Service::APM |
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index c98a46e05..fb4d89068 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp | |||
| @@ -5,8 +5,7 @@ | |||
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | #include "core/hle/ipc_helpers.h" | 6 | #include "core/hle/ipc_helpers.h" |
| 7 | #include "core/hle/service/friend/friend.h" | 7 | #include "core/hle/service/friend/friend.h" |
| 8 | #include "core/hle/service/friend/friend_a.h" | 8 | #include "core/hle/service/friend/interface.h" |
| 9 | #include "core/hle/service/friend/friend_u.h" | ||
| 10 | 9 | ||
| 11 | namespace Service::Friend { | 10 | namespace Service::Friend { |
| 12 | 11 | ||
| @@ -21,8 +20,11 @@ Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) | |||
| 21 | 20 | ||
| 22 | void InstallInterfaces(SM::ServiceManager& service_manager) { | 21 | void InstallInterfaces(SM::ServiceManager& service_manager) { |
| 23 | auto module = std::make_shared<Module>(); | 22 | auto module = std::make_shared<Module>(); |
| 24 | std::make_shared<Friend_A>(module)->InstallAsService(service_manager); | 23 | std::make_shared<Friend>(module, "friend:a")->InstallAsService(service_manager); |
| 25 | std::make_shared<Friend_U>(module)->InstallAsService(service_manager); | 24 | std::make_shared<Friend>(module, "friend:m")->InstallAsService(service_manager); |
| 25 | std::make_shared<Friend>(module, "friend:s")->InstallAsService(service_manager); | ||
| 26 | std::make_shared<Friend>(module, "friend:u")->InstallAsService(service_manager); | ||
| 27 | std::make_shared<Friend>(module, "friend:v")->InstallAsService(service_manager); | ||
| 26 | } | 28 | } |
| 27 | 29 | ||
| 28 | } // namespace Service::Friend | 30 | } // namespace Service::Friend |
diff --git a/src/core/hle/service/friend/friend_u.cpp b/src/core/hle/service/friend/friend_u.cpp deleted file mode 100644 index 90b30883f..000000000 --- a/src/core/hle/service/friend/friend_u.cpp +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "core/hle/service/friend/friend_u.h" | ||
| 6 | |||
| 7 | namespace Service::Friend { | ||
| 8 | |||
| 9 | Friend_U::Friend_U(std::shared_ptr<Module> module) | ||
| 10 | : Module::Interface(std::move(module), "friend:u") { | ||
| 11 | static const FunctionInfo functions[] = { | ||
| 12 | {0, &Friend_U::CreateFriendService, "CreateFriendService"}, | ||
| 13 | {1, nullptr, "CreateNotificationService"}, | ||
| 14 | }; | ||
| 15 | RegisterHandlers(functions); | ||
| 16 | } | ||
| 17 | |||
| 18 | } // namespace Service::Friend | ||
diff --git a/src/core/hle/service/friend/friend_u.h b/src/core/hle/service/friend/friend_u.h deleted file mode 100644 index 0d953d807..000000000 --- a/src/core/hle/service/friend/friend_u.h +++ /dev/null | |||
| @@ -1,16 +0,0 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "core/hle/service/friend/friend.h" | ||
| 8 | |||
| 9 | namespace Service::Friend { | ||
| 10 | |||
| 11 | class Friend_U final : public Module::Interface { | ||
| 12 | public: | ||
| 13 | explicit Friend_U(std::shared_ptr<Module> module); | ||
| 14 | }; | ||
| 15 | |||
| 16 | } // namespace Service::Friend | ||
diff --git a/src/core/hle/service/friend/friend_a.cpp b/src/core/hle/service/friend/interface.cpp index a2cc81926..27c6a09e2 100644 --- a/src/core/hle/service/friend/friend_a.cpp +++ b/src/core/hle/service/friend/interface.cpp | |||
| @@ -2,15 +2,16 @@ | |||
| 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 "core/hle/service/friend/friend_a.h" | 5 | #include "core/hle/service/friend/interface.h" |
| 6 | 6 | ||
| 7 | namespace Service::Friend { | 7 | namespace Service::Friend { |
| 8 | 8 | ||
| 9 | Friend_A::Friend_A(std::shared_ptr<Module> module) | 9 | Friend::Friend(std::shared_ptr<Module> module, const char* name) |
| 10 | : Module::Interface(std::move(module), "friend:a") { | 10 | : Interface(std::move(module), name) { |
| 11 | static const FunctionInfo functions[] = { | 11 | static const FunctionInfo functions[] = { |
| 12 | {0, &Friend_A::CreateFriendService, "CreateFriendService"}, | 12 | {0, &Friend::CreateFriendService, "CreateFriendService"}, |
| 13 | {1, nullptr, "CreateNotificationService"}, | 13 | {1, nullptr, "CreateNotificationService"}, |
| 14 | {2, nullptr, "CreateDaemonSuspendSessionService"}, | ||
| 14 | }; | 15 | }; |
| 15 | RegisterHandlers(functions); | 16 | RegisterHandlers(functions); |
| 16 | } | 17 | } |
diff --git a/src/core/hle/service/friend/friend_a.h b/src/core/hle/service/friend/interface.h index 81257583b..89dae8471 100644 --- a/src/core/hle/service/friend/friend_a.h +++ b/src/core/hle/service/friend/interface.h | |||
| @@ -8,9 +8,9 @@ | |||
| 8 | 8 | ||
| 9 | namespace Service::Friend { | 9 | namespace Service::Friend { |
| 10 | 10 | ||
| 11 | class Friend_A final : public Module::Interface { | 11 | class Friend final : public Module::Interface { |
| 12 | public: | 12 | public: |
| 13 | explicit Friend_A(std::shared_ptr<Module> module); | 13 | explicit Friend(std::shared_ptr<Module> module, const char* name); |
| 14 | }; | 14 | }; |
| 15 | 15 | ||
| 16 | } // namespace Service::Friend | 16 | } // namespace Service::Friend |
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index fee841d46..180f22703 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h | |||
| @@ -146,7 +146,7 @@ protected: | |||
| 146 | * @param max_sessions Maximum number of sessions that can be | 146 | * @param max_sessions Maximum number of sessions that can be |
| 147 | * connected to this service at the same time. | 147 | * connected to this service at the same time. |
| 148 | */ | 148 | */ |
| 149 | ServiceFramework(const char* service_name, u32 max_sessions = DefaultMaxSessions) | 149 | explicit ServiceFramework(const char* service_name, u32 max_sessions = DefaultMaxSessions) |
| 150 | : ServiceFrameworkBase(service_name, max_sessions, Invoker) {} | 150 | : ServiceFrameworkBase(service_name, max_sessions, Invoker) {} |
| 151 | 151 | ||
| 152 | /// Registers handlers in the service. | 152 | /// Registers handlers in the service. |
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp index fa85277fe..41efca31c 100644 --- a/src/core/hle/service/set/set_sys.cpp +++ b/src/core/hle/service/set/set_sys.cpp | |||
| @@ -10,13 +10,22 @@ | |||
| 10 | namespace Service::Set { | 10 | namespace Service::Set { |
| 11 | 11 | ||
| 12 | void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) { | 12 | void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) { |
| 13 | |||
| 14 | IPC::ResponseBuilder rb{ctx, 3}; | 13 | IPC::ResponseBuilder rb{ctx, 3}; |
| 15 | 14 | ||
| 16 | rb.Push(RESULT_SUCCESS); | 15 | rb.Push(RESULT_SUCCESS); |
| 17 | rb.Push<u32>(0); | 16 | rb.PushEnum(color_set); |
| 18 | 17 | ||
| 19 | LOG_WARNING(Service_SET, "(STUBBED) called"); | 18 | LOG_DEBUG(Service_SET, "called"); |
| 19 | } | ||
| 20 | |||
| 21 | void SET_SYS::SetColorSetId(Kernel::HLERequestContext& ctx) { | ||
| 22 | IPC::RequestParser rp{ctx}; | ||
| 23 | color_set = rp.PopEnum<ColorSet>(); | ||
| 24 | |||
| 25 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 26 | rb.Push(RESULT_SUCCESS); | ||
| 27 | |||
| 28 | LOG_DEBUG(Service_SET, "called"); | ||
| 20 | } | 29 | } |
| 21 | 30 | ||
| 22 | SET_SYS::SET_SYS() : ServiceFramework("set:sys") { | 31 | SET_SYS::SET_SYS() : ServiceFramework("set:sys") { |
| @@ -44,7 +53,7 @@ SET_SYS::SET_SYS() : ServiceFramework("set:sys") { | |||
| 44 | {21, nullptr, "GetEulaVersions"}, | 53 | {21, nullptr, "GetEulaVersions"}, |
| 45 | {22, nullptr, "SetEulaVersions"}, | 54 | {22, nullptr, "SetEulaVersions"}, |
| 46 | {23, &SET_SYS::GetColorSetId, "GetColorSetId"}, | 55 | {23, &SET_SYS::GetColorSetId, "GetColorSetId"}, |
| 47 | {24, nullptr, "SetColorSetId"}, | 56 | {24, &SET_SYS::SetColorSetId, "SetColorSetId"}, |
| 48 | {25, nullptr, "GetConsoleInformationUploadFlag"}, | 57 | {25, nullptr, "GetConsoleInformationUploadFlag"}, |
| 49 | {26, nullptr, "SetConsoleInformationUploadFlag"}, | 58 | {26, nullptr, "SetConsoleInformationUploadFlag"}, |
| 50 | {27, nullptr, "GetAutomaticApplicationDownloadFlag"}, | 59 | {27, nullptr, "GetAutomaticApplicationDownloadFlag"}, |
| @@ -172,4 +181,6 @@ SET_SYS::SET_SYS() : ServiceFramework("set:sys") { | |||
| 172 | RegisterHandlers(functions); | 181 | RegisterHandlers(functions); |
| 173 | } | 182 | } |
| 174 | 183 | ||
| 184 | SET_SYS::~SET_SYS() = default; | ||
| 185 | |||
| 175 | } // namespace Service::Set | 186 | } // namespace Service::Set |
diff --git a/src/core/hle/service/set/set_sys.h b/src/core/hle/service/set/set_sys.h index b77a97cde..f602f3c77 100644 --- a/src/core/hle/service/set/set_sys.h +++ b/src/core/hle/service/set/set_sys.h | |||
| @@ -11,10 +11,19 @@ namespace Service::Set { | |||
| 11 | class SET_SYS final : public ServiceFramework<SET_SYS> { | 11 | class SET_SYS final : public ServiceFramework<SET_SYS> { |
| 12 | public: | 12 | public: |
| 13 | explicit SET_SYS(); | 13 | explicit SET_SYS(); |
| 14 | ~SET_SYS() = default; | 14 | ~SET_SYS() override; |
| 15 | 15 | ||
| 16 | private: | 16 | private: |
| 17 | /// Indicates the current theme set by the system settings | ||
| 18 | enum class ColorSet : u32 { | ||
| 19 | BasicWhite = 0, | ||
| 20 | BasicBlack = 1, | ||
| 21 | }; | ||
| 22 | |||
| 17 | void GetColorSetId(Kernel::HLERequestContext& ctx); | 23 | void GetColorSetId(Kernel::HLERequestContext& ctx); |
| 24 | void SetColorSetId(Kernel::HLERequestContext& ctx); | ||
| 25 | |||
| 26 | ColorSet color_set = ColorSet::BasicWhite; | ||
| 18 | }; | 27 | }; |
| 19 | 28 | ||
| 20 | } // namespace Service::Set | 29 | } // namespace Service::Set |
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp index 18bd62a08..b0277a875 100644 --- a/src/core/loader/deconstructed_rom_directory.cpp +++ b/src/core/loader/deconstructed_rom_directory.cpp | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | #include "common/common_funcs.h" | 6 | #include "common/common_funcs.h" |
| 7 | #include "common/file_util.h" | 7 | #include "common/file_util.h" |
| 8 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 9 | #include "common/string_util.h" | ||
| 10 | #include "core/file_sys/content_archive.h" | 9 | #include "core/file_sys/content_archive.h" |
| 11 | #include "core/gdbstub/gdbstub.h" | 10 | #include "core/gdbstub/gdbstub.h" |
| 12 | #include "core/hle/kernel/process.h" | 11 | #include "core/hle/kernel/process.h" |
| @@ -18,34 +17,6 @@ | |||
| 18 | 17 | ||
| 19 | namespace Loader { | 18 | namespace Loader { |
| 20 | 19 | ||
| 21 | static std::string FindRomFS(const std::string& directory) { | ||
| 22 | std::string filepath_romfs; | ||
| 23 | const auto callback = [&filepath_romfs](u64*, const std::string& directory, | ||
| 24 | const std::string& virtual_name) -> bool { | ||
| 25 | const std::string physical_name = directory + virtual_name; | ||
| 26 | if (FileUtil::IsDirectory(physical_name)) { | ||
| 27 | // Skip directories | ||
| 28 | return true; | ||
| 29 | } | ||
| 30 | |||
| 31 | // Verify extension | ||
| 32 | const std::string extension = physical_name.substr(physical_name.find_last_of(".") + 1); | ||
| 33 | if (Common::ToLower(extension) != "romfs") { | ||
| 34 | return true; | ||
| 35 | } | ||
| 36 | |||
| 37 | // Found it - we are done | ||
| 38 | filepath_romfs = std::move(physical_name); | ||
| 39 | return false; | ||
| 40 | }; | ||
| 41 | |||
| 42 | // Search the specified directory recursively, looking for the first .romfs file, which will | ||
| 43 | // be used for the RomFS | ||
| 44 | FileUtil::ForeachDirectoryEntry(nullptr, directory, callback); | ||
| 45 | |||
| 46 | return filepath_romfs; | ||
| 47 | } | ||
| 48 | |||
| 49 | AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file) | 20 | AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file) |
| 50 | : AppLoader(std::move(file)) {} | 21 | : AppLoader(std::move(file)) {} |
| 51 | 22 | ||
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp index 4bfd5f536..352938dcb 100644 --- a/src/core/loader/elf.cpp +++ b/src/core/loader/elf.cpp | |||
| @@ -190,7 +190,7 @@ private: | |||
| 190 | u32 entryPoint; | 190 | u32 entryPoint; |
| 191 | 191 | ||
| 192 | public: | 192 | public: |
| 193 | ElfReader(void* ptr); | 193 | explicit ElfReader(void* ptr); |
| 194 | 194 | ||
| 195 | u32 Read32(int off) const { | 195 | u32 Read32(int off) const { |
| 196 | return base32[off >> 2]; | 196 | return base32[off >> 2]; |
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 6f517ca8c..fbf11e5d0 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h | |||
| @@ -79,7 +79,7 @@ enum class ResultStatus { | |||
| 79 | /// Interface for loading an application | 79 | /// Interface for loading an application |
| 80 | class AppLoader : NonCopyable { | 80 | class AppLoader : NonCopyable { |
| 81 | public: | 81 | public: |
| 82 | AppLoader(FileSys::VirtualFile file) : file(std::move(file)) {} | 82 | explicit AppLoader(FileSys::VirtualFile file) : file(std::move(file)) {} |
| 83 | virtual ~AppLoader() {} | 83 | virtual ~AppLoader() {} |
| 84 | 84 | ||
| 85 | /** | 85 | /** |
diff --git a/src/core/tracer/recorder.h b/src/core/tracer/recorder.h index 629c2f6d2..e1cefd5fe 100644 --- a/src/core/tracer/recorder.h +++ b/src/core/tracer/recorder.h | |||
| @@ -32,7 +32,7 @@ public: | |||
| 32 | * Recorder constructor | 32 | * Recorder constructor |
| 33 | * @param initial_state Initial recorder state | 33 | * @param initial_state Initial recorder state |
| 34 | */ | 34 | */ |
| 35 | Recorder(const InitialState& initial_state); | 35 | explicit Recorder(const InitialState& initial_state); |
| 36 | 36 | ||
| 37 | /// Finish recording of this Citrace and save it using the given filename. | 37 | /// Finish recording of this Citrace and save it using the given filename. |
| 38 | void Finish(const std::string& filename); | 38 | void Finish(const std::string& filename); |
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index d7328ff39..0e205ed72 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -75,14 +75,6 @@ void Maxwell3D::WriteReg(u32 method, u32 value, u32 remaining_params) { | |||
| 75 | ProcessMacroUpload(value); | 75 | ProcessMacroUpload(value); |
| 76 | break; | 76 | break; |
| 77 | } | 77 | } |
| 78 | case MAXWELL3D_REG_INDEX(code_address.code_address_high): | ||
| 79 | case MAXWELL3D_REG_INDEX(code_address.code_address_low): { | ||
| 80 | // Note: For some reason games (like Puyo Puyo Tetris) seem to write 0 to the CODE_ADDRESS | ||
| 81 | // register, we do not currently know if that's intended or a bug, so we assert it lest | ||
| 82 | // stuff breaks in other places (like the shader address calculation). | ||
| 83 | ASSERT_MSG(regs.code_address.CodeAddress() == 0, "Unexpected CODE_ADDRESS register value."); | ||
| 84 | break; | ||
| 85 | } | ||
| 86 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[0]): | 78 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[0]): |
| 87 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[1]): | 79 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[1]): |
| 88 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[2]): | 80 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[2]): |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 58501ca8b..e9d87efb4 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -24,6 +24,7 @@ enum class RenderTargetFormat : u32 { | |||
| 24 | RGBA8_UNORM = 0xD5, | 24 | RGBA8_UNORM = 0xD5, |
| 25 | RGBA8_SRGB = 0xD6, | 25 | RGBA8_SRGB = 0xD6, |
| 26 | R11G11B10_FLOAT = 0xE0, | 26 | R11G11B10_FLOAT = 0xE0, |
| 27 | R8_UNORM = 0xF3, | ||
| 27 | }; | 28 | }; |
| 28 | 29 | ||
| 29 | enum class DepthFormat : u32 { | 30 | enum class DepthFormat : u32 { |
| @@ -33,6 +34,7 @@ enum class DepthFormat : u32 { | |||
| 33 | Z24_X8_UNORM = 0x15, | 34 | Z24_X8_UNORM = 0x15, |
| 34 | Z24_S8_UNORM = 0x16, | 35 | Z24_S8_UNORM = 0x16, |
| 35 | Z24_C8_UNORM = 0x18, | 36 | Z24_C8_UNORM = 0x18, |
| 37 | Z32_S8_X24_FLOAT = 0x19, | ||
| 36 | }; | 38 | }; |
| 37 | 39 | ||
| 38 | /// Returns the number of bytes per pixel of each rendertarget format. | 40 | /// Returns the number of bytes per pixel of each rendertarget format. |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 56d9c575b..a1c47bae9 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <memory> | 6 | #include <memory> |
| 7 | #include <string> | 7 | #include <string> |
| 8 | #include <string_view> | ||
| 8 | #include <tuple> | 9 | #include <tuple> |
| 9 | #include <utility> | 10 | #include <utility> |
| 10 | #include <glad/glad.h> | 11 | #include <glad/glad.h> |
| @@ -37,11 +38,6 @@ MICROPROFILE_DEFINE(OpenGL_Blits, "OpenGL", "Blits", MP_RGB(100, 100, 255)); | |||
| 37 | MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100, 255, 100)); | 38 | MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100, 255, 100)); |
| 38 | 39 | ||
| 39 | RasterizerOpenGL::RasterizerOpenGL() { | 40 | RasterizerOpenGL::RasterizerOpenGL() { |
| 40 | has_ARB_buffer_storage = false; | ||
| 41 | has_ARB_direct_state_access = false; | ||
| 42 | has_ARB_separate_shader_objects = false; | ||
| 43 | has_ARB_vertex_attrib_binding = false; | ||
| 44 | |||
| 45 | // Create sampler objects | 41 | // Create sampler objects |
| 46 | for (size_t i = 0; i < texture_samplers.size(); ++i) { | 42 | for (size_t i = 0; i < texture_samplers.size(); ++i) { |
| 47 | texture_samplers[i].Create(); | 43 | texture_samplers[i].Create(); |
| @@ -59,7 +55,8 @@ RasterizerOpenGL::RasterizerOpenGL() { | |||
| 59 | GLint ext_num; | 55 | GLint ext_num; |
| 60 | glGetIntegerv(GL_NUM_EXTENSIONS, &ext_num); | 56 | glGetIntegerv(GL_NUM_EXTENSIONS, &ext_num); |
| 61 | for (GLint i = 0; i < ext_num; i++) { | 57 | for (GLint i = 0; i < ext_num; i++) { |
| 62 | std::string extension{reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i))}; | 58 | const std::string_view extension{ |
| 59 | reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i))}; | ||
| 63 | 60 | ||
| 64 | if (extension == "GL_ARB_buffer_storage") { | 61 | if (extension == "GL_ARB_buffer_storage") { |
| 65 | has_ARB_buffer_storage = true; | 62 | has_ARB_buffer_storage = true; |
| @@ -110,8 +107,6 @@ RasterizerOpenGL::RasterizerOpenGL() { | |||
| 110 | glBindBufferBase(GL_UNIFORM_BUFFER, index, buffer.handle); | 107 | glBindBufferBase(GL_UNIFORM_BUFFER, index, buffer.handle); |
| 111 | } | 108 | } |
| 112 | 109 | ||
| 113 | accelerate_draw = AccelDraw::Disabled; | ||
| 114 | |||
| 115 | glEnable(GL_BLEND); | 110 | glEnable(GL_BLEND); |
| 116 | 111 | ||
| 117 | LOG_CRITICAL(Render_OpenGL, "Sync fixed function OpenGL state here!"); | 112 | LOG_CRITICAL(Render_OpenGL, "Sync fixed function OpenGL state here!"); |
| @@ -601,7 +596,6 @@ void RasterizerOpenGL::SamplerInfo::Create() { | |||
| 601 | sampler.Create(); | 596 | sampler.Create(); |
| 602 | mag_filter = min_filter = Tegra::Texture::TextureFilter::Linear; | 597 | mag_filter = min_filter = Tegra::Texture::TextureFilter::Linear; |
| 603 | wrap_u = wrap_v = Tegra::Texture::WrapMode::Wrap; | 598 | wrap_u = wrap_v = Tegra::Texture::WrapMode::Wrap; |
| 604 | border_color_r = border_color_g = border_color_b = border_color_a = 0; | ||
| 605 | 599 | ||
| 606 | // default is GL_LINEAR_MIPMAP_LINEAR | 600 | // default is GL_LINEAR_MIPMAP_LINEAR |
| 607 | glSamplerParameteri(sampler.handle, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 601 | glSamplerParameteri(sampler.handle, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| @@ -630,8 +624,12 @@ void RasterizerOpenGL::SamplerInfo::SyncWithConfig(const Tegra::Texture::TSCEntr | |||
| 630 | } | 624 | } |
| 631 | 625 | ||
| 632 | if (wrap_u == Tegra::Texture::WrapMode::Border || wrap_v == Tegra::Texture::WrapMode::Border) { | 626 | if (wrap_u == Tegra::Texture::WrapMode::Border || wrap_v == Tegra::Texture::WrapMode::Border) { |
| 633 | // TODO(Subv): Implement border color | 627 | const GLvec4 new_border_color = {{config.border_color_r, config.border_color_g, |
| 634 | ASSERT(false); | 628 | config.border_color_b, config.border_color_a}}; |
| 629 | if (border_color != new_border_color) { | ||
| 630 | border_color = new_border_color; | ||
| 631 | glSamplerParameterfv(s, GL_TEXTURE_BORDER_COLOR, border_color.data()); | ||
| 632 | } | ||
| 635 | } | 633 | } |
| 636 | } | 634 | } |
| 637 | 635 | ||
| @@ -691,10 +689,12 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint progr | |||
| 691 | glBindBuffer(GL_UNIFORM_BUFFER, 0); | 689 | glBindBuffer(GL_UNIFORM_BUFFER, 0); |
| 692 | 690 | ||
| 693 | // Now configure the bindpoint of the buffer inside the shader | 691 | // Now configure the bindpoint of the buffer inside the shader |
| 694 | std::string buffer_name = used_buffer.GetName(); | 692 | const std::string buffer_name = used_buffer.GetName(); |
| 695 | GLuint index = glGetProgramResourceIndex(program, GL_UNIFORM_BLOCK, buffer_name.c_str()); | 693 | const GLuint index = |
| 696 | if (index != -1) | 694 | glGetProgramResourceIndex(program, GL_UNIFORM_BLOCK, buffer_name.c_str()); |
| 695 | if (index != GL_INVALID_INDEX) { | ||
| 697 | glUniformBlockBinding(program, index, buffer_draw_state.bindpoint); | 696 | glUniformBlockBinding(program, index, buffer_draw_state.bindpoint); |
| 697 | } | ||
| 698 | } | 698 | } |
| 699 | 699 | ||
| 700 | state.Apply(); | 700 | state.Apply(); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index c406142e4..e150be58f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h | |||
| @@ -77,10 +77,7 @@ private: | |||
| 77 | Tegra::Texture::TextureFilter min_filter; | 77 | Tegra::Texture::TextureFilter min_filter; |
| 78 | Tegra::Texture::WrapMode wrap_u; | 78 | Tegra::Texture::WrapMode wrap_u; |
| 79 | Tegra::Texture::WrapMode wrap_v; | 79 | Tegra::Texture::WrapMode wrap_v; |
| 80 | u32 border_color_r; | 80 | GLvec4 border_color; |
| 81 | u32 border_color_g; | ||
| 82 | u32 border_color_b; | ||
| 83 | u32 border_color_a; | ||
| 84 | }; | 81 | }; |
| 85 | 82 | ||
| 86 | /// Configures the color and depth framebuffer states and returns the dirty <Color, Depth> | 83 | /// Configures the color and depth framebuffer states and returns the dirty <Color, Depth> |
| @@ -138,10 +135,10 @@ private: | |||
| 138 | /// Syncs the blend state to match the guest state | 135 | /// Syncs the blend state to match the guest state |
| 139 | void SyncBlendState(); | 136 | void SyncBlendState(); |
| 140 | 137 | ||
| 141 | bool has_ARB_buffer_storage; | 138 | bool has_ARB_buffer_storage = false; |
| 142 | bool has_ARB_direct_state_access; | 139 | bool has_ARB_direct_state_access = false; |
| 143 | bool has_ARB_separate_shader_objects; | 140 | bool has_ARB_separate_shader_objects = false; |
| 144 | bool has_ARB_vertex_attrib_binding; | 141 | bool has_ARB_vertex_attrib_binding = false; |
| 145 | 142 | ||
| 146 | OpenGLState state; | 143 | OpenGLState state; |
| 147 | 144 | ||
| @@ -170,5 +167,5 @@ private: | |||
| 170 | void SetupShaders(u8* buffer_ptr, GLintptr buffer_offset); | 167 | void SetupShaders(u8* buffer_ptr, GLintptr buffer_offset); |
| 171 | 168 | ||
| 172 | enum class AccelDraw { Disabled, Arrays, Indexed }; | 169 | enum class AccelDraw { Disabled, Arrays, Indexed }; |
| 173 | AccelDraw accelerate_draw; | 170 | AccelDraw accelerate_draw = AccelDraw::Disabled; |
| 174 | }; | 171 | }; |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 8f99864a0..91ce0357b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -110,6 +110,9 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 110 | {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8 | 110 | {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8 |
| 111 | {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F | 111 | {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F |
| 112 | {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F | 112 | {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F |
| 113 | {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F | ||
| 114 | {GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F | ||
| 115 | {GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM | ||
| 113 | 116 | ||
| 114 | // DepthStencil formats | 117 | // DepthStencil formats |
| 115 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, | 118 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, |
| @@ -119,6 +122,8 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 119 | {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F | 122 | {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F |
| 120 | {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, ComponentType::UNorm, | 123 | {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, ComponentType::UNorm, |
| 121 | false}, // Z16 | 124 | false}, // Z16 |
| 125 | {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, | ||
| 126 | ComponentType::Float, false}, // Z32FS8 | ||
| 122 | }}; | 127 | }}; |
| 123 | 128 | ||
| 124 | static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { | 129 | static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { |
| @@ -203,8 +208,10 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 203 | MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, | 208 | MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, |
| 204 | MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, | 209 | MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, |
| 205 | MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, | 210 | MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, |
| 206 | MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, | 211 | MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>, |
| 207 | MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>, | 212 | MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::Z24S8>, |
| 213 | MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, | ||
| 214 | MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>, | ||
| 208 | }; | 215 | }; |
| 209 | 216 | ||
| 210 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | 217 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), |
| @@ -229,10 +236,14 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 229 | MortonCopy<false, PixelFormat::BGRA8>, | 236 | MortonCopy<false, PixelFormat::BGRA8>, |
| 230 | MortonCopy<false, PixelFormat::RGBA32F>, | 237 | MortonCopy<false, PixelFormat::RGBA32F>, |
| 231 | MortonCopy<false, PixelFormat::RG32F>, | 238 | MortonCopy<false, PixelFormat::RG32F>, |
| 239 | MortonCopy<false, PixelFormat::R32F>, | ||
| 240 | MortonCopy<false, PixelFormat::R16F>, | ||
| 241 | MortonCopy<false, PixelFormat::R16UNORM>, | ||
| 232 | MortonCopy<false, PixelFormat::Z24S8>, | 242 | MortonCopy<false, PixelFormat::Z24S8>, |
| 233 | MortonCopy<false, PixelFormat::S8Z24>, | 243 | MortonCopy<false, PixelFormat::S8Z24>, |
| 234 | MortonCopy<false, PixelFormat::Z32F>, | 244 | MortonCopy<false, PixelFormat::Z32F>, |
| 235 | MortonCopy<false, PixelFormat::Z16>, | 245 | MortonCopy<false, PixelFormat::Z16>, |
| 246 | MortonCopy<false, PixelFormat::Z32FS8>, | ||
| 236 | }; | 247 | }; |
| 237 | 248 | ||
| 238 | // Allocate an uninitialized texture of appropriate size and format for the surface | 249 | // Allocate an uninitialized texture of appropriate size and format for the surface |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 23efbe67c..fc864c56f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -40,14 +40,18 @@ struct SurfaceParams { | |||
| 40 | BGRA8 = 15, | 40 | BGRA8 = 15, |
| 41 | RGBA32F = 16, | 41 | RGBA32F = 16, |
| 42 | RG32F = 17, | 42 | RG32F = 17, |
| 43 | R32F = 18, | ||
| 44 | R16F = 19, | ||
| 45 | R16UNORM = 20, | ||
| 43 | 46 | ||
| 44 | MaxColorFormat, | 47 | MaxColorFormat, |
| 45 | 48 | ||
| 46 | // DepthStencil formats | 49 | // DepthStencil formats |
| 47 | Z24S8 = 18, | 50 | Z24S8 = 21, |
| 48 | S8Z24 = 19, | 51 | S8Z24 = 22, |
| 49 | Z32F = 20, | 52 | Z32F = 23, |
| 50 | Z16 = 21, | 53 | Z16 = 24, |
| 54 | Z32FS8 = 25, | ||
| 51 | 55 | ||
| 52 | MaxDepthStencilFormat, | 56 | MaxDepthStencilFormat, |
| 53 | 57 | ||
| @@ -103,10 +107,14 @@ struct SurfaceParams { | |||
| 103 | 1, // BGRA8 | 107 | 1, // BGRA8 |
| 104 | 1, // RGBA32F | 108 | 1, // RGBA32F |
| 105 | 1, // RG32F | 109 | 1, // RG32F |
| 110 | 1, // R32F | ||
| 111 | 1, // R16F | ||
| 112 | 1, // R16UNORM | ||
| 106 | 1, // Z24S8 | 113 | 1, // Z24S8 |
| 107 | 1, // S8Z24 | 114 | 1, // S8Z24 |
| 108 | 1, // Z32F | 115 | 1, // Z32F |
| 109 | 1, // Z16 | 116 | 1, // Z16 |
| 117 | 1, // Z32FS8 | ||
| 110 | }}; | 118 | }}; |
| 111 | 119 | ||
| 112 | ASSERT(static_cast<size_t>(format) < compression_factor_table.size()); | 120 | ASSERT(static_cast<size_t>(format) < compression_factor_table.size()); |
| @@ -136,10 +144,14 @@ struct SurfaceParams { | |||
| 136 | 32, // BGRA8 | 144 | 32, // BGRA8 |
| 137 | 128, // RGBA32F | 145 | 128, // RGBA32F |
| 138 | 64, // RG32F | 146 | 64, // RG32F |
| 147 | 32, // R32F | ||
| 148 | 16, // R16F | ||
| 149 | 16, // R16UNORM | ||
| 139 | 32, // Z24S8 | 150 | 32, // Z24S8 |
| 140 | 32, // S8Z24 | 151 | 32, // S8Z24 |
| 141 | 32, // Z32F | 152 | 32, // Z32F |
| 142 | 16, // Z16 | 153 | 16, // Z16 |
| 154 | 64, // Z32FS8 | ||
| 143 | }}; | 155 | }}; |
| 144 | 156 | ||
| 145 | ASSERT(static_cast<size_t>(format) < bpp_table.size()); | 157 | ASSERT(static_cast<size_t>(format) < bpp_table.size()); |
| @@ -160,6 +172,8 @@ struct SurfaceParams { | |||
| 160 | return PixelFormat::Z32F; | 172 | return PixelFormat::Z32F; |
| 161 | case Tegra::DepthFormat::Z16_UNORM: | 173 | case Tegra::DepthFormat::Z16_UNORM: |
| 162 | return PixelFormat::Z16; | 174 | return PixelFormat::Z16; |
| 175 | case Tegra::DepthFormat::Z32_S8_X24_FLOAT: | ||
| 176 | return PixelFormat::Z32FS8; | ||
| 163 | default: | 177 | default: |
| 164 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 178 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); |
| 165 | UNREACHABLE(); | 179 | UNREACHABLE(); |
| @@ -185,6 +199,8 @@ struct SurfaceParams { | |||
| 185 | return PixelFormat::R11FG11FB10F; | 199 | return PixelFormat::R11FG11FB10F; |
| 186 | case Tegra::RenderTargetFormat::RGBA32_UINT: | 200 | case Tegra::RenderTargetFormat::RGBA32_UINT: |
| 187 | return PixelFormat::RGBA32UI; | 201 | return PixelFormat::RGBA32UI; |
| 202 | case Tegra::RenderTargetFormat::R8_UNORM: | ||
| 203 | return PixelFormat::R8; | ||
| 188 | default: | 204 | default: |
| 189 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 205 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); |
| 190 | UNREACHABLE(); | 206 | UNREACHABLE(); |
| @@ -223,6 +239,22 @@ struct SurfaceParams { | |||
| 223 | UNREACHABLE(); | 239 | UNREACHABLE(); |
| 224 | case Tegra::Texture::TextureFormat::R32_G32: | 240 | case Tegra::Texture::TextureFormat::R32_G32: |
| 225 | return PixelFormat::RG32F; | 241 | return PixelFormat::RG32F; |
| 242 | case Tegra::Texture::TextureFormat::R16: | ||
| 243 | switch (component_type) { | ||
| 244 | case Tegra::Texture::ComponentType::FLOAT: | ||
| 245 | return PixelFormat::R16F; | ||
| 246 | case Tegra::Texture::ComponentType::UNORM: | ||
| 247 | return PixelFormat::R16UNORM; | ||
| 248 | } | ||
| 249 | LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", | ||
| 250 | static_cast<u32>(component_type)); | ||
| 251 | UNREACHABLE(); | ||
| 252 | case Tegra::Texture::TextureFormat::R32: | ||
| 253 | return PixelFormat::R32F; | ||
| 254 | case Tegra::Texture::TextureFormat::ZF32: | ||
| 255 | return PixelFormat::Z32F; | ||
| 256 | case Tegra::Texture::TextureFormat::Z24S8: | ||
| 257 | return PixelFormat::Z24S8; | ||
| 226 | case Tegra::Texture::TextureFormat::DXT1: | 258 | case Tegra::Texture::TextureFormat::DXT1: |
| 227 | return PixelFormat::DXT1; | 259 | return PixelFormat::DXT1; |
| 228 | case Tegra::Texture::TextureFormat::DXT23: | 260 | case Tegra::Texture::TextureFormat::DXT23: |
| @@ -283,6 +315,15 @@ struct SurfaceParams { | |||
| 283 | return Tegra::Texture::TextureFormat::R32_G32_B32_A32; | 315 | return Tegra::Texture::TextureFormat::R32_G32_B32_A32; |
| 284 | case PixelFormat::RG32F: | 316 | case PixelFormat::RG32F: |
| 285 | return Tegra::Texture::TextureFormat::R32_G32; | 317 | return Tegra::Texture::TextureFormat::R32_G32; |
| 318 | case PixelFormat::R32F: | ||
| 319 | return Tegra::Texture::TextureFormat::R32; | ||
| 320 | case PixelFormat::R16F: | ||
| 321 | case PixelFormat::R16UNORM: | ||
| 322 | return Tegra::Texture::TextureFormat::R16; | ||
| 323 | case PixelFormat::Z32F: | ||
| 324 | return Tegra::Texture::TextureFormat::ZF32; | ||
| 325 | case PixelFormat::Z24S8: | ||
| 326 | return Tegra::Texture::TextureFormat::Z24S8; | ||
| 286 | default: | 327 | default: |
| 287 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 328 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); |
| 288 | UNREACHABLE(); | 329 | UNREACHABLE(); |
| @@ -299,6 +340,8 @@ struct SurfaceParams { | |||
| 299 | return Tegra::DepthFormat::Z32_FLOAT; | 340 | return Tegra::DepthFormat::Z32_FLOAT; |
| 300 | case PixelFormat::Z16: | 341 | case PixelFormat::Z16: |
| 301 | return Tegra::DepthFormat::Z16_UNORM; | 342 | return Tegra::DepthFormat::Z16_UNORM; |
| 343 | case PixelFormat::Z32FS8: | ||
| 344 | return Tegra::DepthFormat::Z32_S8_X24_FLOAT; | ||
| 302 | default: | 345 | default: |
| 303 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 346 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); |
| 304 | UNREACHABLE(); | 347 | UNREACHABLE(); |
| @@ -325,6 +368,7 @@ struct SurfaceParams { | |||
| 325 | case Tegra::RenderTargetFormat::RGBA8_SRGB: | 368 | case Tegra::RenderTargetFormat::RGBA8_SRGB: |
| 326 | case Tegra::RenderTargetFormat::BGRA8_UNORM: | 369 | case Tegra::RenderTargetFormat::BGRA8_UNORM: |
| 327 | case Tegra::RenderTargetFormat::RGB10_A2_UNORM: | 370 | case Tegra::RenderTargetFormat::RGB10_A2_UNORM: |
| 371 | case Tegra::RenderTargetFormat::R8_UNORM: | ||
| 328 | return ComponentType::UNorm; | 372 | return ComponentType::UNorm; |
| 329 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: | 373 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: |
| 330 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: | 374 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: |
| @@ -356,6 +400,7 @@ struct SurfaceParams { | |||
| 356 | case Tegra::DepthFormat::Z24_S8_UNORM: | 400 | case Tegra::DepthFormat::Z24_S8_UNORM: |
| 357 | return ComponentType::UNorm; | 401 | return ComponentType::UNorm; |
| 358 | case Tegra::DepthFormat::Z32_FLOAT: | 402 | case Tegra::DepthFormat::Z32_FLOAT: |
| 403 | case Tegra::DepthFormat::Z32_S8_X24_FLOAT: | ||
| 359 | return ComponentType::Float; | 404 | return ComponentType::Float; |
| 360 | default: | 405 | default: |
| 361 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 406 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); |
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index e19c3b280..16b1bd606 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h | |||
| @@ -56,6 +56,9 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) { | |||
| 56 | return {}; | 56 | return {}; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | case Maxwell::VertexAttribute::Type::UnsignedInt: | ||
| 60 | return GL_UNSIGNED_INT; | ||
| 61 | |||
| 59 | case Maxwell::VertexAttribute::Type::Float: | 62 | case Maxwell::VertexAttribute::Type::Float: |
| 60 | return GL_FLOAT; | 63 | return GL_FLOAT; |
| 61 | } | 64 | } |
| @@ -112,6 +115,8 @@ inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) { | |||
| 112 | return GL_MIRRORED_REPEAT; | 115 | return GL_MIRRORED_REPEAT; |
| 113 | case Tegra::Texture::WrapMode::ClampToEdge: | 116 | case Tegra::Texture::WrapMode::ClampToEdge: |
| 114 | return GL_CLAMP_TO_EDGE; | 117 | return GL_CLAMP_TO_EDGE; |
| 118 | case Tegra::Texture::WrapMode::Border: | ||
| 119 | return GL_CLAMP_TO_BORDER; | ||
| 115 | case Tegra::Texture::WrapMode::ClampOGL: | 120 | case Tegra::Texture::WrapMode::ClampOGL: |
| 116 | // TODO(Subv): GL_CLAMP was removed as of OpenGL 3.1, to implement GL_CLAMP, we can use | 121 | // TODO(Subv): GL_CLAMP was removed as of OpenGL 3.1, to implement GL_CLAMP, we can use |
| 117 | // GL_CLAMP_TO_BORDER to get the border color of the texture, and then sample the edge to | 122 | // GL_CLAMP_TO_BORDER to get the border color of the texture, and then sample the edge to |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index e5e9e1898..50c5a56f6 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -61,10 +61,12 @@ u32 BytesPerPixel(TextureFormat format) { | |||
| 61 | case TextureFormat::A8R8G8B8: | 61 | case TextureFormat::A8R8G8B8: |
| 62 | case TextureFormat::A2B10G10R10: | 62 | case TextureFormat::A2B10G10R10: |
| 63 | case TextureFormat::BF10GF11RF11: | 63 | case TextureFormat::BF10GF11RF11: |
| 64 | case TextureFormat::R32: | ||
| 64 | return 4; | 65 | return 4; |
| 65 | case TextureFormat::A1B5G5R5: | 66 | case TextureFormat::A1B5G5R5: |
| 66 | case TextureFormat::B5G6R5: | 67 | case TextureFormat::B5G6R5: |
| 67 | case TextureFormat::G8R8: | 68 | case TextureFormat::G8R8: |
| 69 | case TextureFormat::R16: | ||
| 68 | return 2; | 70 | return 2; |
| 69 | case TextureFormat::R8: | 71 | case TextureFormat::R8: |
| 70 | return 1; | 72 | return 1; |
| @@ -88,6 +90,8 @@ static u32 DepthBytesPerPixel(DepthFormat format) { | |||
| 88 | case DepthFormat::Z24_S8_UNORM: | 90 | case DepthFormat::Z24_S8_UNORM: |
| 89 | case DepthFormat::Z32_FLOAT: | 91 | case DepthFormat::Z32_FLOAT: |
| 90 | return 4; | 92 | return 4; |
| 93 | case DepthFormat::Z32_S8_X24_FLOAT: | ||
| 94 | return 8; | ||
| 91 | default: | 95 | default: |
| 92 | UNIMPLEMENTED_MSG("Format not implemented"); | 96 | UNIMPLEMENTED_MSG("Format not implemented"); |
| 93 | break; | 97 | break; |
| @@ -121,6 +125,8 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width, | |||
| 121 | case TextureFormat::R16_G16_B16_A16: | 125 | case TextureFormat::R16_G16_B16_A16: |
| 122 | case TextureFormat::R32_G32_B32_A32: | 126 | case TextureFormat::R32_G32_B32_A32: |
| 123 | case TextureFormat::R32_G32: | 127 | case TextureFormat::R32_G32: |
| 128 | case TextureFormat::R32: | ||
| 129 | case TextureFormat::R16: | ||
| 124 | case TextureFormat::BF10GF11RF11: | 130 | case TextureFormat::BF10GF11RF11: |
| 125 | case TextureFormat::ASTC_2D_4X4: | 131 | case TextureFormat::ASTC_2D_4X4: |
| 126 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, | 132 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, |
| @@ -146,6 +152,7 @@ std::vector<u8> UnswizzleDepthTexture(VAddr address, DepthFormat format, u32 wid | |||
| 146 | case DepthFormat::S8_Z24_UNORM: | 152 | case DepthFormat::S8_Z24_UNORM: |
| 147 | case DepthFormat::Z24_S8_UNORM: | 153 | case DepthFormat::Z24_S8_UNORM: |
| 148 | case DepthFormat::Z32_FLOAT: | 154 | case DepthFormat::Z32_FLOAT: |
| 155 | case DepthFormat::Z32_S8_X24_FLOAT: | ||
| 149 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, | 156 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, |
| 150 | unswizzled_data.data(), true, block_height); | 157 | unswizzled_data.data(), true, block_height); |
| 151 | break; | 158 | break; |
| @@ -178,6 +185,8 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat | |||
| 178 | case TextureFormat::BF10GF11RF11: | 185 | case TextureFormat::BF10GF11RF11: |
| 179 | case TextureFormat::R32_G32_B32_A32: | 186 | case TextureFormat::R32_G32_B32_A32: |
| 180 | case TextureFormat::R32_G32: | 187 | case TextureFormat::R32_G32: |
| 188 | case TextureFormat::R32: | ||
| 189 | case TextureFormat::R16: | ||
| 181 | // TODO(Subv): For the time being just forward the same data without any decoding. | 190 | // TODO(Subv): For the time being just forward the same data without any decoding. |
| 182 | rgba_data = texture_data; | 191 | rgba_data = texture_data; |
| 183 | break; | 192 | break; |
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h index d1c755033..c6bd2f4b9 100644 --- a/src/video_core/textures/texture.h +++ b/src/video_core/textures/texture.h | |||
| @@ -242,10 +242,10 @@ struct TSCEntry { | |||
| 242 | BitField<6, 2, TextureMipmapFilter> mip_filter; | 242 | BitField<6, 2, TextureMipmapFilter> mip_filter; |
| 243 | }; | 243 | }; |
| 244 | INSERT_PADDING_BYTES(8); | 244 | INSERT_PADDING_BYTES(8); |
| 245 | u32 border_color_r; | 245 | float border_color_r; |
| 246 | u32 border_color_g; | 246 | float border_color_g; |
| 247 | u32 border_color_b; | 247 | float border_color_b; |
| 248 | u32 border_color_a; | 248 | float border_color_a; |
| 249 | }; | 249 | }; |
| 250 | static_assert(sizeof(TSCEntry) == 0x20, "TSCEntry has wrong size"); | 250 | static_assert(sizeof(TSCEntry) == 0x20, "TSCEntry has wrong size"); |
| 251 | 251 | ||
diff --git a/src/yuzu/debugger/wait_tree.cpp b/src/yuzu/debugger/wait_tree.cpp index 8f24586ce..416cc1dfa 100644 --- a/src/yuzu/debugger/wait_tree.cpp +++ b/src/yuzu/debugger/wait_tree.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include "yuzu/debugger/wait_tree.h" | 5 | #include "yuzu/debugger/wait_tree.h" |
| 6 | #include "yuzu/util/util.h" | 6 | #include "yuzu/util/util.h" |
| 7 | 7 | ||
| 8 | #include "common/assert.h" | ||
| 8 | #include "core/core.h" | 9 | #include "core/core.h" |
| 9 | #include "core/hle/kernel/event.h" | 10 | #include "core/hle/kernel/event.h" |
| 10 | #include "core/hle/kernel/handle_table.h" | 11 | #include "core/hle/kernel/handle_table.h" |
| @@ -169,6 +170,8 @@ QString WaitTreeWaitObject::GetResetTypeQString(Kernel::ResetType reset_type) { | |||
| 169 | case Kernel::ResetType::Pulse: | 170 | case Kernel::ResetType::Pulse: |
| 170 | return tr("pulse"); | 171 | return tr("pulse"); |
| 171 | } | 172 | } |
| 173 | UNREACHABLE(); | ||
| 174 | return {}; | ||
| 172 | } | 175 | } |
| 173 | 176 | ||
| 174 | WaitTreeObjectList::WaitTreeObjectList( | 177 | WaitTreeObjectList::WaitTreeObjectList( |