Compare commits
51 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fbc232426d | |||
| eda37ff26b | |||
| a8dab2ffb3 | |||
| 480850ffe7 | |||
| 990b14f181 | |||
| 1d20aac795 | |||
| 9338599d72 | |||
| 95c0f5afe5 | |||
| 977d6c46f3 | |||
| 50c6030a8d | |||
| e849d68048 | |||
| f29fede49c | |||
| fd33e996e0 | |||
| 505c206eb8 | |||
| 143662118c | |||
| f1d8c83e1c | |||
| 07632ad825 | |||
| b2305dcee0 | |||
| b971b82275 | |||
| 84b5804834 | |||
| 539675b21a | |||
| 739d90ee66 | |||
| ed89bcc767 | |||
| f1aabc21ee | |||
| 80a0f2a118 | |||
| 6001538139 | |||
| 63cc4e417f | |||
| e60733aad3 | |||
| 5fb27f83cf | |||
| f16a94fb39 | |||
| e5abf11186 | |||
| 1074c87f18 | |||
| 7a051c4973 | |||
| a4306b9e56 | |||
| 6744e7ea4a | |||
| fb0fefc75c | |||
| a0ee597b19 | |||
| fca26980a2 | |||
| 755506d404 | |||
| 75a01475d1 | |||
| 6d8d7ebc66 | |||
| 7f4d96d873 | |||
| 4c269e5ced | |||
| cf76769026 | |||
| 3f910efb40 | |||
| 38b585a309 | |||
| 86946ea13c | |||
| f3630a0713 | |||
| a0c499aef7 | |||
| f2eead3b5b | |||
| 6a0010d0c6 |
+15
-5
@@ -118,8 +118,17 @@ message(STATUS "Target architecture: ${ARCHITECTURE}")
|
||||
# Configure C++ standard
|
||||
# ===========================
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
# boost asio's concept usage doesn't play nicely with some compilers yet.
|
||||
add_definitions(-DBOOST_ASIO_DISABLE_CONCEPTS)
|
||||
if (MSVC)
|
||||
add_compile_options(/std:c++latest)
|
||||
|
||||
# cubeb and boost still make use of deprecated result_of.
|
||||
add_definitions(-D_HAS_DEPRECATED_RESULT_OF)
|
||||
else()
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
endif()
|
||||
|
||||
# Output binaries to bin/
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
||||
@@ -330,14 +339,15 @@ elseif(SDL2_FOUND)
|
||||
endif()
|
||||
|
||||
# Ensure libusb is properly configured (based on dolphin libusb include)
|
||||
include(FindPkgConfig)
|
||||
find_package(LibUSB)
|
||||
if(NOT APPLE)
|
||||
include(FindPkgConfig)
|
||||
find_package(LibUSB)
|
||||
endif()
|
||||
if (NOT LIBUSB_FOUND)
|
||||
add_subdirectory(externals/libusb)
|
||||
set(LIBUSB_LIBRARIES usb)
|
||||
endif()
|
||||
|
||||
|
||||
# Prefer the -pthread flag on Linux.
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
@@ -2,7 +2,7 @@ yuzu emulator
|
||||
=============
|
||||
[](https://travis-ci.com/yuzu-emu/yuzu)
|
||||
[](https://dev.azure.com/yuzu-emu/yuzu/)
|
||||
[](https://discord.gg/XQV6dn9)
|
||||
[](https://discord.com/invite/u77vRWY)
|
||||
|
||||
yuzu is an experimental open-source emulator for the Nintendo Switch from the creators of [Citra](https://citra-emu.org/).
|
||||
|
||||
@@ -16,7 +16,7 @@ yuzu is licensed under the GPLv2 (or any later version). Refer to the license.tx
|
||||
|
||||
Check out our [website](https://yuzu-emu.org/)!
|
||||
|
||||
For development discussion, please join us on [Discord](https://discord.gg/XQV6dn9).
|
||||
For development discussion, please join us on [Discord](https://discord.com/invite/u77vRWY).
|
||||
|
||||
### Development
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@ namespace Common {
|
||||
template <typename T>
|
||||
constexpr T AlignUp(T value, std::size_t size) {
|
||||
static_assert(std::is_unsigned_v<T>, "T must be an unsigned value.");
|
||||
return static_cast<T>(value + (size - value % size) % size);
|
||||
auto mod{static_cast<T>(value % size)};
|
||||
value -= mod;
|
||||
return static_cast<T>(mod == T{0} ? value : value + size);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -112,19 +112,26 @@ VirtualFile RealVfsFilesystem::MoveFile(std::string_view old_path_, std::string_
|
||||
const auto new_path =
|
||||
FileUtil::SanitizePath(new_path_, FileUtil::DirectorySeparator::PlatformDefault);
|
||||
|
||||
if (!FileUtil::Exists(old_path) || FileUtil::Exists(new_path) ||
|
||||
FileUtil::IsDirectory(old_path) || !FileUtil::Rename(old_path, new_path))
|
||||
return nullptr;
|
||||
|
||||
if (cache.find(old_path) != cache.end()) {
|
||||
auto cached = cache[old_path];
|
||||
if (!cached.expired()) {
|
||||
auto file = cached.lock();
|
||||
file->Open(new_path, "r+b");
|
||||
cache.erase(old_path);
|
||||
cache[new_path] = file;
|
||||
auto file = cache[old_path].lock();
|
||||
|
||||
if (!cache[old_path].expired()) {
|
||||
file->Close();
|
||||
}
|
||||
|
||||
if (!FileUtil::Exists(old_path) || FileUtil::Exists(new_path) ||
|
||||
FileUtil::IsDirectory(old_path) || !FileUtil::Rename(old_path, new_path)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
cache.erase(old_path);
|
||||
file->Open(new_path, "r+b");
|
||||
cache[new_path] = file;
|
||||
} else {
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return OpenFile(new_path, Mode::ReadWrite);
|
||||
}
|
||||
|
||||
|
||||
@@ -1407,7 +1407,19 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
|
||||
u32 supported_languages = 0;
|
||||
FileSys::PatchManager pm{system.CurrentProcess()->GetTitleID()};
|
||||
|
||||
const auto res = pm.GetControlMetadata();
|
||||
const auto res = [this] {
|
||||
const auto title_id = system.CurrentProcess()->GetTitleID();
|
||||
|
||||
FileSys::PatchManager pm{title_id};
|
||||
auto res = pm.GetControlMetadata();
|
||||
if (res.first != nullptr) {
|
||||
return res;
|
||||
}
|
||||
|
||||
FileSys::PatchManager pm_update{FileSys::GetUpdateTitleID(title_id)};
|
||||
return pm_update.GetControlMetadata();
|
||||
}();
|
||||
|
||||
if (res.first != nullptr) {
|
||||
supported_languages = res.first->GetSupportedLanguages();
|
||||
}
|
||||
|
||||
@@ -121,11 +121,83 @@ public:
|
||||
{39, nullptr, "PrepareShutdown"},
|
||||
{40, nullptr, "ListApplyDeltaTask"},
|
||||
{41, nullptr, "ClearNotEnoughSpaceStateOfApplyDeltaTask"},
|
||||
{42, nullptr, "Unknown1"},
|
||||
{43, nullptr, "Unknown2"},
|
||||
{44, nullptr, "Unknown3"},
|
||||
{45, nullptr, "Unknown4"},
|
||||
{46, nullptr, "Unknown5"},
|
||||
{42, nullptr, "Unknown42"},
|
||||
{43, nullptr, "Unknown43"},
|
||||
{44, nullptr, "Unknown44"},
|
||||
{45, nullptr, "Unknown45"},
|
||||
{46, nullptr, "Unknown46"},
|
||||
{47, nullptr, "Unknown47"},
|
||||
{48, nullptr, "Unknown48"},
|
||||
{49, nullptr, "Unknown49"},
|
||||
{50, nullptr, "Unknown50"},
|
||||
{51, nullptr, "Unknown51"},
|
||||
{52, nullptr, "Unknown52"},
|
||||
{53, nullptr, "Unknown53"},
|
||||
{54, nullptr, "Unknown54"},
|
||||
{55, nullptr, "Unknown55"},
|
||||
{56, nullptr, "Unknown56"},
|
||||
{57, nullptr, "Unknown57"},
|
||||
{58, nullptr, "Unknown58"},
|
||||
{59, nullptr, "Unknown59"},
|
||||
{60, nullptr, "Unknown60"},
|
||||
{61, nullptr, "Unknown61"},
|
||||
{62, nullptr, "Unknown62"},
|
||||
{63, nullptr, "Unknown63"},
|
||||
{64, nullptr, "Unknown64"},
|
||||
{65, nullptr, "Unknown65"},
|
||||
{66, nullptr, "Unknown66"},
|
||||
{67, nullptr, "Unknown67"},
|
||||
{68, nullptr, "Unknown68"},
|
||||
{69, nullptr, "Unknown69"},
|
||||
{70, nullptr, "Unknown70"},
|
||||
{71, nullptr, "Unknown71"},
|
||||
{72, nullptr, "Unknown72"},
|
||||
{73, nullptr, "Unknown73"},
|
||||
{74, nullptr, "Unknown74"},
|
||||
{75, nullptr, "Unknown75"},
|
||||
{76, nullptr, "Unknown76"},
|
||||
{77, nullptr, "Unknown77"},
|
||||
{78, nullptr, "Unknown78"},
|
||||
{79, nullptr, "Unknown79"},
|
||||
{80, nullptr, "Unknown80"},
|
||||
{81, nullptr, "Unknown81"},
|
||||
{82, nullptr, "Unknown82"},
|
||||
{83, nullptr, "Unknown83"},
|
||||
{84, nullptr, "Unknown84"},
|
||||
{85, nullptr, "Unknown85"},
|
||||
{86, nullptr, "Unknown86"},
|
||||
{87, nullptr, "Unknown87"},
|
||||
{88, nullptr, "Unknown88"},
|
||||
{89, nullptr, "Unknown89"},
|
||||
{90, nullptr, "Unknown90"},
|
||||
{91, nullptr, "Unknown91"},
|
||||
{92, nullptr, "Unknown92"},
|
||||
{93, nullptr, "Unknown93"},
|
||||
{94, nullptr, "Unknown94"},
|
||||
{95, nullptr, "Unknown95"},
|
||||
{96, nullptr, "Unknown96"},
|
||||
{97, nullptr, "Unknown97"},
|
||||
{98, nullptr, "Unknown98"},
|
||||
{99, nullptr, "Unknown99"},
|
||||
{100, nullptr, "Unknown100"},
|
||||
{101, nullptr, "Unknown101"},
|
||||
{102, nullptr, "Unknown102"},
|
||||
{103, nullptr, "Unknown103"},
|
||||
{104, nullptr, "Unknown104"},
|
||||
{105, nullptr, "Unknown105"},
|
||||
{106, nullptr, "Unknown106"},
|
||||
{107, nullptr, "Unknown107"},
|
||||
{108, nullptr, "Unknown108"},
|
||||
{109, nullptr, "Unknown109"},
|
||||
{110, nullptr, "Unknown110"},
|
||||
{111, nullptr, "Unknown111"},
|
||||
{112, nullptr, "Unknown112"},
|
||||
{113, nullptr, "Unknown113"},
|
||||
{114, nullptr, "Unknown114"},
|
||||
{115, nullptr, "Unknown115"},
|
||||
{116, nullptr, "Unknown116"},
|
||||
{117, nullptr, "Unknown117"},
|
||||
{118, nullptr, "Unknown118"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -142,6 +214,7 @@ public:
|
||||
{1, nullptr, "RefreshDebugAvailability"},
|
||||
{2, nullptr, "ClearDebugResponse"},
|
||||
{3, nullptr, "RegisterDebugResponse"},
|
||||
{4, nullptr, "IsLargeResourceAvailable"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -164,6 +237,8 @@ public:
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "RequestDeviceAuthenticationToken"},
|
||||
{1, nullptr, "RequestCachedDeviceAuthenticationToken"},
|
||||
{2, nullptr, "RequestEdgeToken"},
|
||||
{3, nullptr, "RequestCachedEdgeToken"},
|
||||
{100, nullptr, "RequestRegisterDeviceAccount"},
|
||||
{101, nullptr, "RequestUnregisterDeviceAccount"},
|
||||
{102, nullptr, "RequestDeviceAccountStatus"},
|
||||
@@ -181,7 +256,8 @@ public:
|
||||
{305, nullptr, "RequestCreateVirtualAccount"},
|
||||
{306, nullptr, "RequestDeviceLinkStatus"},
|
||||
{400, nullptr, "GetAccountByVirtualAccount"},
|
||||
{500, nullptr, "RequestSyncTicket"},
|
||||
{401, nullptr, "GetVirtualAccount"},
|
||||
{500, nullptr, "RequestSyncTicketLegacy"},
|
||||
{501, nullptr, "RequestDownloadTicket"},
|
||||
{502, nullptr, "RequestDownloadTicketForPrepurchasedContents"},
|
||||
{503, nullptr, "RequestSyncTicket"},
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
{23, nullptr, "DestroyToken"},
|
||||
{24, nullptr, "DestroyTokenWithApplicationId"},
|
||||
{25, nullptr, "QueryIsTokenValid"},
|
||||
{26, nullptr, "ListenToMyApplicationId"},
|
||||
{31, nullptr, "UploadTokenToBaaS"},
|
||||
{32, nullptr, "DestroyTokenForBaaS"},
|
||||
{33, nullptr, "CreateTokenForBaaS"},
|
||||
|
||||
@@ -104,7 +104,7 @@ IApplicationManagerInterface::IApplicationManagerInterface()
|
||||
{94, nullptr, "LaunchApplication"},
|
||||
{95, nullptr, "GetApplicationLaunchInfo"},
|
||||
{96, nullptr, "AcquireApplicationLaunchInfo"},
|
||||
{97, nullptr, "GetMainApplicationProgramIndex2"},
|
||||
{97, nullptr, "GetMainApplicationProgramIndexByApplicationLaunchInfo"},
|
||||
{98, nullptr, "EnableApplicationAllThreadDumpOnCrash"},
|
||||
{99, nullptr, "LaunchDevMenu"},
|
||||
{100, nullptr, "ResetToFactorySettings"},
|
||||
@@ -254,7 +254,7 @@ IApplicationManagerInterface::IApplicationManagerInterface()
|
||||
{2170, nullptr, "GetRightsEnvironmentStatus"},
|
||||
{2171, nullptr, "GetRightsEnvironmentStatusChangedEvent"},
|
||||
{2180, nullptr, "RequestExtendRightsInRightsEnvironment"},
|
||||
{2181, nullptr, "GetLastResultOfExtendRightsInRightsEnvironment"},
|
||||
{2181, nullptr, "GetResultOfExtendRightsInRightsEnvironment"},
|
||||
{2182, nullptr, "SetActiveRightsContextUsingStateToRightsEnvironment"},
|
||||
{2190, nullptr, "GetRightsEnvironmentHandleForApplication"},
|
||||
{2199, nullptr, "GetRightsEnvironmentCountForDebug"},
|
||||
@@ -446,8 +446,8 @@ IApplicationVersionInterface::IApplicationVersionInterface()
|
||||
|
||||
IApplicationVersionInterface::~IApplicationVersionInterface() = default;
|
||||
|
||||
IContentManagerInterface::IContentManagerInterface()
|
||||
: ServiceFramework{"IContentManagerInterface"} {
|
||||
IContentManagementInterface::IContentManagementInterface()
|
||||
: ServiceFramework{"IContentManagementInterface"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{11, nullptr, "CalculateApplicationOccupiedSize"},
|
||||
@@ -464,7 +464,7 @@ IContentManagerInterface::IContentManagerInterface()
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
IContentManagerInterface::~IContentManagerInterface() = default;
|
||||
IContentManagementInterface::~IContentManagementInterface() = default;
|
||||
|
||||
IDocumentInterface::IDocumentInterface() : ServiceFramework{"IDocumentInterface"} {
|
||||
// clang-format off
|
||||
@@ -546,7 +546,7 @@ NS::NS(const char* name) : ServiceFramework{name} {
|
||||
{7995, &NS::PushInterface<IAccountProxyInterface>, "GetAccountProxyInterface"},
|
||||
{7996, &NS::PushInterface<IApplicationManagerInterface>, "GetApplicationManagerInterface"},
|
||||
{7997, &NS::PushInterface<IDownloadTaskInterface>, "GetDownloadTaskInterface"},
|
||||
{7998, &NS::PushInterface<IContentManagerInterface>, "GetContentManagementInterface"},
|
||||
{7998, &NS::PushInterface<IContentManagementInterface>, "GetContentManagementInterface"},
|
||||
{7999, &NS::PushInterface<IDocumentInterface>, "GetDocumentInterface"},
|
||||
};
|
||||
// clang-format on
|
||||
@@ -573,9 +573,9 @@ public:
|
||||
{6, nullptr, "TerminateApplication"},
|
||||
{7, nullptr, "PrepareLaunchProgramFromHost"},
|
||||
{8, nullptr, "LaunchApplication"},
|
||||
{9, nullptr, "LaunchApplicationWithStorageId"},
|
||||
{10, nullptr, "TerminateApplication2"},
|
||||
{11, nullptr, "GetRunningApplicationProcessId"},
|
||||
{9, nullptr, "LaunchApplicationWithStorageIdForDevelop"},
|
||||
{10, nullptr, "IsSystemMemoryResourceLimitBoosted"},
|
||||
{11, nullptr, "GetRunningApplicationProcessIdForDevelop"},
|
||||
{12, nullptr, "SetCurrentApplicationRightsEnvironmentCanBeActive"},
|
||||
{13, nullptr, "CreateApplicationResourceForDevelop"},
|
||||
{14, nullptr, "IsPreomiaForDevelop"},
|
||||
@@ -637,6 +637,10 @@ public:
|
||||
{9, nullptr, "GetSystemUpdateNotificationEventForContentDelivery"},
|
||||
{10, nullptr, "NotifySystemUpdateForContentDelivery"},
|
||||
{11, nullptr, "PrepareShutdown"},
|
||||
{12, nullptr, "Unknown12"},
|
||||
{13, nullptr, "Unknown13"},
|
||||
{14, nullptr, "Unknown14"},
|
||||
{15, nullptr, "Unknown15"},
|
||||
{16, nullptr, "DestroySystemUpdateTask"},
|
||||
{17, nullptr, "RequestSendSystemUpdate"},
|
||||
{18, nullptr, "GetSendSystemUpdateProgress"},
|
||||
|
||||
@@ -40,10 +40,10 @@ public:
|
||||
~IApplicationVersionInterface() override;
|
||||
};
|
||||
|
||||
class IContentManagerInterface final : public ServiceFramework<IContentManagerInterface> {
|
||||
class IContentManagementInterface final : public ServiceFramework<IContentManagementInterface> {
|
||||
public:
|
||||
explicit IContentManagerInterface();
|
||||
~IContentManagerInterface() override;
|
||||
explicit IContentManagementInterface();
|
||||
~IContentManagementInterface() override;
|
||||
};
|
||||
|
||||
class IDocumentInterface final : public ServiceFramework<IDocumentInterface> {
|
||||
|
||||
@@ -163,7 +163,7 @@ PL_U::PL_U(Core::System& system)
|
||||
{5, &PL_U::GetSharedFontInOrderOfPriority, "GetSharedFontInOrderOfPriority"},
|
||||
{6, nullptr, "GetSharedFontInOrderOfPriorityForSystem"},
|
||||
{100, nullptr, "RequestApplicationFunctionAuthorization"},
|
||||
{101, nullptr, "RequestApplicationFunctionAuthorizationForSystem"},
|
||||
{101, nullptr, "RequestApplicationFunctionAuthorizationByProcessId"},
|
||||
{102, nullptr, "RequestApplicationFunctionAuthorizationByApplicationId"},
|
||||
{1000, nullptr, "LoadNgWordDataForPlatformRegionChina"},
|
||||
{1001, nullptr, "GetNgWordDataSizeForPlatformRegionChina"},
|
||||
|
||||
@@ -144,7 +144,7 @@ void NVDRV::QueryEvent(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
}
|
||||
|
||||
void NVDRV::SetClientPID(Kernel::HLERequestContext& ctx) {
|
||||
void NVDRV::SetAruid(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
pid = rp.Pop<u64>();
|
||||
LOG_WARNING(Service_NVDRV, "(STUBBED) called, pid=0x{:X}", pid);
|
||||
@@ -154,7 +154,7 @@ void NVDRV::SetClientPID(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push<u32>(0);
|
||||
}
|
||||
|
||||
void NVDRV::FinishInitialize(Kernel::HLERequestContext& ctx) {
|
||||
void NVDRV::SetGraphicsFirmwareMemoryMarginEnabled(Kernel::HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_NVDRV, "(STUBBED) called");
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
@@ -187,13 +187,14 @@ NVDRV::NVDRV(std::shared_ptr<Module> nvdrv, const char* name)
|
||||
{4, &NVDRV::QueryEvent, "QueryEvent"},
|
||||
{5, nullptr, "MapSharedMem"},
|
||||
{6, &NVDRV::GetStatus, "GetStatus"},
|
||||
{7, nullptr, "ForceSetClientPID"},
|
||||
{8, &NVDRV::SetClientPID, "SetClientPID"},
|
||||
{7, nullptr, "SetAruidForTest"},
|
||||
{8, &NVDRV::SetAruid, "SetAruid"},
|
||||
{9, &NVDRV::DumpGraphicsMemoryInfo, "DumpGraphicsMemoryInfo"},
|
||||
{10, nullptr, "InitializeDevtools"},
|
||||
{11, &NVDRV::Ioctl2, "Ioctl2"},
|
||||
{12, &NVDRV::Ioctl3, "Ioctl3"},
|
||||
{13, &NVDRV::FinishInitialize, "FinishInitialize"},
|
||||
{13, &NVDRV::SetGraphicsFirmwareMemoryMarginEnabled,
|
||||
"SetGraphicsFirmwareMemoryMarginEnabled"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ private:
|
||||
void Close(Kernel::HLERequestContext& ctx);
|
||||
void Initialize(Kernel::HLERequestContext& ctx);
|
||||
void QueryEvent(Kernel::HLERequestContext& ctx);
|
||||
void SetClientPID(Kernel::HLERequestContext& ctx);
|
||||
void FinishInitialize(Kernel::HLERequestContext& ctx);
|
||||
void SetAruid(Kernel::HLERequestContext& ctx);
|
||||
void SetGraphicsFirmwareMemoryMarginEnabled(Kernel::HLERequestContext& ctx);
|
||||
void GetStatus(Kernel::HLERequestContext& ctx);
|
||||
void DumpGraphicsMemoryInfo(Kernel::HLERequestContext& ctx);
|
||||
void IoctlBase(Kernel::HLERequestContext& ctx, IoctlVersion version);
|
||||
|
||||
@@ -10,19 +10,19 @@ namespace Service::Nvidia {
|
||||
|
||||
NVMEMP::NVMEMP() : ServiceFramework("nvmemp") {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &NVMEMP::Cmd0, "Cmd0"},
|
||||
{1, &NVMEMP::Cmd1, "Cmd1"},
|
||||
{0, &NVMEMP::Open, "Open"},
|
||||
{1, &NVMEMP::GetAruid, "GetAruid"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
NVMEMP::~NVMEMP() = default;
|
||||
|
||||
void NVMEMP::Cmd0(Kernel::HLERequestContext& ctx) {
|
||||
void NVMEMP::Open(Kernel::HLERequestContext& ctx) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void NVMEMP::Cmd1(Kernel::HLERequestContext& ctx) {
|
||||
void NVMEMP::GetAruid(Kernel::HLERequestContext& ctx) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ public:
|
||||
~NVMEMP() override;
|
||||
|
||||
private:
|
||||
void Cmd0(Kernel::HLERequestContext& ctx);
|
||||
void Cmd1(Kernel::HLERequestContext& ctx);
|
||||
void Open(Kernel::HLERequestContext& ctx);
|
||||
void GetAruid(Kernel::HLERequestContext& ctx);
|
||||
};
|
||||
|
||||
} // namespace Service::Nvidia
|
||||
|
||||
@@ -36,6 +36,9 @@ public:
|
||||
{18, nullptr, "ReleaseIrq"},
|
||||
{19, nullptr, "SetIrqEnable"},
|
||||
{20, nullptr, "SetAspmEnable"},
|
||||
{21, nullptr, "SetResetUponResumeEnable"},
|
||||
{22, nullptr, "Unknown22"},
|
||||
{23, nullptr, "Unknown23"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ public:
|
||||
{24, nullptr, "GetModuleStateTable"},
|
||||
{25, nullptr, "GetPowerDomainStateTable"},
|
||||
{26, nullptr, "GetFuseInfo"},
|
||||
{27, nullptr, "GetDramId"},
|
||||
{28, nullptr, "IsPoweredOn"},
|
||||
{29, nullptr, "GetVoltage"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -78,13 +78,13 @@ public:
|
||||
: ServiceFramework{"pm:dmnt"}, kernel(kernel) {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "GetDebugProcesses"},
|
||||
{1, nullptr, "StartDebugProcess"},
|
||||
{2, &DebugMonitor::GetTitlePid, "GetTitlePid"},
|
||||
{3, nullptr, "EnableDebugForTitleId"},
|
||||
{4, &DebugMonitor::GetApplicationPid, "GetApplicationPid"},
|
||||
{5, nullptr, "EnableDebugForApplication"},
|
||||
{6, nullptr, "DisableDebug"},
|
||||
{0, nullptr, "GetJitDebugProcessIdList"},
|
||||
{1, nullptr, "StartProcess"},
|
||||
{2, &DebugMonitor::GetProcessId, "GetProcessId"},
|
||||
{3, nullptr, "HookToCreateProcess"},
|
||||
{4, &DebugMonitor::GetApplicationProcessId, "GetApplicationProcessId"},
|
||||
{5, nullptr, "HookToCreateApplicationProgress"},
|
||||
{6, nullptr, "ClearHook"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void GetTitlePid(Kernel::HLERequestContext& ctx) {
|
||||
void GetProcessId(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto title_id = rp.PopRaw<u64>();
|
||||
|
||||
@@ -114,7 +114,7 @@ private:
|
||||
rb.Push((*process)->GetProcessID());
|
||||
}
|
||||
|
||||
void GetApplicationPid(Kernel::HLERequestContext& ctx) {
|
||||
void GetApplicationProcessId(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_PM, "called");
|
||||
GetApplicationPidGeneric(ctx, kernel.GetProcessList());
|
||||
}
|
||||
@@ -163,15 +163,15 @@ public:
|
||||
: ServiceFramework{"pm:shell"}, kernel(kernel) {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "LaunchProcess"},
|
||||
{1, nullptr, "TerminateProcessByPid"},
|
||||
{2, nullptr, "TerminateProcessByTitleId"},
|
||||
{3, nullptr, "GetProcessEventWaiter"},
|
||||
{4, nullptr, "GetProcessEventType"},
|
||||
{0, nullptr, "LaunchProgram"},
|
||||
{1, nullptr, "TerminateProcess"},
|
||||
{2, nullptr, "TerminateProgram"},
|
||||
{3, nullptr, "GetProcessEventHandle"},
|
||||
{4, nullptr, "GetProcessEventInfo"},
|
||||
{5, nullptr, "NotifyBootFinished"},
|
||||
{6, &Shell::GetApplicationPid, "GetApplicationPid"},
|
||||
{6, &Shell::GetApplicationProcessIdForShell, "GetApplicationProcessIdForShell"},
|
||||
{7, nullptr, "BoostSystemMemoryResourceLimit"},
|
||||
{8, nullptr, "EnableAdditionalSystemThreads"},
|
||||
{8, nullptr, "BoostApplicationThreadResourceLimit"},
|
||||
{9, nullptr, "GetBootFinishedEventHandle"},
|
||||
};
|
||||
// clang-format on
|
||||
@@ -180,7 +180,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void GetApplicationPid(Kernel::HLERequestContext& ctx) {
|
||||
void GetApplicationProcessIdForShell(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_PM, "called");
|
||||
GetApplicationPidGeneric(ctx, kernel.GetProcessList());
|
||||
}
|
||||
|
||||
@@ -42,6 +42,11 @@ public:
|
||||
{40101, nullptr, "SetUserAgreementCheckEnabled"},
|
||||
{50100, nullptr, "ReadAllApplicationReportFiles"},
|
||||
{90100, nullptr, "ReadAllReportFiles"},
|
||||
{90101, nullptr, "Unknown90101"},
|
||||
{90102, nullptr, "Unknown90102"},
|
||||
{90200, nullptr, "GetStatistics"},
|
||||
{90201, nullptr, "GetThroughputHistory"},
|
||||
{90300, nullptr, "GetLastUploadError"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ public:
|
||||
{4, nullptr, "Cancel"},
|
||||
{5, nullptr, "PrintModuleInformation"},
|
||||
{6, nullptr, "GetModuleInformation"},
|
||||
{10, nullptr, "Unknown10"},
|
||||
{11, nullptr, "Unknown11"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ public:
|
||||
{15, nullptr, "GetBatteryAgePercentage"},
|
||||
{16, nullptr, "GetBatteryChargeInfoEvent"},
|
||||
{17, nullptr, "GetBatteryChargeInfoFields"},
|
||||
{18, nullptr, "GetBatteryChargeCalibratedEvent"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace Service::SM {
|
||||
|
||||
void Controller::ConvertSessionToDomain(Kernel::HLERequestContext& ctx) {
|
||||
void Controller::ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx) {
|
||||
ASSERT_MSG(ctx.Session()->IsSession(), "Session is already a domain");
|
||||
LOG_DEBUG(Service, "called, server_session={}", ctx.Session()->GetObjectId());
|
||||
ctx.Session()->ConvertToDomain();
|
||||
@@ -22,7 +22,7 @@ void Controller::ConvertSessionToDomain(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push<u32>(1); // Converted sessions start with 1 request handler
|
||||
}
|
||||
|
||||
void Controller::DuplicateSession(Kernel::HLERequestContext& ctx) {
|
||||
void Controller::CloneCurrentObject(Kernel::HLERequestContext& ctx) {
|
||||
// TODO(bunnei): This is just creating a new handle to the same Session. I assume this is wrong
|
||||
// and that we probably want to actually make an entirely new Session, but we still need to
|
||||
// verify this on hardware.
|
||||
@@ -33,10 +33,10 @@ void Controller::DuplicateSession(Kernel::HLERequestContext& ctx) {
|
||||
rb.PushMoveObjects(ctx.Session()->GetParent()->Client());
|
||||
}
|
||||
|
||||
void Controller::DuplicateSessionEx(Kernel::HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called, using DuplicateSession");
|
||||
void Controller::CloneCurrentObjectEx(Kernel::HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called, using CloneCurrentObject");
|
||||
|
||||
DuplicateSession(ctx);
|
||||
CloneCurrentObject(ctx);
|
||||
}
|
||||
|
||||
void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) {
|
||||
@@ -47,13 +47,14 @@ void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push<u16>(0x1000);
|
||||
}
|
||||
|
||||
// https://switchbrew.org/wiki/IPC_Marshalling
|
||||
Controller::Controller() : ServiceFramework("IpcController") {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0x00000000, &Controller::ConvertSessionToDomain, "ConvertSessionToDomain"},
|
||||
{0x00000001, nullptr, "ConvertDomainToSession"},
|
||||
{0x00000002, &Controller::DuplicateSession, "DuplicateSession"},
|
||||
{0x00000003, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"},
|
||||
{0x00000004, &Controller::DuplicateSessionEx, "DuplicateSessionEx"},
|
||||
{0, &Controller::ConvertCurrentObjectToDomain, "ConvertCurrentObjectToDomain"},
|
||||
{1, nullptr, "CopyFromCurrentDomain"},
|
||||
{2, &Controller::CloneCurrentObject, "CloneCurrentObject"},
|
||||
{3, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"},
|
||||
{4, &Controller::CloneCurrentObjectEx, "CloneCurrentObjectEx"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ public:
|
||||
~Controller() override;
|
||||
|
||||
private:
|
||||
void ConvertSessionToDomain(Kernel::HLERequestContext& ctx);
|
||||
void DuplicateSession(Kernel::HLERequestContext& ctx);
|
||||
void DuplicateSessionEx(Kernel::HLERequestContext& ctx);
|
||||
void ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx);
|
||||
void CloneCurrentObject(Kernel::HLERequestContext& ctx);
|
||||
void CloneCurrentObjectEx(Kernel::HLERequestContext& ctx);
|
||||
void QueryPointerBufferSize(Kernel::HLERequestContext& ctx);
|
||||
};
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ NSD::NSD(const char* name) : ServiceFramework(name) {
|
||||
{12, nullptr, "GetDeviceId"},
|
||||
{13, nullptr, "DeleteSettings"},
|
||||
{14, nullptr, "ImportSettings"},
|
||||
{15, nullptr, "SetChangeEnvironmentIdentifierDisabled"},
|
||||
{20, nullptr, "Resolve"},
|
||||
{21, nullptr, "ResolveEx"},
|
||||
{30, nullptr, "GetNasServiceSetting"},
|
||||
@@ -28,6 +29,11 @@ NSD::NSD(const char* name) : ServiceFramework(name) {
|
||||
{60, nullptr, "ReadSaveDataFromFsForTest"},
|
||||
{61, nullptr, "WriteSaveDataToFsForTest"},
|
||||
{62, nullptr, "DeleteSaveDataOfFsForTest"},
|
||||
{63, nullptr, "IsChangeEnvironmentIdentifierDisabled"},
|
||||
{64, nullptr, "SetWithoutDomainExchangeFqdns"},
|
||||
{100, nullptr, "GetApplicationServerEnvironmentType"},
|
||||
{101, nullptr, "SetApplicationServerEnvironmentType"},
|
||||
{102, nullptr, "DeleteApplicationServerEnvironmentType"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace Service::Sockets {
|
||||
|
||||
void SFDNSRES::GetAddrInfo(Kernel::HLERequestContext& ctx) {
|
||||
void SFDNSRES::GetAddrInfoRequest(Kernel::HLERequestContext& ctx) {
|
||||
struct Parameters {
|
||||
u8 use_nsd_resolve;
|
||||
u32 unknown;
|
||||
@@ -29,15 +29,20 @@ SFDNSRES::SFDNSRES() : ServiceFramework("sfdnsres") {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "SetDnsAddressesPrivate"},
|
||||
{1, nullptr, "GetDnsAddressPrivate"},
|
||||
{2, nullptr, "GetHostByName"},
|
||||
{3, nullptr, "GetHostByAddr"},
|
||||
{4, nullptr, "GetHostStringError"},
|
||||
{5, nullptr, "GetGaiStringError"},
|
||||
{6, &SFDNSRES::GetAddrInfo, "GetAddrInfo"},
|
||||
{7, nullptr, "GetNameInfo"},
|
||||
{8, nullptr, "RequestCancelHandle"},
|
||||
{9, nullptr, "CancelSocketCall"},
|
||||
{11, nullptr, "ClearDnsIpServerAddressArray"},
|
||||
{2, nullptr, "GetHostByNameRequest"},
|
||||
{3, nullptr, "GetHostByAddrRequest"},
|
||||
{4, nullptr, "GetHostStringErrorRequest"},
|
||||
{5, nullptr, "GetGaiStringErrorRequest"},
|
||||
{6, &SFDNSRES::GetAddrInfoRequest, "GetAddrInfoRequest"},
|
||||
{7, nullptr, "GetNameInfoRequest"},
|
||||
{8, nullptr, "RequestCancelHandleRequest"},
|
||||
{9, nullptr, "CancelRequest"},
|
||||
{10, nullptr, "GetHostByNameRequestWithOptions"},
|
||||
{11, nullptr, "GetHostByAddrRequestWithOptions"},
|
||||
{12, nullptr, "GetAddrInfoRequestWithOptions"},
|
||||
{13, nullptr, "GetNameInfoRequestWithOptions"},
|
||||
{14, nullptr, "ResolverSetOptionRequest"},
|
||||
{15, nullptr, "ResolverGetOptionRequest"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public:
|
||||
~SFDNSRES() override;
|
||||
|
||||
private:
|
||||
void GetAddrInfo(Kernel::HLERequestContext& ctx);
|
||||
void GetAddrInfoRequest(Kernel::HLERequestContext& ctx);
|
||||
};
|
||||
|
||||
} // namespace Service::Sockets
|
||||
|
||||
@@ -9,35 +9,36 @@ namespace Service::SPL {
|
||||
SPL::SPL(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "spl:") {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "GetConfig"},
|
||||
{1, nullptr, "UserExpMod"},
|
||||
{1, nullptr, "ModularExponentiate"},
|
||||
{2, nullptr, "GenerateAesKek"},
|
||||
{3, nullptr, "LoadAesKey"},
|
||||
{4, nullptr, "GenerateAesKey"},
|
||||
{5, nullptr, "SetConfig"},
|
||||
{7, &SPL::GetRandomBytes, "GetRandomBytes"},
|
||||
{9, nullptr, "LoadSecureExpModKey"},
|
||||
{10, nullptr, "SecureExpMod"},
|
||||
{9, nullptr, "ImportLotusKey"},
|
||||
{10, nullptr, "DecryptLotusMessage"},
|
||||
{11, nullptr, "IsDevelopment"},
|
||||
{12, nullptr, "GenerateSpecificAesKey"},
|
||||
{13, nullptr, "DecryptPrivk"},
|
||||
{13, nullptr, "DecryptDeviceUniqueData"},
|
||||
{14, nullptr, "DecryptAesKey"},
|
||||
{15, nullptr, "DecryptAesCtr"},
|
||||
{15, nullptr, "CryptAesCtr"},
|
||||
{16, nullptr, "ComputeCmac"},
|
||||
{17, nullptr, "LoadRsaOaepKey"},
|
||||
{18, nullptr, "UnwrapRsaOaepWrappedTitleKey"},
|
||||
{17, nullptr, "ImportEsKey"},
|
||||
{18, nullptr, "UnwrapTitleKey"},
|
||||
{19, nullptr, "LoadTitleKey"},
|
||||
{20, nullptr, "UnwrapAesWrappedTitleKey"},
|
||||
{21, nullptr, "LockAesEngine"},
|
||||
{22, nullptr, "UnlockAesEngine"},
|
||||
{23, nullptr, "GetSplWaitEvent"},
|
||||
{24, nullptr, "SetSharedData"},
|
||||
{25, nullptr, "GetSharedData"},
|
||||
{26, nullptr, "ImportSslRsaKey"},
|
||||
{27, nullptr, "SecureExpModWithSslKey"},
|
||||
{28, nullptr, "ImportEsRsaKey"},
|
||||
{29, nullptr, "SecureExpModWithEsKey"},
|
||||
{30, nullptr, "EncryptManuRsaKeyForImport"},
|
||||
{31, nullptr, "GetPackage2Hash"},
|
||||
{20, nullptr, "PrepareEsCommonKey"},
|
||||
{21, nullptr, "AllocateAesKeyslot"},
|
||||
{22, nullptr, "DeallocateAesKeySlot"},
|
||||
{23, nullptr, "GetAesKeyslotAvailableEvent"},
|
||||
{24, nullptr, "SetBootReason"},
|
||||
{25, nullptr, "GetBootReason"},
|
||||
{26, nullptr, "DecryptAndStoreSslClientCertKey"},
|
||||
{27, nullptr, "ModularExponentiateWithSslClientCertKey"},
|
||||
{28, nullptr, "DecryptAndStoreDrmDeviceCertKey"},
|
||||
{29, nullptr, "ModularExponentiateWithDrmDeviceCertKey"},
|
||||
{30, nullptr, "ReencryptDeviceUniqueData "},
|
||||
{31, nullptr, "PrepareEsArchiveKey"}, // This is also GetPackage2Hash?
|
||||
{32, nullptr, "LoadPreparedAesKey"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
@@ -90,6 +90,13 @@ public:
|
||||
: ServiceFramework("ISteadyClock"), clock_core{clock_core}, system{system} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &ISteadyClock::GetCurrentTimePoint, "GetCurrentTimePoint"},
|
||||
{2, nullptr, "GetTestOffset"},
|
||||
{3, nullptr, "SetTestOffset"},
|
||||
{100, nullptr, "GetRtcValue"},
|
||||
{101, nullptr, "IsRtcResetDetected"},
|
||||
{102, nullptr, "GetSetupResultValue"},
|
||||
{200, nullptr, "GetInternalOffset"},
|
||||
{201, nullptr, "SetInternalOffset"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "GetDsEndpoint"},
|
||||
{1, nullptr, "GetSetupEvent"},
|
||||
{2, nullptr, "Unknown"},
|
||||
{2, nullptr, "Unknown2"},
|
||||
{3, nullptr, "EnableInterface"},
|
||||
{4, nullptr, "DisableInterface"},
|
||||
{5, nullptr, "CtrlInPostBufferAsync"},
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
{9, nullptr, "SetBinaryObjectStore"},
|
||||
{10, nullptr, "Enable"},
|
||||
{11, nullptr, "Disable"},
|
||||
{12, nullptr, "Unknown12"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -69,13 +70,13 @@ public:
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "Open"},
|
||||
{1, nullptr, "Close"},
|
||||
{2, nullptr, "Unknown1"},
|
||||
{2, nullptr, "Unknown2"},
|
||||
{3, nullptr, "Populate"},
|
||||
{4, nullptr, "PostBufferAsync"},
|
||||
{5, nullptr, "GetXferReport"},
|
||||
{6, nullptr, "PostBufferMultiAsync"},
|
||||
{7, nullptr, "Unknown3"},
|
||||
{8, nullptr, "Unknown4"},
|
||||
{7, nullptr, "Unknown7"},
|
||||
{8, nullptr, "Unknown8"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -88,13 +89,13 @@ public:
|
||||
explicit IClientIfSession() : ServiceFramework{"IClientIfSession"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "Unknown1"},
|
||||
{0, nullptr, "Unknown0"},
|
||||
{1, nullptr, "SetInterface"},
|
||||
{2, nullptr, "GetInterface"},
|
||||
{3, nullptr, "GetAlternateInterface"},
|
||||
{4, nullptr, "GetCurrentFrame"},
|
||||
{5, nullptr, "CtrlXferAsync"},
|
||||
{6, nullptr, "Unknown2"},
|
||||
{6, nullptr, "Unknown6"},
|
||||
{7, nullptr, "GetCtrlXferReport"},
|
||||
{8, nullptr, "ResetDevice"},
|
||||
{9, nullptr, "OpenUsbEp"},
|
||||
@@ -118,7 +119,7 @@ public:
|
||||
{5, nullptr, "DestroyInterfaceAvailableEvent"},
|
||||
{6, nullptr, "GetInterfaceStateChangeEvent"},
|
||||
{7, nullptr, "AcquireUsbIf"},
|
||||
{8, nullptr, "Unknown1"},
|
||||
{8, nullptr, "Unknown8"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -179,8 +180,8 @@ public:
|
||||
{4, nullptr, "GetFwRevision"},
|
||||
{5, nullptr, "GetManufacturerId"},
|
||||
{6, nullptr, "GetDeviceId"},
|
||||
{7, nullptr, "Unknown1"},
|
||||
{8, nullptr, "Unknown2"},
|
||||
{7, nullptr, "Unknown7"},
|
||||
{8, nullptr, "Unknown8"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -215,12 +216,12 @@ public:
|
||||
explicit USB_PM() : ServiceFramework{"usb:pm"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "Unknown1"},
|
||||
{1, nullptr, "Unknown2"},
|
||||
{2, nullptr, "Unknown3"},
|
||||
{3, nullptr, "Unknown4"},
|
||||
{4, nullptr, "Unknown5"},
|
||||
{5, nullptr, "Unknown6"},
|
||||
{0, nullptr, "Unknown0"},
|
||||
{1, nullptr, "Unknown1"},
|
||||
{2, nullptr, "Unknown2"},
|
||||
{3, nullptr, "Unknown3"},
|
||||
{4, nullptr, "Unknown4"},
|
||||
{5, nullptr, "Unknown5"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -700,6 +700,7 @@ public:
|
||||
{3215, nullptr, "SetDisplayGamma"},
|
||||
{3216, nullptr, "GetDisplayCmuLuma"},
|
||||
{3217, nullptr, "SetDisplayCmuLuma"},
|
||||
{6013, nullptr, "GetLayerPresentationSubmissionTimestamps"},
|
||||
{8225, nullptr, "GetSharedBufferMemoryHandleId"},
|
||||
{8250, nullptr, "OpenSharedLayer"},
|
||||
{8251, nullptr, "CloseSharedLayer"},
|
||||
@@ -785,6 +786,7 @@ public:
|
||||
{2300, nullptr, "AcquireLayerTexturePresentingEvent"},
|
||||
{2301, nullptr, "ReleaseLayerTexturePresentingEvent"},
|
||||
{2302, nullptr, "GetDisplayHotplugEvent"},
|
||||
{2303, nullptr, "GetDisplayModeChangedEvent"},
|
||||
{2402, nullptr, "GetDisplayHotplugState"},
|
||||
{2501, nullptr, "GetCompositorErrorInfo"},
|
||||
{2601, nullptr, "GetDisplayErrorEvent"},
|
||||
|
||||
@@ -12,6 +12,7 @@ VI_U::VI_U(std::shared_ptr<NVFlinger::NVFlinger> nv_flinger)
|
||||
: ServiceFramework{"vi:u"}, nv_flinger{std::move(nv_flinger)} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &VI_U::GetDisplayService, "GetDisplayService"},
|
||||
{1, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
@@ -15,34 +15,37 @@ public:
|
||||
explicit WLANInfra() : ServiceFramework{"wlan:inf"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "Unknown1"},
|
||||
{1, nullptr, "Unknown2"},
|
||||
{0, nullptr, "OpenMode"},
|
||||
{1, nullptr, "CloseMode"},
|
||||
{2, nullptr, "GetMacAddress"},
|
||||
{3, nullptr, "StartScan"},
|
||||
{4, nullptr, "StopScan"},
|
||||
{5, nullptr, "Connect"},
|
||||
{6, nullptr, "CancelConnect"},
|
||||
{7, nullptr, "Disconnect"},
|
||||
{8, nullptr, "Unknown3"},
|
||||
{9, nullptr, "Unknown4"},
|
||||
{8, nullptr, "GetConnectionEvent"},
|
||||
{9, nullptr, "GetConnectionStatus"},
|
||||
{10, nullptr, "GetState"},
|
||||
{11, nullptr, "GetScanResult"},
|
||||
{12, nullptr, "GetRssi"},
|
||||
{13, nullptr, "ChangeRxAntenna"},
|
||||
{14, nullptr, "Unknown5"},
|
||||
{15, nullptr, "Unknown6"},
|
||||
{14, nullptr, "GetFwVersion"},
|
||||
{15, nullptr, "RequestSleep"},
|
||||
{16, nullptr, "RequestWakeUp"},
|
||||
{17, nullptr, "RequestIfUpDown"},
|
||||
{18, nullptr, "Unknown7"},
|
||||
{19, nullptr, "Unknown8"},
|
||||
{20, nullptr, "Unknown9"},
|
||||
{21, nullptr, "Unknown10"},
|
||||
{22, nullptr, "Unknown11"},
|
||||
{23, nullptr, "Unknown12"},
|
||||
{24, nullptr, "Unknown13"},
|
||||
{25, nullptr, "Unknown14"},
|
||||
{26, nullptr, "Unknown15"},
|
||||
{27, nullptr, "Unknown16"},
|
||||
{18, nullptr, "Unknown18"},
|
||||
{19, nullptr, "Unknown19"},
|
||||
{20, nullptr, "Unknown20"},
|
||||
{21, nullptr, "Unknown21"},
|
||||
{22, nullptr, "Unknown22"},
|
||||
{23, nullptr, "Unknown23"},
|
||||
{24, nullptr, "Unknown24"},
|
||||
{25, nullptr, "Unknown25"},
|
||||
{26, nullptr, "Unknown26"},
|
||||
{27, nullptr, "Unknown27"},
|
||||
{28, nullptr, "Unknown28"},
|
||||
{29, nullptr, "Unknown29"},
|
||||
{30, nullptr, "Unknown30"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -55,12 +58,12 @@ public:
|
||||
explicit WLANLocal() : ServiceFramework{"wlan:lcl"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "Unknown1"},
|
||||
{1, nullptr, "Unknown2"},
|
||||
{2, nullptr, "Unknown3"},
|
||||
{3, nullptr, "Unknown4"},
|
||||
{4, nullptr, "Unknown5"},
|
||||
{5, nullptr, "Unknown6"},
|
||||
{0, nullptr, "Unknown0"},
|
||||
{1, nullptr, "Unknown1"},
|
||||
{2, nullptr, "Unknown2"},
|
||||
{3, nullptr, "Unknown3"},
|
||||
{4, nullptr, "Unknown4"},
|
||||
{5, nullptr, "Unknown5"},
|
||||
{6, nullptr, "GetMacAddress"},
|
||||
{7, nullptr, "CreateBss"},
|
||||
{8, nullptr, "DestroyBss"},
|
||||
@@ -72,38 +75,42 @@ public:
|
||||
{14, nullptr, "CancelJoin"},
|
||||
{15, nullptr, "Disconnect"},
|
||||
{16, nullptr, "SetBeaconLostCount"},
|
||||
{17, nullptr, "Unknown7"},
|
||||
{18, nullptr, "Unknown8"},
|
||||
{19, nullptr, "Unknown9"},
|
||||
{17, nullptr, "Unknown17"},
|
||||
{18, nullptr, "Unknown18"},
|
||||
{19, nullptr, "Unknown19"},
|
||||
{20, nullptr, "GetBssIndicationEvent"},
|
||||
{21, nullptr, "GetBssIndicationInfo"},
|
||||
{22, nullptr, "GetState"},
|
||||
{23, nullptr, "GetAllowedChannels"},
|
||||
{24, nullptr, "AddIe"},
|
||||
{25, nullptr, "DeleteIe"},
|
||||
{26, nullptr, "Unknown10"},
|
||||
{27, nullptr, "Unknown11"},
|
||||
{26, nullptr, "Unknown26"},
|
||||
{27, nullptr, "Unknown27"},
|
||||
{28, nullptr, "CreateRxEntry"},
|
||||
{29, nullptr, "DeleteRxEntry"},
|
||||
{30, nullptr, "Unknown12"},
|
||||
{31, nullptr, "Unknown13"},
|
||||
{30, nullptr, "Unknown30"},
|
||||
{31, nullptr, "Unknown31"},
|
||||
{32, nullptr, "AddMatchingDataToRxEntry"},
|
||||
{33, nullptr, "RemoveMatchingDataFromRxEntry"},
|
||||
{34, nullptr, "GetScanResult"},
|
||||
{35, nullptr, "Unknown14"},
|
||||
{35, nullptr, "Unknown35"},
|
||||
{36, nullptr, "SetActionFrameWithBeacon"},
|
||||
{37, nullptr, "CancelActionFrameWithBeacon"},
|
||||
{38, nullptr, "CreateRxEntryForActionFrame"},
|
||||
{39, nullptr, "DeleteRxEntryForActionFrame"},
|
||||
{40, nullptr, "Unknown15"},
|
||||
{41, nullptr, "Unknown16"},
|
||||
{40, nullptr, "Unknown40"},
|
||||
{41, nullptr, "Unknown41"},
|
||||
{42, nullptr, "CancelGetActionFrame"},
|
||||
{43, nullptr, "GetRssi"},
|
||||
{44, nullptr, "Unknown17"},
|
||||
{45, nullptr, "Unknown18"},
|
||||
{46, nullptr, "Unknown19"},
|
||||
{47, nullptr, "Unknown20"},
|
||||
{48, nullptr, "Unknown21"},
|
||||
{44, nullptr, "Unknown44"},
|
||||
{45, nullptr, "Unknown45"},
|
||||
{46, nullptr, "Unknown46"},
|
||||
{47, nullptr, "Unknown47"},
|
||||
{48, nullptr, "Unknown48"},
|
||||
{49, nullptr, "Unknown49"},
|
||||
{50, nullptr, "Unknown50"},
|
||||
{51, nullptr, "Unknown51"},
|
||||
{52, nullptr, "Unknown52"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -142,18 +149,19 @@ public:
|
||||
explicit WLANSocketManager() : ServiceFramework{"wlan:soc"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "Unknown1"},
|
||||
{1, nullptr, "Unknown2"},
|
||||
{2, nullptr, "Unknown3"},
|
||||
{3, nullptr, "Unknown4"},
|
||||
{4, nullptr, "Unknown5"},
|
||||
{5, nullptr, "Unknown6"},
|
||||
{0, nullptr, "Unknown0"},
|
||||
{1, nullptr, "Unknown1"},
|
||||
{2, nullptr, "Unknown2"},
|
||||
{3, nullptr, "Unknown3"},
|
||||
{4, nullptr, "Unknown4"},
|
||||
{5, nullptr, "Unknown5"},
|
||||
{6, nullptr, "GetMacAddress"},
|
||||
{7, nullptr, "SwitchTsfTimerFunction"},
|
||||
{8, nullptr, "Unknown7"},
|
||||
{9, nullptr, "Unknown8"},
|
||||
{10, nullptr, "Unknown9"},
|
||||
{11, nullptr, "Unknown10"},
|
||||
{8, nullptr, "Unknown8"},
|
||||
{9, nullptr, "Unknown9"},
|
||||
{10, nullptr, "Unknown10"},
|
||||
{11, nullptr, "Unknown11"},
|
||||
{12, nullptr, "Unknown12"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -17,101 +17,94 @@ namespace {
|
||||
// https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_texture_view.txt
|
||||
|
||||
constexpr std::array VIEW_CLASS_128_BITS = {
|
||||
PixelFormat::RGBA32F,
|
||||
PixelFormat::RGBA32UI,
|
||||
PixelFormat::R32G32B32A32_FLOAT,
|
||||
PixelFormat::R32G32B32A32_UINT,
|
||||
PixelFormat::R32G32B32A32_SINT,
|
||||
};
|
||||
// Missing formats:
|
||||
// PixelFormat::RGBA32I
|
||||
|
||||
constexpr std::array VIEW_CLASS_96_BITS = {
|
||||
PixelFormat::RGB32F,
|
||||
PixelFormat::R32G32B32_FLOAT,
|
||||
};
|
||||
// Missing formats:
|
||||
// PixelFormat::RGB32UI,
|
||||
// PixelFormat::RGB32I,
|
||||
|
||||
constexpr std::array VIEW_CLASS_64_BITS = {
|
||||
PixelFormat::RGBA16F, PixelFormat::RG32F, PixelFormat::RGBA16UI, PixelFormat::RG32UI,
|
||||
PixelFormat::RGBA16U, PixelFormat::RGBA16F, PixelFormat::RGBA16S,
|
||||
PixelFormat::R32G32_FLOAT, PixelFormat::R32G32_UINT,
|
||||
PixelFormat::R32G32_SINT, PixelFormat::R16G16B16A16_FLOAT,
|
||||
PixelFormat::R16G16B16A16_UNORM, PixelFormat::R16G16B16A16_SNORM,
|
||||
PixelFormat::R16G16B16A16_UINT, PixelFormat::R16G16B16A16_SINT,
|
||||
};
|
||||
// Missing formats:
|
||||
// PixelFormat::RGBA16I
|
||||
// PixelFormat::RG32I
|
||||
|
||||
// TODO: How should we handle 48 bits?
|
||||
|
||||
constexpr std::array VIEW_CLASS_32_BITS = {
|
||||
PixelFormat::RG16F, PixelFormat::R11FG11FB10F, PixelFormat::R32F,
|
||||
PixelFormat::A2B10G10R10U, PixelFormat::RG16UI, PixelFormat::R32UI,
|
||||
PixelFormat::RG16I, PixelFormat::R32I, PixelFormat::ABGR8U,
|
||||
PixelFormat::RG16, PixelFormat::ABGR8S, PixelFormat::RG16S,
|
||||
PixelFormat::RGBA8_SRGB, PixelFormat::E5B9G9R9F, PixelFormat::BGRA8,
|
||||
PixelFormat::BGRA8_SRGB,
|
||||
PixelFormat::R16G16_FLOAT, PixelFormat::B10G11R11_FLOAT, PixelFormat::R32_FLOAT,
|
||||
PixelFormat::A2B10G10R10_UNORM, PixelFormat::R16G16_UINT, PixelFormat::R32_UINT,
|
||||
PixelFormat::R16G16_SINT, PixelFormat::R32_SINT, PixelFormat::A8B8G8R8_UNORM,
|
||||
PixelFormat::R16G16_UNORM, PixelFormat::A8B8G8R8_SNORM, PixelFormat::R16G16_SNORM,
|
||||
PixelFormat::A8B8G8R8_SRGB, PixelFormat::E5B9G9R9_FLOAT, PixelFormat::B8G8R8A8_UNORM,
|
||||
PixelFormat::B8G8R8A8_SRGB, PixelFormat::A8B8G8R8_UINT, PixelFormat::A8B8G8R8_SINT,
|
||||
PixelFormat::A2B10G10R10_UINT,
|
||||
};
|
||||
// Missing formats:
|
||||
// PixelFormat::RGBA8UI
|
||||
// PixelFormat::RGBA8I
|
||||
// PixelFormat::RGB10_A2_UI
|
||||
|
||||
// TODO: How should we handle 24 bits?
|
||||
|
||||
constexpr std::array VIEW_CLASS_16_BITS = {
|
||||
PixelFormat::R16F, PixelFormat::RG8UI, PixelFormat::R16UI, PixelFormat::R16I,
|
||||
PixelFormat::RG8U, PixelFormat::R16U, PixelFormat::RG8S, PixelFormat::R16S,
|
||||
PixelFormat::R16_FLOAT, PixelFormat::R8G8_UINT, PixelFormat::R16_UINT,
|
||||
PixelFormat::R16_SINT, PixelFormat::R8G8_UNORM, PixelFormat::R16_UNORM,
|
||||
PixelFormat::R8G8_SNORM, PixelFormat::R16_SNORM, PixelFormat::R8G8_SINT,
|
||||
};
|
||||
// Missing formats:
|
||||
// PixelFormat::RG8I
|
||||
|
||||
constexpr std::array VIEW_CLASS_8_BITS = {
|
||||
PixelFormat::R8UI,
|
||||
PixelFormat::R8U,
|
||||
PixelFormat::R8_UINT,
|
||||
PixelFormat::R8_UNORM,
|
||||
PixelFormat::R8_SINT,
|
||||
PixelFormat::R8_SNORM,
|
||||
};
|
||||
// Missing formats:
|
||||
// PixelFormat::R8I
|
||||
// PixelFormat::R8S
|
||||
|
||||
constexpr std::array VIEW_CLASS_RGTC1_RED = {
|
||||
PixelFormat::DXN1,
|
||||
PixelFormat::BC4_UNORM,
|
||||
PixelFormat::BC4_SNORM,
|
||||
};
|
||||
// Missing formats:
|
||||
// COMPRESSED_SIGNED_RED_RGTC1
|
||||
|
||||
constexpr std::array VIEW_CLASS_RGTC2_RG = {
|
||||
PixelFormat::DXN2UNORM,
|
||||
PixelFormat::DXN2SNORM,
|
||||
PixelFormat::BC5_UNORM,
|
||||
PixelFormat::BC5_SNORM,
|
||||
};
|
||||
|
||||
constexpr std::array VIEW_CLASS_BPTC_UNORM = {
|
||||
PixelFormat::BC7U,
|
||||
PixelFormat::BC7U_SRGB,
|
||||
PixelFormat::BC7_UNORM,
|
||||
PixelFormat::BC7_SRGB,
|
||||
};
|
||||
|
||||
constexpr std::array VIEW_CLASS_BPTC_FLOAT = {
|
||||
PixelFormat::BC6H_SF16,
|
||||
PixelFormat::BC6H_UF16,
|
||||
PixelFormat::BC6H_SFLOAT,
|
||||
PixelFormat::BC6H_UFLOAT,
|
||||
};
|
||||
|
||||
// Compatibility table taken from Table 4.X.1 in:
|
||||
// https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_copy_image.txt
|
||||
|
||||
constexpr std::array COPY_CLASS_128_BITS = {
|
||||
PixelFormat::RGBA32UI, PixelFormat::RGBA32F, PixelFormat::DXT23,
|
||||
PixelFormat::DXT23_SRGB, PixelFormat::DXT45, PixelFormat::DXT45_SRGB,
|
||||
PixelFormat::DXN2SNORM, PixelFormat::BC7U, PixelFormat::BC7U_SRGB,
|
||||
PixelFormat::BC6H_SF16, PixelFormat::BC6H_UF16,
|
||||
PixelFormat::R32G32B32A32_UINT, PixelFormat::R32G32B32A32_FLOAT, PixelFormat::R32G32B32A32_SINT,
|
||||
PixelFormat::BC2_UNORM, PixelFormat::BC2_SRGB, PixelFormat::BC3_UNORM,
|
||||
PixelFormat::BC3_SRGB, PixelFormat::BC5_UNORM, PixelFormat::BC5_SNORM,
|
||||
PixelFormat::BC7_UNORM, PixelFormat::BC7_SRGB, PixelFormat::BC6H_SFLOAT,
|
||||
PixelFormat::BC6H_UFLOAT,
|
||||
};
|
||||
// Missing formats:
|
||||
// PixelFormat::RGBA32I
|
||||
// COMPRESSED_RG_RGTC2
|
||||
|
||||
constexpr std::array COPY_CLASS_64_BITS = {
|
||||
PixelFormat::RGBA16F, PixelFormat::RG32F, PixelFormat::RGBA16UI, PixelFormat::RG32UI,
|
||||
PixelFormat::RGBA16U, PixelFormat::RGBA16S, PixelFormat::DXT1_SRGB, PixelFormat::DXT1,
|
||||
|
||||
PixelFormat::R16G16B16A16_FLOAT, PixelFormat::R16G16B16A16_UINT,
|
||||
PixelFormat::R16G16B16A16_UNORM, PixelFormat::R16G16B16A16_SNORM,
|
||||
PixelFormat::R16G16B16A16_SINT, PixelFormat::R32G32_UINT,
|
||||
PixelFormat::R32G32_FLOAT, PixelFormat::R32G32_SINT,
|
||||
PixelFormat::BC1_RGBA_UNORM, PixelFormat::BC1_RGBA_SRGB,
|
||||
};
|
||||
// Missing formats:
|
||||
// PixelFormat::RGBA16I
|
||||
// PixelFormat::RG32I,
|
||||
// COMPRESSED_RGB_S3TC_DXT1_EXT
|
||||
// COMPRESSED_SRGB_S3TC_DXT1_EXT
|
||||
// COMPRESSED_RGBA_S3TC_DXT1_EXT
|
||||
|
||||
+45
-37
@@ -39,53 +39,61 @@ namespace Tegra {
|
||||
|
||||
enum class RenderTargetFormat : u32 {
|
||||
NONE = 0x0,
|
||||
RGBA32_FLOAT = 0xC0,
|
||||
RGBA32_UINT = 0xC2,
|
||||
RGBA16_UNORM = 0xC6,
|
||||
RGBA16_SNORM = 0xC7,
|
||||
RGBA16_UINT = 0xC9,
|
||||
RGBA16_FLOAT = 0xCA,
|
||||
RG32_FLOAT = 0xCB,
|
||||
RG32_UINT = 0xCD,
|
||||
RGBX16_FLOAT = 0xCE,
|
||||
BGRA8_UNORM = 0xCF,
|
||||
BGRA8_SRGB = 0xD0,
|
||||
RGB10_A2_UNORM = 0xD1,
|
||||
RGBA8_UNORM = 0xD5,
|
||||
RGBA8_SRGB = 0xD6,
|
||||
RGBA8_SNORM = 0xD7,
|
||||
RGBA8_UINT = 0xD9,
|
||||
RG16_UNORM = 0xDA,
|
||||
RG16_SNORM = 0xDB,
|
||||
RG16_SINT = 0xDC,
|
||||
RG16_UINT = 0xDD,
|
||||
RG16_FLOAT = 0xDE,
|
||||
R11G11B10_FLOAT = 0xE0,
|
||||
R32B32G32A32_FLOAT = 0xC0,
|
||||
R32G32B32A32_SINT = 0xC1,
|
||||
R32G32B32A32_UINT = 0xC2,
|
||||
R16G16B16A16_UNORM = 0xC6,
|
||||
R16G16B16A16_SNORM = 0xC7,
|
||||
R16G16B16A16_SINT = 0xC8,
|
||||
R16G16B16A16_UINT = 0xC9,
|
||||
R16G16B16A16_FLOAT = 0xCA,
|
||||
R32G32_FLOAT = 0xCB,
|
||||
R32G32_SINT = 0xCC,
|
||||
R32G32_UINT = 0xCD,
|
||||
R16G16B16X16_FLOAT = 0xCE,
|
||||
B8G8R8A8_UNORM = 0xCF,
|
||||
B8G8R8A8_SRGB = 0xD0,
|
||||
A2B10G10R10_UNORM = 0xD1,
|
||||
A2B10G10R10_UINT = 0xD2,
|
||||
A8B8G8R8_UNORM = 0xD5,
|
||||
A8B8G8R8_SRGB = 0xD6,
|
||||
A8B8G8R8_SNORM = 0xD7,
|
||||
A8B8G8R8_SINT = 0xD8,
|
||||
A8B8G8R8_UINT = 0xD9,
|
||||
R16G16_UNORM = 0xDA,
|
||||
R16G16_SNORM = 0xDB,
|
||||
R16G16_SINT = 0xDC,
|
||||
R16G16_UINT = 0xDD,
|
||||
R16G16_FLOAT = 0xDE,
|
||||
B10G11R11_FLOAT = 0xE0,
|
||||
R32_SINT = 0xE3,
|
||||
R32_UINT = 0xE4,
|
||||
R32_FLOAT = 0xE5,
|
||||
B5G6R5_UNORM = 0xE8,
|
||||
BGR5A1_UNORM = 0xE9,
|
||||
RG8_UNORM = 0xEA,
|
||||
RG8_SNORM = 0xEB,
|
||||
RG8_UINT = 0xED,
|
||||
R5G6B5_UNORM = 0xE8,
|
||||
A1R5G5B5_UNORM = 0xE9,
|
||||
R8G8_UNORM = 0xEA,
|
||||
R8G8_SNORM = 0xEB,
|
||||
R8G8_SINT = 0xEC,
|
||||
R8G8_UINT = 0xED,
|
||||
R16_UNORM = 0xEE,
|
||||
R16_SNORM = 0xEF,
|
||||
R16_SINT = 0xF0,
|
||||
R16_UINT = 0xF1,
|
||||
R16_FLOAT = 0xF2,
|
||||
R8_UNORM = 0xF3,
|
||||
R8_SNORM = 0xF4,
|
||||
R8_SINT = 0xF5,
|
||||
R8_UINT = 0xF6,
|
||||
};
|
||||
|
||||
enum class DepthFormat : u32 {
|
||||
Z32_FLOAT = 0xA,
|
||||
Z16_UNORM = 0x13,
|
||||
S8_Z24_UNORM = 0x14,
|
||||
Z24_X8_UNORM = 0x15,
|
||||
Z24_S8_UNORM = 0x16,
|
||||
Z24_C8_UNORM = 0x18,
|
||||
Z32_S8_X24_FLOAT = 0x19,
|
||||
D32_FLOAT = 0xA,
|
||||
D16_UNORM = 0x13,
|
||||
S8_UINT_Z24_UNORM = 0x14,
|
||||
D24X8_UNORM = 0x15,
|
||||
D24S8_UNORM = 0x16,
|
||||
D24C8_UNORM = 0x18,
|
||||
D32_FLOAT_S8X24_UINT = 0x19,
|
||||
};
|
||||
|
||||
struct CommandListHeader;
|
||||
@@ -96,9 +104,9 @@ class DebugContext;
|
||||
*/
|
||||
struct FramebufferConfig {
|
||||
enum class PixelFormat : u32 {
|
||||
ABGR8 = 1,
|
||||
RGB565 = 4,
|
||||
BGRA8 = 5,
|
||||
A8B8G8R8_UNORM = 1,
|
||||
RGB565_UNORM = 4,
|
||||
B8G8R8A8_UNORM = 5,
|
||||
};
|
||||
|
||||
VAddr address;
|
||||
|
||||
+149
-127
@@ -41,146 +41,168 @@ static void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depth
|
||||
}
|
||||
|
||||
static constexpr ConversionArray morton_to_linear_fns = {
|
||||
MortonCopy<true, PixelFormat::ABGR8U>,
|
||||
MortonCopy<true, PixelFormat::ABGR8S>,
|
||||
MortonCopy<true, PixelFormat::ABGR8UI>,
|
||||
MortonCopy<true, PixelFormat::B5G6R5U>,
|
||||
MortonCopy<true, PixelFormat::A2B10G10R10U>,
|
||||
MortonCopy<true, PixelFormat::A1B5G5R5U>,
|
||||
MortonCopy<true, PixelFormat::R8U>,
|
||||
MortonCopy<true, PixelFormat::R8UI>,
|
||||
MortonCopy<true, PixelFormat::RGBA16F>,
|
||||
MortonCopy<true, PixelFormat::RGBA16U>,
|
||||
MortonCopy<true, PixelFormat::RGBA16S>,
|
||||
MortonCopy<true, PixelFormat::RGBA16UI>,
|
||||
MortonCopy<true, PixelFormat::R11FG11FB10F>,
|
||||
MortonCopy<true, PixelFormat::RGBA32UI>,
|
||||
MortonCopy<true, PixelFormat::DXT1>,
|
||||
MortonCopy<true, PixelFormat::DXT23>,
|
||||
MortonCopy<true, PixelFormat::DXT45>,
|
||||
MortonCopy<true, PixelFormat::DXN1>,
|
||||
MortonCopy<true, PixelFormat::DXN2UNORM>,
|
||||
MortonCopy<true, PixelFormat::DXN2SNORM>,
|
||||
MortonCopy<true, PixelFormat::BC7U>,
|
||||
MortonCopy<true, PixelFormat::BC6H_UF16>,
|
||||
MortonCopy<true, PixelFormat::BC6H_SF16>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
|
||||
MortonCopy<true, PixelFormat::BGRA8>,
|
||||
MortonCopy<true, PixelFormat::RGBA32F>,
|
||||
MortonCopy<true, PixelFormat::RG32F>,
|
||||
MortonCopy<true, PixelFormat::R32F>,
|
||||
MortonCopy<true, PixelFormat::R16F>,
|
||||
MortonCopy<true, PixelFormat::R16U>,
|
||||
MortonCopy<true, PixelFormat::R16S>,
|
||||
MortonCopy<true, PixelFormat::R16UI>,
|
||||
MortonCopy<true, PixelFormat::R16I>,
|
||||
MortonCopy<true, PixelFormat::RG16>,
|
||||
MortonCopy<true, PixelFormat::RG16F>,
|
||||
MortonCopy<true, PixelFormat::RG16UI>,
|
||||
MortonCopy<true, PixelFormat::RG16I>,
|
||||
MortonCopy<true, PixelFormat::RG16S>,
|
||||
MortonCopy<true, PixelFormat::RGB32F>,
|
||||
MortonCopy<true, PixelFormat::RGBA8_SRGB>,
|
||||
MortonCopy<true, PixelFormat::RG8U>,
|
||||
MortonCopy<true, PixelFormat::RG8S>,
|
||||
MortonCopy<true, PixelFormat::RG8UI>,
|
||||
MortonCopy<true, PixelFormat::RG32UI>,
|
||||
MortonCopy<true, PixelFormat::RGBX16F>,
|
||||
MortonCopy<true, PixelFormat::R32UI>,
|
||||
MortonCopy<true, PixelFormat::R32I>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_8X8>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_8X5>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_5X4>,
|
||||
MortonCopy<true, PixelFormat::BGRA8_SRGB>,
|
||||
MortonCopy<true, PixelFormat::DXT1_SRGB>,
|
||||
MortonCopy<true, PixelFormat::DXT23_SRGB>,
|
||||
MortonCopy<true, PixelFormat::DXT45_SRGB>,
|
||||
MortonCopy<true, PixelFormat::BC7U_SRGB>,
|
||||
MortonCopy<true, PixelFormat::R4G4B4A4U>,
|
||||
MortonCopy<true, PixelFormat::A8B8G8R8_UNORM>,
|
||||
MortonCopy<true, PixelFormat::A8B8G8R8_SNORM>,
|
||||
MortonCopy<true, PixelFormat::A8B8G8R8_SINT>,
|
||||
MortonCopy<true, PixelFormat::A8B8G8R8_UINT>,
|
||||
MortonCopy<true, PixelFormat::R5G6B5_UNORM>,
|
||||
MortonCopy<true, PixelFormat::B5G6R5_UNORM>,
|
||||
MortonCopy<true, PixelFormat::A1R5G5B5_UNORM>,
|
||||
MortonCopy<true, PixelFormat::A2B10G10R10_UNORM>,
|
||||
MortonCopy<true, PixelFormat::A2B10G10R10_UINT>,
|
||||
MortonCopy<true, PixelFormat::A1B5G5R5_UNORM>,
|
||||
MortonCopy<true, PixelFormat::R8_UNORM>,
|
||||
MortonCopy<true, PixelFormat::R8_SNORM>,
|
||||
MortonCopy<true, PixelFormat::R8_SINT>,
|
||||
MortonCopy<true, PixelFormat::R8_UINT>,
|
||||
MortonCopy<true, PixelFormat::R16G16B16A16_FLOAT>,
|
||||
MortonCopy<true, PixelFormat::R16G16B16A16_UNORM>,
|
||||
MortonCopy<true, PixelFormat::R16G16B16A16_SNORM>,
|
||||
MortonCopy<true, PixelFormat::R16G16B16A16_SINT>,
|
||||
MortonCopy<true, PixelFormat::R16G16B16A16_UINT>,
|
||||
MortonCopy<true, PixelFormat::B10G11R11_FLOAT>,
|
||||
MortonCopy<true, PixelFormat::R32G32B32A32_UINT>,
|
||||
MortonCopy<true, PixelFormat::BC1_RGBA_UNORM>,
|
||||
MortonCopy<true, PixelFormat::BC2_UNORM>,
|
||||
MortonCopy<true, PixelFormat::BC3_UNORM>,
|
||||
MortonCopy<true, PixelFormat::BC4_UNORM>,
|
||||
MortonCopy<true, PixelFormat::BC4_SNORM>,
|
||||
MortonCopy<true, PixelFormat::BC5_UNORM>,
|
||||
MortonCopy<true, PixelFormat::BC5_SNORM>,
|
||||
MortonCopy<true, PixelFormat::BC7_UNORM>,
|
||||
MortonCopy<true, PixelFormat::BC6H_UFLOAT>,
|
||||
MortonCopy<true, PixelFormat::BC6H_SFLOAT>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_4X4_UNORM>,
|
||||
MortonCopy<true, PixelFormat::B8G8R8A8_UNORM>,
|
||||
MortonCopy<true, PixelFormat::R32G32B32A32_FLOAT>,
|
||||
MortonCopy<true, PixelFormat::R32G32B32A32_SINT>,
|
||||
MortonCopy<true, PixelFormat::R32G32_FLOAT>,
|
||||
MortonCopy<true, PixelFormat::R32G32_SINT>,
|
||||
MortonCopy<true, PixelFormat::R32_FLOAT>,
|
||||
MortonCopy<true, PixelFormat::R16_FLOAT>,
|
||||
MortonCopy<true, PixelFormat::R16_UNORM>,
|
||||
MortonCopy<true, PixelFormat::R16_SNORM>,
|
||||
MortonCopy<true, PixelFormat::R16_UINT>,
|
||||
MortonCopy<true, PixelFormat::R16_SINT>,
|
||||
MortonCopy<true, PixelFormat::R16G16_UNORM>,
|
||||
MortonCopy<true, PixelFormat::R16G16_FLOAT>,
|
||||
MortonCopy<true, PixelFormat::R16G16_UINT>,
|
||||
MortonCopy<true, PixelFormat::R16G16_SINT>,
|
||||
MortonCopy<true, PixelFormat::R16G16_SNORM>,
|
||||
MortonCopy<true, PixelFormat::R32G32B32_FLOAT>,
|
||||
MortonCopy<true, PixelFormat::A8B8G8R8_SRGB>,
|
||||
MortonCopy<true, PixelFormat::R8G8_UNORM>,
|
||||
MortonCopy<true, PixelFormat::R8G8_SNORM>,
|
||||
MortonCopy<true, PixelFormat::R8G8_SINT>,
|
||||
MortonCopy<true, PixelFormat::R8G8_UINT>,
|
||||
MortonCopy<true, PixelFormat::R32G32_UINT>,
|
||||
MortonCopy<true, PixelFormat::R16G16B16X16_FLOAT>,
|
||||
MortonCopy<true, PixelFormat::R32_UINT>,
|
||||
MortonCopy<true, PixelFormat::R32_SINT>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_8X8_UNORM>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_8X5_UNORM>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_5X4_UNORM>,
|
||||
MortonCopy<true, PixelFormat::B8G8R8A8_SRGB>,
|
||||
MortonCopy<true, PixelFormat::BC1_RGBA_SRGB>,
|
||||
MortonCopy<true, PixelFormat::BC2_SRGB>,
|
||||
MortonCopy<true, PixelFormat::BC3_SRGB>,
|
||||
MortonCopy<true, PixelFormat::BC7_SRGB>,
|
||||
MortonCopy<true, PixelFormat::A4B4G4R4_UNORM>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_4X4_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_8X8_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_8X5_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_5X4_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_5X5>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_5X5_UNORM>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_5X5_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_10X8>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_10X8_UNORM>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_10X8_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_6X6>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_6X6_UNORM>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_6X6_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_10X10>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_10X10_UNORM>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_10X10_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_12X12>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_12X12_UNORM>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_12X12_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_8X6>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_8X6_UNORM>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_8X6_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_6X5>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_6X5_UNORM>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_6X5_SRGB>,
|
||||
MortonCopy<true, PixelFormat::E5B9G9R9F>,
|
||||
MortonCopy<true, PixelFormat::Z32F>,
|
||||
MortonCopy<true, PixelFormat::Z16>,
|
||||
MortonCopy<true, PixelFormat::Z24S8>,
|
||||
MortonCopy<true, PixelFormat::S8Z24>,
|
||||
MortonCopy<true, PixelFormat::Z32FS8>,
|
||||
MortonCopy<true, PixelFormat::E5B9G9R9_FLOAT>,
|
||||
MortonCopy<true, PixelFormat::D32_FLOAT>,
|
||||
MortonCopy<true, PixelFormat::D16_UNORM>,
|
||||
MortonCopy<true, PixelFormat::D24_UNORM_S8_UINT>,
|
||||
MortonCopy<true, PixelFormat::S8_UINT_D24_UNORM>,
|
||||
MortonCopy<true, PixelFormat::D32_FLOAT_S8_UINT>,
|
||||
};
|
||||
|
||||
static constexpr ConversionArray linear_to_morton_fns = {
|
||||
MortonCopy<false, PixelFormat::ABGR8U>,
|
||||
MortonCopy<false, PixelFormat::ABGR8S>,
|
||||
MortonCopy<false, PixelFormat::ABGR8UI>,
|
||||
MortonCopy<false, PixelFormat::B5G6R5U>,
|
||||
MortonCopy<false, PixelFormat::A2B10G10R10U>,
|
||||
MortonCopy<false, PixelFormat::A1B5G5R5U>,
|
||||
MortonCopy<false, PixelFormat::R8U>,
|
||||
MortonCopy<false, PixelFormat::R8UI>,
|
||||
MortonCopy<false, PixelFormat::RGBA16F>,
|
||||
MortonCopy<false, PixelFormat::RGBA16S>,
|
||||
MortonCopy<false, PixelFormat::RGBA16U>,
|
||||
MortonCopy<false, PixelFormat::RGBA16UI>,
|
||||
MortonCopy<false, PixelFormat::R11FG11FB10F>,
|
||||
MortonCopy<false, PixelFormat::RGBA32UI>,
|
||||
MortonCopy<false, PixelFormat::DXT1>,
|
||||
MortonCopy<false, PixelFormat::DXT23>,
|
||||
MortonCopy<false, PixelFormat::DXT45>,
|
||||
MortonCopy<false, PixelFormat::DXN1>,
|
||||
MortonCopy<false, PixelFormat::DXN2UNORM>,
|
||||
MortonCopy<false, PixelFormat::DXN2SNORM>,
|
||||
MortonCopy<false, PixelFormat::BC7U>,
|
||||
MortonCopy<false, PixelFormat::BC6H_UF16>,
|
||||
MortonCopy<false, PixelFormat::BC6H_SF16>,
|
||||
MortonCopy<false, PixelFormat::A8B8G8R8_UNORM>,
|
||||
MortonCopy<false, PixelFormat::A8B8G8R8_SNORM>,
|
||||
MortonCopy<false, PixelFormat::A8B8G8R8_SINT>,
|
||||
MortonCopy<false, PixelFormat::A8B8G8R8_UINT>,
|
||||
MortonCopy<false, PixelFormat::R5G6B5_UNORM>,
|
||||
MortonCopy<false, PixelFormat::B5G6R5_UNORM>,
|
||||
MortonCopy<false, PixelFormat::A1R5G5B5_UNORM>,
|
||||
MortonCopy<false, PixelFormat::A2B10G10R10_UNORM>,
|
||||
MortonCopy<false, PixelFormat::A2B10G10R10_UINT>,
|
||||
MortonCopy<false, PixelFormat::A1B5G5R5_UNORM>,
|
||||
MortonCopy<false, PixelFormat::R8_UNORM>,
|
||||
MortonCopy<false, PixelFormat::R8_SNORM>,
|
||||
MortonCopy<false, PixelFormat::R8_SINT>,
|
||||
MortonCopy<false, PixelFormat::R8_UINT>,
|
||||
MortonCopy<false, PixelFormat::R16G16B16A16_FLOAT>,
|
||||
MortonCopy<false, PixelFormat::R16G16B16A16_SNORM>,
|
||||
MortonCopy<false, PixelFormat::R16G16B16A16_SINT>,
|
||||
MortonCopy<false, PixelFormat::R16G16B16A16_UNORM>,
|
||||
MortonCopy<false, PixelFormat::R16G16B16A16_UINT>,
|
||||
MortonCopy<false, PixelFormat::B10G11R11_FLOAT>,
|
||||
MortonCopy<false, PixelFormat::R32G32B32A32_UINT>,
|
||||
MortonCopy<false, PixelFormat::BC1_RGBA_UNORM>,
|
||||
MortonCopy<false, PixelFormat::BC2_UNORM>,
|
||||
MortonCopy<false, PixelFormat::BC3_UNORM>,
|
||||
MortonCopy<false, PixelFormat::BC4_UNORM>,
|
||||
MortonCopy<false, PixelFormat::BC4_SNORM>,
|
||||
MortonCopy<false, PixelFormat::BC5_UNORM>,
|
||||
MortonCopy<false, PixelFormat::BC5_SNORM>,
|
||||
MortonCopy<false, PixelFormat::BC7_UNORM>,
|
||||
MortonCopy<false, PixelFormat::BC6H_UFLOAT>,
|
||||
MortonCopy<false, PixelFormat::BC6H_SFLOAT>,
|
||||
// TODO(Subv): Swizzling ASTC formats are not supported
|
||||
nullptr,
|
||||
MortonCopy<false, PixelFormat::BGRA8>,
|
||||
MortonCopy<false, PixelFormat::RGBA32F>,
|
||||
MortonCopy<false, PixelFormat::RG32F>,
|
||||
MortonCopy<false, PixelFormat::R32F>,
|
||||
MortonCopy<false, PixelFormat::R16F>,
|
||||
MortonCopy<false, PixelFormat::R16U>,
|
||||
MortonCopy<false, PixelFormat::R16S>,
|
||||
MortonCopy<false, PixelFormat::R16UI>,
|
||||
MortonCopy<false, PixelFormat::R16I>,
|
||||
MortonCopy<false, PixelFormat::RG16>,
|
||||
MortonCopy<false, PixelFormat::RG16F>,
|
||||
MortonCopy<false, PixelFormat::RG16UI>,
|
||||
MortonCopy<false, PixelFormat::RG16I>,
|
||||
MortonCopy<false, PixelFormat::RG16S>,
|
||||
MortonCopy<false, PixelFormat::RGB32F>,
|
||||
MortonCopy<false, PixelFormat::RGBA8_SRGB>,
|
||||
MortonCopy<false, PixelFormat::RG8U>,
|
||||
MortonCopy<false, PixelFormat::RG8S>,
|
||||
MortonCopy<false, PixelFormat::RG8UI>,
|
||||
MortonCopy<false, PixelFormat::RG32UI>,
|
||||
MortonCopy<false, PixelFormat::RGBX16F>,
|
||||
MortonCopy<false, PixelFormat::R32UI>,
|
||||
MortonCopy<false, PixelFormat::R32I>,
|
||||
MortonCopy<false, PixelFormat::B8G8R8A8_UNORM>,
|
||||
MortonCopy<false, PixelFormat::R32G32B32A32_FLOAT>,
|
||||
MortonCopy<false, PixelFormat::R32G32B32A32_SINT>,
|
||||
MortonCopy<false, PixelFormat::R32G32_FLOAT>,
|
||||
MortonCopy<false, PixelFormat::R32G32_SINT>,
|
||||
MortonCopy<false, PixelFormat::R32_FLOAT>,
|
||||
MortonCopy<false, PixelFormat::R16_FLOAT>,
|
||||
MortonCopy<false, PixelFormat::R16_UNORM>,
|
||||
MortonCopy<false, PixelFormat::R16_SNORM>,
|
||||
MortonCopy<false, PixelFormat::R16_UINT>,
|
||||
MortonCopy<false, PixelFormat::R16_SINT>,
|
||||
MortonCopy<false, PixelFormat::R16G16_UNORM>,
|
||||
MortonCopy<false, PixelFormat::R16G16_FLOAT>,
|
||||
MortonCopy<false, PixelFormat::R16G16_UINT>,
|
||||
MortonCopy<false, PixelFormat::R16G16_SINT>,
|
||||
MortonCopy<false, PixelFormat::R16G16_SNORM>,
|
||||
MortonCopy<false, PixelFormat::R32G32B32_FLOAT>,
|
||||
MortonCopy<false, PixelFormat::A8B8G8R8_SRGB>,
|
||||
MortonCopy<false, PixelFormat::R8G8_UNORM>,
|
||||
MortonCopy<false, PixelFormat::R8G8_SNORM>,
|
||||
MortonCopy<false, PixelFormat::R8G8_SINT>,
|
||||
MortonCopy<false, PixelFormat::R8G8_UINT>,
|
||||
MortonCopy<false, PixelFormat::R32G32_UINT>,
|
||||
MortonCopy<false, PixelFormat::R16G16B16X16_FLOAT>,
|
||||
MortonCopy<false, PixelFormat::R32_UINT>,
|
||||
MortonCopy<false, PixelFormat::R32_SINT>,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
MortonCopy<false, PixelFormat::BGRA8_SRGB>,
|
||||
MortonCopy<false, PixelFormat::DXT1_SRGB>,
|
||||
MortonCopy<false, PixelFormat::DXT23_SRGB>,
|
||||
MortonCopy<false, PixelFormat::DXT45_SRGB>,
|
||||
MortonCopy<false, PixelFormat::BC7U_SRGB>,
|
||||
MortonCopy<false, PixelFormat::R4G4B4A4U>,
|
||||
MortonCopy<false, PixelFormat::B8G8R8A8_SRGB>,
|
||||
MortonCopy<false, PixelFormat::BC1_RGBA_SRGB>,
|
||||
MortonCopy<false, PixelFormat::BC2_SRGB>,
|
||||
MortonCopy<false, PixelFormat::BC3_SRGB>,
|
||||
MortonCopy<false, PixelFormat::BC7_SRGB>,
|
||||
MortonCopy<false, PixelFormat::A4B4G4R4_UNORM>,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
@@ -199,12 +221,12 @@ static constexpr ConversionArray linear_to_morton_fns = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
MortonCopy<false, PixelFormat::E5B9G9R9F>,
|
||||
MortonCopy<false, PixelFormat::Z32F>,
|
||||
MortonCopy<false, PixelFormat::Z16>,
|
||||
MortonCopy<false, PixelFormat::Z24S8>,
|
||||
MortonCopy<false, PixelFormat::S8Z24>,
|
||||
MortonCopy<false, PixelFormat::Z32FS8>,
|
||||
MortonCopy<false, PixelFormat::E5B9G9R9_FLOAT>,
|
||||
MortonCopy<false, PixelFormat::D32_FLOAT>,
|
||||
MortonCopy<false, PixelFormat::D16_UNORM>,
|
||||
MortonCopy<false, PixelFormat::D24_UNORM_S8_UINT>,
|
||||
MortonCopy<false, PixelFormat::S8_UINT_D24_UNORM>,
|
||||
MortonCopy<false, PixelFormat::D32_FLOAT_S8_UINT>,
|
||||
};
|
||||
|
||||
static MortonCopyFn GetSwizzleFunction(MortonSwizzleMode mode, Surface::PixelFormat format) {
|
||||
|
||||
@@ -41,91 +41,103 @@ struct FormatTuple {
|
||||
};
|
||||
|
||||
constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format_tuples = {{
|
||||
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // ABGR8U
|
||||
{GL_RGBA8_SNORM, GL_RGBA, GL_BYTE}, // ABGR8S
|
||||
{GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE}, // ABGR8UI
|
||||
{GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV}, // B5G6R5U
|
||||
{GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10U
|
||||
{GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1B5G5R5U
|
||||
{GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8U
|
||||
{GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE}, // R8UI
|
||||
{GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT}, // RGBA16F
|
||||
{GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT}, // RGBA16U
|
||||
{GL_RGBA16_SNORM, GL_RGBA, GL_SHORT}, // RGBA16S
|
||||
{GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT}, // RGBA16UI
|
||||
{GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV}, // R11FG11FB10F
|
||||
{GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT}, // RGBA32UI
|
||||
{GL_COMPRESSED_RGBA_S3TC_DXT1_EXT}, // DXT1
|
||||
{GL_COMPRESSED_RGBA_S3TC_DXT3_EXT}, // DXT23
|
||||
{GL_COMPRESSED_RGBA_S3TC_DXT5_EXT}, // DXT45
|
||||
{GL_COMPRESSED_RED_RGTC1}, // DXN1
|
||||
{GL_COMPRESSED_RG_RGTC2}, // DXN2UNORM
|
||||
{GL_COMPRESSED_SIGNED_RG_RGTC2}, // DXN2SNORM
|
||||
{GL_COMPRESSED_RGBA_BPTC_UNORM}, // BC7U
|
||||
{GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT}, // BC6H_UF16
|
||||
{GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT}, // BC6H_SF16
|
||||
{GL_COMPRESSED_RGBA_ASTC_4x4_KHR}, // ASTC_2D_4X4
|
||||
{GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, // BGRA8
|
||||
{GL_RGBA32F, GL_RGBA, GL_FLOAT}, // RGBA32F
|
||||
{GL_RG32F, GL_RG, GL_FLOAT}, // RG32F
|
||||
{GL_R32F, GL_RED, GL_FLOAT}, // R32F
|
||||
{GL_R16F, GL_RED, GL_HALF_FLOAT}, // R16F
|
||||
{GL_R16, GL_RED, GL_UNSIGNED_SHORT}, // R16U
|
||||
{GL_R16_SNORM, GL_RED, GL_SHORT}, // R16S
|
||||
{GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT}, // R16UI
|
||||
{GL_R16I, GL_RED_INTEGER, GL_SHORT}, // R16I
|
||||
{GL_RG16, GL_RG, GL_UNSIGNED_SHORT}, // RG16
|
||||
{GL_RG16F, GL_RG, GL_HALF_FLOAT}, // RG16F
|
||||
{GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT}, // RG16UI
|
||||
{GL_RG16I, GL_RG_INTEGER, GL_SHORT}, // RG16I
|
||||
{GL_RG16_SNORM, GL_RG, GL_SHORT}, // RG16S
|
||||
{GL_RGB32F, GL_RGB, GL_FLOAT}, // RGB32F
|
||||
{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // RGBA8_SRGB
|
||||
{GL_RG8, GL_RG, GL_UNSIGNED_BYTE}, // RG8U
|
||||
{GL_RG8_SNORM, GL_RG, GL_BYTE}, // RG8S
|
||||
{GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // RG8UI
|
||||
{GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // RG32UI
|
||||
{GL_RGB16F, GL_RGBA, GL_HALF_FLOAT}, // RGBX16F
|
||||
{GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT}, // R32UI
|
||||
{GL_R32I, GL_RED_INTEGER, GL_INT}, // R32I
|
||||
{GL_COMPRESSED_RGBA_ASTC_8x8_KHR}, // ASTC_2D_8X8
|
||||
{GL_COMPRESSED_RGBA_ASTC_8x5_KHR}, // ASTC_2D_8X5
|
||||
{GL_COMPRESSED_RGBA_ASTC_5x4_KHR}, // ASTC_2D_5X4
|
||||
{GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE}, // BGRA8
|
||||
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // A8B8G8R8_UNORM
|
||||
{GL_RGBA8_SNORM, GL_RGBA, GL_BYTE}, // A8B8G8R8_SNORM
|
||||
{GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE}, // A8B8G8R8_SINT
|
||||
{GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE}, // A8B8G8R8_UINT
|
||||
{GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}, // R5G6B5_UNORM
|
||||
{GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV}, // B5G6R5_UNORM
|
||||
{GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1R5G5B5_UNORM
|
||||
{GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10_UNORM
|
||||
{GL_RGB10_A2UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10_UINT
|
||||
{GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1B5G5R5_UNORM
|
||||
{GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8_UNORM
|
||||
{GL_R8_SNORM, GL_RED, GL_BYTE}, // R8_SNORM
|
||||
{GL_R8I, GL_RED_INTEGER, GL_BYTE}, // R8_SINT
|
||||
{GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE}, // R8_UINT
|
||||
{GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT}, // R16G16B16A16_FLOAT
|
||||
{GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT}, // R16G16B16A16_UNORM
|
||||
{GL_RGBA16_SNORM, GL_RGBA, GL_SHORT}, // R16G16B16A16_SNORM
|
||||
{GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT}, // R16G16B16A16_SINT
|
||||
{GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT}, // R16G16B16A16_UINT
|
||||
{GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV}, // B10G11R11_FLOAT
|
||||
{GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT}, // R32G32B32A32_UINT
|
||||
{GL_COMPRESSED_RGBA_S3TC_DXT1_EXT}, // BC1_RGBA_UNORM
|
||||
{GL_COMPRESSED_RGBA_S3TC_DXT3_EXT}, // BC2_UNORM
|
||||
{GL_COMPRESSED_RGBA_S3TC_DXT5_EXT}, // BC3_UNORM
|
||||
{GL_COMPRESSED_RED_RGTC1}, // BC4_UNORM
|
||||
{GL_COMPRESSED_SIGNED_RED_RGTC1}, // BC4_SNORM
|
||||
{GL_COMPRESSED_RG_RGTC2}, // BC5_UNORM
|
||||
{GL_COMPRESSED_SIGNED_RG_RGTC2}, // BC5_SNORM
|
||||
{GL_COMPRESSED_RGBA_BPTC_UNORM}, // BC7_UNORM
|
||||
{GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT}, // BC6H_UFLOAT
|
||||
{GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT}, // BC6H_SFLOAT
|
||||
{GL_COMPRESSED_RGBA_ASTC_4x4_KHR}, // ASTC_2D_4X4_UNORM
|
||||
{GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, // B8G8R8A8_UNORM
|
||||
{GL_RGBA32F, GL_RGBA, GL_FLOAT}, // R32G32B32A32_FLOAT
|
||||
{GL_RGBA32I, GL_RGBA_INTEGER, GL_INT}, // R32G32B32A32_SINT
|
||||
{GL_RG32F, GL_RG, GL_FLOAT}, // R32G32_FLOAT
|
||||
{GL_RG32I, GL_RG_INTEGER, GL_INT}, // R32G32_SINT
|
||||
{GL_R32F, GL_RED, GL_FLOAT}, // R32_FLOAT
|
||||
{GL_R16F, GL_RED, GL_HALF_FLOAT}, // R16_FLOAT
|
||||
{GL_R16, GL_RED, GL_UNSIGNED_SHORT}, // R16_UNORM
|
||||
{GL_R16_SNORM, GL_RED, GL_SHORT}, // R16_SNORM
|
||||
{GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT}, // R16_UINT
|
||||
{GL_R16I, GL_RED_INTEGER, GL_SHORT}, // R16_SINT
|
||||
{GL_RG16, GL_RG, GL_UNSIGNED_SHORT}, // R16G16_UNORM
|
||||
{GL_RG16F, GL_RG, GL_HALF_FLOAT}, // R16G16_FLOAT
|
||||
{GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT}, // R16G16_UINT
|
||||
{GL_RG16I, GL_RG_INTEGER, GL_SHORT}, // R16G16_SINT
|
||||
{GL_RG16_SNORM, GL_RG, GL_SHORT}, // R16G16_SNORM
|
||||
{GL_RGB32F, GL_RGB, GL_FLOAT}, // R32G32B32_FLOAT
|
||||
{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // A8B8G8R8_SRGB
|
||||
{GL_RG8, GL_RG, GL_UNSIGNED_BYTE}, // R8G8_UNORM
|
||||
{GL_RG8_SNORM, GL_RG, GL_BYTE}, // R8G8_SNORM
|
||||
{GL_RG8I, GL_RG_INTEGER, GL_BYTE}, // R8G8_SINT
|
||||
{GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE}, // R8G8_UINT
|
||||
{GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // R32G32_UINT
|
||||
{GL_RGB16F, GL_RGBA, GL_HALF_FLOAT}, // R16G16B16X16_FLOAT
|
||||
{GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT}, // R32_UINT
|
||||
{GL_R32I, GL_RED_INTEGER, GL_INT}, // R32_SINT
|
||||
{GL_COMPRESSED_RGBA_ASTC_8x8_KHR}, // ASTC_2D_8X8_UNORM
|
||||
{GL_COMPRESSED_RGBA_ASTC_8x5_KHR}, // ASTC_2D_8X5_UNORM
|
||||
{GL_COMPRESSED_RGBA_ASTC_5x4_KHR}, // ASTC_2D_5X4_UNORM
|
||||
{GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE}, // B8G8R8A8_UNORM
|
||||
// Compressed sRGB formats
|
||||
{GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT}, // DXT1_SRGB
|
||||
{GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT}, // DXT23_SRGB
|
||||
{GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}, // DXT45_SRGB
|
||||
{GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM}, // BC7U_SRGB
|
||||
{GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV}, // R4G4B4A4U
|
||||
{GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT}, // BC1_RGBA_SRGB
|
||||
{GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT}, // BC2_SRGB
|
||||
{GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}, // BC3_SRGB
|
||||
{GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM}, // BC7_SRGB
|
||||
{GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV}, // A4B4G4R4_UNORM
|
||||
{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR}, // ASTC_2D_4X4_SRGB
|
||||
{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR}, // ASTC_2D_8X8_SRGB
|
||||
{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR}, // ASTC_2D_8X5_SRGB
|
||||
{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR}, // ASTC_2D_5X4_SRGB
|
||||
{GL_COMPRESSED_RGBA_ASTC_5x5_KHR}, // ASTC_2D_5X5
|
||||
{GL_COMPRESSED_RGBA_ASTC_5x5_KHR}, // ASTC_2D_5X5_UNORM
|
||||
{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR}, // ASTC_2D_5X5_SRGB
|
||||
{GL_COMPRESSED_RGBA_ASTC_10x8_KHR}, // ASTC_2D_10X8
|
||||
{GL_COMPRESSED_RGBA_ASTC_10x8_KHR}, // ASTC_2D_10X8_UNORM
|
||||
{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR}, // ASTC_2D_10X8_SRGB
|
||||
{GL_COMPRESSED_RGBA_ASTC_6x6_KHR}, // ASTC_2D_6X6
|
||||
{GL_COMPRESSED_RGBA_ASTC_6x6_KHR}, // ASTC_2D_6X6_UNORM
|
||||
{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR}, // ASTC_2D_6X6_SRGB
|
||||
{GL_COMPRESSED_RGBA_ASTC_10x10_KHR}, // ASTC_2D_10X10
|
||||
{GL_COMPRESSED_RGBA_ASTC_10x10_KHR}, // ASTC_2D_10X10_UNORM
|
||||
{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR}, // ASTC_2D_10X10_SRGB
|
||||
{GL_COMPRESSED_RGBA_ASTC_12x12_KHR}, // ASTC_2D_12X12
|
||||
{GL_COMPRESSED_RGBA_ASTC_12x12_KHR}, // ASTC_2D_12X12_UNORM
|
||||
{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}, // ASTC_2D_12X12_SRGB
|
||||
{GL_COMPRESSED_RGBA_ASTC_8x6_KHR}, // ASTC_2D_8X6
|
||||
{GL_COMPRESSED_RGBA_ASTC_8x6_KHR}, // ASTC_2D_8X6_UNORM
|
||||
{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR}, // ASTC_2D_8X6_SRGB
|
||||
{GL_COMPRESSED_RGBA_ASTC_6x5_KHR}, // ASTC_2D_6X5
|
||||
{GL_COMPRESSED_RGBA_ASTC_6x5_KHR}, // ASTC_2D_6X5_UNORM
|
||||
{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR}, // ASTC_2D_6X5_SRGB
|
||||
{GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV}, // E5B9G9R9F
|
||||
{GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV}, // E5B9G9R9_FLOAT
|
||||
|
||||
// Depth formats
|
||||
{GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, // Z32F
|
||||
{GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}, // Z16
|
||||
{GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, // D32_FLOAT
|
||||
{GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}, // D16_UNORM
|
||||
|
||||
// DepthStencil formats
|
||||
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // Z24S8
|
||||
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // S8Z24
|
||||
{GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV}, // Z32FS8
|
||||
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // D24_UNORM_S8_UINT
|
||||
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // S8_UINT_D24_UNORM
|
||||
{GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL,
|
||||
GL_FLOAT_32_UNSIGNED_INT_24_8_REV}, // D32_FLOAT_S8_UINT
|
||||
}};
|
||||
|
||||
const FormatTuple& GetFormatTuple(PixelFormat pixel_format) {
|
||||
@@ -178,10 +190,10 @@ GLint GetSwizzleSource(SwizzleSource source) {
|
||||
|
||||
GLenum GetComponent(PixelFormat format, bool is_first) {
|
||||
switch (format) {
|
||||
case PixelFormat::Z24S8:
|
||||
case PixelFormat::Z32FS8:
|
||||
case PixelFormat::D24_UNORM_S8_UINT:
|
||||
case PixelFormat::D32_FLOAT_S8_UINT:
|
||||
return is_first ? GL_DEPTH_COMPONENT : GL_STENCIL_INDEX;
|
||||
case PixelFormat::S8Z24:
|
||||
case PixelFormat::S8_UINT_D24_UNORM:
|
||||
return is_first ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@@ -482,9 +494,9 @@ GLuint CachedSurfaceView::GetTexture(SwizzleSource x_source, SwizzleSource y_sou
|
||||
std::array swizzle{x_source, y_source, z_source, w_source};
|
||||
|
||||
switch (const PixelFormat format = GetSurfaceParams().pixel_format) {
|
||||
case PixelFormat::Z24S8:
|
||||
case PixelFormat::Z32FS8:
|
||||
case PixelFormat::S8Z24:
|
||||
case PixelFormat::D24_UNORM_S8_UINT:
|
||||
case PixelFormat::D32_FLOAT_S8_UINT:
|
||||
case PixelFormat::S8_UINT_D24_UNORM:
|
||||
UNIMPLEMENTED_IF(x_source != SwizzleSource::R && x_source != SwizzleSource::G);
|
||||
glTextureParameteri(view.handle, GL_DEPTH_STENCIL_TEXTURE_MODE,
|
||||
GetComponent(format, x_source == SwizzleSource::R));
|
||||
|
||||
@@ -535,12 +535,12 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
|
||||
|
||||
GLint internal_format;
|
||||
switch (framebuffer.pixel_format) {
|
||||
case Tegra::FramebufferConfig::PixelFormat::ABGR8:
|
||||
case Tegra::FramebufferConfig::PixelFormat::A8B8G8R8_UNORM:
|
||||
internal_format = GL_RGBA8;
|
||||
texture.gl_format = GL_RGBA;
|
||||
texture.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||
break;
|
||||
case Tegra::FramebufferConfig::PixelFormat::RGB565:
|
||||
case Tegra::FramebufferConfig::PixelFormat::RGB565_UNORM:
|
||||
internal_format = GL_RGB565;
|
||||
texture.gl_format = GL_RGB;
|
||||
texture.gl_type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
|
||||
@@ -117,90 +117,101 @@ struct FormatTuple {
|
||||
VkFormat format; ///< Vulkan format
|
||||
int usage = 0; ///< Describes image format usage
|
||||
} constexpr tex_format_tuples[] = {
|
||||
{VK_FORMAT_A8B8G8R8_UNORM_PACK32, Attachable | Storage}, // ABGR8U
|
||||
{VK_FORMAT_A8B8G8R8_SNORM_PACK32, Attachable | Storage}, // ABGR8S
|
||||
{VK_FORMAT_A8B8G8R8_UINT_PACK32, Attachable | Storage}, // ABGR8UI
|
||||
{VK_FORMAT_B5G6R5_UNORM_PACK16}, // B5G6R5U
|
||||
{VK_FORMAT_A2B10G10R10_UNORM_PACK32, Attachable | Storage}, // A2B10G10R10U
|
||||
{VK_FORMAT_A1R5G5B5_UNORM_PACK16, Attachable}, // A1B5G5R5U (flipped with swizzle)
|
||||
{VK_FORMAT_R8_UNORM, Attachable | Storage}, // R8U
|
||||
{VK_FORMAT_R8_UINT, Attachable | Storage}, // R8UI
|
||||
{VK_FORMAT_R16G16B16A16_SFLOAT, Attachable | Storage}, // RGBA16F
|
||||
{VK_FORMAT_R16G16B16A16_UNORM, Attachable | Storage}, // RGBA16U
|
||||
{VK_FORMAT_R16G16B16A16_SNORM, Attachable | Storage}, // RGBA16S
|
||||
{VK_FORMAT_R16G16B16A16_UINT, Attachable | Storage}, // RGBA16UI
|
||||
{VK_FORMAT_B10G11R11_UFLOAT_PACK32, Attachable | Storage}, // R11FG11FB10F
|
||||
{VK_FORMAT_R32G32B32A32_UINT, Attachable | Storage}, // RGBA32UI
|
||||
{VK_FORMAT_BC1_RGBA_UNORM_BLOCK}, // DXT1
|
||||
{VK_FORMAT_BC2_UNORM_BLOCK}, // DXT23
|
||||
{VK_FORMAT_BC3_UNORM_BLOCK}, // DXT45
|
||||
{VK_FORMAT_BC4_UNORM_BLOCK}, // DXN1
|
||||
{VK_FORMAT_BC5_UNORM_BLOCK}, // DXN2UNORM
|
||||
{VK_FORMAT_BC5_SNORM_BLOCK}, // DXN2SNORM
|
||||
{VK_FORMAT_BC7_UNORM_BLOCK}, // BC7U
|
||||
{VK_FORMAT_BC6H_UFLOAT_BLOCK}, // BC6H_UF16
|
||||
{VK_FORMAT_BC6H_SFLOAT_BLOCK}, // BC6H_SF16
|
||||
{VK_FORMAT_ASTC_4x4_UNORM_BLOCK}, // ASTC_2D_4X4
|
||||
{VK_FORMAT_B8G8R8A8_UNORM, Attachable}, // BGRA8
|
||||
{VK_FORMAT_R32G32B32A32_SFLOAT, Attachable | Storage}, // RGBA32F
|
||||
{VK_FORMAT_R32G32_SFLOAT, Attachable | Storage}, // RG32F
|
||||
{VK_FORMAT_R32_SFLOAT, Attachable | Storage}, // R32F
|
||||
{VK_FORMAT_R16_SFLOAT, Attachable | Storage}, // R16F
|
||||
{VK_FORMAT_R16_UNORM, Attachable | Storage}, // R16U
|
||||
{VK_FORMAT_UNDEFINED}, // R16S
|
||||
{VK_FORMAT_R16_UINT, Attachable | Storage}, // R16UI
|
||||
{VK_FORMAT_UNDEFINED}, // R16I
|
||||
{VK_FORMAT_R16G16_UNORM, Attachable | Storage}, // RG16
|
||||
{VK_FORMAT_R16G16_SFLOAT, Attachable | Storage}, // RG16F
|
||||
{VK_FORMAT_UNDEFINED}, // RG16UI
|
||||
{VK_FORMAT_UNDEFINED}, // RG16I
|
||||
{VK_FORMAT_R16G16_SNORM, Attachable | Storage}, // RG16S
|
||||
{VK_FORMAT_UNDEFINED}, // RGB32F
|
||||
{VK_FORMAT_R8G8B8A8_SRGB, Attachable}, // RGBA8_SRGB
|
||||
{VK_FORMAT_R8G8_UNORM, Attachable | Storage}, // RG8U
|
||||
{VK_FORMAT_R8G8_SNORM, Attachable | Storage}, // RG8S
|
||||
{VK_FORMAT_R8G8_UINT, Attachable | Storage}, // RG8UI
|
||||
{VK_FORMAT_R32G32_UINT, Attachable | Storage}, // RG32UI
|
||||
{VK_FORMAT_UNDEFINED}, // RGBX16F
|
||||
{VK_FORMAT_R32_UINT, Attachable | Storage}, // R32UI
|
||||
{VK_FORMAT_R32_SINT, Attachable | Storage}, // R32I
|
||||
{VK_FORMAT_ASTC_8x8_UNORM_BLOCK}, // ASTC_2D_8X8
|
||||
{VK_FORMAT_UNDEFINED}, // ASTC_2D_8X5
|
||||
{VK_FORMAT_UNDEFINED}, // ASTC_2D_5X4
|
||||
{VK_FORMAT_B8G8R8A8_SRGB, Attachable}, // BGRA8_SRGB
|
||||
{VK_FORMAT_BC1_RGBA_SRGB_BLOCK}, // DXT1_SRGB
|
||||
{VK_FORMAT_BC2_SRGB_BLOCK}, // DXT23_SRGB
|
||||
{VK_FORMAT_BC3_SRGB_BLOCK}, // DXT45_SRGB
|
||||
{VK_FORMAT_BC7_SRGB_BLOCK}, // BC7U_SRGB
|
||||
{VK_FORMAT_R4G4B4A4_UNORM_PACK16, Attachable}, // R4G4B4A4U
|
||||
{VK_FORMAT_ASTC_4x4_SRGB_BLOCK}, // ASTC_2D_4X4_SRGB
|
||||
{VK_FORMAT_ASTC_8x8_SRGB_BLOCK}, // ASTC_2D_8X8_SRGB
|
||||
{VK_FORMAT_ASTC_8x5_SRGB_BLOCK}, // ASTC_2D_8X5_SRGB
|
||||
{VK_FORMAT_ASTC_5x4_SRGB_BLOCK}, // ASTC_2D_5X4_SRGB
|
||||
{VK_FORMAT_ASTC_5x5_UNORM_BLOCK}, // ASTC_2D_5X5
|
||||
{VK_FORMAT_ASTC_5x5_SRGB_BLOCK}, // ASTC_2D_5X5_SRGB
|
||||
{VK_FORMAT_ASTC_10x8_UNORM_BLOCK}, // ASTC_2D_10X8
|
||||
{VK_FORMAT_ASTC_10x8_SRGB_BLOCK}, // ASTC_2D_10X8_SRGB
|
||||
{VK_FORMAT_ASTC_6x6_UNORM_BLOCK}, // ASTC_2D_6X6
|
||||
{VK_FORMAT_ASTC_6x6_SRGB_BLOCK}, // ASTC_2D_6X6_SRGB
|
||||
{VK_FORMAT_ASTC_10x10_UNORM_BLOCK}, // ASTC_2D_10X10
|
||||
{VK_FORMAT_ASTC_10x10_SRGB_BLOCK}, // ASTC_2D_10X10_SRGB
|
||||
{VK_FORMAT_ASTC_12x12_UNORM_BLOCK}, // ASTC_2D_12X12
|
||||
{VK_FORMAT_ASTC_12x12_SRGB_BLOCK}, // ASTC_2D_12X12_SRGB
|
||||
{VK_FORMAT_ASTC_8x6_UNORM_BLOCK}, // ASTC_2D_8X6
|
||||
{VK_FORMAT_ASTC_8x6_SRGB_BLOCK}, // ASTC_2D_8X6_SRGB
|
||||
{VK_FORMAT_ASTC_6x5_UNORM_BLOCK}, // ASTC_2D_6X5
|
||||
{VK_FORMAT_ASTC_6x5_SRGB_BLOCK}, // ASTC_2D_6X5_SRGB
|
||||
{VK_FORMAT_E5B9G9R9_UFLOAT_PACK32}, // E5B9G9R9F
|
||||
{VK_FORMAT_A8B8G8R8_UNORM_PACK32, Attachable | Storage}, // A8B8G8R8_UNORM
|
||||
{VK_FORMAT_A8B8G8R8_SNORM_PACK32, Attachable | Storage}, // A8B8G8R8_SNORM
|
||||
{VK_FORMAT_A8B8G8R8_SINT_PACK32, Attachable | Storage}, // A8B8G8R8_SINT
|
||||
{VK_FORMAT_A8B8G8R8_UINT_PACK32, Attachable | Storage}, // A8B8G8R8_UINT
|
||||
{VK_FORMAT_R5G6B5_UNORM_PACK16, Attachable}, // R5G6B5_UNORM
|
||||
{VK_FORMAT_B5G6R5_UNORM_PACK16, Attachable}, // B5G6R5_UNORM
|
||||
{VK_FORMAT_A1R5G5B5_UNORM_PACK16, Attachable}, // A1R5G5B5_UNORM
|
||||
{VK_FORMAT_A2B10G10R10_UNORM_PACK32, Attachable | Storage}, // A2B10G10R10_UNORM
|
||||
{VK_FORMAT_A2B10G10R10_UINT_PACK32, Attachable | Storage}, // A2B10G10R10_UINT
|
||||
{VK_FORMAT_A1R5G5B5_UNORM_PACK16, Attachable}, // A1B5G5R5_UNORM (flipped with swizzle)
|
||||
{VK_FORMAT_R8_UNORM, Attachable | Storage}, // R8_UNORM
|
||||
{VK_FORMAT_R8_SNORM, Attachable | Storage}, // R8_SNORM
|
||||
{VK_FORMAT_R8_SINT, Attachable | Storage}, // R8_SINT
|
||||
{VK_FORMAT_R8_UINT, Attachable | Storage}, // R8_UINT
|
||||
{VK_FORMAT_R16G16B16A16_SFLOAT, Attachable | Storage}, // R16G16B16A16_FLOAT
|
||||
{VK_FORMAT_R16G16B16A16_UNORM, Attachable | Storage}, // R16G16B16A16_UNORM
|
||||
{VK_FORMAT_R16G16B16A16_SNORM, Attachable | Storage}, // R16G16B16A16_SNORM
|
||||
{VK_FORMAT_R16G16B16A16_SINT, Attachable | Storage}, // R16G16B16A16_SINT
|
||||
{VK_FORMAT_R16G16B16A16_UINT, Attachable | Storage}, // R16G16B16A16_UINT
|
||||
{VK_FORMAT_B10G11R11_UFLOAT_PACK32, Attachable | Storage}, // B10G11R11_FLOAT
|
||||
{VK_FORMAT_R32G32B32A32_UINT, Attachable | Storage}, // R32G32B32A32_UINT
|
||||
{VK_FORMAT_BC1_RGBA_UNORM_BLOCK}, // BC1_RGBA_UNORM
|
||||
{VK_FORMAT_BC2_UNORM_BLOCK}, // BC2_UNORM
|
||||
{VK_FORMAT_BC3_UNORM_BLOCK}, // BC3_UNORM
|
||||
{VK_FORMAT_BC4_UNORM_BLOCK}, // BC4_UNORM
|
||||
{VK_FORMAT_BC4_SNORM_BLOCK}, // BC4_SNORM
|
||||
{VK_FORMAT_BC5_UNORM_BLOCK}, // BC5_UNORM
|
||||
{VK_FORMAT_BC5_SNORM_BLOCK}, // BC5_SNORM
|
||||
{VK_FORMAT_BC7_UNORM_BLOCK}, // BC7_UNORM
|
||||
{VK_FORMAT_BC6H_UFLOAT_BLOCK}, // BC6H_UFLOAT
|
||||
{VK_FORMAT_BC6H_SFLOAT_BLOCK}, // BC6H_SFLOAT
|
||||
{VK_FORMAT_ASTC_4x4_UNORM_BLOCK}, // ASTC_2D_4X4_UNORM
|
||||
{VK_FORMAT_B8G8R8A8_UNORM, Attachable}, // B8G8R8A8_UNORM
|
||||
{VK_FORMAT_R32G32B32A32_SFLOAT, Attachable | Storage}, // R32G32B32A32_FLOAT
|
||||
{VK_FORMAT_R32G32B32A32_SINT, Attachable | Storage}, // R32G32B32A32_SINT
|
||||
{VK_FORMAT_R32G32_SFLOAT, Attachable | Storage}, // R32G32_FLOAT
|
||||
{VK_FORMAT_R32G32_SINT, Attachable | Storage}, // R32G32_SINT
|
||||
{VK_FORMAT_R32_SFLOAT, Attachable | Storage}, // R32_FLOAT
|
||||
{VK_FORMAT_R16_SFLOAT, Attachable | Storage}, // R16_FLOAT
|
||||
{VK_FORMAT_R16_UNORM, Attachable | Storage}, // R16_UNORM
|
||||
{VK_FORMAT_UNDEFINED}, // R16_SNORM
|
||||
{VK_FORMAT_R16_UINT, Attachable | Storage}, // R16_UINT
|
||||
{VK_FORMAT_UNDEFINED}, // R16_SINT
|
||||
{VK_FORMAT_R16G16_UNORM, Attachable | Storage}, // R16G16_UNORM
|
||||
{VK_FORMAT_R16G16_SFLOAT, Attachable | Storage}, // R16G16_FLOAT
|
||||
{VK_FORMAT_UNDEFINED}, // R16G16_UINT
|
||||
{VK_FORMAT_UNDEFINED}, // R16G16_SINT
|
||||
{VK_FORMAT_R16G16_SNORM, Attachable | Storage}, // R16G16_SNORM
|
||||
{VK_FORMAT_UNDEFINED}, // R32G32B32_FLOAT
|
||||
{VK_FORMAT_R8G8B8A8_SRGB, Attachable}, // A8B8G8R8_SRGB
|
||||
{VK_FORMAT_R8G8_UNORM, Attachable | Storage}, // R8G8_UNORM
|
||||
{VK_FORMAT_R8G8_SNORM, Attachable | Storage}, // R8G8_SNORM
|
||||
{VK_FORMAT_R8G8_SINT, Attachable | Storage}, // R8G8_SINT
|
||||
{VK_FORMAT_R8G8_UINT, Attachable | Storage}, // R8G8_UINT
|
||||
{VK_FORMAT_R32G32_UINT, Attachable | Storage}, // R32G32_UINT
|
||||
{VK_FORMAT_UNDEFINED}, // R16G16B16X16_FLOAT
|
||||
{VK_FORMAT_R32_UINT, Attachable | Storage}, // R32_UINT
|
||||
{VK_FORMAT_R32_SINT, Attachable | Storage}, // R32_SINT
|
||||
{VK_FORMAT_ASTC_8x8_UNORM_BLOCK}, // ASTC_2D_8X8_UNORM
|
||||
{VK_FORMAT_UNDEFINED}, // ASTC_2D_8X5_UNORM
|
||||
{VK_FORMAT_UNDEFINED}, // ASTC_2D_5X4_UNORM
|
||||
{VK_FORMAT_B8G8R8A8_SRGB, Attachable}, // B8G8R8A8_SRGB
|
||||
{VK_FORMAT_BC1_RGBA_SRGB_BLOCK}, // BC1_RGBA_SRGB
|
||||
{VK_FORMAT_BC2_SRGB_BLOCK}, // BC2_SRGB
|
||||
{VK_FORMAT_BC3_SRGB_BLOCK}, // BC3_SRGB
|
||||
{VK_FORMAT_BC7_SRGB_BLOCK}, // BC7_SRGB
|
||||
{VK_FORMAT_R4G4B4A4_UNORM_PACK16, Attachable}, // A4B4G4R4_UNORM
|
||||
{VK_FORMAT_ASTC_4x4_SRGB_BLOCK}, // ASTC_2D_4X4_SRGB
|
||||
{VK_FORMAT_ASTC_8x8_SRGB_BLOCK}, // ASTC_2D_8X8_SRGB
|
||||
{VK_FORMAT_ASTC_8x5_SRGB_BLOCK}, // ASTC_2D_8X5_SRGB
|
||||
{VK_FORMAT_ASTC_5x4_SRGB_BLOCK}, // ASTC_2D_5X4_SRGB
|
||||
{VK_FORMAT_ASTC_5x5_UNORM_BLOCK}, // ASTC_2D_5X5_UNORM
|
||||
{VK_FORMAT_ASTC_5x5_SRGB_BLOCK}, // ASTC_2D_5X5_SRGB
|
||||
{VK_FORMAT_ASTC_10x8_UNORM_BLOCK}, // ASTC_2D_10X8_UNORM
|
||||
{VK_FORMAT_ASTC_10x8_SRGB_BLOCK}, // ASTC_2D_10X8_SRGB
|
||||
{VK_FORMAT_ASTC_6x6_UNORM_BLOCK}, // ASTC_2D_6X6_UNORM
|
||||
{VK_FORMAT_ASTC_6x6_SRGB_BLOCK}, // ASTC_2D_6X6_SRGB
|
||||
{VK_FORMAT_ASTC_10x10_UNORM_BLOCK}, // ASTC_2D_10X10_UNORM
|
||||
{VK_FORMAT_ASTC_10x10_SRGB_BLOCK}, // ASTC_2D_10X10_SRGB
|
||||
{VK_FORMAT_ASTC_12x12_UNORM_BLOCK}, // ASTC_2D_12X12_UNORM
|
||||
{VK_FORMAT_ASTC_12x12_SRGB_BLOCK}, // ASTC_2D_12X12_SRGB
|
||||
{VK_FORMAT_ASTC_8x6_UNORM_BLOCK}, // ASTC_2D_8X6_UNORM
|
||||
{VK_FORMAT_ASTC_8x6_SRGB_BLOCK}, // ASTC_2D_8X6_SRGB
|
||||
{VK_FORMAT_ASTC_6x5_UNORM_BLOCK}, // ASTC_2D_6X5_UNORM
|
||||
{VK_FORMAT_ASTC_6x5_SRGB_BLOCK}, // ASTC_2D_6X5_SRGB
|
||||
{VK_FORMAT_E5B9G9R9_UFLOAT_PACK32}, // E5B9G9R9_FLOAT
|
||||
|
||||
// Depth formats
|
||||
{VK_FORMAT_D32_SFLOAT, Attachable}, // Z32F
|
||||
{VK_FORMAT_D16_UNORM, Attachable}, // Z16
|
||||
{VK_FORMAT_D32_SFLOAT, Attachable}, // D32_FLOAT
|
||||
{VK_FORMAT_D16_UNORM, Attachable}, // D16_UNORM
|
||||
|
||||
// DepthStencil formats
|
||||
{VK_FORMAT_D24_UNORM_S8_UINT, Attachable}, // Z24S8
|
||||
{VK_FORMAT_D24_UNORM_S8_UINT, Attachable}, // S8Z24 (emulated)
|
||||
{VK_FORMAT_D32_SFLOAT_S8_UINT, Attachable}, // Z32FS8
|
||||
{VK_FORMAT_D24_UNORM_S8_UINT, Attachable}, // D24_UNORM_S8_UINT
|
||||
{VK_FORMAT_D24_UNORM_S8_UINT, Attachable}, // S8_UINT_D24_UNORM (emulated)
|
||||
{VK_FORMAT_D32_SFLOAT_S8_UINT, Attachable}, // D32_FLOAT_S8_UINT
|
||||
};
|
||||
static_assert(std::size(tex_format_tuples) == VideoCore::Surface::MaxPixelFormat);
|
||||
|
||||
@@ -221,7 +232,7 @@ FormatInfo SurfaceFormat(const VKDevice& device, FormatType format_type, PixelFo
|
||||
return {VK_FORMAT_A8B8G8R8_UNORM_PACK32, true, true};
|
||||
}
|
||||
|
||||
// Use ABGR8 on hardware that doesn't support ASTC natively
|
||||
// Use A8B8G8R8_UNORM on hardware that doesn't support ASTC natively
|
||||
if (!device.IsOptimalAstcSupported() && VideoCore::Surface::IsPixelFormatASTC(pixel_format)) {
|
||||
tuple.format = VideoCore::Surface::IsPixelFormatSRGB(pixel_format)
|
||||
? VK_FORMAT_A8B8G8R8_SRGB_PACK32
|
||||
|
||||
@@ -183,9 +183,9 @@ std::size_t GetSizeInBytes(const Tegra::FramebufferConfig& framebuffer) {
|
||||
|
||||
VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) {
|
||||
switch (framebuffer.pixel_format) {
|
||||
case Tegra::FramebufferConfig::PixelFormat::ABGR8:
|
||||
case Tegra::FramebufferConfig::PixelFormat::A8B8G8R8_UNORM:
|
||||
return VK_FORMAT_A8B8G8R8_UNORM_PACK32;
|
||||
case Tegra::FramebufferConfig::PixelFormat::RGB565:
|
||||
case Tegra::FramebufferConfig::PixelFormat::RGB565_UNORM:
|
||||
return VK_FORMAT_R5G6B5_UNORM_PACK16;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Unknown framebuffer pixel format: {}",
|
||||
|
||||
@@ -77,14 +77,19 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(
|
||||
VK_FORMAT_A8B8G8R8_UNORM_PACK32,
|
||||
VK_FORMAT_A8B8G8R8_UINT_PACK32,
|
||||
VK_FORMAT_A8B8G8R8_SNORM_PACK32,
|
||||
VK_FORMAT_A8B8G8R8_SINT_PACK32,
|
||||
VK_FORMAT_A8B8G8R8_SRGB_PACK32,
|
||||
VK_FORMAT_B5G6R5_UNORM_PACK16,
|
||||
VK_FORMAT_A2B10G10R10_UNORM_PACK32,
|
||||
VK_FORMAT_A2B10G10R10_UINT_PACK32,
|
||||
VK_FORMAT_A1R5G5B5_UNORM_PACK16,
|
||||
VK_FORMAT_R32G32B32A32_SFLOAT,
|
||||
VK_FORMAT_R32G32B32A32_SINT,
|
||||
VK_FORMAT_R32G32B32A32_UINT,
|
||||
VK_FORMAT_R32G32_SFLOAT,
|
||||
VK_FORMAT_R32G32_SINT,
|
||||
VK_FORMAT_R32G32_UINT,
|
||||
VK_FORMAT_R16G16B16A16_SINT,
|
||||
VK_FORMAT_R16G16B16A16_UINT,
|
||||
VK_FORMAT_R16G16B16A16_SNORM,
|
||||
VK_FORMAT_R16G16B16A16_UNORM,
|
||||
@@ -96,8 +101,11 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(
|
||||
VK_FORMAT_R8G8B8A8_SRGB,
|
||||
VK_FORMAT_R8G8_UNORM,
|
||||
VK_FORMAT_R8G8_SNORM,
|
||||
VK_FORMAT_R8G8_SINT,
|
||||
VK_FORMAT_R8G8_UINT,
|
||||
VK_FORMAT_R8_UNORM,
|
||||
VK_FORMAT_R8_SNORM,
|
||||
VK_FORMAT_R8_SINT,
|
||||
VK_FORMAT_R8_UINT,
|
||||
VK_FORMAT_B10G11R11_UFLOAT_PACK32,
|
||||
VK_FORMAT_R32_SFLOAT,
|
||||
@@ -117,6 +125,7 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(
|
||||
VK_FORMAT_BC2_UNORM_BLOCK,
|
||||
VK_FORMAT_BC3_UNORM_BLOCK,
|
||||
VK_FORMAT_BC4_UNORM_BLOCK,
|
||||
VK_FORMAT_BC4_SNORM_BLOCK,
|
||||
VK_FORMAT_BC5_UNORM_BLOCK,
|
||||
VK_FORMAT_BC5_SNORM_BLOCK,
|
||||
VK_FORMAT_BC7_UNORM_BLOCK,
|
||||
|
||||
@@ -332,23 +332,23 @@ private:
|
||||
|
||||
if constexpr (has_extended_dynamic_state) {
|
||||
// With extended dynamic states we can specify the length and stride of a vertex buffer
|
||||
// std::array<VkDeviceSize, N> sizes;
|
||||
std::array<VkDeviceSize, N> sizes;
|
||||
std::array<u16, N> strides;
|
||||
// std::copy(vertex.sizes.begin(), vertex.sizes.begin() + N, sizes.begin());
|
||||
std::copy(vertex.sizes.begin(), vertex.sizes.begin() + N, sizes.begin());
|
||||
std::copy(vertex.strides.begin(), vertex.strides.begin() + N, strides.begin());
|
||||
|
||||
if constexpr (is_indexed) {
|
||||
scheduler.Record(
|
||||
[buffers, offsets, strides, index = index](vk::CommandBuffer cmdbuf) {
|
||||
[buffers, offsets, sizes, strides, index = index](vk::CommandBuffer cmdbuf) {
|
||||
cmdbuf.BindIndexBuffer(index.buffer, index.offset, index.type);
|
||||
cmdbuf.BindVertexBuffers2EXT(0, static_cast<u32>(N), buffers.data(),
|
||||
offsets.data(), nullptr,
|
||||
offsets.data(), sizes.data(),
|
||||
ExpandStrides(strides).data());
|
||||
});
|
||||
} else {
|
||||
scheduler.Record([buffers, offsets, strides](vk::CommandBuffer cmdbuf) {
|
||||
scheduler.Record([buffers, offsets, sizes, strides](vk::CommandBuffer cmdbuf) {
|
||||
cmdbuf.BindVertexBuffers2EXT(0, static_cast<u32>(N), buffers.data(),
|
||||
offsets.data(), nullptr,
|
||||
offsets.data(), sizes.data(),
|
||||
ExpandStrides(strides).data());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ void CachedSurface::UploadTexture(const std::vector<u8>& staging_buffer) {
|
||||
void CachedSurface::DownloadTexture(std::vector<u8>& staging_buffer) {
|
||||
UNIMPLEMENTED_IF(params.IsBuffer());
|
||||
|
||||
if (params.pixel_format == VideoCore::Surface::PixelFormat::A1B5G5R5U) {
|
||||
if (params.pixel_format == VideoCore::Surface::PixelFormat::A1B5G5R5_UNORM) {
|
||||
LOG_WARNING(Render_Vulkan, "A1B5G5R5 flushing is stubbed");
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ VkImageView CachedSurfaceView::GetImageView(SwizzleSource x_source, SwizzleSourc
|
||||
|
||||
std::array swizzle{MaxwellToVK::SwizzleSource(x_source), MaxwellToVK::SwizzleSource(y_source),
|
||||
MaxwellToVK::SwizzleSource(z_source), MaxwellToVK::SwizzleSource(w_source)};
|
||||
if (params.pixel_format == VideoCore::Surface::PixelFormat::A1B5G5R5U) {
|
||||
if (params.pixel_format == VideoCore::Surface::PixelFormat::A1B5G5R5_UNORM) {
|
||||
// A1B5G5R5 is implemented as A1R5G5B5, we have to change the swizzle here.
|
||||
std::swap(swizzle[0], swizzle[2]);
|
||||
}
|
||||
@@ -394,11 +394,11 @@ VkImageView CachedSurfaceView::GetImageView(SwizzleSource x_source, SwizzleSourc
|
||||
UNIMPLEMENTED_IF(x_source != SwizzleSource::R && x_source != SwizzleSource::G);
|
||||
const bool is_first = x_source == SwizzleSource::R;
|
||||
switch (params.pixel_format) {
|
||||
case VideoCore::Surface::PixelFormat::Z24S8:
|
||||
case VideoCore::Surface::PixelFormat::Z32FS8:
|
||||
case VideoCore::Surface::PixelFormat::D24_UNORM_S8_UINT:
|
||||
case VideoCore::Surface::PixelFormat::D32_FLOAT_S8_UINT:
|
||||
aspect = is_first ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||
break;
|
||||
case VideoCore::Surface::PixelFormat::S8Z24:
|
||||
case VideoCore::Surface::PixelFormat::S8_UINT_D24_UNORM:
|
||||
aspect = is_first ? VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -31,11 +31,11 @@ ComponentType GetComponentType(Tegra::Engines::SamplerDescriptor descriptor,
|
||||
std::size_t component) {
|
||||
const TextureFormat format{descriptor.format};
|
||||
switch (format) {
|
||||
case TextureFormat::R16_G16_B16_A16:
|
||||
case TextureFormat::R32_G32_B32_A32:
|
||||
case TextureFormat::R32_G32_B32:
|
||||
case TextureFormat::R32_G32:
|
||||
case TextureFormat::R16_G16:
|
||||
case TextureFormat::R16G16B16A16:
|
||||
case TextureFormat::R32G32B32A32:
|
||||
case TextureFormat::R32G32B32:
|
||||
case TextureFormat::R32G32:
|
||||
case TextureFormat::R16G16:
|
||||
case TextureFormat::R32:
|
||||
case TextureFormat::R16:
|
||||
case TextureFormat::R8:
|
||||
@@ -97,7 +97,7 @@ ComponentType GetComponentType(Tegra::Engines::SamplerDescriptor descriptor,
|
||||
break;
|
||||
case TextureFormat::B5G6R5:
|
||||
case TextureFormat::B6G5R5:
|
||||
case TextureFormat::BF10GF11RF11:
|
||||
case TextureFormat::B10G11R11:
|
||||
if (component == 0) {
|
||||
return descriptor.b_type;
|
||||
}
|
||||
@@ -108,9 +108,9 @@ ComponentType GetComponentType(Tegra::Engines::SamplerDescriptor descriptor,
|
||||
return descriptor.r_type;
|
||||
}
|
||||
break;
|
||||
case TextureFormat::G8R24:
|
||||
case TextureFormat::G24R8:
|
||||
case TextureFormat::G8R8:
|
||||
case TextureFormat::R24G8:
|
||||
case TextureFormat::R8G24:
|
||||
case TextureFormat::R8G8:
|
||||
case TextureFormat::G4R4:
|
||||
if (component == 0) {
|
||||
return descriptor.g_type;
|
||||
@@ -137,15 +137,15 @@ bool IsComponentEnabled(std::size_t component_mask, std::size_t component) {
|
||||
|
||||
u32 GetComponentSize(TextureFormat format, std::size_t component) {
|
||||
switch (format) {
|
||||
case TextureFormat::R32_G32_B32_A32:
|
||||
case TextureFormat::R32G32B32A32:
|
||||
return 32;
|
||||
case TextureFormat::R16_G16_B16_A16:
|
||||
case TextureFormat::R16G16B16A16:
|
||||
return 16;
|
||||
case TextureFormat::R32_G32_B32:
|
||||
case TextureFormat::R32G32B32:
|
||||
return component <= 2 ? 32 : 0;
|
||||
case TextureFormat::R32_G32:
|
||||
case TextureFormat::R32G32:
|
||||
return component <= 1 ? 32 : 0;
|
||||
case TextureFormat::R16_G16:
|
||||
case TextureFormat::R16G16:
|
||||
return component <= 1 ? 16 : 0;
|
||||
case TextureFormat::R32:
|
||||
return component == 0 ? 32 : 0;
|
||||
@@ -192,7 +192,7 @@ u32 GetComponentSize(TextureFormat format, std::size_t component) {
|
||||
return 6;
|
||||
}
|
||||
return 0;
|
||||
case TextureFormat::BF10GF11RF11:
|
||||
case TextureFormat::B10G11R11:
|
||||
if (component == 1 || component == 2) {
|
||||
return 11;
|
||||
}
|
||||
@@ -200,7 +200,7 @@ u32 GetComponentSize(TextureFormat format, std::size_t component) {
|
||||
return 10;
|
||||
}
|
||||
return 0;
|
||||
case TextureFormat::G8R24:
|
||||
case TextureFormat::R24G8:
|
||||
if (component == 0) {
|
||||
return 8;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ u32 GetComponentSize(TextureFormat format, std::size_t component) {
|
||||
return 24;
|
||||
}
|
||||
return 0;
|
||||
case TextureFormat::G24R8:
|
||||
case TextureFormat::R8G24:
|
||||
if (component == 0) {
|
||||
return 8;
|
||||
}
|
||||
@@ -216,7 +216,7 @@ u32 GetComponentSize(TextureFormat format, std::size_t component) {
|
||||
return 24;
|
||||
}
|
||||
return 0;
|
||||
case TextureFormat::G8R8:
|
||||
case TextureFormat::R8G8:
|
||||
return (component == 0 || component == 1) ? 8 : 0;
|
||||
case TextureFormat::G4R4:
|
||||
return (component == 0 || component == 1) ? 4 : 0;
|
||||
@@ -231,25 +231,25 @@ std::size_t GetImageComponentMask(TextureFormat format) {
|
||||
constexpr u8 B = 0b0100;
|
||||
constexpr u8 A = 0b1000;
|
||||
switch (format) {
|
||||
case TextureFormat::R32_G32_B32_A32:
|
||||
case TextureFormat::R16_G16_B16_A16:
|
||||
case TextureFormat::R32G32B32A32:
|
||||
case TextureFormat::R16G16B16A16:
|
||||
case TextureFormat::A8R8G8B8:
|
||||
case TextureFormat::A2B10G10R10:
|
||||
case TextureFormat::A4B4G4R4:
|
||||
case TextureFormat::A5B5G5R1:
|
||||
case TextureFormat::A1B5G5R5:
|
||||
return std::size_t{R | G | B | A};
|
||||
case TextureFormat::R32_G32_B32:
|
||||
case TextureFormat::R32G32B32:
|
||||
case TextureFormat::R32_B24G8:
|
||||
case TextureFormat::B5G6R5:
|
||||
case TextureFormat::B6G5R5:
|
||||
case TextureFormat::BF10GF11RF11:
|
||||
case TextureFormat::B10G11R11:
|
||||
return std::size_t{R | G | B};
|
||||
case TextureFormat::R32_G32:
|
||||
case TextureFormat::R16_G16:
|
||||
case TextureFormat::G8R24:
|
||||
case TextureFormat::G24R8:
|
||||
case TextureFormat::G8R8:
|
||||
case TextureFormat::R32G32:
|
||||
case TextureFormat::R16G16:
|
||||
case TextureFormat::R24G8:
|
||||
case TextureFormat::R8G24:
|
||||
case TextureFormat::R8G8:
|
||||
case TextureFormat::G4R4:
|
||||
return std::size_t{R | G};
|
||||
case TextureFormat::R32:
|
||||
|
||||
+126
-133
@@ -74,117 +74,131 @@ bool SurfaceTargetIsArray(SurfaceTarget target) {
|
||||
|
||||
PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format) {
|
||||
switch (format) {
|
||||
case Tegra::DepthFormat::S8_Z24_UNORM:
|
||||
return PixelFormat::S8Z24;
|
||||
case Tegra::DepthFormat::Z24_S8_UNORM:
|
||||
return PixelFormat::Z24S8;
|
||||
case Tegra::DepthFormat::Z32_FLOAT:
|
||||
return PixelFormat::Z32F;
|
||||
case Tegra::DepthFormat::Z16_UNORM:
|
||||
return PixelFormat::Z16;
|
||||
case Tegra::DepthFormat::Z32_S8_X24_FLOAT:
|
||||
return PixelFormat::Z32FS8;
|
||||
case Tegra::DepthFormat::S8_UINT_Z24_UNORM:
|
||||
return PixelFormat::S8_UINT_D24_UNORM;
|
||||
case Tegra::DepthFormat::D24S8_UNORM:
|
||||
return PixelFormat::D24_UNORM_S8_UINT;
|
||||
case Tegra::DepthFormat::D32_FLOAT:
|
||||
return PixelFormat::D32_FLOAT;
|
||||
case Tegra::DepthFormat::D16_UNORM:
|
||||
return PixelFormat::D16_UNORM;
|
||||
case Tegra::DepthFormat::D32_FLOAT_S8X24_UINT:
|
||||
return PixelFormat::D32_FLOAT_S8_UINT;
|
||||
default:
|
||||
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
||||
UNREACHABLE();
|
||||
return PixelFormat::S8Z24;
|
||||
UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<u32>(format));
|
||||
return PixelFormat::S8_UINT_D24_UNORM;
|
||||
}
|
||||
}
|
||||
|
||||
PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) {
|
||||
switch (format) {
|
||||
case Tegra::RenderTargetFormat::RGBA8_SRGB:
|
||||
return PixelFormat::RGBA8_SRGB;
|
||||
case Tegra::RenderTargetFormat::RGBA8_UNORM:
|
||||
return PixelFormat::ABGR8U;
|
||||
case Tegra::RenderTargetFormat::RGBA8_SNORM:
|
||||
return PixelFormat::ABGR8S;
|
||||
case Tegra::RenderTargetFormat::RGBA8_UINT:
|
||||
return PixelFormat::ABGR8UI;
|
||||
case Tegra::RenderTargetFormat::BGRA8_SRGB:
|
||||
return PixelFormat::BGRA8_SRGB;
|
||||
case Tegra::RenderTargetFormat::BGRA8_UNORM:
|
||||
return PixelFormat::BGRA8;
|
||||
case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
|
||||
return PixelFormat::A2B10G10R10U;
|
||||
case Tegra::RenderTargetFormat::RGBA16_FLOAT:
|
||||
return PixelFormat::RGBA16F;
|
||||
case Tegra::RenderTargetFormat::RGBA16_UNORM:
|
||||
return PixelFormat::RGBA16U;
|
||||
case Tegra::RenderTargetFormat::RGBA16_SNORM:
|
||||
return PixelFormat::RGBA16S;
|
||||
case Tegra::RenderTargetFormat::RGBA16_UINT:
|
||||
return PixelFormat::RGBA16UI;
|
||||
case Tegra::RenderTargetFormat::RGBA32_FLOAT:
|
||||
return PixelFormat::RGBA32F;
|
||||
case Tegra::RenderTargetFormat::RG32_FLOAT:
|
||||
return PixelFormat::RG32F;
|
||||
case Tegra::RenderTargetFormat::R11G11B10_FLOAT:
|
||||
return PixelFormat::R11FG11FB10F;
|
||||
case Tegra::RenderTargetFormat::B5G6R5_UNORM:
|
||||
return PixelFormat::B5G6R5U;
|
||||
case Tegra::RenderTargetFormat::BGR5A1_UNORM:
|
||||
return PixelFormat::A1B5G5R5U;
|
||||
case Tegra::RenderTargetFormat::RGBA32_UINT:
|
||||
return PixelFormat::RGBA32UI;
|
||||
case Tegra::RenderTargetFormat::R8_UNORM:
|
||||
return PixelFormat::R8U;
|
||||
case Tegra::RenderTargetFormat::R8_UINT:
|
||||
return PixelFormat::R8UI;
|
||||
case Tegra::RenderTargetFormat::RG16_FLOAT:
|
||||
return PixelFormat::RG16F;
|
||||
case Tegra::RenderTargetFormat::RG16_UINT:
|
||||
return PixelFormat::RG16UI;
|
||||
case Tegra::RenderTargetFormat::RG16_SINT:
|
||||
return PixelFormat::RG16I;
|
||||
case Tegra::RenderTargetFormat::RG16_UNORM:
|
||||
return PixelFormat::RG16;
|
||||
case Tegra::RenderTargetFormat::RG16_SNORM:
|
||||
return PixelFormat::RG16S;
|
||||
case Tegra::RenderTargetFormat::RG8_UNORM:
|
||||
return PixelFormat::RG8U;
|
||||
case Tegra::RenderTargetFormat::RG8_SNORM:
|
||||
return PixelFormat::RG8S;
|
||||
case Tegra::RenderTargetFormat::RG8_UINT:
|
||||
return PixelFormat::RG8UI;
|
||||
case Tegra::RenderTargetFormat::R16_FLOAT:
|
||||
return PixelFormat::R16F;
|
||||
case Tegra::RenderTargetFormat::R16_UNORM:
|
||||
return PixelFormat::R16U;
|
||||
case Tegra::RenderTargetFormat::R16_SNORM:
|
||||
return PixelFormat::R16S;
|
||||
case Tegra::RenderTargetFormat::R16_UINT:
|
||||
return PixelFormat::R16UI;
|
||||
case Tegra::RenderTargetFormat::R16_SINT:
|
||||
return PixelFormat::R16I;
|
||||
case Tegra::RenderTargetFormat::R32_FLOAT:
|
||||
return PixelFormat::R32F;
|
||||
case Tegra::RenderTargetFormat::R32B32G32A32_FLOAT:
|
||||
return PixelFormat::R32G32B32A32_FLOAT;
|
||||
case Tegra::RenderTargetFormat::R32G32B32A32_SINT:
|
||||
return PixelFormat::R32G32B32A32_SINT;
|
||||
case Tegra::RenderTargetFormat::R32G32B32A32_UINT:
|
||||
return PixelFormat::R32G32B32A32_UINT;
|
||||
case Tegra::RenderTargetFormat::R16G16B16A16_UNORM:
|
||||
return PixelFormat::R16G16B16A16_UNORM;
|
||||
case Tegra::RenderTargetFormat::R16G16B16A16_SNORM:
|
||||
return PixelFormat::R16G16B16A16_SNORM;
|
||||
case Tegra::RenderTargetFormat::R16G16B16A16_SINT:
|
||||
return PixelFormat::R16G16B16A16_SINT;
|
||||
case Tegra::RenderTargetFormat::R16G16B16A16_UINT:
|
||||
return PixelFormat::R16G16B16A16_UINT;
|
||||
case Tegra::RenderTargetFormat::R16G16B16A16_FLOAT:
|
||||
return PixelFormat::R16G16B16A16_FLOAT;
|
||||
case Tegra::RenderTargetFormat::R32G32_FLOAT:
|
||||
return PixelFormat::R32G32_FLOAT;
|
||||
case Tegra::RenderTargetFormat::R32G32_SINT:
|
||||
return PixelFormat::R32G32_SINT;
|
||||
case Tegra::RenderTargetFormat::R32G32_UINT:
|
||||
return PixelFormat::R32G32_UINT;
|
||||
case Tegra::RenderTargetFormat::R16G16B16X16_FLOAT:
|
||||
return PixelFormat::R16G16B16X16_FLOAT;
|
||||
case Tegra::RenderTargetFormat::B8G8R8A8_UNORM:
|
||||
return PixelFormat::B8G8R8A8_UNORM;
|
||||
case Tegra::RenderTargetFormat::B8G8R8A8_SRGB:
|
||||
return PixelFormat::B8G8R8A8_SRGB;
|
||||
case Tegra::RenderTargetFormat::A2B10G10R10_UNORM:
|
||||
return PixelFormat::A2B10G10R10_UNORM;
|
||||
case Tegra::RenderTargetFormat::A2B10G10R10_UINT:
|
||||
return PixelFormat::A2B10G10R10_UINT;
|
||||
case Tegra::RenderTargetFormat::A8B8G8R8_UNORM:
|
||||
return PixelFormat::A8B8G8R8_UNORM;
|
||||
case Tegra::RenderTargetFormat::A8B8G8R8_SRGB:
|
||||
return PixelFormat::A8B8G8R8_SRGB;
|
||||
case Tegra::RenderTargetFormat::A8B8G8R8_SNORM:
|
||||
return PixelFormat::A8B8G8R8_SNORM;
|
||||
case Tegra::RenderTargetFormat::A8B8G8R8_SINT:
|
||||
return PixelFormat::A8B8G8R8_SINT;
|
||||
case Tegra::RenderTargetFormat::A8B8G8R8_UINT:
|
||||
return PixelFormat::A8B8G8R8_UINT;
|
||||
case Tegra::RenderTargetFormat::R16G16_UNORM:
|
||||
return PixelFormat::R16G16_UNORM;
|
||||
case Tegra::RenderTargetFormat::R16G16_SNORM:
|
||||
return PixelFormat::R16G16_SNORM;
|
||||
case Tegra::RenderTargetFormat::R16G16_SINT:
|
||||
return PixelFormat::R16G16_SINT;
|
||||
case Tegra::RenderTargetFormat::R16G16_UINT:
|
||||
return PixelFormat::R16G16_UINT;
|
||||
case Tegra::RenderTargetFormat::R16G16_FLOAT:
|
||||
return PixelFormat::R16G16_FLOAT;
|
||||
case Tegra::RenderTargetFormat::B10G11R11_FLOAT:
|
||||
return PixelFormat::B10G11R11_FLOAT;
|
||||
case Tegra::RenderTargetFormat::R32_SINT:
|
||||
return PixelFormat::R32I;
|
||||
return PixelFormat::R32_SINT;
|
||||
case Tegra::RenderTargetFormat::R32_UINT:
|
||||
return PixelFormat::R32UI;
|
||||
case Tegra::RenderTargetFormat::RG32_UINT:
|
||||
return PixelFormat::RG32UI;
|
||||
case Tegra::RenderTargetFormat::RGBX16_FLOAT:
|
||||
return PixelFormat::RGBX16F;
|
||||
return PixelFormat::R32_UINT;
|
||||
case Tegra::RenderTargetFormat::R32_FLOAT:
|
||||
return PixelFormat::R32_FLOAT;
|
||||
case Tegra::RenderTargetFormat::R5G6B5_UNORM:
|
||||
return PixelFormat::R5G6B5_UNORM;
|
||||
case Tegra::RenderTargetFormat::A1R5G5B5_UNORM:
|
||||
return PixelFormat::A1R5G5B5_UNORM;
|
||||
case Tegra::RenderTargetFormat::R8G8_UNORM:
|
||||
return PixelFormat::R8G8_UNORM;
|
||||
case Tegra::RenderTargetFormat::R8G8_SNORM:
|
||||
return PixelFormat::R8G8_SNORM;
|
||||
case Tegra::RenderTargetFormat::R8G8_SINT:
|
||||
return PixelFormat::R8G8_SINT;
|
||||
case Tegra::RenderTargetFormat::R8G8_UINT:
|
||||
return PixelFormat::R8G8_UINT;
|
||||
case Tegra::RenderTargetFormat::R16_UNORM:
|
||||
return PixelFormat::R16_UNORM;
|
||||
case Tegra::RenderTargetFormat::R16_SNORM:
|
||||
return PixelFormat::R16_SNORM;
|
||||
case Tegra::RenderTargetFormat::R16_SINT:
|
||||
return PixelFormat::R16_SINT;
|
||||
case Tegra::RenderTargetFormat::R16_UINT:
|
||||
return PixelFormat::R16_UINT;
|
||||
case Tegra::RenderTargetFormat::R16_FLOAT:
|
||||
return PixelFormat::R16_FLOAT;
|
||||
case Tegra::RenderTargetFormat::R8_UNORM:
|
||||
return PixelFormat::R8_UNORM;
|
||||
case Tegra::RenderTargetFormat::R8_SNORM:
|
||||
return PixelFormat::R8_SNORM;
|
||||
case Tegra::RenderTargetFormat::R8_SINT:
|
||||
return PixelFormat::R8_SINT;
|
||||
case Tegra::RenderTargetFormat::R8_UINT:
|
||||
return PixelFormat::R8_UINT;
|
||||
default:
|
||||
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
||||
UNREACHABLE();
|
||||
return PixelFormat::RGBA8_SRGB;
|
||||
UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<int>(format));
|
||||
return PixelFormat::A8B8G8R8_UNORM;
|
||||
}
|
||||
}
|
||||
|
||||
PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat format) {
|
||||
switch (format) {
|
||||
case Tegra::FramebufferConfig::PixelFormat::ABGR8:
|
||||
return PixelFormat::ABGR8U;
|
||||
case Tegra::FramebufferConfig::PixelFormat::RGB565:
|
||||
return PixelFormat::B5G6R5U;
|
||||
case Tegra::FramebufferConfig::PixelFormat::BGRA8:
|
||||
return PixelFormat::BGRA8;
|
||||
case Tegra::FramebufferConfig::PixelFormat::A8B8G8R8_UNORM:
|
||||
return PixelFormat::A8B8G8R8_UNORM;
|
||||
case Tegra::FramebufferConfig::PixelFormat::RGB565_UNORM:
|
||||
return PixelFormat::R5G6B5_UNORM;
|
||||
case Tegra::FramebufferConfig::PixelFormat::B8G8R8A8_UNORM:
|
||||
return PixelFormat::B8G8R8A8_UNORM;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<u32>(format));
|
||||
return PixelFormat::ABGR8U;
|
||||
return PixelFormat::A8B8G8R8_UNORM;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,27 +226,27 @@ SurfaceType GetFormatType(PixelFormat pixel_format) {
|
||||
|
||||
bool IsPixelFormatASTC(PixelFormat format) {
|
||||
switch (format) {
|
||||
case PixelFormat::ASTC_2D_4X4:
|
||||
case PixelFormat::ASTC_2D_5X4:
|
||||
case PixelFormat::ASTC_2D_5X5:
|
||||
case PixelFormat::ASTC_2D_8X8:
|
||||
case PixelFormat::ASTC_2D_8X5:
|
||||
case PixelFormat::ASTC_2D_4X4_UNORM:
|
||||
case PixelFormat::ASTC_2D_5X4_UNORM:
|
||||
case PixelFormat::ASTC_2D_5X5_UNORM:
|
||||
case PixelFormat::ASTC_2D_8X8_UNORM:
|
||||
case PixelFormat::ASTC_2D_8X5_UNORM:
|
||||
case PixelFormat::ASTC_2D_4X4_SRGB:
|
||||
case PixelFormat::ASTC_2D_5X4_SRGB:
|
||||
case PixelFormat::ASTC_2D_5X5_SRGB:
|
||||
case PixelFormat::ASTC_2D_8X8_SRGB:
|
||||
case PixelFormat::ASTC_2D_8X5_SRGB:
|
||||
case PixelFormat::ASTC_2D_10X8:
|
||||
case PixelFormat::ASTC_2D_10X8_UNORM:
|
||||
case PixelFormat::ASTC_2D_10X8_SRGB:
|
||||
case PixelFormat::ASTC_2D_6X6:
|
||||
case PixelFormat::ASTC_2D_6X6_UNORM:
|
||||
case PixelFormat::ASTC_2D_6X6_SRGB:
|
||||
case PixelFormat::ASTC_2D_10X10:
|
||||
case PixelFormat::ASTC_2D_10X10_UNORM:
|
||||
case PixelFormat::ASTC_2D_10X10_SRGB:
|
||||
case PixelFormat::ASTC_2D_12X12:
|
||||
case PixelFormat::ASTC_2D_12X12_UNORM:
|
||||
case PixelFormat::ASTC_2D_12X12_SRGB:
|
||||
case PixelFormat::ASTC_2D_8X6:
|
||||
case PixelFormat::ASTC_2D_8X6_UNORM:
|
||||
case PixelFormat::ASTC_2D_8X6_SRGB:
|
||||
case PixelFormat::ASTC_2D_6X5:
|
||||
case PixelFormat::ASTC_2D_6X5_UNORM:
|
||||
case PixelFormat::ASTC_2D_6X5_SRGB:
|
||||
return true;
|
||||
default:
|
||||
@@ -242,12 +256,12 @@ bool IsPixelFormatASTC(PixelFormat format) {
|
||||
|
||||
bool IsPixelFormatSRGB(PixelFormat format) {
|
||||
switch (format) {
|
||||
case PixelFormat::RGBA8_SRGB:
|
||||
case PixelFormat::BGRA8_SRGB:
|
||||
case PixelFormat::DXT1_SRGB:
|
||||
case PixelFormat::DXT23_SRGB:
|
||||
case PixelFormat::DXT45_SRGB:
|
||||
case PixelFormat::BC7U_SRGB:
|
||||
case PixelFormat::A8B8G8R8_SRGB:
|
||||
case PixelFormat::B8G8R8A8_SRGB:
|
||||
case PixelFormat::BC1_RGBA_SRGB:
|
||||
case PixelFormat::BC2_SRGB:
|
||||
case PixelFormat::BC3_SRGB:
|
||||
case PixelFormat::BC7_SRGB:
|
||||
case PixelFormat::ASTC_2D_4X4_SRGB:
|
||||
case PixelFormat::ASTC_2D_8X8_SRGB:
|
||||
case PixelFormat::ASTC_2D_8X5_SRGB:
|
||||
@@ -269,25 +283,4 @@ std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) {
|
||||
return {GetDefaultBlockWidth(format), GetDefaultBlockHeight(format)};
|
||||
}
|
||||
|
||||
bool IsFormatBCn(PixelFormat format) {
|
||||
switch (format) {
|
||||
case PixelFormat::DXT1:
|
||||
case PixelFormat::DXT23:
|
||||
case PixelFormat::DXT45:
|
||||
case PixelFormat::DXN1:
|
||||
case PixelFormat::DXN2SNORM:
|
||||
case PixelFormat::DXN2UNORM:
|
||||
case PixelFormat::BC7U:
|
||||
case PixelFormat::BC6H_UF16:
|
||||
case PixelFormat::BC6H_SF16:
|
||||
case PixelFormat::DXT1_SRGB:
|
||||
case PixelFormat::DXT23_SRGB:
|
||||
case PixelFormat::DXT45_SRGB:
|
||||
case PixelFormat::BC7U_SRGB:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace VideoCore::Surface
|
||||
|
||||
+411
-359
@@ -15,94 +15,105 @@
|
||||
namespace VideoCore::Surface {
|
||||
|
||||
enum class PixelFormat {
|
||||
ABGR8U = 0,
|
||||
ABGR8S = 1,
|
||||
ABGR8UI = 2,
|
||||
B5G6R5U = 3,
|
||||
A2B10G10R10U = 4,
|
||||
A1B5G5R5U = 5,
|
||||
R8U = 6,
|
||||
R8UI = 7,
|
||||
RGBA16F = 8,
|
||||
RGBA16U = 9,
|
||||
RGBA16S = 10,
|
||||
RGBA16UI = 11,
|
||||
R11FG11FB10F = 12,
|
||||
RGBA32UI = 13,
|
||||
DXT1 = 14,
|
||||
DXT23 = 15,
|
||||
DXT45 = 16,
|
||||
DXN1 = 17, // This is also known as BC4
|
||||
DXN2UNORM = 18,
|
||||
DXN2SNORM = 19,
|
||||
BC7U = 20,
|
||||
BC6H_UF16 = 21,
|
||||
BC6H_SF16 = 22,
|
||||
ASTC_2D_4X4 = 23,
|
||||
BGRA8 = 24,
|
||||
RGBA32F = 25,
|
||||
RG32F = 26,
|
||||
R32F = 27,
|
||||
R16F = 28,
|
||||
R16U = 29,
|
||||
R16S = 30,
|
||||
R16UI = 31,
|
||||
R16I = 32,
|
||||
RG16 = 33,
|
||||
RG16F = 34,
|
||||
RG16UI = 35,
|
||||
RG16I = 36,
|
||||
RG16S = 37,
|
||||
RGB32F = 38,
|
||||
RGBA8_SRGB = 39,
|
||||
RG8U = 40,
|
||||
RG8S = 41,
|
||||
RG8UI = 42,
|
||||
RG32UI = 43,
|
||||
RGBX16F = 44,
|
||||
R32UI = 45,
|
||||
R32I = 46,
|
||||
ASTC_2D_8X8 = 47,
|
||||
ASTC_2D_8X5 = 48,
|
||||
ASTC_2D_5X4 = 49,
|
||||
BGRA8_SRGB = 50,
|
||||
DXT1_SRGB = 51,
|
||||
DXT23_SRGB = 52,
|
||||
DXT45_SRGB = 53,
|
||||
BC7U_SRGB = 54,
|
||||
R4G4B4A4U = 55,
|
||||
ASTC_2D_4X4_SRGB = 56,
|
||||
ASTC_2D_8X8_SRGB = 57,
|
||||
ASTC_2D_8X5_SRGB = 58,
|
||||
ASTC_2D_5X4_SRGB = 59,
|
||||
ASTC_2D_5X5 = 60,
|
||||
ASTC_2D_5X5_SRGB = 61,
|
||||
ASTC_2D_10X8 = 62,
|
||||
ASTC_2D_10X8_SRGB = 63,
|
||||
ASTC_2D_6X6 = 64,
|
||||
ASTC_2D_6X6_SRGB = 65,
|
||||
ASTC_2D_10X10 = 66,
|
||||
ASTC_2D_10X10_SRGB = 67,
|
||||
ASTC_2D_12X12 = 68,
|
||||
ASTC_2D_12X12_SRGB = 69,
|
||||
ASTC_2D_8X6 = 70,
|
||||
ASTC_2D_8X6_SRGB = 71,
|
||||
ASTC_2D_6X5 = 72,
|
||||
ASTC_2D_6X5_SRGB = 73,
|
||||
E5B9G9R9F = 74,
|
||||
A8B8G8R8_UNORM,
|
||||
A8B8G8R8_SNORM,
|
||||
A8B8G8R8_SINT,
|
||||
A8B8G8R8_UINT,
|
||||
R5G6B5_UNORM,
|
||||
B5G6R5_UNORM,
|
||||
A1R5G5B5_UNORM,
|
||||
A2B10G10R10_UNORM,
|
||||
A2B10G10R10_UINT,
|
||||
A1B5G5R5_UNORM,
|
||||
R8_UNORM,
|
||||
R8_SNORM,
|
||||
R8_SINT,
|
||||
R8_UINT,
|
||||
R16G16B16A16_FLOAT,
|
||||
R16G16B16A16_UNORM,
|
||||
R16G16B16A16_SNORM,
|
||||
R16G16B16A16_SINT,
|
||||
R16G16B16A16_UINT,
|
||||
B10G11R11_FLOAT,
|
||||
R32G32B32A32_UINT,
|
||||
BC1_RGBA_UNORM,
|
||||
BC2_UNORM,
|
||||
BC3_UNORM,
|
||||
BC4_UNORM,
|
||||
BC4_SNORM,
|
||||
BC5_UNORM,
|
||||
BC5_SNORM,
|
||||
BC7_UNORM,
|
||||
BC6H_UFLOAT,
|
||||
BC6H_SFLOAT,
|
||||
ASTC_2D_4X4_UNORM,
|
||||
B8G8R8A8_UNORM,
|
||||
R32G32B32A32_FLOAT,
|
||||
R32G32B32A32_SINT,
|
||||
R32G32_FLOAT,
|
||||
R32G32_SINT,
|
||||
R32_FLOAT,
|
||||
R16_FLOAT,
|
||||
R16_UNORM,
|
||||
R16_SNORM,
|
||||
R16_UINT,
|
||||
R16_SINT,
|
||||
R16G16_UNORM,
|
||||
R16G16_FLOAT,
|
||||
R16G16_UINT,
|
||||
R16G16_SINT,
|
||||
R16G16_SNORM,
|
||||
R32G32B32_FLOAT,
|
||||
A8B8G8R8_SRGB,
|
||||
R8G8_UNORM,
|
||||
R8G8_SNORM,
|
||||
R8G8_SINT,
|
||||
R8G8_UINT,
|
||||
R32G32_UINT,
|
||||
R16G16B16X16_FLOAT,
|
||||
R32_UINT,
|
||||
R32_SINT,
|
||||
ASTC_2D_8X8_UNORM,
|
||||
ASTC_2D_8X5_UNORM,
|
||||
ASTC_2D_5X4_UNORM,
|
||||
B8G8R8A8_SRGB,
|
||||
BC1_RGBA_SRGB,
|
||||
BC2_SRGB,
|
||||
BC3_SRGB,
|
||||
BC7_SRGB,
|
||||
A4B4G4R4_UNORM,
|
||||
ASTC_2D_4X4_SRGB,
|
||||
ASTC_2D_8X8_SRGB,
|
||||
ASTC_2D_8X5_SRGB,
|
||||
ASTC_2D_5X4_SRGB,
|
||||
ASTC_2D_5X5_UNORM,
|
||||
ASTC_2D_5X5_SRGB,
|
||||
ASTC_2D_10X8_UNORM,
|
||||
ASTC_2D_10X8_SRGB,
|
||||
ASTC_2D_6X6_UNORM,
|
||||
ASTC_2D_6X6_SRGB,
|
||||
ASTC_2D_10X10_UNORM,
|
||||
ASTC_2D_10X10_SRGB,
|
||||
ASTC_2D_12X12_UNORM,
|
||||
ASTC_2D_12X12_SRGB,
|
||||
ASTC_2D_8X6_UNORM,
|
||||
ASTC_2D_8X6_SRGB,
|
||||
ASTC_2D_6X5_UNORM,
|
||||
ASTC_2D_6X5_SRGB,
|
||||
E5B9G9R9_FLOAT,
|
||||
|
||||
MaxColorFormat,
|
||||
|
||||
// Depth formats
|
||||
Z32F = 75,
|
||||
Z16 = 76,
|
||||
D32_FLOAT = MaxColorFormat,
|
||||
D16_UNORM,
|
||||
|
||||
MaxDepthFormat,
|
||||
|
||||
// DepthStencil formats
|
||||
Z24S8 = 77,
|
||||
S8Z24 = 78,
|
||||
Z32FS8 = 79,
|
||||
D24_UNORM_S8_UINT = MaxDepthFormat,
|
||||
S8_UINT_D24_UNORM,
|
||||
D32_FLOAT_S8_UINT,
|
||||
|
||||
MaxDepthStencilFormat,
|
||||
|
||||
@@ -130,86 +141,97 @@ enum class SurfaceTarget {
|
||||
};
|
||||
|
||||
constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{
|
||||
0, // ABGR8U
|
||||
0, // ABGR8S
|
||||
0, // ABGR8UI
|
||||
0, // B5G6R5U
|
||||
0, // A2B10G10R10U
|
||||
0, // A1B5G5R5U
|
||||
0, // R8U
|
||||
0, // R8UI
|
||||
0, // RGBA16F
|
||||
0, // RGBA16U
|
||||
0, // RGBA16S
|
||||
0, // RGBA16UI
|
||||
0, // R11FG11FB10F
|
||||
0, // RGBA32UI
|
||||
2, // DXT1
|
||||
2, // DXT23
|
||||
2, // DXT45
|
||||
2, // DXN1
|
||||
2, // DXN2UNORM
|
||||
2, // DXN2SNORM
|
||||
2, // BC7U
|
||||
2, // BC6H_UF16
|
||||
2, // BC6H_SF16
|
||||
2, // ASTC_2D_4X4
|
||||
0, // BGRA8
|
||||
0, // RGBA32F
|
||||
0, // RG32F
|
||||
0, // R32F
|
||||
0, // R16F
|
||||
0, // R16U
|
||||
0, // R16S
|
||||
0, // R16UI
|
||||
0, // R16I
|
||||
0, // RG16
|
||||
0, // RG16F
|
||||
0, // RG16UI
|
||||
0, // RG16I
|
||||
0, // RG16S
|
||||
0, // RGB32F
|
||||
0, // RGBA8_SRGB
|
||||
0, // RG8U
|
||||
0, // RG8S
|
||||
0, // RG8UI
|
||||
0, // RG32UI
|
||||
0, // RGBX16F
|
||||
0, // R32UI
|
||||
0, // R32I
|
||||
2, // ASTC_2D_8X8
|
||||
2, // ASTC_2D_8X5
|
||||
2, // ASTC_2D_5X4
|
||||
0, // BGRA8_SRGB
|
||||
2, // DXT1_SRGB
|
||||
2, // DXT23_SRGB
|
||||
2, // DXT45_SRGB
|
||||
2, // BC7U_SRGB
|
||||
0, // R4G4B4A4U
|
||||
0, // A8B8G8R8_UNORM
|
||||
0, // A8B8G8R8_SNORM
|
||||
0, // A8B8G8R8_SINT
|
||||
0, // A8B8G8R8_UINT
|
||||
0, // R5G6B5_UNORM
|
||||
0, // B5G6R5_UNORM
|
||||
0, // A1R5G5B5_UNORM
|
||||
0, // A2B10G10R10_UNORM
|
||||
0, // A2B10G10R10_UINT
|
||||
0, // A1B5G5R5_UNORM
|
||||
0, // R8_UNORM
|
||||
0, // R8_SNORM
|
||||
0, // R8_SINT
|
||||
0, // R8_UINT
|
||||
0, // R16G16B16A16_FLOAT
|
||||
0, // R16G16B16A16_UNORM
|
||||
0, // R16G16B16A16_SNORM
|
||||
0, // R16G16B16A16_SINT
|
||||
0, // R16G16B16A16_UINT
|
||||
0, // B10G11R11_FLOAT
|
||||
0, // R32G32B32A32_UINT
|
||||
2, // BC1_RGBA_UNORM
|
||||
2, // BC2_UNORM
|
||||
2, // BC3_UNORM
|
||||
2, // BC4_UNORM
|
||||
2, // BC4_SNORM
|
||||
2, // BC5_UNORM
|
||||
2, // BC5_SNORM
|
||||
2, // BC7_UNORM
|
||||
2, // BC6H_UFLOAT
|
||||
2, // BC6H_SFLOAT
|
||||
2, // ASTC_2D_4X4_UNORM
|
||||
0, // B8G8R8A8_UNORM
|
||||
0, // R32G32B32A32_FLOAT
|
||||
0, // R32G32B32A32_SINT
|
||||
0, // R32G32_FLOAT
|
||||
0, // R32G32_SINT
|
||||
0, // R32_FLOAT
|
||||
0, // R16_FLOAT
|
||||
0, // R16_UNORM
|
||||
0, // R16_SNORM
|
||||
0, // R16_UINT
|
||||
0, // R16_SINT
|
||||
0, // R16G16_UNORM
|
||||
0, // R16G16_FLOAT
|
||||
0, // R16G16_UINT
|
||||
0, // R16G16_SINT
|
||||
0, // R16G16_SNORM
|
||||
0, // R32G32B32_FLOAT
|
||||
0, // A8B8G8R8_SRGB
|
||||
0, // R8G8_UNORM
|
||||
0, // R8G8_SNORM
|
||||
0, // R8G8_SINT
|
||||
0, // R8G8_UINT
|
||||
0, // R32G32_UINT
|
||||
0, // R16G16B16X16_FLOAT
|
||||
0, // R32_UINT
|
||||
0, // R32_SINT
|
||||
2, // ASTC_2D_8X8_UNORM
|
||||
2, // ASTC_2D_8X5_UNORM
|
||||
2, // ASTC_2D_5X4_UNORM
|
||||
0, // B8G8R8A8_SRGB
|
||||
2, // BC1_RGBA_SRGB
|
||||
2, // BC2_SRGB
|
||||
2, // BC3_SRGB
|
||||
2, // BC7_SRGB
|
||||
0, // A4B4G4R4_UNORM
|
||||
2, // ASTC_2D_4X4_SRGB
|
||||
2, // ASTC_2D_8X8_SRGB
|
||||
2, // ASTC_2D_8X5_SRGB
|
||||
2, // ASTC_2D_5X4_SRGB
|
||||
2, // ASTC_2D_5X5
|
||||
2, // ASTC_2D_5X5_UNORM
|
||||
2, // ASTC_2D_5X5_SRGB
|
||||
2, // ASTC_2D_10X8
|
||||
2, // ASTC_2D_10X8_UNORM
|
||||
2, // ASTC_2D_10X8_SRGB
|
||||
2, // ASTC_2D_6X6
|
||||
2, // ASTC_2D_6X6_UNORM
|
||||
2, // ASTC_2D_6X6_SRGB
|
||||
2, // ASTC_2D_10X10
|
||||
2, // ASTC_2D_10X10_UNORM
|
||||
2, // ASTC_2D_10X10_SRGB
|
||||
2, // ASTC_2D_12X12
|
||||
2, // ASTC_2D_12X12_UNORM
|
||||
2, // ASTC_2D_12X12_SRGB
|
||||
2, // ASTC_2D_8X6
|
||||
2, // ASTC_2D_8X6_UNORM
|
||||
2, // ASTC_2D_8X6_SRGB
|
||||
2, // ASTC_2D_6X5
|
||||
2, // ASTC_2D_6X5_UNORM
|
||||
2, // ASTC_2D_6X5_SRGB
|
||||
0, // E5B9G9R9F
|
||||
0, // Z32F
|
||||
0, // Z16
|
||||
0, // Z24S8
|
||||
0, // S8Z24
|
||||
0, // Z32FS8
|
||||
0, // E5B9G9R9_FLOAT
|
||||
0, // D32_FLOAT
|
||||
0, // D16_UNORM
|
||||
0, // D24_UNORM_S8_UINT
|
||||
0, // S8_UINT_D24_UNORM
|
||||
0, // D32_FLOAT_S8_UINT
|
||||
}};
|
||||
|
||||
/**
|
||||
@@ -229,86 +251,97 @@ inline constexpr u32 GetCompressionFactor(PixelFormat format) {
|
||||
}
|
||||
|
||||
constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
|
||||
1, // ABGR8U
|
||||
1, // ABGR8S
|
||||
1, // ABGR8UI
|
||||
1, // B5G6R5U
|
||||
1, // A2B10G10R10U
|
||||
1, // A1B5G5R5U
|
||||
1, // R8U
|
||||
1, // R8UI
|
||||
1, // RGBA16F
|
||||
1, // RGBA16U
|
||||
1, // RGBA16S
|
||||
1, // RGBA16UI
|
||||
1, // R11FG11FB10F
|
||||
1, // RGBA32UI
|
||||
4, // DXT1
|
||||
4, // DXT23
|
||||
4, // DXT45
|
||||
4, // DXN1
|
||||
4, // DXN2UNORM
|
||||
4, // DXN2SNORM
|
||||
4, // BC7U
|
||||
4, // BC6H_UF16
|
||||
4, // BC6H_SF16
|
||||
4, // ASTC_2D_4X4
|
||||
1, // BGRA8
|
||||
1, // RGBA32F
|
||||
1, // RG32F
|
||||
1, // R32F
|
||||
1, // R16F
|
||||
1, // R16U
|
||||
1, // R16S
|
||||
1, // R16UI
|
||||
1, // R16I
|
||||
1, // RG16
|
||||
1, // RG16F
|
||||
1, // RG16UI
|
||||
1, // RG16I
|
||||
1, // RG16S
|
||||
1, // RGB32F
|
||||
1, // RGBA8_SRGB
|
||||
1, // RG8U
|
||||
1, // RG8S
|
||||
1, // RG8UI
|
||||
1, // RG32UI
|
||||
1, // RGBX16F
|
||||
1, // R32UI
|
||||
1, // R32I
|
||||
8, // ASTC_2D_8X8
|
||||
8, // ASTC_2D_8X5
|
||||
5, // ASTC_2D_5X4
|
||||
1, // BGRA8_SRGB
|
||||
4, // DXT1_SRGB
|
||||
4, // DXT23_SRGB
|
||||
4, // DXT45_SRGB
|
||||
4, // BC7U_SRGB
|
||||
1, // R4G4B4A4U
|
||||
1, // A8B8G8R8_UNORM
|
||||
1, // A8B8G8R8_SNORM
|
||||
1, // A8B8G8R8_SINT
|
||||
1, // A8B8G8R8_UINT
|
||||
1, // R5G6B5_UNORM
|
||||
1, // B5G6R5_UNORM
|
||||
1, // A1R5G5B5_UNORM
|
||||
1, // A2B10G10R10_UNORM
|
||||
1, // A2B10G10R10_UINT
|
||||
1, // A1B5G5R5_UNORM
|
||||
1, // R8_UNORM
|
||||
1, // R8_SNORM
|
||||
1, // R8_SINT
|
||||
1, // R8_UINT
|
||||
1, // R16G16B16A16_FLOAT
|
||||
1, // R16G16B16A16_UNORM
|
||||
1, // R16G16B16A16_SNORM
|
||||
1, // R16G16B16A16_SINT
|
||||
1, // R16G16B16A16_UINT
|
||||
1, // B10G11R11_FLOAT
|
||||
1, // R32G32B32A32_UINT
|
||||
4, // BC1_RGBA_UNORM
|
||||
4, // BC2_UNORM
|
||||
4, // BC3_UNORM
|
||||
4, // BC4_UNORM
|
||||
4, // BC4_SNORM
|
||||
4, // BC5_UNORM
|
||||
4, // BC5_SNORM
|
||||
4, // BC7_UNORM
|
||||
4, // BC6H_UFLOAT
|
||||
4, // BC6H_SFLOAT
|
||||
4, // ASTC_2D_4X4_UNORM
|
||||
1, // B8G8R8A8_UNORM
|
||||
1, // R32G32B32A32_FLOAT
|
||||
1, // R32G32B32A32_SINT
|
||||
1, // R32G32_FLOAT
|
||||
1, // R32G32_SINT
|
||||
1, // R32_FLOAT
|
||||
1, // R16_FLOAT
|
||||
1, // R16_UNORM
|
||||
1, // R16_SNORM
|
||||
1, // R16_UINT
|
||||
1, // R16_SINT
|
||||
1, // R16G16_UNORM
|
||||
1, // R16G16_FLOAT
|
||||
1, // R16G16_UINT
|
||||
1, // R16G16_SINT
|
||||
1, // R16G16_SNORM
|
||||
1, // R32G32B32_FLOAT
|
||||
1, // A8B8G8R8_SRGB
|
||||
1, // R8G8_UNORM
|
||||
1, // R8G8_SNORM
|
||||
1, // R8G8_SINT
|
||||
1, // R8G8_UINT
|
||||
1, // R32G32_UINT
|
||||
1, // R16G16B16X16_FLOAT
|
||||
1, // R32_UINT
|
||||
1, // R32_SINT
|
||||
8, // ASTC_2D_8X8_UNORM
|
||||
8, // ASTC_2D_8X5_UNORM
|
||||
5, // ASTC_2D_5X4_UNORM
|
||||
1, // B8G8R8A8_SRGB
|
||||
4, // BC1_RGBA_SRGB
|
||||
4, // BC2_SRGB
|
||||
4, // BC3_SRGB
|
||||
4, // BC7_SRGB
|
||||
1, // A4B4G4R4_UNORM
|
||||
4, // ASTC_2D_4X4_SRGB
|
||||
8, // ASTC_2D_8X8_SRGB
|
||||
8, // ASTC_2D_8X5_SRGB
|
||||
5, // ASTC_2D_5X4_SRGB
|
||||
5, // ASTC_2D_5X5
|
||||
5, // ASTC_2D_5X5_UNORM
|
||||
5, // ASTC_2D_5X5_SRGB
|
||||
10, // ASTC_2D_10X8
|
||||
10, // ASTC_2D_10X8_UNORM
|
||||
10, // ASTC_2D_10X8_SRGB
|
||||
6, // ASTC_2D_6X6
|
||||
6, // ASTC_2D_6X6_UNORM
|
||||
6, // ASTC_2D_6X6_SRGB
|
||||
10, // ASTC_2D_10X10
|
||||
10, // ASTC_2D_10X10_UNORM
|
||||
10, // ASTC_2D_10X10_SRGB
|
||||
12, // ASTC_2D_12X12
|
||||
12, // ASTC_2D_12X12_UNORM
|
||||
12, // ASTC_2D_12X12_SRGB
|
||||
8, // ASTC_2D_8X6
|
||||
8, // ASTC_2D_8X6_UNORM
|
||||
8, // ASTC_2D_8X6_SRGB
|
||||
6, // ASTC_2D_6X5
|
||||
6, // ASTC_2D_6X5_UNORM
|
||||
6, // ASTC_2D_6X5_SRGB
|
||||
1, // E5B9G9R9F
|
||||
1, // Z32F
|
||||
1, // Z16
|
||||
1, // Z24S8
|
||||
1, // S8Z24
|
||||
1, // Z32FS8
|
||||
1, // E5B9G9R9_FLOAT
|
||||
1, // D32_FLOAT
|
||||
1, // D16_UNORM
|
||||
1, // D24_UNORM_S8_UINT
|
||||
1, // S8_UINT_D24_UNORM
|
||||
1, // D32_FLOAT_S8_UINT
|
||||
}};
|
||||
|
||||
static constexpr u32 GetDefaultBlockWidth(PixelFormat format) {
|
||||
@@ -320,86 +353,97 @@ static constexpr u32 GetDefaultBlockWidth(PixelFormat format) {
|
||||
}
|
||||
|
||||
constexpr std::array<u32, MaxPixelFormat> block_height_table = {{
|
||||
1, // ABGR8U
|
||||
1, // ABGR8S
|
||||
1, // ABGR8UI
|
||||
1, // B5G6R5U
|
||||
1, // A2B10G10R10U
|
||||
1, // A1B5G5R5U
|
||||
1, // R8U
|
||||
1, // R8UI
|
||||
1, // RGBA16F
|
||||
1, // RGBA16U
|
||||
1, // RGBA16S
|
||||
1, // RGBA16UI
|
||||
1, // R11FG11FB10F
|
||||
1, // RGBA32UI
|
||||
4, // DXT1
|
||||
4, // DXT23
|
||||
4, // DXT45
|
||||
4, // DXN1
|
||||
4, // DXN2UNORM
|
||||
4, // DXN2SNORM
|
||||
4, // BC7U
|
||||
4, // BC6H_UF16
|
||||
4, // BC6H_SF16
|
||||
4, // ASTC_2D_4X4
|
||||
1, // BGRA8
|
||||
1, // RGBA32F
|
||||
1, // RG32F
|
||||
1, // R32F
|
||||
1, // R16F
|
||||
1, // R16U
|
||||
1, // R16S
|
||||
1, // R16UI
|
||||
1, // R16I
|
||||
1, // RG16
|
||||
1, // RG16F
|
||||
1, // RG16UI
|
||||
1, // RG16I
|
||||
1, // RG16S
|
||||
1, // RGB32F
|
||||
1, // RGBA8_SRGB
|
||||
1, // RG8U
|
||||
1, // RG8S
|
||||
1, // RG8UI
|
||||
1, // RG32UI
|
||||
1, // RGBX16F
|
||||
1, // R32UI
|
||||
1, // R32I
|
||||
8, // ASTC_2D_8X8
|
||||
5, // ASTC_2D_8X5
|
||||
4, // ASTC_2D_5X4
|
||||
1, // BGRA8_SRGB
|
||||
4, // DXT1_SRGB
|
||||
4, // DXT23_SRGB
|
||||
4, // DXT45_SRGB
|
||||
4, // BC7U_SRGB
|
||||
1, // R4G4B4A4U
|
||||
1, // A8B8G8R8_UNORM
|
||||
1, // A8B8G8R8_SNORM
|
||||
1, // A8B8G8R8_SINT
|
||||
1, // A8B8G8R8_UINT
|
||||
1, // R5G6B5_UNORM
|
||||
1, // B5G6R5_UNORM
|
||||
1, // A1R5G5B5_UNORM
|
||||
1, // A2B10G10R10_UNORM
|
||||
1, // A2B10G10R10_UINT
|
||||
1, // A1B5G5R5_UNORM
|
||||
1, // R8_UNORM
|
||||
1, // R8_SNORM
|
||||
1, // R8_SINT
|
||||
1, // R8_UINT
|
||||
1, // R16G16B16A16_FLOAT
|
||||
1, // R16G16B16A16_UNORM
|
||||
1, // R16G16B16A16_SNORM
|
||||
1, // R16G16B16A16_SINT
|
||||
1, // R16G16B16A16_UINT
|
||||
1, // B10G11R11_FLOAT
|
||||
1, // R32G32B32A32_UINT
|
||||
4, // BC1_RGBA_UNORM
|
||||
4, // BC2_UNORM
|
||||
4, // BC3_UNORM
|
||||
4, // BC4_UNORM
|
||||
4, // BC4_SNORM
|
||||
4, // BC5_UNORM
|
||||
4, // BC5_SNORM
|
||||
4, // BC7_UNORM
|
||||
4, // BC6H_UFLOAT
|
||||
4, // BC6H_SFLOAT
|
||||
4, // ASTC_2D_4X4_UNORM
|
||||
1, // B8G8R8A8_UNORM
|
||||
1, // R32G32B32A32_FLOAT
|
||||
1, // R32G32B32A32_SINT
|
||||
1, // R32G32_FLOAT
|
||||
1, // R32G32_SINT
|
||||
1, // R32_FLOAT
|
||||
1, // R16_FLOAT
|
||||
1, // R16_UNORM
|
||||
1, // R16_SNORM
|
||||
1, // R16_UINT
|
||||
1, // R16_SINT
|
||||
1, // R16G16_UNORM
|
||||
1, // R16G16_FLOAT
|
||||
1, // R16G16_UINT
|
||||
1, // R16G16_SINT
|
||||
1, // R16G16_SNORM
|
||||
1, // R32G32B32_FLOAT
|
||||
1, // A8B8G8R8_SRGB
|
||||
1, // R8G8_UNORM
|
||||
1, // R8G8_SNORM
|
||||
1, // R8G8_SINT
|
||||
1, // R8G8_UINT
|
||||
1, // R32G32_UINT
|
||||
1, // R16G16B16X16_FLOAT
|
||||
1, // R32_UINT
|
||||
1, // R32_SINT
|
||||
8, // ASTC_2D_8X8_UNORM
|
||||
5, // ASTC_2D_8X5_UNORM
|
||||
4, // ASTC_2D_5X4_UNORM
|
||||
1, // B8G8R8A8_SRGB
|
||||
4, // BC1_RGBA_SRGB
|
||||
4, // BC2_SRGB
|
||||
4, // BC3_SRGB
|
||||
4, // BC7_SRGB
|
||||
1, // A4B4G4R4_UNORM
|
||||
4, // ASTC_2D_4X4_SRGB
|
||||
8, // ASTC_2D_8X8_SRGB
|
||||
5, // ASTC_2D_8X5_SRGB
|
||||
4, // ASTC_2D_5X4_SRGB
|
||||
5, // ASTC_2D_5X5
|
||||
5, // ASTC_2D_5X5_UNORM
|
||||
5, // ASTC_2D_5X5_SRGB
|
||||
8, // ASTC_2D_10X8
|
||||
8, // ASTC_2D_10X8_UNORM
|
||||
8, // ASTC_2D_10X8_SRGB
|
||||
6, // ASTC_2D_6X6
|
||||
6, // ASTC_2D_6X6_UNORM
|
||||
6, // ASTC_2D_6X6_SRGB
|
||||
10, // ASTC_2D_10X10
|
||||
10, // ASTC_2D_10X10_UNORM
|
||||
10, // ASTC_2D_10X10_SRGB
|
||||
12, // ASTC_2D_12X12
|
||||
12, // ASTC_2D_12X12_UNORM
|
||||
12, // ASTC_2D_12X12_SRGB
|
||||
6, // ASTC_2D_8X6
|
||||
6, // ASTC_2D_8X6_UNORM
|
||||
6, // ASTC_2D_8X6_SRGB
|
||||
5, // ASTC_2D_6X5
|
||||
5, // ASTC_2D_6X5_UNORM
|
||||
5, // ASTC_2D_6X5_SRGB
|
||||
1, // E5B9G9R9F
|
||||
1, // Z32F
|
||||
1, // Z16
|
||||
1, // Z24S8
|
||||
1, // S8Z24
|
||||
1, // Z32FS8
|
||||
1, // E5B9G9R9_FLOAT
|
||||
1, // D32_FLOAT
|
||||
1, // D16_UNORM
|
||||
1, // D24_UNORM_S8_UINT
|
||||
1, // S8_UINT_D24_UNORM
|
||||
1, // D32_FLOAT_S8_UINT
|
||||
}};
|
||||
|
||||
static constexpr u32 GetDefaultBlockHeight(PixelFormat format) {
|
||||
@@ -411,86 +455,97 @@ static constexpr u32 GetDefaultBlockHeight(PixelFormat format) {
|
||||
}
|
||||
|
||||
constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
|
||||
32, // ABGR8U
|
||||
32, // ABGR8S
|
||||
32, // ABGR8UI
|
||||
16, // B5G6R5U
|
||||
32, // A2B10G10R10U
|
||||
16, // A1B5G5R5U
|
||||
8, // R8U
|
||||
8, // R8UI
|
||||
64, // RGBA16F
|
||||
64, // RGBA16U
|
||||
64, // RGBA16S
|
||||
64, // RGBA16UI
|
||||
32, // R11FG11FB10F
|
||||
128, // RGBA32UI
|
||||
64, // DXT1
|
||||
128, // DXT23
|
||||
128, // DXT45
|
||||
64, // DXN1
|
||||
128, // DXN2UNORM
|
||||
128, // DXN2SNORM
|
||||
128, // BC7U
|
||||
128, // BC6H_UF16
|
||||
128, // BC6H_SF16
|
||||
128, // ASTC_2D_4X4
|
||||
32, // BGRA8
|
||||
128, // RGBA32F
|
||||
64, // RG32F
|
||||
32, // R32F
|
||||
16, // R16F
|
||||
16, // R16U
|
||||
16, // R16S
|
||||
16, // R16UI
|
||||
16, // R16I
|
||||
32, // RG16
|
||||
32, // RG16F
|
||||
32, // RG16UI
|
||||
32, // RG16I
|
||||
32, // RG16S
|
||||
96, // RGB32F
|
||||
32, // RGBA8_SRGB
|
||||
16, // RG8U
|
||||
16, // RG8S
|
||||
16, // RG8UI
|
||||
64, // RG32UI
|
||||
64, // RGBX16F
|
||||
32, // R32UI
|
||||
32, // R32I
|
||||
128, // ASTC_2D_8X8
|
||||
128, // ASTC_2D_8X5
|
||||
128, // ASTC_2D_5X4
|
||||
32, // BGRA8_SRGB
|
||||
64, // DXT1_SRGB
|
||||
128, // DXT23_SRGB
|
||||
128, // DXT45_SRGB
|
||||
128, // BC7U
|
||||
16, // R4G4B4A4U
|
||||
32, // A8B8G8R8_UNORM
|
||||
32, // A8B8G8R8_SNORM
|
||||
32, // A8B8G8R8_SINT
|
||||
32, // A8B8G8R8_UINT
|
||||
16, // R5G6B5_UNORM
|
||||
16, // B5G6R5_UNORM
|
||||
16, // A1R5G5B5_UNORM
|
||||
32, // A2B10G10R10_UNORM
|
||||
32, // A2B10G10R10_UINT
|
||||
16, // A1B5G5R5_UNORM
|
||||
8, // R8_UNORM
|
||||
8, // R8_SNORM
|
||||
8, // R8_SINT
|
||||
8, // R8_UINT
|
||||
64, // R16G16B16A16_FLOAT
|
||||
64, // R16G16B16A16_UNORM
|
||||
64, // R16G16B16A16_SNORM
|
||||
64, // R16G16B16A16_SINT
|
||||
64, // R16G16B16A16_UINT
|
||||
32, // B10G11R11_FLOAT
|
||||
128, // R32G32B32A32_UINT
|
||||
64, // BC1_RGBA_UNORM
|
||||
128, // BC2_UNORM
|
||||
128, // BC3_UNORM
|
||||
64, // BC4_UNORM
|
||||
64, // BC4_SNORM
|
||||
128, // BC5_UNORM
|
||||
128, // BC5_SNORM
|
||||
128, // BC7_UNORM
|
||||
128, // BC6H_UFLOAT
|
||||
128, // BC6H_SFLOAT
|
||||
128, // ASTC_2D_4X4_UNORM
|
||||
32, // B8G8R8A8_UNORM
|
||||
128, // R32G32B32A32_FLOAT
|
||||
128, // R32G32B32A32_SINT
|
||||
64, // R32G32_FLOAT
|
||||
64, // R32G32_SINT
|
||||
32, // R32_FLOAT
|
||||
16, // R16_FLOAT
|
||||
16, // R16_UNORM
|
||||
16, // R16_SNORM
|
||||
16, // R16_UINT
|
||||
16, // R16_SINT
|
||||
32, // R16G16_UNORM
|
||||
32, // R16G16_FLOAT
|
||||
32, // R16G16_UINT
|
||||
32, // R16G16_SINT
|
||||
32, // R16G16_SNORM
|
||||
96, // R32G32B32_FLOAT
|
||||
32, // A8B8G8R8_SRGB
|
||||
16, // R8G8_UNORM
|
||||
16, // R8G8_SNORM
|
||||
16, // R8G8_SINT
|
||||
16, // R8G8_UINT
|
||||
64, // R32G32_UINT
|
||||
64, // R16G16B16X16_FLOAT
|
||||
32, // R32_UINT
|
||||
32, // R32_SINT
|
||||
128, // ASTC_2D_8X8_UNORM
|
||||
128, // ASTC_2D_8X5_UNORM
|
||||
128, // ASTC_2D_5X4_UNORM
|
||||
32, // B8G8R8A8_SRGB
|
||||
64, // BC1_RGBA_SRGB
|
||||
128, // BC2_SRGB
|
||||
128, // BC3_SRGB
|
||||
128, // BC7_UNORM
|
||||
16, // A4B4G4R4_UNORM
|
||||
128, // ASTC_2D_4X4_SRGB
|
||||
128, // ASTC_2D_8X8_SRGB
|
||||
128, // ASTC_2D_8X5_SRGB
|
||||
128, // ASTC_2D_5X4_SRGB
|
||||
128, // ASTC_2D_5X5
|
||||
128, // ASTC_2D_5X5_UNORM
|
||||
128, // ASTC_2D_5X5_SRGB
|
||||
128, // ASTC_2D_10X8
|
||||
128, // ASTC_2D_10X8_UNORM
|
||||
128, // ASTC_2D_10X8_SRGB
|
||||
128, // ASTC_2D_6X6
|
||||
128, // ASTC_2D_6X6_UNORM
|
||||
128, // ASTC_2D_6X6_SRGB
|
||||
128, // ASTC_2D_10X10
|
||||
128, // ASTC_2D_10X10_UNORM
|
||||
128, // ASTC_2D_10X10_SRGB
|
||||
128, // ASTC_2D_12X12
|
||||
128, // ASTC_2D_12X12_UNORM
|
||||
128, // ASTC_2D_12X12_SRGB
|
||||
128, // ASTC_2D_8X6
|
||||
128, // ASTC_2D_8X6_UNORM
|
||||
128, // ASTC_2D_8X6_SRGB
|
||||
128, // ASTC_2D_6X5
|
||||
128, // ASTC_2D_6X5_UNORM
|
||||
128, // ASTC_2D_6X5_SRGB
|
||||
32, // E5B9G9R9F
|
||||
32, // Z32F
|
||||
16, // Z16
|
||||
32, // Z24S8
|
||||
32, // S8Z24
|
||||
64, // Z32FS8
|
||||
32, // E5B9G9R9_FLOAT
|
||||
32, // D32_FLOAT
|
||||
16, // D16_UNORM
|
||||
32, // D24_UNORM_S8_UINT
|
||||
32, // S8_UINT_D24_UNORM
|
||||
64, // D32_FLOAT_S8_UINT
|
||||
}};
|
||||
|
||||
static constexpr u32 GetFormatBpp(PixelFormat format) {
|
||||
@@ -529,7 +584,4 @@ bool IsPixelFormatSRGB(PixelFormat format);
|
||||
|
||||
std::pair<u32, u32> GetASTCBlockSize(PixelFormat format);
|
||||
|
||||
/// Returns true if the specified PixelFormat is a BCn format, e.g. DXT or DXN
|
||||
bool IsFormatBCn(PixelFormat format);
|
||||
|
||||
} // namespace VideoCore::Surface
|
||||
|
||||
@@ -41,119 +41,126 @@ struct Table {
|
||||
ComponentType alpha_component;
|
||||
bool is_srgb;
|
||||
};
|
||||
constexpr std::array<Table, 78> DefinitionTable = {{
|
||||
{TextureFormat::A8R8G8B8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ABGR8U},
|
||||
{TextureFormat::A8R8G8B8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::ABGR8S},
|
||||
{TextureFormat::A8R8G8B8, C, UINT, UINT, UINT, UINT, PixelFormat::ABGR8UI},
|
||||
{TextureFormat::A8R8G8B8, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::RGBA8_SRGB},
|
||||
constexpr std::array<Table, 86> DefinitionTable = {{
|
||||
{TextureFormat::A8R8G8B8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::A8B8G8R8_UNORM},
|
||||
{TextureFormat::A8R8G8B8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::A8B8G8R8_SNORM},
|
||||
{TextureFormat::A8R8G8B8, C, UINT, UINT, UINT, UINT, PixelFormat::A8B8G8R8_UINT},
|
||||
{TextureFormat::A8R8G8B8, C, SINT, SINT, SINT, SINT, PixelFormat::A8B8G8R8_SINT},
|
||||
{TextureFormat::A8R8G8B8, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::A8B8G8R8_SRGB},
|
||||
|
||||
{TextureFormat::B5G6R5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::B5G6R5U},
|
||||
{TextureFormat::B5G6R5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::B5G6R5_UNORM},
|
||||
|
||||
{TextureFormat::A2B10G10R10, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::A2B10G10R10U},
|
||||
{TextureFormat::A2B10G10R10, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::A2B10G10R10_UNORM},
|
||||
{TextureFormat::A2B10G10R10, C, UINT, UINT, UINT, UINT, PixelFormat::A2B10G10R10_UINT},
|
||||
|
||||
{TextureFormat::A1B5G5R5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::A1B5G5R5U},
|
||||
{TextureFormat::A1B5G5R5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::A1B5G5R5_UNORM},
|
||||
|
||||
{TextureFormat::A4B4G4R4, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R4G4B4A4U},
|
||||
{TextureFormat::A4B4G4R4, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::A4B4G4R4_UNORM},
|
||||
|
||||
{TextureFormat::R8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R8U},
|
||||
{TextureFormat::R8, C, UINT, UINT, UINT, UINT, PixelFormat::R8UI},
|
||||
{TextureFormat::R8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R8_UNORM},
|
||||
{TextureFormat::R8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::R8_SNORM},
|
||||
{TextureFormat::R8, C, UINT, UINT, UINT, UINT, PixelFormat::R8_UINT},
|
||||
{TextureFormat::R8, C, SINT, SINT, SINT, SINT, PixelFormat::R8_SINT},
|
||||
|
||||
{TextureFormat::G8R8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RG8U},
|
||||
{TextureFormat::G8R8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RG8S},
|
||||
{TextureFormat::G8R8, C, UINT, UINT, UINT, UINT, PixelFormat::RG8UI},
|
||||
{TextureFormat::R8G8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R8G8_UNORM},
|
||||
{TextureFormat::R8G8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::R8G8_SNORM},
|
||||
{TextureFormat::R8G8, C, UINT, UINT, UINT, UINT, PixelFormat::R8G8_UINT},
|
||||
{TextureFormat::R8G8, C, SINT, SINT, SINT, SINT, PixelFormat::R8G8_SINT},
|
||||
|
||||
{TextureFormat::R16_G16_B16_A16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RGBA16S},
|
||||
{TextureFormat::R16_G16_B16_A16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RGBA16U},
|
||||
{TextureFormat::R16_G16_B16_A16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::RGBA16F},
|
||||
{TextureFormat::R16_G16_B16_A16, C, UINT, UINT, UINT, UINT, PixelFormat::RGBA16UI},
|
||||
{TextureFormat::R16G16B16A16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::R16G16B16A16_SNORM},
|
||||
{TextureFormat::R16G16B16A16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R16G16B16A16_UNORM},
|
||||
{TextureFormat::R16G16B16A16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R16G16B16A16_FLOAT},
|
||||
{TextureFormat::R16G16B16A16, C, UINT, UINT, UINT, UINT, PixelFormat::R16G16B16A16_UINT},
|
||||
{TextureFormat::R16G16B16A16, C, SINT, SINT, SINT, SINT, PixelFormat::R16G16B16A16_SINT},
|
||||
|
||||
{TextureFormat::R16_G16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::RG16F},
|
||||
{TextureFormat::R16_G16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RG16},
|
||||
{TextureFormat::R16_G16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RG16S},
|
||||
{TextureFormat::R16_G16, C, UINT, UINT, UINT, UINT, PixelFormat::RG16UI},
|
||||
{TextureFormat::R16_G16, C, SINT, SINT, SINT, SINT, PixelFormat::RG16I},
|
||||
{TextureFormat::R16G16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R16G16_FLOAT},
|
||||
{TextureFormat::R16G16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R16G16_UNORM},
|
||||
{TextureFormat::R16G16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::R16G16_SNORM},
|
||||
{TextureFormat::R16G16, C, UINT, UINT, UINT, UINT, PixelFormat::R16G16_UINT},
|
||||
{TextureFormat::R16G16, C, SINT, SINT, SINT, SINT, PixelFormat::R16G16_SINT},
|
||||
|
||||
{TextureFormat::R16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R16F},
|
||||
{TextureFormat::R16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R16U},
|
||||
{TextureFormat::R16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::R16S},
|
||||
{TextureFormat::R16, C, UINT, UINT, UINT, UINT, PixelFormat::R16UI},
|
||||
{TextureFormat::R16, C, SINT, SINT, SINT, SINT, PixelFormat::R16I},
|
||||
{TextureFormat::R16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R16_FLOAT},
|
||||
{TextureFormat::R16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::R16_UNORM},
|
||||
{TextureFormat::R16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::R16_SNORM},
|
||||
{TextureFormat::R16, C, UINT, UINT, UINT, UINT, PixelFormat::R16_UINT},
|
||||
{TextureFormat::R16, C, SINT, SINT, SINT, SINT, PixelFormat::R16_SINT},
|
||||
|
||||
{TextureFormat::BF10GF11RF11, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R11FG11FB10F},
|
||||
{TextureFormat::B10G11R11, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::B10G11R11_FLOAT},
|
||||
|
||||
{TextureFormat::R32_G32_B32_A32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::RGBA32F},
|
||||
{TextureFormat::R32_G32_B32_A32, C, UINT, UINT, UINT, UINT, PixelFormat::RGBA32UI},
|
||||
{TextureFormat::R32G32B32A32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R32G32B32A32_FLOAT},
|
||||
{TextureFormat::R32G32B32A32, C, UINT, UINT, UINT, UINT, PixelFormat::R32G32B32A32_UINT},
|
||||
{TextureFormat::R32G32B32A32, C, SINT, SINT, SINT, SINT, PixelFormat::R32G32B32A32_SINT},
|
||||
|
||||
{TextureFormat::R32_G32_B32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::RGB32F},
|
||||
{TextureFormat::R32G32B32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R32G32B32_FLOAT},
|
||||
|
||||
{TextureFormat::R32_G32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::RG32F},
|
||||
{TextureFormat::R32_G32, C, UINT, UINT, UINT, UINT, PixelFormat::RG32UI},
|
||||
{TextureFormat::R32G32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R32G32_FLOAT},
|
||||
{TextureFormat::R32G32, C, UINT, UINT, UINT, UINT, PixelFormat::R32G32_UINT},
|
||||
{TextureFormat::R32G32, C, SINT, SINT, SINT, SINT, PixelFormat::R32G32_SINT},
|
||||
|
||||
{TextureFormat::R32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R32F},
|
||||
{TextureFormat::R32, C, UINT, UINT, UINT, UINT, PixelFormat::R32UI},
|
||||
{TextureFormat::R32, C, SINT, SINT, SINT, SINT, PixelFormat::R32I},
|
||||
{TextureFormat::R32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R32_FLOAT},
|
||||
{TextureFormat::R32, C, UINT, UINT, UINT, UINT, PixelFormat::R32_UINT},
|
||||
{TextureFormat::R32, C, SINT, SINT, SINT, SINT, PixelFormat::R32_SINT},
|
||||
|
||||
{TextureFormat::E5B9G9R9_SHAREDEXP, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::E5B9G9R9F},
|
||||
{TextureFormat::E5B9G9R9, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::E5B9G9R9_FLOAT},
|
||||
|
||||
{TextureFormat::ZF32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::Z32F},
|
||||
{TextureFormat::Z16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::Z16},
|
||||
{TextureFormat::S8Z24, C, UINT, UNORM, UNORM, UNORM, PixelFormat::S8Z24},
|
||||
{TextureFormat::G24R8, C, UINT, UNORM, UNORM, UNORM, PixelFormat::S8Z24},
|
||||
{TextureFormat::ZF32_X24S8, C, FLOAT, UINT, UNORM, UNORM, PixelFormat::Z32FS8},
|
||||
{TextureFormat::D32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::D32_FLOAT},
|
||||
{TextureFormat::D16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::D16_UNORM},
|
||||
{TextureFormat::S8D24, C, UINT, UNORM, UNORM, UNORM, PixelFormat::S8_UINT_D24_UNORM},
|
||||
{TextureFormat::R8G24, C, UINT, UNORM, UNORM, UNORM, PixelFormat::S8_UINT_D24_UNORM},
|
||||
{TextureFormat::D32S8, C, FLOAT, UINT, UNORM, UNORM, PixelFormat::D32_FLOAT_S8_UINT},
|
||||
|
||||
{TextureFormat::DXT1, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXT1},
|
||||
{TextureFormat::DXT1, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXT1_SRGB},
|
||||
{TextureFormat::BC1_RGBA, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC1_RGBA_UNORM},
|
||||
{TextureFormat::BC1_RGBA, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC1_RGBA_SRGB},
|
||||
|
||||
{TextureFormat::DXT23, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXT23},
|
||||
{TextureFormat::DXT23, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXT23_SRGB},
|
||||
{TextureFormat::BC2, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC2_UNORM},
|
||||
{TextureFormat::BC2, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC2_SRGB},
|
||||
|
||||
{TextureFormat::DXT45, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXT45},
|
||||
{TextureFormat::DXT45, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXT45_SRGB},
|
||||
{TextureFormat::BC3, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC3_UNORM},
|
||||
{TextureFormat::BC3, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC3_SRGB},
|
||||
|
||||
// TODO: Use a different pixel format for SNORM
|
||||
{TextureFormat::DXN1, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXN1},
|
||||
{TextureFormat::DXN1, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::DXN1},
|
||||
{TextureFormat::BC4, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC4_UNORM},
|
||||
{TextureFormat::BC4, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::BC4_SNORM},
|
||||
|
||||
{TextureFormat::DXN2, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::DXN2UNORM},
|
||||
{TextureFormat::DXN2, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::DXN2SNORM},
|
||||
{TextureFormat::BC5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC5_UNORM},
|
||||
{TextureFormat::BC5, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::BC5_SNORM},
|
||||
|
||||
{TextureFormat::BC7U, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC7U},
|
||||
{TextureFormat::BC7U, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC7U_SRGB},
|
||||
{TextureFormat::BC7, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC7_UNORM},
|
||||
{TextureFormat::BC7, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::BC7_SRGB},
|
||||
|
||||
{TextureFormat::BC6H_SF16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::BC6H_SF16},
|
||||
{TextureFormat::BC6H_UF16, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::BC6H_UF16},
|
||||
{TextureFormat::BC6H_SFLOAT, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::BC6H_SFLOAT},
|
||||
{TextureFormat::BC6H_UFLOAT, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::BC6H_UFLOAT},
|
||||
|
||||
{TextureFormat::ASTC_2D_4X4, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_4X4},
|
||||
{TextureFormat::ASTC_2D_4X4, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_4X4_UNORM},
|
||||
{TextureFormat::ASTC_2D_4X4, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_4X4_SRGB},
|
||||
|
||||
{TextureFormat::ASTC_2D_5X4, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_5X4},
|
||||
{TextureFormat::ASTC_2D_5X4, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_5X4_UNORM},
|
||||
{TextureFormat::ASTC_2D_5X4, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_5X4_SRGB},
|
||||
|
||||
{TextureFormat::ASTC_2D_5X5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_5X5},
|
||||
{TextureFormat::ASTC_2D_5X5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_5X5_UNORM},
|
||||
{TextureFormat::ASTC_2D_5X5, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_5X5_SRGB},
|
||||
|
||||
{TextureFormat::ASTC_2D_8X8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X8},
|
||||
{TextureFormat::ASTC_2D_8X8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X8_UNORM},
|
||||
{TextureFormat::ASTC_2D_8X8, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X8_SRGB},
|
||||
|
||||
{TextureFormat::ASTC_2D_8X5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X5},
|
||||
{TextureFormat::ASTC_2D_8X5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X5_UNORM},
|
||||
{TextureFormat::ASTC_2D_8X5, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X5_SRGB},
|
||||
|
||||
{TextureFormat::ASTC_2D_10X8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_10X8},
|
||||
{TextureFormat::ASTC_2D_10X8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_10X8_UNORM},
|
||||
{TextureFormat::ASTC_2D_10X8, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_10X8_SRGB},
|
||||
|
||||
{TextureFormat::ASTC_2D_6X6, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_6X6},
|
||||
{TextureFormat::ASTC_2D_6X6, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_6X6_UNORM},
|
||||
{TextureFormat::ASTC_2D_6X6, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_6X6_SRGB},
|
||||
|
||||
{TextureFormat::ASTC_2D_10X10, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_10X10},
|
||||
{TextureFormat::ASTC_2D_10X10, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_10X10_UNORM},
|
||||
{TextureFormat::ASTC_2D_10X10, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_10X10_SRGB},
|
||||
|
||||
{TextureFormat::ASTC_2D_12X12, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_12X12},
|
||||
{TextureFormat::ASTC_2D_12X12, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_12X12_UNORM},
|
||||
{TextureFormat::ASTC_2D_12X12, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_12X12_SRGB},
|
||||
|
||||
{TextureFormat::ASTC_2D_8X6, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X6},
|
||||
{TextureFormat::ASTC_2D_8X6, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X6_UNORM},
|
||||
{TextureFormat::ASTC_2D_8X6, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_8X6_SRGB},
|
||||
|
||||
{TextureFormat::ASTC_2D_6X5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_6X5},
|
||||
{TextureFormat::ASTC_2D_6X5, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_6X5_UNORM},
|
||||
{TextureFormat::ASTC_2D_6X5, S, UNORM, UNORM, UNORM, UNORM, PixelFormat::ASTC_2D_6X5_SRGB},
|
||||
}};
|
||||
|
||||
@@ -184,7 +191,7 @@ PixelFormat FormatLookupTable::GetPixelFormat(TextureFormat format, bool is_srgb
|
||||
static_cast<int>(format), is_srgb, static_cast<int>(red_component),
|
||||
static_cast<int>(green_component), static_cast<int>(blue_component),
|
||||
static_cast<int>(alpha_component));
|
||||
return PixelFormat::ABGR8U;
|
||||
return PixelFormat::A8B8G8R8_UNORM;
|
||||
}
|
||||
|
||||
void FormatLookupTable::Set(TextureFormat format, bool is_srgb, ComponentType red_component,
|
||||
|
||||
@@ -228,7 +228,7 @@ void SurfaceBaseImpl::LoadBuffer(Tegra::MemoryManager& memory_manager,
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_converted && params.pixel_format != PixelFormat::S8Z24) {
|
||||
if (!is_converted && params.pixel_format != PixelFormat::S8_UINT_D24_UNORM) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,12 +83,12 @@ SurfaceParams SurfaceParams::CreateForTexture(const FormatLookupTable& lookup_ta
|
||||
params.type = GetFormatType(params.pixel_format);
|
||||
if (entry.is_shadow && params.type == SurfaceType::ColorTexture) {
|
||||
switch (params.pixel_format) {
|
||||
case PixelFormat::R16U:
|
||||
case PixelFormat::R16F:
|
||||
params.pixel_format = PixelFormat::Z16;
|
||||
case PixelFormat::R16_UNORM:
|
||||
case PixelFormat::R16_FLOAT:
|
||||
params.pixel_format = PixelFormat::D16_UNORM;
|
||||
break;
|
||||
case PixelFormat::R32F:
|
||||
params.pixel_format = PixelFormat::Z32F;
|
||||
case PixelFormat::R32_FLOAT:
|
||||
params.pixel_format = PixelFormat::D32_FLOAT;
|
||||
break;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Unimplemented shadow convert format: {}",
|
||||
@@ -195,8 +195,8 @@ SurfaceParams SurfaceParams::CreateForFramebuffer(Core::System& system, std::siz
|
||||
SurfaceParams params;
|
||||
params.is_tiled =
|
||||
config.memory_layout.type == Tegra::Engines::Maxwell3D::Regs::InvMemoryLayout::BlockLinear;
|
||||
params.srgb_conversion = config.format == Tegra::RenderTargetFormat::BGRA8_SRGB ||
|
||||
config.format == Tegra::RenderTargetFormat::RGBA8_SRGB;
|
||||
params.srgb_conversion = config.format == Tegra::RenderTargetFormat::B8G8R8A8_SRGB ||
|
||||
config.format == Tegra::RenderTargetFormat::A8B8G8R8_SRGB;
|
||||
params.block_width = config.memory_layout.block_width;
|
||||
params.block_height = config.memory_layout.block_height;
|
||||
params.block_depth = config.memory_layout.block_depth;
|
||||
@@ -235,8 +235,8 @@ SurfaceParams SurfaceParams::CreateForFermiCopySurface(
|
||||
const Tegra::Engines::Fermi2D::Regs::Surface& config) {
|
||||
SurfaceParams params{};
|
||||
params.is_tiled = !config.linear;
|
||||
params.srgb_conversion = config.format == Tegra::RenderTargetFormat::BGRA8_SRGB ||
|
||||
config.format == Tegra::RenderTargetFormat::RGBA8_SRGB;
|
||||
params.srgb_conversion = config.format == Tegra::RenderTargetFormat::B8G8R8A8_SRGB ||
|
||||
config.format == Tegra::RenderTargetFormat::A8B8G8R8_SRGB;
|
||||
params.block_width = params.is_tiled ? std::min(config.BlockWidth(), 5U) : 0,
|
||||
params.block_height = params.is_tiled ? std::min(config.BlockHeight(), 5U) : 0,
|
||||
params.block_depth = params.is_tiled ? std::min(config.BlockDepth(), 5U) : 0,
|
||||
|
||||
@@ -373,9 +373,9 @@ protected:
|
||||
siblings_table[static_cast<std::size_t>(b)] = a;
|
||||
};
|
||||
std::fill(siblings_table.begin(), siblings_table.end(), PixelFormat::Invalid);
|
||||
make_siblings(PixelFormat::Z16, PixelFormat::R16U);
|
||||
make_siblings(PixelFormat::Z32F, PixelFormat::R32F);
|
||||
make_siblings(PixelFormat::Z32FS8, PixelFormat::RG32F);
|
||||
make_siblings(PixelFormat::D16_UNORM, PixelFormat::R16_UNORM);
|
||||
make_siblings(PixelFormat::D32_FLOAT, PixelFormat::R32_FLOAT);
|
||||
make_siblings(PixelFormat::D32_FLOAT_S8_UINT, PixelFormat::R32G32_FLOAT);
|
||||
|
||||
sampled_textures.reserve(64);
|
||||
}
|
||||
@@ -1031,7 +1031,7 @@ private:
|
||||
params.pitch = 4;
|
||||
params.num_levels = 1;
|
||||
params.emulated_levels = 1;
|
||||
params.pixel_format = VideoCore::Surface::PixelFormat::R8U;
|
||||
params.pixel_format = VideoCore::Surface::PixelFormat::R8_UNORM;
|
||||
params.type = VideoCore::Surface::SurfaceType::ColorTexture;
|
||||
auto surface = CreateSurface(0ULL, params);
|
||||
invalid_memory.resize(surface->GetHostSizeInBytes(), 0U);
|
||||
|
||||
@@ -35,7 +35,7 @@ void SwapS8Z24ToZ24S8(u8* data, u32 width, u32 height) {
|
||||
S8Z24 s8z24_pixel{};
|
||||
Z24S8 z24s8_pixel{};
|
||||
constexpr auto bpp{
|
||||
VideoCore::Surface::GetBytesPerPixel(VideoCore::Surface::PixelFormat::S8Z24)};
|
||||
VideoCore::Surface::GetBytesPerPixel(VideoCore::Surface::PixelFormat::S8_UINT_D24_UNORM)};
|
||||
for (std::size_t y = 0; y < height; ++y) {
|
||||
for (std::size_t x = 0; x < width; ++x) {
|
||||
const std::size_t offset{bpp * (y * width + x)};
|
||||
@@ -73,7 +73,7 @@ void ConvertFromGuestToHost(u8* in_data, u8* out_data, PixelFormat pixel_format,
|
||||
in_data, width, height, depth, block_width, block_height);
|
||||
std::copy(rgba8_data.begin(), rgba8_data.end(), out_data);
|
||||
|
||||
} else if (convert_s8z24 && pixel_format == PixelFormat::S8Z24) {
|
||||
} else if (convert_s8z24 && pixel_format == PixelFormat::S8_UINT_D24_UNORM) {
|
||||
Tegra::Texture::ConvertS8Z24ToZ24S8(in_data, width, height);
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ void ConvertFromHostToGuest(u8* data, PixelFormat pixel_format, u32 width, u32 h
|
||||
static_cast<u32>(pixel_format));
|
||||
UNREACHABLE();
|
||||
|
||||
} else if (convert_s8z24 && pixel_format == PixelFormat::S8Z24) {
|
||||
} else if (convert_s8z24 && pixel_format == PixelFormat::S8_UINT_D24_UNORM) {
|
||||
Tegra::Texture::ConvertZ24S8ToS8Z24(data, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,53 +193,6 @@ void CopySwizzledData(u32 width, u32 height, u32 depth, u32 bytes_per_pixel,
|
||||
}
|
||||
}
|
||||
|
||||
u32 BytesPerPixel(TextureFormat format) {
|
||||
switch (format) {
|
||||
case TextureFormat::DXT1:
|
||||
case TextureFormat::DXN1:
|
||||
// In this case a 'pixel' actually refers to a 4x4 tile.
|
||||
return 8;
|
||||
case TextureFormat::DXT23:
|
||||
case TextureFormat::DXT45:
|
||||
case TextureFormat::DXN2:
|
||||
case TextureFormat::BC7U:
|
||||
case TextureFormat::BC6H_UF16:
|
||||
case TextureFormat::BC6H_SF16:
|
||||
// In this case a 'pixel' actually refers to a 4x4 tile.
|
||||
return 16;
|
||||
case TextureFormat::R32_G32_B32:
|
||||
return 12;
|
||||
case TextureFormat::ASTC_2D_4X4:
|
||||
case TextureFormat::ASTC_2D_5X4:
|
||||
case TextureFormat::ASTC_2D_8X8:
|
||||
case TextureFormat::ASTC_2D_8X5:
|
||||
case TextureFormat::ASTC_2D_10X8:
|
||||
case TextureFormat::ASTC_2D_5X5:
|
||||
case TextureFormat::A8R8G8B8:
|
||||
case TextureFormat::A2B10G10R10:
|
||||
case TextureFormat::BF10GF11RF11:
|
||||
case TextureFormat::R32:
|
||||
case TextureFormat::R16_G16:
|
||||
return 4;
|
||||
case TextureFormat::A1B5G5R5:
|
||||
case TextureFormat::B5G6R5:
|
||||
case TextureFormat::G8R8:
|
||||
case TextureFormat::R16:
|
||||
return 2;
|
||||
case TextureFormat::R8:
|
||||
return 1;
|
||||
case TextureFormat::R16_G16_B16_A16:
|
||||
return 8;
|
||||
case TextureFormat::R32_G32_B32_A32:
|
||||
return 16;
|
||||
case TextureFormat::R32_G32:
|
||||
return 8;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Format not implemented");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void UnswizzleTexture(u8* const unswizzled_data, u8* address, u32 tile_size_x, u32 tile_size_y,
|
||||
u32 bytes_per_pixel, u32 width, u32 height, u32 depth, u32 block_height,
|
||||
u32 block_depth, u32 width_spacing) {
|
||||
@@ -328,48 +281,6 @@ void SwizzleKepler(const u32 width, const u32 height, const u32 dst_x, const u32
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat format, u32 width,
|
||||
u32 height) {
|
||||
std::vector<u8> rgba_data;
|
||||
|
||||
// TODO(Subv): Implement.
|
||||
switch (format) {
|
||||
case TextureFormat::DXT1:
|
||||
case TextureFormat::DXT23:
|
||||
case TextureFormat::DXT45:
|
||||
case TextureFormat::DXN1:
|
||||
case TextureFormat::DXN2:
|
||||
case TextureFormat::BC7U:
|
||||
case TextureFormat::BC6H_UF16:
|
||||
case TextureFormat::BC6H_SF16:
|
||||
case TextureFormat::ASTC_2D_4X4:
|
||||
case TextureFormat::ASTC_2D_8X8:
|
||||
case TextureFormat::ASTC_2D_5X5:
|
||||
case TextureFormat::ASTC_2D_10X8:
|
||||
case TextureFormat::A8R8G8B8:
|
||||
case TextureFormat::A2B10G10R10:
|
||||
case TextureFormat::A1B5G5R5:
|
||||
case TextureFormat::B5G6R5:
|
||||
case TextureFormat::R8:
|
||||
case TextureFormat::G8R8:
|
||||
case TextureFormat::BF10GF11RF11:
|
||||
case TextureFormat::R32_G32_B32_A32:
|
||||
case TextureFormat::R32_G32:
|
||||
case TextureFormat::R32:
|
||||
case TextureFormat::R16:
|
||||
case TextureFormat::R16_G16:
|
||||
case TextureFormat::R32_G32_B32:
|
||||
// TODO(Subv): For the time being just forward the same data without any decoding.
|
||||
rgba_data = texture_data;
|
||||
break;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Format not implemented");
|
||||
break;
|
||||
}
|
||||
|
||||
return rgba_data;
|
||||
}
|
||||
|
||||
std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height, u32 depth,
|
||||
u32 block_height, u32 block_depth) {
|
||||
if (tiled) {
|
||||
|
||||
@@ -38,10 +38,6 @@ void CopySwizzledData(u32 width, u32 height, u32 depth, u32 bytes_per_pixel,
|
||||
u32 out_bytes_per_pixel, u8* swizzled_data, u8* unswizzled_data,
|
||||
bool unswizzle, u32 block_height, u32 block_depth, u32 width_spacing);
|
||||
|
||||
/// Decodes an unswizzled texture into a A8R8G8B8 texture.
|
||||
std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat format, u32 width,
|
||||
u32 height);
|
||||
|
||||
/// This function calculates the correct size of a texture depending if it's tiled or not.
|
||||
std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height, u32 depth,
|
||||
u32 block_height, u32 block_depth);
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
namespace Tegra::Texture {
|
||||
|
||||
enum class TextureFormat : u32 {
|
||||
R32_G32_B32_A32 = 0x01,
|
||||
R32_G32_B32 = 0x02,
|
||||
R16_G16_B16_A16 = 0x03,
|
||||
R32_G32 = 0x04,
|
||||
R32G32B32A32 = 0x01,
|
||||
R32G32B32 = 0x02,
|
||||
R16G16B16A16 = 0x03,
|
||||
R32G32 = 0x04,
|
||||
R32_B24G8 = 0x05,
|
||||
ETC2_RGB = 0x06,
|
||||
X8B8G8R8 = 0x07,
|
||||
@@ -23,19 +23,19 @@ enum class TextureFormat : u32 {
|
||||
A2B10G10R10 = 0x09,
|
||||
ETC2_RGB_PTA = 0x0a,
|
||||
ETC2_RGBA = 0x0b,
|
||||
R16_G16 = 0x0c,
|
||||
G8R24 = 0x0d,
|
||||
G24R8 = 0x0e,
|
||||
R16G16 = 0x0c,
|
||||
R24G8 = 0x0d,
|
||||
R8G24 = 0x0e,
|
||||
R32 = 0x0f,
|
||||
BC6H_SF16 = 0x10,
|
||||
BC6H_UF16 = 0x11,
|
||||
BC6H_SFLOAT = 0x10,
|
||||
BC6H_UFLOAT = 0x11,
|
||||
A4B4G4R4 = 0x12,
|
||||
A5B5G5R1 = 0x13,
|
||||
A1B5G5R5 = 0x14,
|
||||
B5G6R5 = 0x15,
|
||||
B6G5R5 = 0x16,
|
||||
BC7U = 0x17,
|
||||
G8R8 = 0x18,
|
||||
BC7 = 0x17,
|
||||
R8G8 = 0x18,
|
||||
EAC = 0x19,
|
||||
EACX2 = 0x1a,
|
||||
R16 = 0x1b,
|
||||
@@ -43,23 +43,23 @@ enum class TextureFormat : u32 {
|
||||
R8 = 0x1d,
|
||||
G4R4 = 0x1e,
|
||||
R1 = 0x1f,
|
||||
E5B9G9R9_SHAREDEXP = 0x20,
|
||||
BF10GF11RF11 = 0x21,
|
||||
E5B9G9R9 = 0x20,
|
||||
B10G11R11 = 0x21,
|
||||
G8B8G8R8 = 0x22,
|
||||
B8G8R8G8 = 0x23,
|
||||
DXT1 = 0x24,
|
||||
DXT23 = 0x25,
|
||||
DXT45 = 0x26,
|
||||
DXN1 = 0x27,
|
||||
DXN2 = 0x28,
|
||||
S8Z24 = 0x29,
|
||||
BC1_RGBA = 0x24,
|
||||
BC2 = 0x25,
|
||||
BC3 = 0x26,
|
||||
BC4 = 0x27,
|
||||
BC5 = 0x28,
|
||||
S8D24 = 0x29,
|
||||
X8Z24 = 0x2a,
|
||||
Z24S8 = 0x2b,
|
||||
D24S8 = 0x2b,
|
||||
X4V4Z24__COV4R4V = 0x2c,
|
||||
X4V4Z24__COV8R8V = 0x2d,
|
||||
V8Z24__COV4R12V = 0x2e,
|
||||
ZF32 = 0x2f,
|
||||
ZF32_X24S8 = 0x30,
|
||||
D32 = 0x2f,
|
||||
D32S8 = 0x30,
|
||||
X8Z24_X20V4S8__COV4R4V = 0x31,
|
||||
X8Z24_X20V4S8__COV8R8V = 0x32,
|
||||
ZF32_X20V4X8__COV4R4V = 0x33,
|
||||
@@ -69,7 +69,7 @@ enum class TextureFormat : u32 {
|
||||
X8Z24_X16V8S8__COV4R12V = 0x37,
|
||||
ZF32_X16V8X8__COV4R12V = 0x38,
|
||||
ZF32_X16V8S8__COV4R12V = 0x39,
|
||||
Z16 = 0x3a,
|
||||
D16 = 0x3a,
|
||||
V8Z24__COV8R24V = 0x3b,
|
||||
X8Z24_X16V8S8__COV8R24V = 0x3c,
|
||||
ZF32_X16V8X8__COV8R24V = 0x3d,
|
||||
@@ -375,7 +375,4 @@ struct FullTextureInfo {
|
||||
TSCEntry tsc;
|
||||
};
|
||||
|
||||
/// Returns the number of bytes per pixel of the input texture format.
|
||||
u32 BytesPerPixel(TextureFormat format);
|
||||
|
||||
} // namespace Tegra::Texture
|
||||
|
||||
@@ -98,11 +98,13 @@ add_executable(yuzu
|
||||
game_list_p.h
|
||||
game_list_worker.cpp
|
||||
game_list_worker.h
|
||||
hotkeys.cpp
|
||||
hotkeys.h
|
||||
install_dialog.cpp
|
||||
install_dialog.h
|
||||
loading_screen.cpp
|
||||
loading_screen.h
|
||||
loading_screen.ui
|
||||
hotkeys.cpp
|
||||
hotkeys.h
|
||||
main.cpp
|
||||
main.h
|
||||
main.ui
|
||||
|
||||
@@ -531,8 +531,8 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) {
|
||||
UISettings::GameDir& game_dir =
|
||||
*selected.data(GameListDir::GameDirRole).value<UISettings::GameDir*>();
|
||||
|
||||
QAction* move_up = context_menu.addAction(tr(u8"\U000025b2 Move Up"));
|
||||
QAction* move_down = context_menu.addAction(tr(u8"\U000025bc Move Down "));
|
||||
QAction* move_up = context_menu.addAction(tr("\u25B2 Move Up"));
|
||||
QAction* move_down = context_menu.addAction(tr("\u25bc Move Down"));
|
||||
QAction* open_directory_location = context_menu.addAction(tr("Open Directory Location"));
|
||||
|
||||
const int row = selected.row();
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
// Copyright 2020 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFileInfo>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QListWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include "yuzu/install_dialog.h"
|
||||
#include "yuzu/uisettings.h"
|
||||
|
||||
InstallDialog::InstallDialog(QWidget* parent, const QStringList& files) : QDialog(parent) {
|
||||
file_list = new QListWidget(this);
|
||||
|
||||
for (const QString& file : files) {
|
||||
QListWidgetItem* item = new QListWidgetItem(QFileInfo(file).fileName(), file_list);
|
||||
item->setData(Qt::UserRole, file);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(Qt::Checked);
|
||||
}
|
||||
|
||||
file_list->setMinimumWidth((file_list->sizeHintForColumn(0) * 11) / 10);
|
||||
|
||||
vbox_layout = new QVBoxLayout;
|
||||
|
||||
hbox_layout = new QHBoxLayout;
|
||||
|
||||
description = new QLabel(tr("Please confirm these are the files you wish to install."));
|
||||
|
||||
update_description =
|
||||
new QLabel(tr("Installing an Update or DLC will overwrite the previously installed one."));
|
||||
|
||||
buttons = new QDialogButtonBox;
|
||||
buttons->addButton(QDialogButtonBox::Cancel);
|
||||
buttons->addButton(tr("Install"), QDialogButtonBox::AcceptRole);
|
||||
|
||||
connect(buttons, &QDialogButtonBox::accepted, this, &InstallDialog::accept);
|
||||
connect(buttons, &QDialogButtonBox::rejected, this, &InstallDialog::reject);
|
||||
|
||||
hbox_layout->addWidget(buttons);
|
||||
|
||||
vbox_layout->addWidget(description);
|
||||
vbox_layout->addWidget(update_description);
|
||||
vbox_layout->addWidget(file_list);
|
||||
vbox_layout->addLayout(hbox_layout);
|
||||
|
||||
setLayout(vbox_layout);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
setWindowTitle(tr("Install Files to NAND"));
|
||||
}
|
||||
|
||||
InstallDialog::~InstallDialog() = default;
|
||||
|
||||
QStringList InstallDialog::GetFiles() const {
|
||||
QStringList files;
|
||||
|
||||
for (int i = 0; i < file_list->count(); ++i) {
|
||||
const QListWidgetItem* item = file_list->item(i);
|
||||
if (item->checkState() == Qt::Checked) {
|
||||
files.append(item->data(Qt::UserRole).toString());
|
||||
}
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
int InstallDialog::GetMinimumWidth() const {
|
||||
return file_list->width();
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// Copyright 2020 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QCheckBox;
|
||||
class QDialogButtonBox;
|
||||
class QHBoxLayout;
|
||||
class QLabel;
|
||||
class QListWidget;
|
||||
class QVBoxLayout;
|
||||
|
||||
class InstallDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InstallDialog(QWidget* parent, const QStringList& files);
|
||||
~InstallDialog() override;
|
||||
|
||||
QStringList GetFiles() const;
|
||||
bool ShouldOverwriteFiles() const;
|
||||
int GetMinimumWidth() const;
|
||||
|
||||
private:
|
||||
QListWidget* file_list;
|
||||
|
||||
QVBoxLayout* vbox_layout;
|
||||
QHBoxLayout* hbox_layout;
|
||||
|
||||
QLabel* description;
|
||||
QLabel* update_description;
|
||||
QDialogButtonBox* buttons;
|
||||
};
|
||||
+217
-145
@@ -107,6 +107,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
|
||||
#include "yuzu/game_list.h"
|
||||
#include "yuzu/game_list_p.h"
|
||||
#include "yuzu/hotkeys.h"
|
||||
#include "yuzu/install_dialog.h"
|
||||
#include "yuzu/loading_screen.h"
|
||||
#include "yuzu/main.h"
|
||||
#include "yuzu/uisettings.h"
|
||||
@@ -847,6 +848,9 @@ void GMainWindow::ConnectWidgetEvents() {
|
||||
connect(game_list, &GameList::OpenPerGameGeneralRequested, this,
|
||||
&GMainWindow::OnGameListOpenPerGameProperties);
|
||||
|
||||
connect(this, &GMainWindow::UpdateInstallProgress, this,
|
||||
&GMainWindow::IncrementInstallProgress);
|
||||
|
||||
connect(this, &GMainWindow::EmulationStarting, render_window,
|
||||
&GRenderWindow::OnEmulationStarting);
|
||||
connect(this, &GMainWindow::EmulationStopping, render_window,
|
||||
@@ -1593,187 +1597,255 @@ void GMainWindow::OnMenuLoadFolder() {
|
||||
}
|
||||
}
|
||||
|
||||
void GMainWindow::IncrementInstallProgress() {
|
||||
install_progress->setValue(install_progress->value() + 1);
|
||||
}
|
||||
|
||||
void GMainWindow::OnMenuInstallToNAND() {
|
||||
const QString file_filter =
|
||||
tr("Installable Switch File (*.nca *.nsp *.xci);;Nintendo Content Archive "
|
||||
"(*.nca);;Nintendo Submissions Package (*.nsp);;NX Cartridge "
|
||||
"(*.nca);;Nintendo Submission Package (*.nsp);;NX Cartridge "
|
||||
"Image (*.xci)");
|
||||
QString filename = QFileDialog::getOpenFileName(this, tr("Install File"),
|
||||
UISettings::values.roms_path, file_filter);
|
||||
|
||||
if (filename.isEmpty()) {
|
||||
QStringList filenames = QFileDialog::getOpenFileNames(
|
||||
this, tr("Install Files"), UISettings::values.roms_path, file_filter);
|
||||
|
||||
if (filenames.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
InstallDialog installDialog(this, filenames);
|
||||
if (installDialog.exec() == QDialog::Rejected) {
|
||||
return;
|
||||
}
|
||||
|
||||
const QStringList files = installDialog.GetFiles();
|
||||
|
||||
if (files.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int remaining = filenames.size();
|
||||
|
||||
// This would only overflow above 2^43 bytes (8.796 TB)
|
||||
int total_size = 0;
|
||||
for (const QString& file : files) {
|
||||
total_size += static_cast<int>(QFile(file).size() / 0x1000);
|
||||
}
|
||||
if (total_size < 0) {
|
||||
LOG_CRITICAL(Frontend, "Attempting to install too many files, aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList new_files{}; // Newly installed files that do not yet exist in the NAND
|
||||
QStringList overwritten_files{}; // Files that overwrote those existing in the NAND
|
||||
QStringList failed_files{}; // Files that failed to install due to errors
|
||||
|
||||
ui.action_Install_File_NAND->setEnabled(false);
|
||||
|
||||
install_progress = new QProgressDialog(QStringLiteral(""), tr("Cancel"), 0, total_size, this);
|
||||
install_progress->setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint &
|
||||
~Qt::WindowMaximizeButtonHint);
|
||||
install_progress->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
install_progress->setFixedWidth(installDialog.GetMinimumWidth() + 40);
|
||||
install_progress->show();
|
||||
|
||||
for (const QString& file : files) {
|
||||
install_progress->setWindowTitle(tr("%n file(s) remaining", "", remaining));
|
||||
install_progress->setLabelText(
|
||||
tr("Installing file \"%1\"...").arg(QFileInfo(file).fileName()));
|
||||
|
||||
QFuture<InstallResult> future;
|
||||
InstallResult result;
|
||||
|
||||
if (file.endsWith(QStringLiteral("xci"), Qt::CaseInsensitive) ||
|
||||
file.endsWith(QStringLiteral("nsp"), Qt::CaseInsensitive)) {
|
||||
|
||||
future = QtConcurrent::run([this, &file] { return InstallNSPXCI(file); });
|
||||
|
||||
while (!future.isFinished()) {
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
|
||||
result = future.result();
|
||||
|
||||
} else {
|
||||
result = InstallNCA(file);
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
|
||||
switch (result) {
|
||||
case InstallResult::Success:
|
||||
new_files.append(QFileInfo(file).fileName());
|
||||
break;
|
||||
case InstallResult::Overwrite:
|
||||
overwritten_files.append(QFileInfo(file).fileName());
|
||||
break;
|
||||
case InstallResult::Failure:
|
||||
failed_files.append(QFileInfo(file).fileName());
|
||||
break;
|
||||
}
|
||||
|
||||
--remaining;
|
||||
}
|
||||
|
||||
install_progress->close();
|
||||
|
||||
const QString install_results =
|
||||
(new_files.isEmpty() ? QStringLiteral("")
|
||||
: tr("%n file(s) were newly installed\n", "", new_files.size())) +
|
||||
(overwritten_files.isEmpty()
|
||||
? QStringLiteral("")
|
||||
: tr("%n file(s) were overwritten\n", "", overwritten_files.size())) +
|
||||
(failed_files.isEmpty() ? QStringLiteral("")
|
||||
: tr("%n file(s) failed to install\n", "", failed_files.size()));
|
||||
|
||||
QMessageBox::information(this, tr("Install Results"), install_results);
|
||||
game_list->PopulateAsync(UISettings::values.game_dirs);
|
||||
FileUtil::DeleteDirRecursively(FileUtil::GetUserPath(FileUtil::UserPath::CacheDir) + DIR_SEP +
|
||||
"game_list");
|
||||
ui.action_Install_File_NAND->setEnabled(true);
|
||||
}
|
||||
|
||||
InstallResult GMainWindow::InstallNSPXCI(const QString& filename) {
|
||||
const auto qt_raw_copy = [this](const FileSys::VirtualFile& src,
|
||||
const FileSys::VirtualFile& dest, std::size_t block_size) {
|
||||
if (src == nullptr || dest == nullptr)
|
||||
if (src == nullptr || dest == nullptr) {
|
||||
return false;
|
||||
if (!dest->Resize(src->GetSize()))
|
||||
}
|
||||
if (!dest->Resize(src->GetSize())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::array<u8, 0x1000> buffer{};
|
||||
const int progress_maximum = static_cast<int>(src->GetSize() / buffer.size());
|
||||
|
||||
QProgressDialog progress(
|
||||
tr("Installing file \"%1\"...").arg(QString::fromStdString(src->GetName())),
|
||||
tr("Cancel"), 0, progress_maximum, this);
|
||||
progress.setWindowModality(Qt::WindowModal);
|
||||
|
||||
for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) {
|
||||
if (progress.wasCanceled()) {
|
||||
if (install_progress->wasCanceled()) {
|
||||
dest->Resize(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
const int progress_value = static_cast<int>(i / buffer.size());
|
||||
progress.setValue(progress_value);
|
||||
emit UpdateInstallProgress();
|
||||
|
||||
const auto read = src->Read(buffer.data(), buffer.size(), i);
|
||||
dest->Write(buffer.data(), read, i);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const auto success = [this]() {
|
||||
QMessageBox::information(this, tr("Successfully Installed"),
|
||||
tr("The file was successfully installed."));
|
||||
game_list->PopulateAsync(UISettings::values.game_dirs);
|
||||
FileUtil::DeleteDirRecursively(FileUtil::GetUserPath(FileUtil::UserPath::CacheDir) +
|
||||
DIR_SEP + "game_list");
|
||||
};
|
||||
|
||||
const auto failed = [this]() {
|
||||
QMessageBox::warning(
|
||||
this, tr("Failed to Install"),
|
||||
tr("There was an error while attempting to install the provided file. It "
|
||||
"could have an incorrect format or be missing metadata. Please "
|
||||
"double-check your file and try again."));
|
||||
};
|
||||
|
||||
const auto overwrite = [this]() {
|
||||
return QMessageBox::question(this, tr("Failed to Install"),
|
||||
tr("The file you are attempting to install already exists "
|
||||
"in the cache. Would you like to overwrite it?")) ==
|
||||
QMessageBox::Yes;
|
||||
};
|
||||
|
||||
if (filename.endsWith(QStringLiteral("xci"), Qt::CaseInsensitive) ||
|
||||
filename.endsWith(QStringLiteral("nsp"), Qt::CaseInsensitive)) {
|
||||
std::shared_ptr<FileSys::NSP> nsp;
|
||||
if (filename.endsWith(QStringLiteral("nsp"), Qt::CaseInsensitive)) {
|
||||
nsp = std::make_shared<FileSys::NSP>(
|
||||
vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read));
|
||||
if (nsp->IsExtractedType())
|
||||
failed();
|
||||
} else {
|
||||
const auto xci = std::make_shared<FileSys::XCI>(
|
||||
vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read));
|
||||
nsp = xci->GetSecurePartitionNSP();
|
||||
}
|
||||
|
||||
if (nsp->GetStatus() != Loader::ResultStatus::Success) {
|
||||
failed();
|
||||
return;
|
||||
}
|
||||
const auto res = Core::System::GetInstance()
|
||||
.GetFileSystemController()
|
||||
.GetUserNANDContents()
|
||||
->InstallEntry(*nsp, false, qt_raw_copy);
|
||||
if (res == FileSys::InstallResult::Success) {
|
||||
success();
|
||||
} else {
|
||||
if (res == FileSys::InstallResult::ErrorAlreadyExists) {
|
||||
if (overwrite()) {
|
||||
const auto res2 = Core::System::GetInstance()
|
||||
.GetFileSystemController()
|
||||
.GetUserNANDContents()
|
||||
->InstallEntry(*nsp, true, qt_raw_copy);
|
||||
if (res2 == FileSys::InstallResult::Success) {
|
||||
success();
|
||||
} else {
|
||||
failed();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
failed();
|
||||
}
|
||||
std::shared_ptr<FileSys::NSP> nsp;
|
||||
if (filename.endsWith(QStringLiteral("nsp"), Qt::CaseInsensitive)) {
|
||||
nsp = std::make_shared<FileSys::NSP>(
|
||||
vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read));
|
||||
if (nsp->IsExtractedType()) {
|
||||
return InstallResult::Failure;
|
||||
}
|
||||
} else {
|
||||
const auto nca = std::make_shared<FileSys::NCA>(
|
||||
const auto xci = std::make_shared<FileSys::XCI>(
|
||||
vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read));
|
||||
const auto id = nca->GetStatus();
|
||||
nsp = xci->GetSecurePartitionNSP();
|
||||
}
|
||||
|
||||
// Game updates necessary are missing base RomFS
|
||||
if (id != Loader::ResultStatus::Success &&
|
||||
id != Loader::ResultStatus::ErrorMissingBKTRBaseRomFS) {
|
||||
failed();
|
||||
return;
|
||||
if (nsp->GetStatus() != Loader::ResultStatus::Success) {
|
||||
return InstallResult::Failure;
|
||||
}
|
||||
const auto res =
|
||||
Core::System::GetInstance().GetFileSystemController().GetUserNANDContents()->InstallEntry(
|
||||
*nsp, true, qt_raw_copy);
|
||||
if (res == FileSys::InstallResult::Success) {
|
||||
return InstallResult::Success;
|
||||
} else if (res == FileSys::InstallResult::ErrorAlreadyExists) {
|
||||
return InstallResult::Overwrite;
|
||||
} else {
|
||||
return InstallResult::Failure;
|
||||
}
|
||||
}
|
||||
|
||||
InstallResult GMainWindow::InstallNCA(const QString& filename) {
|
||||
const auto qt_raw_copy = [this](const FileSys::VirtualFile& src,
|
||||
const FileSys::VirtualFile& dest, std::size_t block_size) {
|
||||
if (src == nullptr || dest == nullptr) {
|
||||
return false;
|
||||
}
|
||||
if (!dest->Resize(src->GetSize())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const QStringList tt_options{tr("System Application"),
|
||||
tr("System Archive"),
|
||||
tr("System Application Update"),
|
||||
tr("Firmware Package (Type A)"),
|
||||
tr("Firmware Package (Type B)"),
|
||||
tr("Game"),
|
||||
tr("Game Update"),
|
||||
tr("Game DLC"),
|
||||
tr("Delta Title")};
|
||||
bool ok;
|
||||
const auto item = QInputDialog::getItem(
|
||||
this, tr("Select NCA Install Type..."),
|
||||
tr("Please select the type of title you would like to install this NCA as:\n(In "
|
||||
"most instances, the default 'Game' is fine.)"),
|
||||
tt_options, 5, false, &ok);
|
||||
std::array<u8, 0x1000> buffer{};
|
||||
|
||||
auto index = tt_options.indexOf(item);
|
||||
if (!ok || index == -1) {
|
||||
QMessageBox::warning(this, tr("Failed to Install"),
|
||||
tr("The title type you selected for the NCA is invalid."));
|
||||
return;
|
||||
}
|
||||
|
||||
// If index is equal to or past Game, add the jump in TitleType.
|
||||
if (index >= 5) {
|
||||
index += static_cast<size_t>(FileSys::TitleType::Application) -
|
||||
static_cast<size_t>(FileSys::TitleType::FirmwarePackageB);
|
||||
}
|
||||
|
||||
FileSys::InstallResult res;
|
||||
if (index >= static_cast<s32>(FileSys::TitleType::Application)) {
|
||||
res = Core::System::GetInstance()
|
||||
.GetFileSystemController()
|
||||
.GetUserNANDContents()
|
||||
->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), false,
|
||||
qt_raw_copy);
|
||||
} else {
|
||||
res = Core::System::GetInstance()
|
||||
.GetFileSystemController()
|
||||
.GetSystemNANDContents()
|
||||
->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), false,
|
||||
qt_raw_copy);
|
||||
}
|
||||
|
||||
if (res == FileSys::InstallResult::Success) {
|
||||
success();
|
||||
} else if (res == FileSys::InstallResult::ErrorAlreadyExists) {
|
||||
if (overwrite()) {
|
||||
const auto res2 = Core::System::GetInstance()
|
||||
.GetFileSystemController()
|
||||
.GetUserNANDContents()
|
||||
->InstallEntry(*nca, static_cast<FileSys::TitleType>(index),
|
||||
true, qt_raw_copy);
|
||||
if (res2 == FileSys::InstallResult::Success) {
|
||||
success();
|
||||
} else {
|
||||
failed();
|
||||
}
|
||||
for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) {
|
||||
if (install_progress->wasCanceled()) {
|
||||
dest->Resize(0);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
failed();
|
||||
|
||||
emit UpdateInstallProgress();
|
||||
|
||||
const auto read = src->Read(buffer.data(), buffer.size(), i);
|
||||
dest->Write(buffer.data(), read, i);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const auto nca =
|
||||
std::make_shared<FileSys::NCA>(vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read));
|
||||
const auto id = nca->GetStatus();
|
||||
|
||||
// Game updates necessary are missing base RomFS
|
||||
if (id != Loader::ResultStatus::Success &&
|
||||
id != Loader::ResultStatus::ErrorMissingBKTRBaseRomFS) {
|
||||
return InstallResult::Failure;
|
||||
}
|
||||
|
||||
const QStringList tt_options{tr("System Application"),
|
||||
tr("System Archive"),
|
||||
tr("System Application Update"),
|
||||
tr("Firmware Package (Type A)"),
|
||||
tr("Firmware Package (Type B)"),
|
||||
tr("Game"),
|
||||
tr("Game Update"),
|
||||
tr("Game DLC"),
|
||||
tr("Delta Title")};
|
||||
bool ok;
|
||||
const auto item = QInputDialog::getItem(
|
||||
this, tr("Select NCA Install Type..."),
|
||||
tr("Please select the type of title you would like to install this NCA as:\n(In "
|
||||
"most instances, the default 'Game' is fine.)"),
|
||||
tt_options, 5, false, &ok);
|
||||
|
||||
auto index = tt_options.indexOf(item);
|
||||
if (!ok || index == -1) {
|
||||
QMessageBox::warning(this, tr("Failed to Install"),
|
||||
tr("The title type you selected for the NCA is invalid."));
|
||||
return InstallResult::Failure;
|
||||
}
|
||||
|
||||
// If index is equal to or past Game, add the jump in TitleType.
|
||||
if (index >= 5) {
|
||||
index += static_cast<size_t>(FileSys::TitleType::Application) -
|
||||
static_cast<size_t>(FileSys::TitleType::FirmwarePackageB);
|
||||
}
|
||||
|
||||
FileSys::InstallResult res;
|
||||
if (index >= static_cast<s32>(FileSys::TitleType::Application)) {
|
||||
res = Core::System::GetInstance()
|
||||
.GetFileSystemController()
|
||||
.GetUserNANDContents()
|
||||
->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
|
||||
} else {
|
||||
res = Core::System::GetInstance()
|
||||
.GetFileSystemController()
|
||||
.GetSystemNANDContents()
|
||||
->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
|
||||
}
|
||||
|
||||
if (res == FileSys::InstallResult::Success) {
|
||||
return InstallResult::Success;
|
||||
} else if (res == FileSys::InstallResult::ErrorAlreadyExists) {
|
||||
return InstallResult::Overwrite;
|
||||
} else {
|
||||
return InstallResult::Failure;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ class MicroProfileDialog;
|
||||
class ProfilerWidget;
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
class QProgressDialog;
|
||||
class WaitTreeWidget;
|
||||
enum class GameListOpenTarget;
|
||||
class GameListPlaceholder;
|
||||
@@ -47,6 +48,12 @@ enum class EmulatedDirectoryTarget {
|
||||
SDMC,
|
||||
};
|
||||
|
||||
enum class InstallResult {
|
||||
Success,
|
||||
Overwrite,
|
||||
Failure,
|
||||
};
|
||||
|
||||
enum class ReinitializeKeyBehavior {
|
||||
NoWarning,
|
||||
Warning,
|
||||
@@ -102,6 +109,8 @@ signals:
|
||||
// Signal that tells widgets to update icons to use the current theme
|
||||
void UpdateThemedIcons();
|
||||
|
||||
void UpdateInstallProgress();
|
||||
|
||||
void ErrorDisplayFinished();
|
||||
|
||||
void ProfileSelectorFinishedSelection(std::optional<Common::UUID> uuid);
|
||||
@@ -198,6 +207,7 @@ private slots:
|
||||
void OnGameListOpenPerGameProperties(const std::string& file);
|
||||
void OnMenuLoadFile();
|
||||
void OnMenuLoadFolder();
|
||||
void IncrementInstallProgress();
|
||||
void OnMenuInstallToNAND();
|
||||
void OnMenuRecentFile();
|
||||
void OnConfigure();
|
||||
@@ -218,6 +228,8 @@ private slots:
|
||||
|
||||
private:
|
||||
std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id);
|
||||
InstallResult InstallNSPXCI(const QString& filename);
|
||||
InstallResult InstallNCA(const QString& filename);
|
||||
void UpdateWindowTitle(const std::string& title_name = {},
|
||||
const std::string& title_version = {});
|
||||
void UpdateStatusBar();
|
||||
@@ -272,6 +284,9 @@ private:
|
||||
|
||||
HotkeyRegistry hotkey_registry;
|
||||
|
||||
// Install progress dialog
|
||||
QProgressDialog* install_progress;
|
||||
|
||||
protected:
|
||||
void dropEvent(QDropEvent* event) override;
|
||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Install File to NAND...</string>
|
||||
<string>Install Files to NAND...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Load_File">
|
||||
|
||||
Reference in New Issue
Block a user