diff options
Diffstat (limited to 'src')
31 files changed, 220 insertions, 161 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 6b6efbc00..b7d52babc 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -146,10 +146,8 @@ add_library(core STATIC | |||
| 146 | hle/service/filesystem/fsp_srv.h | 146 | hle/service/filesystem/fsp_srv.h |
| 147 | hle/service/friend/friend.cpp | 147 | hle/service/friend/friend.cpp |
| 148 | hle/service/friend/friend.h | 148 | hle/service/friend/friend.h |
| 149 | hle/service/friend/friend_a.cpp | 149 | hle/service/friend/interface.cpp |
| 150 | hle/service/friend/friend_a.h | 150 | hle/service/friend/interface.h |
| 151 | hle/service/friend/friend_u.cpp | ||
| 152 | hle/service/friend/friend_u.h | ||
| 153 | hle/service/hid/hid.cpp | 151 | hle/service/hid/hid.cpp |
| 154 | hle/service/hid/hid.h | 152 | hle/service/hid/hid.h |
| 155 | hle/service/lm/lm.cpp | 153 | 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/file_sys/partition_filesystem.cpp b/src/core/file_sys/partition_filesystem.cpp index 8d2bd9f6b..521e21078 100644 --- a/src/core/file_sys/partition_filesystem.cpp +++ b/src/core/file_sys/partition_filesystem.cpp | |||
| @@ -65,8 +65,8 @@ PartitionFilesystem::PartitionFilesystem(std::shared_ptr<VfsFile> file) { | |||
| 65 | std::string name( | 65 | std::string name( |
| 66 | reinterpret_cast<const char*>(&file_data[strtab_offset + entry.strtab_offset])); | 66 | reinterpret_cast<const char*>(&file_data[strtab_offset + entry.strtab_offset])); |
| 67 | 67 | ||
| 68 | pfs_files.emplace_back( | 68 | pfs_files.emplace_back(std::make_shared<OffsetVfsFile>( |
| 69 | std::make_shared<OffsetVfsFile>(file, entry.size, content_offset + entry.offset, name)); | 69 | file, entry.size, content_offset + entry.offset, std::move(name))); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | status = Loader::ResultStatus::Success; | 72 | status = Loader::ResultStatus::Success; |
| @@ -109,7 +109,7 @@ bool PartitionFilesystem::ReplaceFileWithSubdirectory(VirtualFile file, VirtualD | |||
| 109 | return false; | 109 | return false; |
| 110 | 110 | ||
| 111 | const std::ptrdiff_t offset = std::distance(pfs_files.begin(), iter); | 111 | const std::ptrdiff_t offset = std::distance(pfs_files.begin(), iter); |
| 112 | pfs_files[offset] = pfs_files.back(); | 112 | pfs_files[offset] = std::move(pfs_files.back()); |
| 113 | pfs_files.pop_back(); | 113 | pfs_files.pop_back(); |
| 114 | 114 | ||
| 115 | pfs_dirs.emplace_back(std::move(dir)); | 115 | pfs_dirs.emplace_back(std::move(dir)); |
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index ac1a633ba..7fb0da408 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h | |||
| @@ -25,9 +25,9 @@ protected: | |||
| 25 | ptrdiff_t index = 0; | 25 | ptrdiff_t index = 0; |
| 26 | 26 | ||
| 27 | public: | 27 | public: |
| 28 | RequestHelperBase(u32* command_buffer) : cmdbuf(command_buffer) {} | 28 | explicit RequestHelperBase(u32* command_buffer) : cmdbuf(command_buffer) {} |
| 29 | 29 | ||
| 30 | RequestHelperBase(Kernel::HLERequestContext& context) | 30 | explicit RequestHelperBase(Kernel::HLERequestContext& context) |
| 31 | : context(&context), cmdbuf(context.CommandBuffer()) {} | 31 | : context(&context), cmdbuf(context.CommandBuffer()) {} |
| 32 | 32 | ||
| 33 | void Skip(unsigned size_in_words, bool set_to_null) { | 33 | void Skip(unsigned size_in_words, bool set_to_null) { |
| @@ -56,13 +56,6 @@ public: | |||
| 56 | 56 | ||
| 57 | class ResponseBuilder : public RequestHelperBase { | 57 | class ResponseBuilder : public RequestHelperBase { |
| 58 | public: | 58 | public: |
| 59 | ResponseBuilder(u32* command_buffer) : RequestHelperBase(command_buffer) {} | ||
| 60 | |||
| 61 | u32 normal_params_size{}; | ||
| 62 | u32 num_handles_to_copy{}; | ||
| 63 | u32 num_objects_to_move{}; ///< Domain objects or move handles, context dependent | ||
| 64 | std::ptrdiff_t datapayload_index{}; | ||
| 65 | |||
| 66 | /// Flags used for customizing the behavior of ResponseBuilder | 59 | /// Flags used for customizing the behavior of ResponseBuilder |
| 67 | enum class Flags : u32 { | 60 | enum class Flags : u32 { |
| 68 | None = 0, | 61 | None = 0, |
| @@ -71,9 +64,11 @@ public: | |||
| 71 | AlwaysMoveHandles = 1, | 64 | AlwaysMoveHandles = 1, |
| 72 | }; | 65 | }; |
| 73 | 66 | ||
| 74 | ResponseBuilder(Kernel::HLERequestContext& context, u32 normal_params_size, | 67 | explicit ResponseBuilder(u32* command_buffer) : RequestHelperBase(command_buffer) {} |
| 75 | u32 num_handles_to_copy = 0, u32 num_objects_to_move = 0, | 68 | |
| 76 | Flags flags = Flags::None) | 69 | explicit ResponseBuilder(Kernel::HLERequestContext& context, u32 normal_params_size, |
| 70 | u32 num_handles_to_copy = 0, u32 num_objects_to_move = 0, | ||
| 71 | Flags flags = Flags::None) | ||
| 77 | 72 | ||
| 78 | : RequestHelperBase(context), normal_params_size(normal_params_size), | 73 | : RequestHelperBase(context), normal_params_size(normal_params_size), |
| 79 | num_handles_to_copy(num_handles_to_copy), num_objects_to_move(num_objects_to_move) { | 74 | num_handles_to_copy(num_handles_to_copy), num_objects_to_move(num_objects_to_move) { |
| @@ -206,6 +201,12 @@ public: | |||
| 206 | 201 | ||
| 207 | template <typename... O> | 202 | template <typename... O> |
| 208 | void PushCopyObjects(Kernel::SharedPtr<O>... pointers); | 203 | void PushCopyObjects(Kernel::SharedPtr<O>... pointers); |
| 204 | |||
| 205 | private: | ||
| 206 | u32 normal_params_size{}; | ||
| 207 | u32 num_handles_to_copy{}; | ||
| 208 | u32 num_objects_to_move{}; ///< Domain objects or move handles, context dependent | ||
| 209 | std::ptrdiff_t datapayload_index{}; | ||
| 209 | }; | 210 | }; |
| 210 | 211 | ||
| 211 | /// Push /// | 212 | /// Push /// |
| @@ -273,9 +274,9 @@ inline void ResponseBuilder::PushMoveObjects(Kernel::SharedPtr<O>... pointers) { | |||
| 273 | 274 | ||
| 274 | class RequestParser : public RequestHelperBase { | 275 | class RequestParser : public RequestHelperBase { |
| 275 | public: | 276 | public: |
| 276 | RequestParser(u32* command_buffer) : RequestHelperBase(command_buffer) {} | 277 | explicit RequestParser(u32* command_buffer) : RequestHelperBase(command_buffer) {} |
| 277 | 278 | ||
| 278 | RequestParser(Kernel::HLERequestContext& context) : RequestHelperBase(context) { | 279 | explicit RequestParser(Kernel::HLERequestContext& context) : RequestHelperBase(context) { |
| 279 | ASSERT_MSG(context.GetDataPayloadOffset(), "context is incomplete"); | 280 | ASSERT_MSG(context.GetDataPayloadOffset(), "context is incomplete"); |
| 280 | Skip(context.GetDataPayloadOffset(), false); | 281 | Skip(context.GetDataPayloadOffset(), false); |
| 281 | // Skip the u64 command id, it's already stored in the context | 282 | // Skip the u64 command id, it's already stored in the context |
| @@ -285,8 +286,9 @@ public: | |||
| 285 | 286 | ||
| 286 | ResponseBuilder MakeBuilder(u32 normal_params_size, u32 num_handles_to_copy, | 287 | ResponseBuilder MakeBuilder(u32 normal_params_size, u32 num_handles_to_copy, |
| 287 | u32 num_handles_to_move, | 288 | u32 num_handles_to_move, |
| 288 | ResponseBuilder::Flags flags = ResponseBuilder::Flags::None) { | 289 | ResponseBuilder::Flags flags = ResponseBuilder::Flags::None) const { |
| 289 | return {*context, normal_params_size, num_handles_to_copy, num_handles_to_move, flags}; | 290 | return ResponseBuilder{*context, normal_params_size, num_handles_to_copy, |
| 291 | num_handles_to_move, flags}; | ||
| 290 | } | 292 | } |
| 291 | 293 | ||
| 292 | template <typename T> | 294 | template <typename T> |
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 01b805df8..84727f748 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h | |||
| @@ -91,7 +91,7 @@ protected: | |||
| 91 | */ | 91 | */ |
| 92 | class HLERequestContext { | 92 | class HLERequestContext { |
| 93 | public: | 93 | public: |
| 94 | HLERequestContext(SharedPtr<Kernel::ServerSession> session); | 94 | explicit HLERequestContext(SharedPtr<ServerSession> session); |
| 95 | ~HLERequestContext(); | 95 | ~HLERequestContext(); |
| 96 | 96 | ||
| 97 | /// Returns a pointer to the IPC command buffer for this request. | 97 | /// Returns a pointer to the IPC command buffer for this request. |
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/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.cpp b/src/video_core/gpu.cpp index a003bc9e3..60c49d672 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -35,9 +35,11 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { | |||
| 35 | case RenderTargetFormat::RGBA32_FLOAT: | 35 | case RenderTargetFormat::RGBA32_FLOAT: |
| 36 | return 16; | 36 | return 16; |
| 37 | case RenderTargetFormat::RGBA16_FLOAT: | 37 | case RenderTargetFormat::RGBA16_FLOAT: |
| 38 | case RenderTargetFormat::RG32_FLOAT: | ||
| 38 | return 8; | 39 | return 8; |
| 39 | case RenderTargetFormat::RGBA8_UNORM: | 40 | case RenderTargetFormat::RGBA8_UNORM: |
| 40 | case RenderTargetFormat::RGB10_A2_UNORM: | 41 | case RenderTargetFormat::RGB10_A2_UNORM: |
| 42 | case RenderTargetFormat::BGRA8_UNORM: | ||
| 41 | return 4; | 43 | return 4; |
| 42 | default: | 44 | default: |
| 43 | UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format)); | 45 | UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format)); |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index a32148ecd..e9d87efb4 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -18,10 +18,13 @@ enum class RenderTargetFormat : u32 { | |||
| 18 | RGBA32_FLOAT = 0xC0, | 18 | RGBA32_FLOAT = 0xC0, |
| 19 | RGBA32_UINT = 0xC2, | 19 | RGBA32_UINT = 0xC2, |
| 20 | RGBA16_FLOAT = 0xCA, | 20 | RGBA16_FLOAT = 0xCA, |
| 21 | RG32_FLOAT = 0xCB, | ||
| 22 | BGRA8_UNORM = 0xCF, | ||
| 21 | RGB10_A2_UNORM = 0xD1, | 23 | RGB10_A2_UNORM = 0xD1, |
| 22 | RGBA8_UNORM = 0xD5, | 24 | RGBA8_UNORM = 0xD5, |
| 23 | RGBA8_SRGB = 0xD6, | 25 | RGBA8_SRGB = 0xD6, |
| 24 | R11G11B10_FLOAT = 0xE0, | 26 | R11G11B10_FLOAT = 0xE0, |
| 27 | R8_UNORM = 0xF3, | ||
| 25 | }; | 28 | }; |
| 26 | 29 | ||
| 27 | enum class DepthFormat : u32 { | 30 | enum class DepthFormat : u32 { |
| @@ -31,6 +34,7 @@ enum class DepthFormat : u32 { | |||
| 31 | Z24_X8_UNORM = 0x15, | 34 | Z24_X8_UNORM = 0x15, |
| 32 | Z24_S8_UNORM = 0x16, | 35 | Z24_S8_UNORM = 0x16, |
| 33 | Z24_C8_UNORM = 0x18, | 36 | Z24_C8_UNORM = 0x18, |
| 37 | Z32_S8_X24_FLOAT = 0x19, | ||
| 34 | }; | 38 | }; |
| 35 | 39 | ||
| 36 | /// 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 28f0bc379..91ce0357b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -38,7 +38,8 @@ struct FormatTuple { | |||
| 38 | params.addr = config.tic.Address(); | 38 | params.addr = config.tic.Address(); |
| 39 | params.is_tiled = config.tic.IsTiled(); | 39 | params.is_tiled = config.tic.IsTiled(); |
| 40 | params.block_height = params.is_tiled ? config.tic.BlockHeight() : 0, | 40 | params.block_height = params.is_tiled ? config.tic.BlockHeight() : 0, |
| 41 | params.pixel_format = PixelFormatFromTextureFormat(config.tic.format); | 41 | params.pixel_format = |
| 42 | PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value()); | ||
| 42 | params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value()); | 43 | params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value()); |
| 43 | params.type = GetFormatType(params.pixel_format); | 44 | params.type = GetFormatType(params.pixel_format); |
| 44 | params.width = Common::AlignUp(config.tic.Width(), GetCompressionFactor(params.pixel_format)); | 45 | params.width = Common::AlignUp(config.tic.Width(), GetCompressionFactor(params.pixel_format)); |
| @@ -106,6 +107,12 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 106 | true}, // BC7U | 107 | true}, // BC7U |
| 107 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 | 108 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 |
| 108 | {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8 | 109 | {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8 |
| 110 | {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8 | ||
| 111 | {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F | ||
| 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 | ||
| 109 | 116 | ||
| 110 | // DepthStencil formats | 117 | // DepthStencil formats |
| 111 | {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, |
| @@ -115,6 +122,8 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 115 | {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 |
| 116 | {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, ComponentType::UNorm, | 123 | {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, ComponentType::UNorm, |
| 117 | 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 | ||
| 118 | }}; | 127 | }}; |
| 119 | 128 | ||
| 120 | static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { | 129 | static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { |
| @@ -197,9 +206,12 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 197 | MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, | 206 | MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, |
| 198 | MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, | 207 | MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, |
| 199 | MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, | 208 | MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, |
| 200 | MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::Z24S8>, | 209 | MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, |
| 210 | MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, | ||
| 211 | MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>, | ||
| 212 | MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::Z24S8>, | ||
| 201 | MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, | 213 | MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, |
| 202 | MortonCopy<true, PixelFormat::Z16>, | 214 | MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>, |
| 203 | }; | 215 | }; |
| 204 | 216 | ||
| 205 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | 217 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), |
| @@ -213,7 +225,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 213 | MortonCopy<false, PixelFormat::RGBA16F>, | 225 | MortonCopy<false, PixelFormat::RGBA16F>, |
| 214 | MortonCopy<false, PixelFormat::R11FG11FB10F>, | 226 | MortonCopy<false, PixelFormat::R11FG11FB10F>, |
| 215 | MortonCopy<false, PixelFormat::RGBA32UI>, | 227 | MortonCopy<false, PixelFormat::RGBA32UI>, |
| 216 | // TODO(Subv): Swizzling the DXT1/DXT23/DXT45/DXN1/BC7U formats is not yet supported | 228 | // TODO(Subv): Swizzling DXT1/DXT23/DXT45/DXN1/BC7U/ASTC_2D_4X4 formats is not supported |
| 217 | nullptr, | 229 | nullptr, |
| 218 | nullptr, | 230 | nullptr, |
| 219 | nullptr, | 231 | nullptr, |
| @@ -221,10 +233,17 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 221 | nullptr, | 233 | nullptr, |
| 222 | nullptr, | 234 | nullptr, |
| 223 | MortonCopy<false, PixelFormat::G8R8>, | 235 | MortonCopy<false, PixelFormat::G8R8>, |
| 236 | MortonCopy<false, PixelFormat::BGRA8>, | ||
| 237 | MortonCopy<false, PixelFormat::RGBA32F>, | ||
| 238 | MortonCopy<false, PixelFormat::RG32F>, | ||
| 239 | MortonCopy<false, PixelFormat::R32F>, | ||
| 240 | MortonCopy<false, PixelFormat::R16F>, | ||
| 241 | MortonCopy<false, PixelFormat::R16UNORM>, | ||
| 224 | MortonCopy<false, PixelFormat::Z24S8>, | 242 | MortonCopy<false, PixelFormat::Z24S8>, |
| 225 | MortonCopy<false, PixelFormat::S8Z24>, | 243 | MortonCopy<false, PixelFormat::S8Z24>, |
| 226 | MortonCopy<false, PixelFormat::Z32F>, | 244 | MortonCopy<false, PixelFormat::Z32F>, |
| 227 | MortonCopy<false, PixelFormat::Z16>, | 245 | MortonCopy<false, PixelFormat::Z16>, |
| 246 | MortonCopy<false, PixelFormat::Z32FS8>, | ||
| 228 | }; | 247 | }; |
| 229 | 248 | ||
| 230 | // 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 b084c4db4..fc864c56f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -37,14 +37,21 @@ struct SurfaceParams { | |||
| 37 | BC7U = 12, | 37 | BC7U = 12, |
| 38 | ASTC_2D_4X4 = 13, | 38 | ASTC_2D_4X4 = 13, |
| 39 | G8R8 = 14, | 39 | G8R8 = 14, |
| 40 | BGRA8 = 15, | ||
| 41 | RGBA32F = 16, | ||
| 42 | RG32F = 17, | ||
| 43 | R32F = 18, | ||
| 44 | R16F = 19, | ||
| 45 | R16UNORM = 20, | ||
| 40 | 46 | ||
| 41 | MaxColorFormat, | 47 | MaxColorFormat, |
| 42 | 48 | ||
| 43 | // DepthStencil formats | 49 | // DepthStencil formats |
| 44 | Z24S8 = 15, | 50 | Z24S8 = 21, |
| 45 | S8Z24 = 16, | 51 | S8Z24 = 22, |
| 46 | Z32F = 17, | 52 | Z32F = 23, |
| 47 | Z16 = 18, | 53 | Z16 = 24, |
| 54 | Z32FS8 = 25, | ||
| 48 | 55 | ||
| 49 | MaxDepthStencilFormat, | 56 | MaxDepthStencilFormat, |
| 50 | 57 | ||
| @@ -97,10 +104,17 @@ struct SurfaceParams { | |||
| 97 | 4, // BC7U | 104 | 4, // BC7U |
| 98 | 4, // ASTC_2D_4X4 | 105 | 4, // ASTC_2D_4X4 |
| 99 | 1, // G8R8 | 106 | 1, // G8R8 |
| 107 | 1, // BGRA8 | ||
| 108 | 1, // RGBA32F | ||
| 109 | 1, // RG32F | ||
| 110 | 1, // R32F | ||
| 111 | 1, // R16F | ||
| 112 | 1, // R16UNORM | ||
| 100 | 1, // Z24S8 | 113 | 1, // Z24S8 |
| 101 | 1, // S8Z24 | 114 | 1, // S8Z24 |
| 102 | 1, // Z32F | 115 | 1, // Z32F |
| 103 | 1, // Z16 | 116 | 1, // Z16 |
| 117 | 1, // Z32FS8 | ||
| 104 | }}; | 118 | }}; |
| 105 | 119 | ||
| 106 | ASSERT(static_cast<size_t>(format) < compression_factor_table.size()); | 120 | ASSERT(static_cast<size_t>(format) < compression_factor_table.size()); |
| @@ -127,10 +141,17 @@ struct SurfaceParams { | |||
| 127 | 128, // BC7U | 141 | 128, // BC7U |
| 128 | 32, // ASTC_2D_4X4 | 142 | 32, // ASTC_2D_4X4 |
| 129 | 16, // G8R8 | 143 | 16, // G8R8 |
| 144 | 32, // BGRA8 | ||
| 145 | 128, // RGBA32F | ||
| 146 | 64, // RG32F | ||
| 147 | 32, // R32F | ||
| 148 | 16, // R16F | ||
| 149 | 16, // R16UNORM | ||
| 130 | 32, // Z24S8 | 150 | 32, // Z24S8 |
| 131 | 32, // S8Z24 | 151 | 32, // S8Z24 |
| 132 | 32, // Z32F | 152 | 32, // Z32F |
| 133 | 16, // Z16 | 153 | 16, // Z16 |
| 154 | 64, // Z32FS8 | ||
| 134 | }}; | 155 | }}; |
| 135 | 156 | ||
| 136 | ASSERT(static_cast<size_t>(format) < bpp_table.size()); | 157 | ASSERT(static_cast<size_t>(format) < bpp_table.size()); |
| @@ -151,6 +172,8 @@ struct SurfaceParams { | |||
| 151 | return PixelFormat::Z32F; | 172 | return PixelFormat::Z32F; |
| 152 | case Tegra::DepthFormat::Z16_UNORM: | 173 | case Tegra::DepthFormat::Z16_UNORM: |
| 153 | return PixelFormat::Z16; | 174 | return PixelFormat::Z16; |
| 175 | case Tegra::DepthFormat::Z32_S8_X24_FLOAT: | ||
| 176 | return PixelFormat::Z32FS8; | ||
| 154 | default: | 177 | default: |
| 155 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 178 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); |
| 156 | UNREACHABLE(); | 179 | UNREACHABLE(); |
| @@ -162,21 +185,30 @@ struct SurfaceParams { | |||
| 162 | case Tegra::RenderTargetFormat::RGBA8_UNORM: | 185 | case Tegra::RenderTargetFormat::RGBA8_UNORM: |
| 163 | case Tegra::RenderTargetFormat::RGBA8_SRGB: | 186 | case Tegra::RenderTargetFormat::RGBA8_SRGB: |
| 164 | return PixelFormat::ABGR8; | 187 | return PixelFormat::ABGR8; |
| 188 | case Tegra::RenderTargetFormat::BGRA8_UNORM: | ||
| 189 | return PixelFormat::BGRA8; | ||
| 165 | case Tegra::RenderTargetFormat::RGB10_A2_UNORM: | 190 | case Tegra::RenderTargetFormat::RGB10_A2_UNORM: |
| 166 | return PixelFormat::A2B10G10R10; | 191 | return PixelFormat::A2B10G10R10; |
| 167 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: | 192 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: |
| 168 | return PixelFormat::RGBA16F; | 193 | return PixelFormat::RGBA16F; |
| 194 | case Tegra::RenderTargetFormat::RGBA32_FLOAT: | ||
| 195 | return PixelFormat::RGBA32F; | ||
| 196 | case Tegra::RenderTargetFormat::RG32_FLOAT: | ||
| 197 | return PixelFormat::RG32F; | ||
| 169 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: | 198 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: |
| 170 | return PixelFormat::R11FG11FB10F; | 199 | return PixelFormat::R11FG11FB10F; |
| 171 | case Tegra::RenderTargetFormat::RGBA32_UINT: | 200 | case Tegra::RenderTargetFormat::RGBA32_UINT: |
| 172 | return PixelFormat::RGBA32UI; | 201 | return PixelFormat::RGBA32UI; |
| 202 | case Tegra::RenderTargetFormat::R8_UNORM: | ||
| 203 | return PixelFormat::R8; | ||
| 173 | default: | 204 | default: |
| 174 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 205 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); |
| 175 | UNREACHABLE(); | 206 | UNREACHABLE(); |
| 176 | } | 207 | } |
| 177 | } | 208 | } |
| 178 | 209 | ||
| 179 | static PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format) { | 210 | static PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format, |
| 211 | Tegra::Texture::ComponentType component_type) { | ||
| 180 | // TODO(Subv): Properly implement this | 212 | // TODO(Subv): Properly implement this |
| 181 | switch (format) { | 213 | switch (format) { |
| 182 | case Tegra::Texture::TextureFormat::A8R8G8B8: | 214 | case Tegra::Texture::TextureFormat::A8R8G8B8: |
| @@ -196,7 +228,33 @@ struct SurfaceParams { | |||
| 196 | case Tegra::Texture::TextureFormat::BF10GF11RF11: | 228 | case Tegra::Texture::TextureFormat::BF10GF11RF11: |
| 197 | return PixelFormat::R11FG11FB10F; | 229 | return PixelFormat::R11FG11FB10F; |
| 198 | case Tegra::Texture::TextureFormat::R32_G32_B32_A32: | 230 | case Tegra::Texture::TextureFormat::R32_G32_B32_A32: |
| 199 | return PixelFormat::RGBA32UI; | 231 | switch (component_type) { |
| 232 | case Tegra::Texture::ComponentType::FLOAT: | ||
| 233 | return PixelFormat::RGBA32F; | ||
| 234 | case Tegra::Texture::ComponentType::UINT: | ||
| 235 | return PixelFormat::RGBA32UI; | ||
| 236 | } | ||
| 237 | LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", | ||
| 238 | static_cast<u32>(component_type)); | ||
| 239 | UNREACHABLE(); | ||
| 240 | case Tegra::Texture::TextureFormat::R32_G32: | ||
| 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; | ||
| 200 | case Tegra::Texture::TextureFormat::DXT1: | 258 | case Tegra::Texture::TextureFormat::DXT1: |
| 201 | return PixelFormat::DXT1; | 259 | return PixelFormat::DXT1; |
| 202 | case Tegra::Texture::TextureFormat::DXT23: | 260 | case Tegra::Texture::TextureFormat::DXT23: |
| @@ -210,7 +268,8 @@ struct SurfaceParams { | |||
| 210 | case Tegra::Texture::TextureFormat::ASTC_2D_4X4: | 268 | case Tegra::Texture::TextureFormat::ASTC_2D_4X4: |
| 211 | return PixelFormat::ASTC_2D_4X4; | 269 | return PixelFormat::ASTC_2D_4X4; |
| 212 | default: | 270 | default: |
| 213 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 271 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}, component_type={}", |
| 272 | static_cast<u32>(format), static_cast<u32>(component_type)); | ||
| 214 | UNREACHABLE(); | 273 | UNREACHABLE(); |
| 215 | } | 274 | } |
| 216 | } | 275 | } |
| @@ -248,7 +307,25 @@ struct SurfaceParams { | |||
| 248 | return Tegra::Texture::TextureFormat::BC7U; | 307 | return Tegra::Texture::TextureFormat::BC7U; |
| 249 | case PixelFormat::ASTC_2D_4X4: | 308 | case PixelFormat::ASTC_2D_4X4: |
| 250 | return Tegra::Texture::TextureFormat::ASTC_2D_4X4; | 309 | return Tegra::Texture::TextureFormat::ASTC_2D_4X4; |
| 310 | case PixelFormat::BGRA8: | ||
| 311 | // TODO(bunnei): This is fine for unswizzling (since we just need the right component | ||
| 312 | // sizes), but could be a bug if we used this function in different ways. | ||
| 313 | return Tegra::Texture::TextureFormat::A8R8G8B8; | ||
| 314 | case PixelFormat::RGBA32F: | ||
| 315 | return Tegra::Texture::TextureFormat::R32_G32_B32_A32; | ||
| 316 | case PixelFormat::RG32F: | ||
| 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; | ||
| 251 | default: | 327 | default: |
| 328 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | ||
| 252 | UNREACHABLE(); | 329 | UNREACHABLE(); |
| 253 | } | 330 | } |
| 254 | } | 331 | } |
| @@ -263,7 +340,10 @@ struct SurfaceParams { | |||
| 263 | return Tegra::DepthFormat::Z32_FLOAT; | 340 | return Tegra::DepthFormat::Z32_FLOAT; |
| 264 | case PixelFormat::Z16: | 341 | case PixelFormat::Z16: |
| 265 | return Tegra::DepthFormat::Z16_UNORM; | 342 | return Tegra::DepthFormat::Z16_UNORM; |
| 343 | case PixelFormat::Z32FS8: | ||
| 344 | return Tegra::DepthFormat::Z32_S8_X24_FLOAT; | ||
| 266 | default: | 345 | default: |
| 346 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | ||
| 267 | UNREACHABLE(); | 347 | UNREACHABLE(); |
| 268 | } | 348 | } |
| 269 | } | 349 | } |
| @@ -273,6 +353,8 @@ struct SurfaceParams { | |||
| 273 | switch (type) { | 353 | switch (type) { |
| 274 | case Tegra::Texture::ComponentType::UNORM: | 354 | case Tegra::Texture::ComponentType::UNORM: |
| 275 | return ComponentType::UNorm; | 355 | return ComponentType::UNorm; |
| 356 | case Tegra::Texture::ComponentType::FLOAT: | ||
| 357 | return ComponentType::Float; | ||
| 276 | default: | 358 | default: |
| 277 | LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type)); | 359 | LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type)); |
| 278 | UNREACHABLE(); | 360 | UNREACHABLE(); |
| @@ -284,10 +366,14 @@ struct SurfaceParams { | |||
| 284 | switch (format) { | 366 | switch (format) { |
| 285 | case Tegra::RenderTargetFormat::RGBA8_UNORM: | 367 | case Tegra::RenderTargetFormat::RGBA8_UNORM: |
| 286 | case Tegra::RenderTargetFormat::RGBA8_SRGB: | 368 | case Tegra::RenderTargetFormat::RGBA8_SRGB: |
| 369 | case Tegra::RenderTargetFormat::BGRA8_UNORM: | ||
| 287 | case Tegra::RenderTargetFormat::RGB10_A2_UNORM: | 370 | case Tegra::RenderTargetFormat::RGB10_A2_UNORM: |
| 371 | case Tegra::RenderTargetFormat::R8_UNORM: | ||
| 288 | return ComponentType::UNorm; | 372 | return ComponentType::UNorm; |
| 289 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: | 373 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: |
| 290 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: | 374 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: |
| 375 | case Tegra::RenderTargetFormat::RGBA32_FLOAT: | ||
| 376 | case Tegra::RenderTargetFormat::RG32_FLOAT: | ||
| 291 | return ComponentType::Float; | 377 | return ComponentType::Float; |
| 292 | case Tegra::RenderTargetFormat::RGBA32_UINT: | 378 | case Tegra::RenderTargetFormat::RGBA32_UINT: |
| 293 | return ComponentType::UInt; | 379 | return ComponentType::UInt; |
| @@ -314,6 +400,7 @@ struct SurfaceParams { | |||
| 314 | case Tegra::DepthFormat::Z24_S8_UNORM: | 400 | case Tegra::DepthFormat::Z24_S8_UNORM: |
| 315 | return ComponentType::UNorm; | 401 | return ComponentType::UNorm; |
| 316 | case Tegra::DepthFormat::Z32_FLOAT: | 402 | case Tegra::DepthFormat::Z32_FLOAT: |
| 403 | case Tegra::DepthFormat::Z32_S8_X24_FLOAT: | ||
| 317 | return ComponentType::Float; | 404 | return ComponentType::Float; |
| 318 | default: | 405 | default: |
| 319 | 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/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index d4b1a6f33..acf067050 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -756,8 +756,8 @@ private: | |||
| 756 | } | 756 | } |
| 757 | } | 757 | } |
| 758 | 758 | ||
| 759 | std::string WriteTexsInstruction(const Instruction& instr, const std::string& coord, | 759 | void WriteTexsInstruction(const Instruction& instr, const std::string& coord, |
| 760 | const std::string& texture) { | 760 | const std::string& texture) { |
| 761 | // Add an extra scope and declare the texture coords inside to prevent | 761 | // Add an extra scope and declare the texture coords inside to prevent |
| 762 | // overwriting them in case they are used as outputs of the texs instruction. | 762 | // overwriting them in case they are used as outputs of the texs instruction. |
| 763 | shader.AddLine('{'); | 763 | shader.AddLine('{'); |
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 a3e67d105..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; |
| @@ -72,6 +74,8 @@ u32 BytesPerPixel(TextureFormat format) { | |||
| 72 | return 8; | 74 | return 8; |
| 73 | case TextureFormat::R32_G32_B32_A32: | 75 | case TextureFormat::R32_G32_B32_A32: |
| 74 | return 16; | 76 | return 16; |
| 77 | case TextureFormat::R32_G32: | ||
| 78 | return 8; | ||
| 75 | default: | 79 | default: |
| 76 | UNIMPLEMENTED_MSG("Format not implemented"); | 80 | UNIMPLEMENTED_MSG("Format not implemented"); |
| 77 | break; | 81 | break; |
| @@ -86,6 +90,8 @@ static u32 DepthBytesPerPixel(DepthFormat format) { | |||
| 86 | case DepthFormat::Z24_S8_UNORM: | 90 | case DepthFormat::Z24_S8_UNORM: |
| 87 | case DepthFormat::Z32_FLOAT: | 91 | case DepthFormat::Z32_FLOAT: |
| 88 | return 4; | 92 | return 4; |
| 93 | case DepthFormat::Z32_S8_X24_FLOAT: | ||
| 94 | return 8; | ||
| 89 | default: | 95 | default: |
| 90 | UNIMPLEMENTED_MSG("Format not implemented"); | 96 | UNIMPLEMENTED_MSG("Format not implemented"); |
| 91 | break; | 97 | break; |
| @@ -118,6 +124,9 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width, | |||
| 118 | case TextureFormat::G8R8: | 124 | case TextureFormat::G8R8: |
| 119 | case TextureFormat::R16_G16_B16_A16: | 125 | case TextureFormat::R16_G16_B16_A16: |
| 120 | case TextureFormat::R32_G32_B32_A32: | 126 | case TextureFormat::R32_G32_B32_A32: |
| 127 | case TextureFormat::R32_G32: | ||
| 128 | case TextureFormat::R32: | ||
| 129 | case TextureFormat::R16: | ||
| 121 | case TextureFormat::BF10GF11RF11: | 130 | case TextureFormat::BF10GF11RF11: |
| 122 | case TextureFormat::ASTC_2D_4X4: | 131 | case TextureFormat::ASTC_2D_4X4: |
| 123 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, | 132 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, |
| @@ -143,6 +152,7 @@ std::vector<u8> UnswizzleDepthTexture(VAddr address, DepthFormat format, u32 wid | |||
| 143 | case DepthFormat::S8_Z24_UNORM: | 152 | case DepthFormat::S8_Z24_UNORM: |
| 144 | case DepthFormat::Z24_S8_UNORM: | 153 | case DepthFormat::Z24_S8_UNORM: |
| 145 | case DepthFormat::Z32_FLOAT: | 154 | case DepthFormat::Z32_FLOAT: |
| 155 | case DepthFormat::Z32_S8_X24_FLOAT: | ||
| 146 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, | 156 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, |
| 147 | unswizzled_data.data(), true, block_height); | 157 | unswizzled_data.data(), true, block_height); |
| 148 | break; | 158 | break; |
| @@ -174,6 +184,9 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat | |||
| 174 | case TextureFormat::G8R8: | 184 | case TextureFormat::G8R8: |
| 175 | case TextureFormat::BF10GF11RF11: | 185 | case TextureFormat::BF10GF11RF11: |
| 176 | case TextureFormat::R32_G32_B32_A32: | 186 | case TextureFormat::R32_G32_B32_A32: |
| 187 | case TextureFormat::R32_G32: | ||
| 188 | case TextureFormat::R32: | ||
| 189 | case TextureFormat::R16: | ||
| 177 | // 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. |
| 178 | rgba_data = texture_data; | 191 | rgba_data = texture_data; |
| 179 | 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 | ||