diff options
Diffstat (limited to 'src')
23 files changed, 386 insertions, 611 deletions
diff --git a/src/audio_core/renderer/effect/effect_info_base.h b/src/audio_core/renderer/effect/effect_info_base.h index 43d0589cc..8c9583878 100644 --- a/src/audio_core/renderer/effect/effect_info_base.h +++ b/src/audio_core/renderer/effect/effect_info_base.h | |||
| @@ -419,13 +419,13 @@ protected: | |||
| 419 | /// Workbuffers assigned to this effect | 419 | /// Workbuffers assigned to this effect |
| 420 | std::array<AddressInfo, 2> workbuffers{AddressInfo(CpuAddr(0), 0), AddressInfo(CpuAddr(0), 0)}; | 420 | std::array<AddressInfo, 2> workbuffers{AddressInfo(CpuAddr(0), 0), AddressInfo(CpuAddr(0), 0)}; |
| 421 | /// Aux/Capture buffer info for reading | 421 | /// Aux/Capture buffer info for reading |
| 422 | CpuAddr send_buffer_info; | 422 | CpuAddr send_buffer_info{}; |
| 423 | /// Aux/Capture buffer for reading | 423 | /// Aux/Capture buffer for reading |
| 424 | CpuAddr send_buffer; | 424 | CpuAddr send_buffer{}; |
| 425 | /// Aux/Capture buffer info for writing | 425 | /// Aux/Capture buffer info for writing |
| 426 | CpuAddr return_buffer_info; | 426 | CpuAddr return_buffer_info{}; |
| 427 | /// Aux/Capture buffer for writing | 427 | /// Aux/Capture buffer for writing |
| 428 | CpuAddr return_buffer; | 428 | CpuAddr return_buffer{}; |
| 429 | /// Parameters of this effect | 429 | /// Parameters of this effect |
| 430 | std::array<u8, sizeof(InParameterVersion2)> parameter{}; | 430 | std::array<u8, sizeof(InParameterVersion2)> parameter{}; |
| 431 | /// State of this effect used by the AudioRenderer across calls | 431 | /// State of this effect used by the AudioRenderer across calls |
diff --git a/src/common/threadsafe_queue.h b/src/common/threadsafe_queue.h index f7ae9d8c2..053798e79 100644 --- a/src/common/threadsafe_queue.h +++ b/src/common/threadsafe_queue.h | |||
| @@ -39,7 +39,7 @@ public: | |||
| 39 | template <typename Arg> | 39 | template <typename Arg> |
| 40 | void Push(Arg&& t) { | 40 | void Push(Arg&& t) { |
| 41 | // create the element, add it to the queue | 41 | // create the element, add it to the queue |
| 42 | write_ptr->current = std::forward<Arg>(t); | 42 | write_ptr->current = std::move(t); |
| 43 | // set the next pointer to a new element ptr | 43 | // set the next pointer to a new element ptr |
| 44 | // then advance the write pointer | 44 | // then advance the write pointer |
| 45 | ElementPtr* new_ptr = new ElementPtr(); | 45 | ElementPtr* new_ptr = new ElementPtr(); |
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 40b1ea4a2..9dbe5bdca 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -727,8 +727,6 @@ add_library(core STATIC | |||
| 727 | internal_network/sockets.h | 727 | internal_network/sockets.h |
| 728 | loader/deconstructed_rom_directory.cpp | 728 | loader/deconstructed_rom_directory.cpp |
| 729 | loader/deconstructed_rom_directory.h | 729 | loader/deconstructed_rom_directory.h |
| 730 | loader/elf.cpp | ||
| 731 | loader/elf.h | ||
| 732 | loader/kip.cpp | 730 | loader/kip.cpp |
| 733 | loader/kip.h | 731 | loader/kip.h |
| 734 | loader/loader.cpp | 732 | loader/loader.cpp |
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index c64291e7f..dadaf897f 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -194,13 +194,16 @@ Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session, | |||
| 194 | Kernel::HLERequestContext& ctx) { | 194 | Kernel::HLERequestContext& ctx) { |
| 195 | const auto guard = LockService(); | 195 | const auto guard = LockService(); |
| 196 | 196 | ||
| 197 | Result result = ResultSuccess; | ||
| 198 | |||
| 197 | switch (ctx.GetCommandType()) { | 199 | switch (ctx.GetCommandType()) { |
| 198 | case IPC::CommandType::Close: | 200 | case IPC::CommandType::Close: |
| 199 | case IPC::CommandType::TIPC_Close: { | 201 | case IPC::CommandType::TIPC_Close: { |
| 200 | session.Close(); | 202 | session.Close(); |
| 201 | IPC::ResponseBuilder rb{ctx, 2}; | 203 | IPC::ResponseBuilder rb{ctx, 2}; |
| 202 | rb.Push(ResultSuccess); | 204 | rb.Push(ResultSuccess); |
| 203 | return IPC::ERR_REMOTE_PROCESS_DEAD; | 205 | result = IPC::ERR_REMOTE_PROCESS_DEAD; |
| 206 | break; | ||
| 204 | } | 207 | } |
| 205 | case IPC::CommandType::ControlWithContext: | 208 | case IPC::CommandType::ControlWithContext: |
| 206 | case IPC::CommandType::Control: { | 209 | case IPC::CommandType::Control: { |
| @@ -227,7 +230,7 @@ Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session, | |||
| 227 | ctx.WriteToOutgoingCommandBuffer(ctx.GetThread()); | 230 | ctx.WriteToOutgoingCommandBuffer(ctx.GetThread()); |
| 228 | } | 231 | } |
| 229 | 232 | ||
| 230 | return ResultSuccess; | 233 | return result; |
| 231 | } | 234 | } |
| 232 | 235 | ||
| 233 | /// Initialize Services | 236 | /// Initialize Services |
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp deleted file mode 100644 index dfb10c34f..000000000 --- a/src/core/loader/elf.cpp +++ /dev/null | |||
| @@ -1,263 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: 2013 Dolphin Emulator Project | ||
| 2 | // SPDX-FileCopyrightText: 2014 Citra Emulator Project | ||
| 3 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 4 | |||
| 5 | #include <cstring> | ||
| 6 | #include <memory> | ||
| 7 | #include "common/common_funcs.h" | ||
| 8 | #include "common/common_types.h" | ||
| 9 | #include "common/elf.h" | ||
| 10 | #include "common/logging/log.h" | ||
| 11 | #include "core/hle/kernel/code_set.h" | ||
| 12 | #include "core/hle/kernel/k_page_table.h" | ||
| 13 | #include "core/hle/kernel/k_process.h" | ||
| 14 | #include "core/loader/elf.h" | ||
| 15 | #include "core/memory.h" | ||
| 16 | |||
| 17 | using namespace Common::ELF; | ||
| 18 | |||
| 19 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 20 | // ElfReader class | ||
| 21 | |||
| 22 | typedef int SectionID; | ||
| 23 | |||
| 24 | class ElfReader { | ||
| 25 | private: | ||
| 26 | char* base; | ||
| 27 | u32* base32; | ||
| 28 | |||
| 29 | Elf32_Ehdr* header; | ||
| 30 | Elf32_Phdr* segments; | ||
| 31 | Elf32_Shdr* sections; | ||
| 32 | |||
| 33 | u32* sectionAddrs; | ||
| 34 | bool relocate; | ||
| 35 | VAddr entryPoint; | ||
| 36 | |||
| 37 | public: | ||
| 38 | explicit ElfReader(void* ptr); | ||
| 39 | |||
| 40 | u32 Read32(int off) const { | ||
| 41 | return base32[off >> 2]; | ||
| 42 | } | ||
| 43 | |||
| 44 | // Quick accessors | ||
| 45 | u16 GetType() const { | ||
| 46 | return header->e_type; | ||
| 47 | } | ||
| 48 | u16 GetMachine() const { | ||
| 49 | return header->e_machine; | ||
| 50 | } | ||
| 51 | VAddr GetEntryPoint() const { | ||
| 52 | return entryPoint; | ||
| 53 | } | ||
| 54 | u32 GetFlags() const { | ||
| 55 | return (u32)(header->e_flags); | ||
| 56 | } | ||
| 57 | Kernel::CodeSet LoadInto(VAddr vaddr); | ||
| 58 | |||
| 59 | int GetNumSegments() const { | ||
| 60 | return (int)(header->e_phnum); | ||
| 61 | } | ||
| 62 | int GetNumSections() const { | ||
| 63 | return (int)(header->e_shnum); | ||
| 64 | } | ||
| 65 | const u8* GetPtr(int offset) const { | ||
| 66 | return (u8*)base + offset; | ||
| 67 | } | ||
| 68 | const char* GetSectionName(int section) const; | ||
| 69 | const u8* GetSectionDataPtr(int section) const { | ||
| 70 | if (section < 0 || section >= header->e_shnum) | ||
| 71 | return nullptr; | ||
| 72 | if (sections[section].sh_type != ElfShtNobits) | ||
| 73 | return GetPtr(sections[section].sh_offset); | ||
| 74 | else | ||
| 75 | return nullptr; | ||
| 76 | } | ||
| 77 | bool IsCodeSection(int section) const { | ||
| 78 | return sections[section].sh_type == ElfShtProgBits; | ||
| 79 | } | ||
| 80 | const u8* GetSegmentPtr(int segment) { | ||
| 81 | return GetPtr(segments[segment].p_offset); | ||
| 82 | } | ||
| 83 | u32 GetSectionAddr(SectionID section) const { | ||
| 84 | return sectionAddrs[section]; | ||
| 85 | } | ||
| 86 | unsigned int GetSectionSize(SectionID section) const { | ||
| 87 | return sections[section].sh_size; | ||
| 88 | } | ||
| 89 | SectionID GetSectionByName(const char* name, int firstSection = 0) const; //-1 for not found | ||
| 90 | |||
| 91 | bool DidRelocate() const { | ||
| 92 | return relocate; | ||
| 93 | } | ||
| 94 | }; | ||
| 95 | |||
| 96 | ElfReader::ElfReader(void* ptr) { | ||
| 97 | base = (char*)ptr; | ||
| 98 | base32 = (u32*)ptr; | ||
| 99 | header = (Elf32_Ehdr*)ptr; | ||
| 100 | |||
| 101 | segments = (Elf32_Phdr*)(base + header->e_phoff); | ||
| 102 | sections = (Elf32_Shdr*)(base + header->e_shoff); | ||
| 103 | |||
| 104 | entryPoint = header->e_entry; | ||
| 105 | } | ||
| 106 | |||
| 107 | const char* ElfReader::GetSectionName(int section) const { | ||
| 108 | if (sections[section].sh_type == ElfShtNull) | ||
| 109 | return nullptr; | ||
| 110 | |||
| 111 | int name_offset = sections[section].sh_name; | ||
| 112 | const char* ptr = reinterpret_cast<const char*>(GetSectionDataPtr(header->e_shstrndx)); | ||
| 113 | |||
| 114 | if (ptr) | ||
| 115 | return ptr + name_offset; | ||
| 116 | |||
| 117 | return nullptr; | ||
| 118 | } | ||
| 119 | |||
| 120 | Kernel::CodeSet ElfReader::LoadInto(VAddr vaddr) { | ||
| 121 | LOG_DEBUG(Loader, "String section: {}", header->e_shstrndx); | ||
| 122 | |||
| 123 | // Should we relocate? | ||
| 124 | relocate = (header->e_type != ElfTypeExec); | ||
| 125 | |||
| 126 | if (relocate) { | ||
| 127 | LOG_DEBUG(Loader, "Relocatable module"); | ||
| 128 | entryPoint += vaddr; | ||
| 129 | } else { | ||
| 130 | LOG_DEBUG(Loader, "Prerelocated executable"); | ||
| 131 | } | ||
| 132 | LOG_DEBUG(Loader, "{} segments:", header->e_phnum); | ||
| 133 | |||
| 134 | // First pass : Get the bits into RAM | ||
| 135 | const VAddr base_addr = relocate ? vaddr : 0; | ||
| 136 | |||
| 137 | u64 total_image_size = 0; | ||
| 138 | for (unsigned int i = 0; i < header->e_phnum; ++i) { | ||
| 139 | const Elf32_Phdr* p = &segments[i]; | ||
| 140 | if (p->p_type == ElfPtLoad) { | ||
| 141 | total_image_size += (p->p_memsz + 0xFFF) & ~0xFFF; | ||
| 142 | } | ||
| 143 | } | ||
| 144 | |||
| 145 | Kernel::PhysicalMemory program_image(total_image_size); | ||
| 146 | std::size_t current_image_position = 0; | ||
| 147 | |||
| 148 | Kernel::CodeSet codeset; | ||
| 149 | |||
| 150 | for (unsigned int i = 0; i < header->e_phnum; ++i) { | ||
| 151 | const Elf32_Phdr* p = &segments[i]; | ||
| 152 | LOG_DEBUG(Loader, "Type: {} Vaddr: {:08X} Filesz: {:08X} Memsz: {:08X} ", p->p_type, | ||
| 153 | p->p_vaddr, p->p_filesz, p->p_memsz); | ||
| 154 | |||
| 155 | if (p->p_type == ElfPtLoad) { | ||
| 156 | Kernel::CodeSet::Segment* codeset_segment; | ||
| 157 | u32 permission_flags = p->p_flags & (ElfPfRead | ElfPfWrite | ElfPfExec); | ||
| 158 | if (permission_flags == (ElfPfRead | ElfPfExec)) { | ||
| 159 | codeset_segment = &codeset.CodeSegment(); | ||
| 160 | } else if (permission_flags == (ElfPfRead)) { | ||
| 161 | codeset_segment = &codeset.RODataSegment(); | ||
| 162 | } else if (permission_flags == (ElfPfRead | ElfPfWrite)) { | ||
| 163 | codeset_segment = &codeset.DataSegment(); | ||
| 164 | } else { | ||
| 165 | LOG_ERROR(Loader, "Unexpected ELF PT_LOAD segment id {} with flags {:X}", i, | ||
| 166 | p->p_flags); | ||
| 167 | continue; | ||
| 168 | } | ||
| 169 | |||
| 170 | if (codeset_segment->size != 0) { | ||
| 171 | LOG_ERROR(Loader, | ||
| 172 | "ELF has more than one segment of the same type. Skipping extra " | ||
| 173 | "segment (id {})", | ||
| 174 | i); | ||
| 175 | continue; | ||
| 176 | } | ||
| 177 | |||
| 178 | const VAddr segment_addr = base_addr + p->p_vaddr; | ||
| 179 | const u32 aligned_size = (p->p_memsz + 0xFFF) & ~0xFFF; | ||
| 180 | |||
| 181 | codeset_segment->offset = current_image_position; | ||
| 182 | codeset_segment->addr = segment_addr; | ||
| 183 | codeset_segment->size = aligned_size; | ||
| 184 | |||
| 185 | std::memcpy(program_image.data() + current_image_position, GetSegmentPtr(i), | ||
| 186 | p->p_filesz); | ||
| 187 | current_image_position += aligned_size; | ||
| 188 | } | ||
| 189 | } | ||
| 190 | |||
| 191 | codeset.entrypoint = base_addr + header->e_entry; | ||
| 192 | codeset.memory = std::move(program_image); | ||
| 193 | |||
| 194 | LOG_DEBUG(Loader, "Done loading."); | ||
| 195 | |||
| 196 | return codeset; | ||
| 197 | } | ||
| 198 | |||
| 199 | SectionID ElfReader::GetSectionByName(const char* name, int firstSection) const { | ||
| 200 | for (int i = firstSection; i < header->e_shnum; i++) { | ||
| 201 | const char* secname = GetSectionName(i); | ||
| 202 | |||
| 203 | if (secname != nullptr && strcmp(name, secname) == 0) | ||
| 204 | return i; | ||
| 205 | } | ||
| 206 | return -1; | ||
| 207 | } | ||
| 208 | |||
| 209 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 210 | // Loader namespace | ||
| 211 | |||
| 212 | namespace Loader { | ||
| 213 | |||
| 214 | AppLoader_ELF::AppLoader_ELF(FileSys::VirtualFile file_) : AppLoader(std::move(file_)) {} | ||
| 215 | |||
| 216 | FileType AppLoader_ELF::IdentifyType(const FileSys::VirtualFile& elf_file) { | ||
| 217 | static constexpr u16 ELF_MACHINE_ARM{0x28}; | ||
| 218 | |||
| 219 | u32 magic = 0; | ||
| 220 | if (4 != elf_file->ReadObject(&magic)) { | ||
| 221 | return FileType::Error; | ||
| 222 | } | ||
| 223 | |||
| 224 | u16 machine = 0; | ||
| 225 | if (2 != elf_file->ReadObject(&machine, 18)) { | ||
| 226 | return FileType::Error; | ||
| 227 | } | ||
| 228 | |||
| 229 | if (Common::MakeMagic('\x7f', 'E', 'L', 'F') == magic && ELF_MACHINE_ARM == machine) { | ||
| 230 | return FileType::ELF; | ||
| 231 | } | ||
| 232 | |||
| 233 | return FileType::Error; | ||
| 234 | } | ||
| 235 | |||
| 236 | AppLoader_ELF::LoadResult AppLoader_ELF::Load(Kernel::KProcess& process, | ||
| 237 | [[maybe_unused]] Core::System& system) { | ||
| 238 | if (is_loaded) { | ||
| 239 | return {ResultStatus::ErrorAlreadyLoaded, {}}; | ||
| 240 | } | ||
| 241 | |||
| 242 | std::vector<u8> buffer = file->ReadAllBytes(); | ||
| 243 | if (buffer.size() != file->GetSize()) { | ||
| 244 | return {ResultStatus::ErrorIncorrectELFFileSize, {}}; | ||
| 245 | } | ||
| 246 | |||
| 247 | const VAddr base_address = process.PageTable().GetCodeRegionStart(); | ||
| 248 | ElfReader elf_reader(&buffer[0]); | ||
| 249 | Kernel::CodeSet codeset = elf_reader.LoadInto(base_address); | ||
| 250 | const VAddr entry_point = codeset.entrypoint; | ||
| 251 | |||
| 252 | // Setup the process code layout | ||
| 253 | if (process.LoadFromMetadata(FileSys::ProgramMetadata::GetDefault(), buffer.size()).IsError()) { | ||
| 254 | return {ResultStatus::ErrorNotInitialized, {}}; | ||
| 255 | } | ||
| 256 | |||
| 257 | process.LoadModule(std::move(codeset), entry_point); | ||
| 258 | |||
| 259 | is_loaded = true; | ||
| 260 | return {ResultStatus::Success, LoadParameters{48, Core::Memory::DEFAULT_STACK_SIZE}}; | ||
| 261 | } | ||
| 262 | |||
| 263 | } // namespace Loader | ||
diff --git a/src/core/loader/elf.h b/src/core/loader/elf.h deleted file mode 100644 index acd33dc3d..000000000 --- a/src/core/loader/elf.h +++ /dev/null | |||
| @@ -1,36 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: 2013 Dolphin Emulator Project | ||
| 2 | // SPDX-FileCopyrightText: 2014 Citra Emulator Project | ||
| 3 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "core/loader/loader.h" | ||
| 8 | |||
| 9 | namespace Core { | ||
| 10 | class System; | ||
| 11 | } | ||
| 12 | |||
| 13 | namespace Loader { | ||
| 14 | |||
| 15 | /// Loads an ELF/AXF file | ||
| 16 | class AppLoader_ELF final : public AppLoader { | ||
| 17 | public: | ||
| 18 | explicit AppLoader_ELF(FileSys::VirtualFile file); | ||
| 19 | |||
| 20 | /** | ||
| 21 | * Identifies whether or not the given file is an ELF file. | ||
| 22 | * | ||
| 23 | * @param elf_file The file to identify. | ||
| 24 | * | ||
| 25 | * @return FileType::ELF, or FileType::Error if the file is not an ELF file. | ||
| 26 | */ | ||
| 27 | static FileType IdentifyType(const FileSys::VirtualFile& elf_file); | ||
| 28 | |||
| 29 | FileType GetFileType() const override { | ||
| 30 | return IdentifyType(file); | ||
| 31 | } | ||
| 32 | |||
| 33 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; | ||
| 34 | }; | ||
| 35 | |||
| 36 | } // namespace Loader | ||
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index 994ee891f..104d16efa 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | #include "core/core.h" | 12 | #include "core/core.h" |
| 13 | #include "core/hle/kernel/k_process.h" | 13 | #include "core/hle/kernel/k_process.h" |
| 14 | #include "core/loader/deconstructed_rom_directory.h" | 14 | #include "core/loader/deconstructed_rom_directory.h" |
| 15 | #include "core/loader/elf.h" | ||
| 16 | #include "core/loader/kip.h" | 15 | #include "core/loader/kip.h" |
| 17 | #include "core/loader/nax.h" | 16 | #include "core/loader/nax.h" |
| 18 | #include "core/loader/nca.h" | 17 | #include "core/loader/nca.h" |
| @@ -39,8 +38,6 @@ std::optional<FileType> IdentifyFileLoader(FileSys::VirtualFile file) { | |||
| 39 | FileType IdentifyFile(FileSys::VirtualFile file) { | 38 | FileType IdentifyFile(FileSys::VirtualFile file) { |
| 40 | if (const auto romdir_type = IdentifyFileLoader<AppLoader_DeconstructedRomDirectory>(file)) { | 39 | if (const auto romdir_type = IdentifyFileLoader<AppLoader_DeconstructedRomDirectory>(file)) { |
| 41 | return *romdir_type; | 40 | return *romdir_type; |
| 42 | } else if (const auto elf_type = IdentifyFileLoader<AppLoader_ELF>(file)) { | ||
| 43 | return *elf_type; | ||
| 44 | } else if (const auto nso_type = IdentifyFileLoader<AppLoader_NSO>(file)) { | 41 | } else if (const auto nso_type = IdentifyFileLoader<AppLoader_NSO>(file)) { |
| 45 | return *nso_type; | 42 | return *nso_type; |
| 46 | } else if (const auto nro_type = IdentifyFileLoader<AppLoader_NRO>(file)) { | 43 | } else if (const auto nro_type = IdentifyFileLoader<AppLoader_NRO>(file)) { |
| @@ -69,8 +66,6 @@ FileType GuessFromFilename(const std::string& name) { | |||
| 69 | const std::string extension = | 66 | const std::string extension = |
| 70 | Common::ToLower(std::string(Common::FS::GetExtensionFromFilename(name))); | 67 | Common::ToLower(std::string(Common::FS::GetExtensionFromFilename(name))); |
| 71 | 68 | ||
| 72 | if (extension == "elf") | ||
| 73 | return FileType::ELF; | ||
| 74 | if (extension == "nro") | 69 | if (extension == "nro") |
| 75 | return FileType::NRO; | 70 | return FileType::NRO; |
| 76 | if (extension == "nso") | 71 | if (extension == "nso") |
| @@ -89,8 +84,6 @@ FileType GuessFromFilename(const std::string& name) { | |||
| 89 | 84 | ||
| 90 | std::string GetFileTypeString(FileType type) { | 85 | std::string GetFileTypeString(FileType type) { |
| 91 | switch (type) { | 86 | switch (type) { |
| 92 | case FileType::ELF: | ||
| 93 | return "ELF"; | ||
| 94 | case FileType::NRO: | 87 | case FileType::NRO: |
| 95 | return "NRO"; | 88 | return "NRO"; |
| 96 | case FileType::NSO: | 89 | case FileType::NSO: |
| @@ -208,10 +201,6 @@ static std::unique_ptr<AppLoader> GetFileLoader(Core::System& system, FileSys::V | |||
| 208 | FileType type, u64 program_id, | 201 | FileType type, u64 program_id, |
| 209 | std::size_t program_index) { | 202 | std::size_t program_index) { |
| 210 | switch (type) { | 203 | switch (type) { |
| 211 | // Standard ELF file format. | ||
| 212 | case FileType::ELF: | ||
| 213 | return std::make_unique<AppLoader_ELF>(std::move(file)); | ||
| 214 | |||
| 215 | // NX NSO file format. | 204 | // NX NSO file format. |
| 216 | case FileType::NSO: | 205 | case FileType::NSO: |
| 217 | return std::make_unique<AppLoader_NSO>(std::move(file)); | 206 | return std::make_unique<AppLoader_NSO>(std::move(file)); |
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 7bf4faaf1..7b43f70ed 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h | |||
| @@ -34,7 +34,6 @@ namespace Loader { | |||
| 34 | enum class FileType { | 34 | enum class FileType { |
| 35 | Error, | 35 | Error, |
| 36 | Unknown, | 36 | Unknown, |
| 37 | ELF, | ||
| 38 | NSO, | 37 | NSO, |
| 39 | NRO, | 38 | NRO, |
| 40 | NCA, | 39 | NCA, |
diff --git a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp index d4a49ea99..98dd9035a 100644 --- a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp | |||
| @@ -1306,7 +1306,7 @@ void EmitContext::DefineInputs(const IR::Program& program) { | |||
| 1306 | subgroup_mask_gt = DefineInput(*this, U32[4], false, spv::BuiltIn::SubgroupGtMaskKHR); | 1306 | subgroup_mask_gt = DefineInput(*this, U32[4], false, spv::BuiltIn::SubgroupGtMaskKHR); |
| 1307 | subgroup_mask_ge = DefineInput(*this, U32[4], false, spv::BuiltIn::SubgroupGeMaskKHR); | 1307 | subgroup_mask_ge = DefineInput(*this, U32[4], false, spv::BuiltIn::SubgroupGeMaskKHR); |
| 1308 | } | 1308 | } |
| 1309 | if (info.uses_subgroup_invocation_id || info.uses_subgroup_shuffles || | 1309 | if (info.uses_fswzadd || info.uses_subgroup_invocation_id || info.uses_subgroup_shuffles || |
| 1310 | (profile.warp_size_potentially_larger_than_guest && | 1310 | (profile.warp_size_potentially_larger_than_guest && |
| 1311 | (info.uses_subgroup_vote || info.uses_subgroup_mask))) { | 1311 | (info.uses_subgroup_vote || info.uses_subgroup_mask))) { |
| 1312 | subgroup_local_invocation_id = | 1312 | subgroup_local_invocation_id = |
| @@ -1411,7 +1411,8 @@ void EmitContext::DefineInputs(const IR::Program& program) { | |||
| 1411 | void EmitContext::DefineOutputs(const IR::Program& program) { | 1411 | void EmitContext::DefineOutputs(const IR::Program& program) { |
| 1412 | const Info& info{program.info}; | 1412 | const Info& info{program.info}; |
| 1413 | const std::optional<u32> invocations{program.invocations}; | 1413 | const std::optional<u32> invocations{program.invocations}; |
| 1414 | if (info.stores.AnyComponent(IR::Attribute::PositionX) || stage == Stage::VertexB) { | 1414 | if (runtime_info.convert_depth_mode || info.stores.AnyComponent(IR::Attribute::PositionX) || |
| 1415 | stage == Stage::VertexB) { | ||
| 1415 | output_position = DefineOutput(*this, F32[4], invocations, spv::BuiltIn::Position); | 1416 | output_position = DefineOutput(*this, F32[4], invocations, spv::BuiltIn::Position); |
| 1416 | } | 1417 | } |
| 1417 | if (info.stores[IR::Attribute::PointSize] || runtime_info.fixed_state_point_size) { | 1418 | if (info.stores[IR::Attribute::PointSize] || runtime_info.fixed_state_point_size) { |
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index 07d4b7cf0..1ad56d9e7 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp | |||
| @@ -299,7 +299,7 @@ void ShaderCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading, | |||
| 299 | state.has_loaded = true; | 299 | state.has_loaded = true; |
| 300 | lock.unlock(); | 300 | lock.unlock(); |
| 301 | 301 | ||
| 302 | workers->WaitForRequests(); | 302 | workers->WaitForRequests(stop_loading); |
| 303 | if (!use_asynchronous_shaders) { | 303 | if (!use_asynchronous_shaders) { |
| 304 | workers.reset(); | 304 | workers.reset(); |
| 305 | } | 305 | } |
diff --git a/src/video_core/renderer_opengl/gl_shader_util.cpp b/src/video_core/renderer_opengl/gl_shader_util.cpp index f83ad0a5b..a0d9d10ef 100644 --- a/src/video_core/renderer_opengl/gl_shader_util.cpp +++ b/src/video_core/renderer_opengl/gl_shader_util.cpp | |||
| @@ -17,6 +17,7 @@ static OGLProgram LinkSeparableProgram(GLuint shader) { | |||
| 17 | glProgramParameteri(program.handle, GL_PROGRAM_SEPARABLE, GL_TRUE); | 17 | glProgramParameteri(program.handle, GL_PROGRAM_SEPARABLE, GL_TRUE); |
| 18 | glAttachShader(program.handle, shader); | 18 | glAttachShader(program.handle, shader); |
| 19 | glLinkProgram(program.handle); | 19 | glLinkProgram(program.handle); |
| 20 | glDetachShader(program.handle, shader); | ||
| 20 | if (!Settings::values.renderer_debug) { | 21 | if (!Settings::values.renderer_debug) { |
| 21 | return program; | 22 | return program; |
| 22 | } | 23 | } |
diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp index 689164a6a..7d1431b6d 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp | |||
| @@ -317,195 +317,204 @@ VkPrimitiveTopology PrimitiveTopology([[maybe_unused]] const Device& device, | |||
| 317 | } | 317 | } |
| 318 | } | 318 | } |
| 319 | 319 | ||
| 320 | VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttribute::Size size) { | 320 | VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type, |
| 321 | switch (type) { | 321 | Maxwell::VertexAttribute::Size size) { |
| 322 | case Maxwell::VertexAttribute::Type::UnsignedNorm: | 322 | const VkFormat format{([&]() { |
| 323 | switch (size) { | 323 | switch (type) { |
| 324 | case Maxwell::VertexAttribute::Size::Size_8: | 324 | case Maxwell::VertexAttribute::Type::UnsignedNorm: |
| 325 | return VK_FORMAT_R8_UNORM; | 325 | switch (size) { |
| 326 | case Maxwell::VertexAttribute::Size::Size_8_8: | 326 | case Maxwell::VertexAttribute::Size::Size_8: |
| 327 | return VK_FORMAT_R8G8_UNORM; | 327 | return VK_FORMAT_R8_UNORM; |
| 328 | case Maxwell::VertexAttribute::Size::Size_8_8_8: | 328 | case Maxwell::VertexAttribute::Size::Size_8_8: |
| 329 | return VK_FORMAT_R8G8B8_UNORM; | 329 | return VK_FORMAT_R8G8_UNORM; |
| 330 | case Maxwell::VertexAttribute::Size::Size_8_8_8_8: | 330 | case Maxwell::VertexAttribute::Size::Size_8_8_8: |
| 331 | return VK_FORMAT_R8G8B8A8_UNORM; | 331 | return VK_FORMAT_R8G8B8_UNORM; |
| 332 | case Maxwell::VertexAttribute::Size::Size_16: | 332 | case Maxwell::VertexAttribute::Size::Size_8_8_8_8: |
| 333 | return VK_FORMAT_R16_UNORM; | 333 | return VK_FORMAT_R8G8B8A8_UNORM; |
| 334 | case Maxwell::VertexAttribute::Size::Size_16_16: | 334 | case Maxwell::VertexAttribute::Size::Size_16: |
| 335 | return VK_FORMAT_R16G16_UNORM; | 335 | return VK_FORMAT_R16_UNORM; |
| 336 | case Maxwell::VertexAttribute::Size::Size_16_16_16: | 336 | case Maxwell::VertexAttribute::Size::Size_16_16: |
| 337 | return VK_FORMAT_R16G16B16_UNORM; | 337 | return VK_FORMAT_R16G16_UNORM; |
| 338 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: | 338 | case Maxwell::VertexAttribute::Size::Size_16_16_16: |
| 339 | return VK_FORMAT_R16G16B16A16_UNORM; | 339 | return VK_FORMAT_R16G16B16_UNORM; |
| 340 | case Maxwell::VertexAttribute::Size::Size_10_10_10_2: | 340 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: |
| 341 | return VK_FORMAT_A2B10G10R10_UNORM_PACK32; | 341 | return VK_FORMAT_R16G16B16A16_UNORM; |
| 342 | default: | 342 | case Maxwell::VertexAttribute::Size::Size_10_10_10_2: |
| 343 | return VK_FORMAT_A2B10G10R10_UNORM_PACK32; | ||
| 344 | default: | ||
| 345 | break; | ||
| 346 | } | ||
| 343 | break; | 347 | break; |
| 344 | } | 348 | case Maxwell::VertexAttribute::Type::SignedNorm: |
| 345 | break; | 349 | switch (size) { |
| 346 | case Maxwell::VertexAttribute::Type::SignedNorm: | 350 | case Maxwell::VertexAttribute::Size::Size_8: |
| 347 | switch (size) { | 351 | return VK_FORMAT_R8_SNORM; |
| 348 | case Maxwell::VertexAttribute::Size::Size_8: | 352 | case Maxwell::VertexAttribute::Size::Size_8_8: |
| 349 | return VK_FORMAT_R8_SNORM; | 353 | return VK_FORMAT_R8G8_SNORM; |
| 350 | case Maxwell::VertexAttribute::Size::Size_8_8: | 354 | case Maxwell::VertexAttribute::Size::Size_8_8_8: |
| 351 | return VK_FORMAT_R8G8_SNORM; | 355 | return VK_FORMAT_R8G8B8_SNORM; |
| 352 | case Maxwell::VertexAttribute::Size::Size_8_8_8: | 356 | case Maxwell::VertexAttribute::Size::Size_8_8_8_8: |
| 353 | return VK_FORMAT_R8G8B8_SNORM; | 357 | return VK_FORMAT_R8G8B8A8_SNORM; |
| 354 | case Maxwell::VertexAttribute::Size::Size_8_8_8_8: | 358 | case Maxwell::VertexAttribute::Size::Size_16: |
| 355 | return VK_FORMAT_R8G8B8A8_SNORM; | 359 | return VK_FORMAT_R16_SNORM; |
| 356 | case Maxwell::VertexAttribute::Size::Size_16: | 360 | case Maxwell::VertexAttribute::Size::Size_16_16: |
| 357 | return VK_FORMAT_R16_SNORM; | 361 | return VK_FORMAT_R16G16_SNORM; |
| 358 | case Maxwell::VertexAttribute::Size::Size_16_16: | 362 | case Maxwell::VertexAttribute::Size::Size_16_16_16: |
| 359 | return VK_FORMAT_R16G16_SNORM; | 363 | return VK_FORMAT_R16G16B16_SNORM; |
| 360 | case Maxwell::VertexAttribute::Size::Size_16_16_16: | 364 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: |
| 361 | return VK_FORMAT_R16G16B16_SNORM; | 365 | return VK_FORMAT_R16G16B16A16_SNORM; |
| 362 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: | 366 | case Maxwell::VertexAttribute::Size::Size_10_10_10_2: |
| 363 | return VK_FORMAT_R16G16B16A16_SNORM; | 367 | return VK_FORMAT_A2B10G10R10_SNORM_PACK32; |
| 364 | case Maxwell::VertexAttribute::Size::Size_10_10_10_2: | 368 | default: |
| 365 | return VK_FORMAT_A2B10G10R10_SNORM_PACK32; | 369 | break; |
| 366 | default: | 370 | } |
| 367 | break; | 371 | break; |
| 368 | } | 372 | case Maxwell::VertexAttribute::Type::UnsignedScaled: |
| 369 | break; | 373 | switch (size) { |
| 370 | case Maxwell::VertexAttribute::Type::UnsignedScaled: | 374 | case Maxwell::VertexAttribute::Size::Size_8: |
| 371 | switch (size) { | 375 | return VK_FORMAT_R8_USCALED; |
| 372 | case Maxwell::VertexAttribute::Size::Size_8: | 376 | case Maxwell::VertexAttribute::Size::Size_8_8: |
| 373 | return VK_FORMAT_R8_USCALED; | 377 | return VK_FORMAT_R8G8_USCALED; |
| 374 | case Maxwell::VertexAttribute::Size::Size_8_8: | 378 | case Maxwell::VertexAttribute::Size::Size_8_8_8: |
| 375 | return VK_FORMAT_R8G8_USCALED; | 379 | return VK_FORMAT_R8G8B8_USCALED; |
| 376 | case Maxwell::VertexAttribute::Size::Size_8_8_8: | 380 | case Maxwell::VertexAttribute::Size::Size_8_8_8_8: |
| 377 | return VK_FORMAT_R8G8B8_USCALED; | 381 | return VK_FORMAT_R8G8B8A8_USCALED; |
| 378 | case Maxwell::VertexAttribute::Size::Size_8_8_8_8: | 382 | case Maxwell::VertexAttribute::Size::Size_16: |
| 379 | return VK_FORMAT_R8G8B8A8_USCALED; | 383 | return VK_FORMAT_R16_USCALED; |
| 380 | case Maxwell::VertexAttribute::Size::Size_16: | 384 | case Maxwell::VertexAttribute::Size::Size_16_16: |
| 381 | return VK_FORMAT_R16_USCALED; | 385 | return VK_FORMAT_R16G16_USCALED; |
| 382 | case Maxwell::VertexAttribute::Size::Size_16_16: | 386 | case Maxwell::VertexAttribute::Size::Size_16_16_16: |
| 383 | return VK_FORMAT_R16G16_USCALED; | 387 | return VK_FORMAT_R16G16B16_USCALED; |
| 384 | case Maxwell::VertexAttribute::Size::Size_16_16_16: | 388 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: |
| 385 | return VK_FORMAT_R16G16B16_USCALED; | 389 | return VK_FORMAT_R16G16B16A16_USCALED; |
| 386 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: | 390 | case Maxwell::VertexAttribute::Size::Size_10_10_10_2: |
| 387 | return VK_FORMAT_R16G16B16A16_USCALED; | 391 | return VK_FORMAT_A2B10G10R10_USCALED_PACK32; |
| 388 | case Maxwell::VertexAttribute::Size::Size_10_10_10_2: | 392 | default: |
| 389 | return VK_FORMAT_A2B10G10R10_USCALED_PACK32; | 393 | break; |
| 390 | default: | 394 | } |
| 391 | break; | 395 | break; |
| 392 | } | 396 | case Maxwell::VertexAttribute::Type::SignedScaled: |
| 393 | break; | 397 | switch (size) { |
| 394 | case Maxwell::VertexAttribute::Type::SignedScaled: | 398 | case Maxwell::VertexAttribute::Size::Size_8: |
| 395 | switch (size) { | 399 | return VK_FORMAT_R8_SSCALED; |
| 396 | case Maxwell::VertexAttribute::Size::Size_8: | 400 | case Maxwell::VertexAttribute::Size::Size_8_8: |
| 397 | return VK_FORMAT_R8_SSCALED; | 401 | return VK_FORMAT_R8G8_SSCALED; |
| 398 | case Maxwell::VertexAttribute::Size::Size_8_8: | 402 | case Maxwell::VertexAttribute::Size::Size_8_8_8: |
| 399 | return VK_FORMAT_R8G8_SSCALED; | 403 | return VK_FORMAT_R8G8B8_SSCALED; |
| 400 | case Maxwell::VertexAttribute::Size::Size_8_8_8: | 404 | case Maxwell::VertexAttribute::Size::Size_8_8_8_8: |
| 401 | return VK_FORMAT_R8G8B8_SSCALED; | 405 | return VK_FORMAT_R8G8B8A8_SSCALED; |
| 402 | case Maxwell::VertexAttribute::Size::Size_8_8_8_8: | 406 | case Maxwell::VertexAttribute::Size::Size_16: |
| 403 | return VK_FORMAT_R8G8B8A8_SSCALED; | 407 | return VK_FORMAT_R16_SSCALED; |
| 404 | case Maxwell::VertexAttribute::Size::Size_16: | 408 | case Maxwell::VertexAttribute::Size::Size_16_16: |
| 405 | return VK_FORMAT_R16_SSCALED; | 409 | return VK_FORMAT_R16G16_SSCALED; |
| 406 | case Maxwell::VertexAttribute::Size::Size_16_16: | 410 | case Maxwell::VertexAttribute::Size::Size_16_16_16: |
| 407 | return VK_FORMAT_R16G16_SSCALED; | 411 | return VK_FORMAT_R16G16B16_SSCALED; |
| 408 | case Maxwell::VertexAttribute::Size::Size_16_16_16: | 412 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: |
| 409 | return VK_FORMAT_R16G16B16_SSCALED; | 413 | return VK_FORMAT_R16G16B16A16_SSCALED; |
| 410 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: | 414 | case Maxwell::VertexAttribute::Size::Size_10_10_10_2: |
| 411 | return VK_FORMAT_R16G16B16A16_SSCALED; | 415 | return VK_FORMAT_A2B10G10R10_SSCALED_PACK32; |
| 412 | case Maxwell::VertexAttribute::Size::Size_10_10_10_2: | 416 | default: |
| 413 | return VK_FORMAT_A2B10G10R10_SSCALED_PACK32; | 417 | break; |
| 414 | default: | 418 | } |
| 415 | break; | 419 | break; |
| 416 | } | 420 | case Maxwell::VertexAttribute::Type::UnsignedInt: |
| 417 | break; | 421 | switch (size) { |
| 418 | case Maxwell::VertexAttribute::Type::UnsignedInt: | 422 | case Maxwell::VertexAttribute::Size::Size_8: |
| 419 | switch (size) { | 423 | return VK_FORMAT_R8_UINT; |
| 420 | case Maxwell::VertexAttribute::Size::Size_8: | 424 | case Maxwell::VertexAttribute::Size::Size_8_8: |
| 421 | return VK_FORMAT_R8_UINT; | 425 | return VK_FORMAT_R8G8_UINT; |
| 422 | case Maxwell::VertexAttribute::Size::Size_8_8: | 426 | case Maxwell::VertexAttribute::Size::Size_8_8_8: |
| 423 | return VK_FORMAT_R8G8_UINT; | 427 | return VK_FORMAT_R8G8B8_UINT; |
| 424 | case Maxwell::VertexAttribute::Size::Size_8_8_8: | 428 | case Maxwell::VertexAttribute::Size::Size_8_8_8_8: |
| 425 | return VK_FORMAT_R8G8B8_UINT; | 429 | return VK_FORMAT_R8G8B8A8_UINT; |
| 426 | case Maxwell::VertexAttribute::Size::Size_8_8_8_8: | 430 | case Maxwell::VertexAttribute::Size::Size_16: |
| 427 | return VK_FORMAT_R8G8B8A8_UINT; | 431 | return VK_FORMAT_R16_UINT; |
| 428 | case Maxwell::VertexAttribute::Size::Size_16: | 432 | case Maxwell::VertexAttribute::Size::Size_16_16: |
| 429 | return VK_FORMAT_R16_UINT; | 433 | return VK_FORMAT_R16G16_UINT; |
| 430 | case Maxwell::VertexAttribute::Size::Size_16_16: | 434 | case Maxwell::VertexAttribute::Size::Size_16_16_16: |
| 431 | return VK_FORMAT_R16G16_UINT; | 435 | return VK_FORMAT_R16G16B16_UINT; |
| 432 | case Maxwell::VertexAttribute::Size::Size_16_16_16: | 436 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: |
| 433 | return VK_FORMAT_R16G16B16_UINT; | 437 | return VK_FORMAT_R16G16B16A16_UINT; |
| 434 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: | 438 | case Maxwell::VertexAttribute::Size::Size_32: |
| 435 | return VK_FORMAT_R16G16B16A16_UINT; | 439 | return VK_FORMAT_R32_UINT; |
| 436 | case Maxwell::VertexAttribute::Size::Size_32: | 440 | case Maxwell::VertexAttribute::Size::Size_32_32: |
| 437 | return VK_FORMAT_R32_UINT; | 441 | return VK_FORMAT_R32G32_UINT; |
| 438 | case Maxwell::VertexAttribute::Size::Size_32_32: | 442 | case Maxwell::VertexAttribute::Size::Size_32_32_32: |
| 439 | return VK_FORMAT_R32G32_UINT; | 443 | return VK_FORMAT_R32G32B32_UINT; |
| 440 | case Maxwell::VertexAttribute::Size::Size_32_32_32: | 444 | case Maxwell::VertexAttribute::Size::Size_32_32_32_32: |
| 441 | return VK_FORMAT_R32G32B32_UINT; | 445 | return VK_FORMAT_R32G32B32A32_UINT; |
| 442 | case Maxwell::VertexAttribute::Size::Size_32_32_32_32: | 446 | case Maxwell::VertexAttribute::Size::Size_10_10_10_2: |
| 443 | return VK_FORMAT_R32G32B32A32_UINT; | 447 | return VK_FORMAT_A2B10G10R10_UINT_PACK32; |
| 444 | case Maxwell::VertexAttribute::Size::Size_10_10_10_2: | 448 | default: |
| 445 | return VK_FORMAT_A2B10G10R10_UINT_PACK32; | 449 | break; |
| 446 | default: | 450 | } |
| 447 | break; | 451 | break; |
| 448 | } | 452 | case Maxwell::VertexAttribute::Type::SignedInt: |
| 449 | break; | 453 | switch (size) { |
| 450 | case Maxwell::VertexAttribute::Type::SignedInt: | 454 | case Maxwell::VertexAttribute::Size::Size_8: |
| 451 | switch (size) { | 455 | return VK_FORMAT_R8_SINT; |
| 452 | case Maxwell::VertexAttribute::Size::Size_8: | 456 | case Maxwell::VertexAttribute::Size::Size_8_8: |
| 453 | return VK_FORMAT_R8_SINT; | 457 | return VK_FORMAT_R8G8_SINT; |
| 454 | case Maxwell::VertexAttribute::Size::Size_8_8: | 458 | case Maxwell::VertexAttribute::Size::Size_8_8_8: |
| 455 | return VK_FORMAT_R8G8_SINT; | 459 | return VK_FORMAT_R8G8B8_SINT; |
| 456 | case Maxwell::VertexAttribute::Size::Size_8_8_8: | 460 | case Maxwell::VertexAttribute::Size::Size_8_8_8_8: |
| 457 | return VK_FORMAT_R8G8B8_SINT; | 461 | return VK_FORMAT_R8G8B8A8_SINT; |
| 458 | case Maxwell::VertexAttribute::Size::Size_8_8_8_8: | 462 | case Maxwell::VertexAttribute::Size::Size_16: |
| 459 | return VK_FORMAT_R8G8B8A8_SINT; | 463 | return VK_FORMAT_R16_SINT; |
| 460 | case Maxwell::VertexAttribute::Size::Size_16: | 464 | case Maxwell::VertexAttribute::Size::Size_16_16: |
| 461 | return VK_FORMAT_R16_SINT; | 465 | return VK_FORMAT_R16G16_SINT; |
| 462 | case Maxwell::VertexAttribute::Size::Size_16_16: | 466 | case Maxwell::VertexAttribute::Size::Size_16_16_16: |
| 463 | return VK_FORMAT_R16G16_SINT; | 467 | return VK_FORMAT_R16G16B16_SINT; |
| 464 | case Maxwell::VertexAttribute::Size::Size_16_16_16: | 468 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: |
| 465 | return VK_FORMAT_R16G16B16_SINT; | 469 | return VK_FORMAT_R16G16B16A16_SINT; |
| 466 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: | 470 | case Maxwell::VertexAttribute::Size::Size_32: |
| 467 | return VK_FORMAT_R16G16B16A16_SINT; | 471 | return VK_FORMAT_R32_SINT; |
| 468 | case Maxwell::VertexAttribute::Size::Size_32: | 472 | case Maxwell::VertexAttribute::Size::Size_32_32: |
| 469 | return VK_FORMAT_R32_SINT; | 473 | return VK_FORMAT_R32G32_SINT; |
| 470 | case Maxwell::VertexAttribute::Size::Size_32_32: | 474 | case Maxwell::VertexAttribute::Size::Size_32_32_32: |
| 471 | return VK_FORMAT_R32G32_SINT; | 475 | return VK_FORMAT_R32G32B32_SINT; |
| 472 | case Maxwell::VertexAttribute::Size::Size_32_32_32: | 476 | case Maxwell::VertexAttribute::Size::Size_32_32_32_32: |
| 473 | return VK_FORMAT_R32G32B32_SINT; | 477 | return VK_FORMAT_R32G32B32A32_SINT; |
| 474 | case Maxwell::VertexAttribute::Size::Size_32_32_32_32: | 478 | case Maxwell::VertexAttribute::Size::Size_10_10_10_2: |
| 475 | return VK_FORMAT_R32G32B32A32_SINT; | 479 | return VK_FORMAT_A2B10G10R10_SINT_PACK32; |
| 476 | case Maxwell::VertexAttribute::Size::Size_10_10_10_2: | 480 | default: |
| 477 | return VK_FORMAT_A2B10G10R10_SINT_PACK32; | 481 | break; |
| 478 | default: | 482 | } |
| 479 | break; | 483 | break; |
| 480 | } | 484 | case Maxwell::VertexAttribute::Type::Float: |
| 481 | break; | 485 | switch (size) { |
| 482 | case Maxwell::VertexAttribute::Type::Float: | 486 | case Maxwell::VertexAttribute::Size::Size_16: |
| 483 | switch (size) { | 487 | return VK_FORMAT_R16_SFLOAT; |
| 484 | case Maxwell::VertexAttribute::Size::Size_16: | 488 | case Maxwell::VertexAttribute::Size::Size_16_16: |
| 485 | return VK_FORMAT_R16_SFLOAT; | 489 | return VK_FORMAT_R16G16_SFLOAT; |
| 486 | case Maxwell::VertexAttribute::Size::Size_16_16: | 490 | case Maxwell::VertexAttribute::Size::Size_16_16_16: |
| 487 | return VK_FORMAT_R16G16_SFLOAT; | 491 | return VK_FORMAT_R16G16B16_SFLOAT; |
| 488 | case Maxwell::VertexAttribute::Size::Size_16_16_16: | 492 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: |
| 489 | return VK_FORMAT_R16G16B16_SFLOAT; | 493 | return VK_FORMAT_R16G16B16A16_SFLOAT; |
| 490 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: | 494 | case Maxwell::VertexAttribute::Size::Size_32: |
| 491 | return VK_FORMAT_R16G16B16A16_SFLOAT; | 495 | return VK_FORMAT_R32_SFLOAT; |
| 492 | case Maxwell::VertexAttribute::Size::Size_32: | 496 | case Maxwell::VertexAttribute::Size::Size_32_32: |
| 493 | return VK_FORMAT_R32_SFLOAT; | 497 | return VK_FORMAT_R32G32_SFLOAT; |
| 494 | case Maxwell::VertexAttribute::Size::Size_32_32: | 498 | case Maxwell::VertexAttribute::Size::Size_32_32_32: |
| 495 | return VK_FORMAT_R32G32_SFLOAT; | 499 | return VK_FORMAT_R32G32B32_SFLOAT; |
| 496 | case Maxwell::VertexAttribute::Size::Size_32_32_32: | 500 | case Maxwell::VertexAttribute::Size::Size_32_32_32_32: |
| 497 | return VK_FORMAT_R32G32B32_SFLOAT; | 501 | return VK_FORMAT_R32G32B32A32_SFLOAT; |
| 498 | case Maxwell::VertexAttribute::Size::Size_32_32_32_32: | 502 | case Maxwell::VertexAttribute::Size::Size_11_11_10: |
| 499 | return VK_FORMAT_R32G32B32A32_SFLOAT; | 503 | return VK_FORMAT_B10G11R11_UFLOAT_PACK32; |
| 500 | case Maxwell::VertexAttribute::Size::Size_11_11_10: | 504 | default: |
| 501 | return VK_FORMAT_B10G11R11_UFLOAT_PACK32; | 505 | break; |
| 502 | default: | 506 | } |
| 503 | break; | 507 | break; |
| 504 | } | 508 | } |
| 505 | break; | 509 | return VK_FORMAT_UNDEFINED; |
| 510 | })()}; | ||
| 511 | |||
| 512 | if (format == VK_FORMAT_UNDEFINED) { | ||
| 513 | UNIMPLEMENTED_MSG("Unimplemented vertex format of type={} and size={}", type, size); | ||
| 506 | } | 514 | } |
| 507 | UNIMPLEMENTED_MSG("Unimplemented vertex format of type={} and size={}", type, size); | 515 | |
| 508 | return {}; | 516 | return device.GetSupportedFormat(format, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT, |
| 517 | FormatType::Buffer); | ||
| 509 | } | 518 | } |
| 510 | 519 | ||
| 511 | VkCompareOp ComparisonOp(Maxwell::ComparisonOp comparison) { | 520 | VkCompareOp ComparisonOp(Maxwell::ComparisonOp comparison) { |
diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.h b/src/video_core/renderer_vulkan/maxwell_to_vk.h index 9edd6af6a..356d46292 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.h +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.h | |||
| @@ -48,7 +48,8 @@ VkShaderStageFlagBits ShaderStage(Shader::Stage stage); | |||
| 48 | 48 | ||
| 49 | VkPrimitiveTopology PrimitiveTopology(const Device& device, Maxwell::PrimitiveTopology topology); | 49 | VkPrimitiveTopology PrimitiveTopology(const Device& device, Maxwell::PrimitiveTopology topology); |
| 50 | 50 | ||
| 51 | VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttribute::Size size); | 51 | VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type, |
| 52 | Maxwell::VertexAttribute::Size size); | ||
| 52 | 53 | ||
| 53 | VkCompareOp ComparisonOp(Maxwell::ComparisonOp comparison); | 54 | VkCompareOp ComparisonOp(Maxwell::ComparisonOp comparison); |
| 54 | 55 | ||
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp index 4a1d96322..27e6ebf94 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp +++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp | |||
| @@ -87,12 +87,8 @@ u32 GetBytesPerPixel(const Tegra::FramebufferConfig& framebuffer) { | |||
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | std::size_t GetSizeInBytes(const Tegra::FramebufferConfig& framebuffer) { | 89 | std::size_t GetSizeInBytes(const Tegra::FramebufferConfig& framebuffer) { |
| 90 | // TODO(Rodrigo): Read this from HLE | 90 | return static_cast<std::size_t>(framebuffer.stride) * |
| 91 | constexpr u32 block_height_log2 = 4; | 91 | static_cast<std::size_t>(framebuffer.height) * GetBytesPerPixel(framebuffer); |
| 92 | const u32 bytes_per_pixel = GetBytesPerPixel(framebuffer); | ||
| 93 | const u64 size_bytes{Tegra::Texture::CalculateSize( | ||
| 94 | true, bytes_per_pixel, framebuffer.stride, framebuffer.height, 1, block_height_log2, 0)}; | ||
| 95 | return size_bytes; | ||
| 96 | } | 92 | } |
| 97 | 93 | ||
| 98 | VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) { | 94 | VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) { |
| @@ -173,10 +169,12 @@ VkSemaphore BlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer, | |||
| 173 | // TODO(Rodrigo): Read this from HLE | 169 | // TODO(Rodrigo): Read this from HLE |
| 174 | constexpr u32 block_height_log2 = 4; | 170 | constexpr u32 block_height_log2 = 4; |
| 175 | const u32 bytes_per_pixel = GetBytesPerPixel(framebuffer); | 171 | const u32 bytes_per_pixel = GetBytesPerPixel(framebuffer); |
| 176 | const u64 size_bytes{GetSizeInBytes(framebuffer)}; | 172 | const u64 linear_size{GetSizeInBytes(framebuffer)}; |
| 177 | 173 | const u64 tiled_size{Tegra::Texture::CalculateSize(true, bytes_per_pixel, | |
| 174 | framebuffer.stride, framebuffer.height, | ||
| 175 | 1, block_height_log2, 0)}; | ||
| 178 | Tegra::Texture::UnswizzleTexture( | 176 | Tegra::Texture::UnswizzleTexture( |
| 179 | mapped_span.subspan(image_offset, size_bytes), std::span(host_ptr, size_bytes), | 177 | mapped_span.subspan(image_offset, linear_size), std::span(host_ptr, tiled_size), |
| 180 | bytes_per_pixel, framebuffer.width, framebuffer.height, 1, block_height_log2, 0); | 178 | bytes_per_pixel, framebuffer.width, framebuffer.height, 1, block_height_log2, 0); |
| 181 | 179 | ||
| 182 | const VkBufferImageCopy copy{ | 180 | const VkBufferImageCopy copy{ |
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 682f05335..5aca8f038 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |||
| @@ -559,7 +559,7 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { | |||
| 559 | vertex_attributes.push_back({ | 559 | vertex_attributes.push_back({ |
| 560 | .location = static_cast<u32>(index), | 560 | .location = static_cast<u32>(index), |
| 561 | .binding = attribute.buffer, | 561 | .binding = attribute.buffer, |
| 562 | .format = MaxwellToVK::VertexFormat(attribute.Type(), attribute.Size()), | 562 | .format = MaxwellToVK::VertexFormat(device, attribute.Type(), attribute.Size()), |
| 563 | .offset = attribute.offset, | 563 | .offset = attribute.offset, |
| 564 | }); | 564 | }); |
| 565 | } | 565 | } |
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 09e035799..43cc94fab 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |||
| @@ -452,7 +452,7 @@ void PipelineCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading | |||
| 452 | state.has_loaded = true; | 452 | state.has_loaded = true; |
| 453 | lock.unlock(); | 453 | lock.unlock(); |
| 454 | 454 | ||
| 455 | workers.WaitForRequests(); | 455 | workers.WaitForRequests(stop_loading); |
| 456 | 456 | ||
| 457 | if (state.statistics) { | 457 | if (state.statistics) { |
| 458 | state.statistics->Report(); | 458 | state.statistics->Report(); |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 10f9fe7fe..16e46d3e5 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -939,7 +939,7 @@ void RasterizerVulkan::UpdateVertexInput(Tegra::Engines::Maxwell3D::Regs& regs) | |||
| 939 | .pNext = nullptr, | 939 | .pNext = nullptr, |
| 940 | .location = static_cast<u32>(index), | 940 | .location = static_cast<u32>(index), |
| 941 | .binding = binding, | 941 | .binding = binding, |
| 942 | .format = MaxwellToVK::VertexFormat(attribute.type, attribute.size), | 942 | .format = MaxwellToVK::VertexFormat(device, attribute.type, attribute.size), |
| 943 | .offset = attribute.offset, | 943 | .offset = attribute.offset, |
| 944 | }); | 944 | }); |
| 945 | } | 945 | } |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index ba6d81420..16463a892 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -1618,6 +1618,9 @@ ImageView::ImageView(TextureCacheRuntime&, const VideoCommon::NullImageViewParam | |||
| 1618 | ImageView::~ImageView() = default; | 1618 | ImageView::~ImageView() = default; |
| 1619 | 1619 | ||
| 1620 | VkImageView ImageView::DepthView() { | 1620 | VkImageView ImageView::DepthView() { |
| 1621 | if (!image_handle) { | ||
| 1622 | return VK_NULL_HANDLE; | ||
| 1623 | } | ||
| 1621 | if (depth_view) { | 1624 | if (depth_view) { |
| 1622 | return *depth_view; | 1625 | return *depth_view; |
| 1623 | } | 1626 | } |
| @@ -1627,6 +1630,9 @@ VkImageView ImageView::DepthView() { | |||
| 1627 | } | 1630 | } |
| 1628 | 1631 | ||
| 1629 | VkImageView ImageView::StencilView() { | 1632 | VkImageView ImageView::StencilView() { |
| 1633 | if (!image_handle) { | ||
| 1634 | return VK_NULL_HANDLE; | ||
| 1635 | } | ||
| 1630 | if (stencil_view) { | 1636 | if (stencil_view) { |
| 1631 | return *stencil_view; | 1637 | return *stencil_view; |
| 1632 | } | 1638 | } |
| @@ -1636,6 +1642,9 @@ VkImageView ImageView::StencilView() { | |||
| 1636 | } | 1642 | } |
| 1637 | 1643 | ||
| 1638 | VkImageView ImageView::ColorView() { | 1644 | VkImageView ImageView::ColorView() { |
| 1645 | if (!image_handle) { | ||
| 1646 | return VK_NULL_HANDLE; | ||
| 1647 | } | ||
| 1639 | if (color_view) { | 1648 | if (color_view) { |
| 1640 | return *color_view; | 1649 | return *color_view; |
| 1641 | } | 1650 | } |
| @@ -1645,6 +1654,9 @@ VkImageView ImageView::ColorView() { | |||
| 1645 | 1654 | ||
| 1646 | VkImageView ImageView::StorageView(Shader::TextureType texture_type, | 1655 | VkImageView ImageView::StorageView(Shader::TextureType texture_type, |
| 1647 | Shader::ImageFormat image_format) { | 1656 | Shader::ImageFormat image_format) { |
| 1657 | if (!image_handle) { | ||
| 1658 | return VK_NULL_HANDLE; | ||
| 1659 | } | ||
| 1648 | if (image_format == Shader::ImageFormat::Typeless) { | 1660 | if (image_format == Shader::ImageFormat::Typeless) { |
| 1649 | return Handle(texture_type); | 1661 | return Handle(texture_type); |
| 1650 | } | 1662 | } |
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 743ac09f6..ddecfca13 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -50,6 +50,21 @@ constexpr std::array R4G4_UNORM_PACK8{ | |||
| 50 | VK_FORMAT_UNDEFINED, | 50 | VK_FORMAT_UNDEFINED, |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | constexpr std::array R16G16B16_SFLOAT{ | ||
| 54 | VK_FORMAT_R16G16B16A16_SFLOAT, | ||
| 55 | VK_FORMAT_UNDEFINED, | ||
| 56 | }; | ||
| 57 | |||
| 58 | constexpr std::array R16G16B16_SSCALED{ | ||
| 59 | VK_FORMAT_R16G16B16A16_SSCALED, | ||
| 60 | VK_FORMAT_UNDEFINED, | ||
| 61 | }; | ||
| 62 | |||
| 63 | constexpr std::array R8G8B8_SSCALED{ | ||
| 64 | VK_FORMAT_R8G8B8A8_SSCALED, | ||
| 65 | VK_FORMAT_UNDEFINED, | ||
| 66 | }; | ||
| 67 | |||
| 53 | } // namespace Alternatives | 68 | } // namespace Alternatives |
| 54 | 69 | ||
| 55 | enum class NvidiaArchitecture { | 70 | enum class NvidiaArchitecture { |
| @@ -102,6 +117,12 @@ constexpr const VkFormat* GetFormatAlternatives(VkFormat format) { | |||
| 102 | return Alternatives::B5G6R5_UNORM_PACK16.data(); | 117 | return Alternatives::B5G6R5_UNORM_PACK16.data(); |
| 103 | case VK_FORMAT_R4G4_UNORM_PACK8: | 118 | case VK_FORMAT_R4G4_UNORM_PACK8: |
| 104 | return Alternatives::R4G4_UNORM_PACK8.data(); | 119 | return Alternatives::R4G4_UNORM_PACK8.data(); |
| 120 | case VK_FORMAT_R16G16B16_SFLOAT: | ||
| 121 | return Alternatives::R16G16B16_SFLOAT.data(); | ||
| 122 | case VK_FORMAT_R16G16B16_SSCALED: | ||
| 123 | return Alternatives::R16G16B16_SSCALED.data(); | ||
| 124 | case VK_FORMAT_R8G8B8_SSCALED: | ||
| 125 | return Alternatives::R8G8B8_SSCALED.data(); | ||
| 105 | default: | 126 | default: |
| 106 | return nullptr; | 127 | return nullptr; |
| 107 | } | 128 | } |
| @@ -122,109 +143,142 @@ VkFormatFeatureFlags GetFormatFeatures(VkFormatProperties properties, FormatType | |||
| 122 | 143 | ||
| 123 | std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(vk::PhysicalDevice physical) { | 144 | std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(vk::PhysicalDevice physical) { |
| 124 | static constexpr std::array formats{ | 145 | static constexpr std::array formats{ |
| 125 | VK_FORMAT_A8B8G8R8_UNORM_PACK32, | 146 | VK_FORMAT_A1R5G5B5_UNORM_PACK16, |
| 126 | VK_FORMAT_A8B8G8R8_UINT_PACK32, | 147 | VK_FORMAT_A2B10G10R10_SINT_PACK32, |
| 127 | VK_FORMAT_A8B8G8R8_SNORM_PACK32, | 148 | VK_FORMAT_A2B10G10R10_SNORM_PACK32, |
| 149 | VK_FORMAT_A2B10G10R10_SSCALED_PACK32, | ||
| 150 | VK_FORMAT_A2B10G10R10_UINT_PACK32, | ||
| 151 | VK_FORMAT_A2B10G10R10_UNORM_PACK32, | ||
| 152 | VK_FORMAT_A2B10G10R10_USCALED_PACK32, | ||
| 128 | VK_FORMAT_A8B8G8R8_SINT_PACK32, | 153 | VK_FORMAT_A8B8G8R8_SINT_PACK32, |
| 154 | VK_FORMAT_A8B8G8R8_SNORM_PACK32, | ||
| 129 | VK_FORMAT_A8B8G8R8_SRGB_PACK32, | 155 | VK_FORMAT_A8B8G8R8_SRGB_PACK32, |
| 130 | VK_FORMAT_R5G6B5_UNORM_PACK16, | 156 | VK_FORMAT_A8B8G8R8_UINT_PACK32, |
| 131 | VK_FORMAT_B5G6R5_UNORM_PACK16, | 157 | VK_FORMAT_A8B8G8R8_UNORM_PACK32, |
| 132 | VK_FORMAT_R5G5B5A1_UNORM_PACK16, | 158 | VK_FORMAT_ASTC_10x10_SRGB_BLOCK, |
| 159 | VK_FORMAT_ASTC_10x10_UNORM_BLOCK, | ||
| 160 | VK_FORMAT_ASTC_10x5_SRGB_BLOCK, | ||
| 161 | VK_FORMAT_ASTC_10x5_UNORM_BLOCK, | ||
| 162 | VK_FORMAT_ASTC_10x6_SRGB_BLOCK, | ||
| 163 | VK_FORMAT_ASTC_10x6_UNORM_BLOCK, | ||
| 164 | VK_FORMAT_ASTC_10x8_SRGB_BLOCK, | ||
| 165 | VK_FORMAT_ASTC_10x8_UNORM_BLOCK, | ||
| 166 | VK_FORMAT_ASTC_12x10_SRGB_BLOCK, | ||
| 167 | VK_FORMAT_ASTC_12x10_UNORM_BLOCK, | ||
| 168 | VK_FORMAT_ASTC_12x12_SRGB_BLOCK, | ||
| 169 | VK_FORMAT_ASTC_12x12_UNORM_BLOCK, | ||
| 170 | VK_FORMAT_ASTC_4x4_SRGB_BLOCK, | ||
| 171 | VK_FORMAT_ASTC_4x4_UNORM_BLOCK, | ||
| 172 | VK_FORMAT_ASTC_5x4_SRGB_BLOCK, | ||
| 173 | VK_FORMAT_ASTC_5x4_UNORM_BLOCK, | ||
| 174 | VK_FORMAT_ASTC_5x5_SRGB_BLOCK, | ||
| 175 | VK_FORMAT_ASTC_5x5_UNORM_BLOCK, | ||
| 176 | VK_FORMAT_ASTC_6x5_SRGB_BLOCK, | ||
| 177 | VK_FORMAT_ASTC_6x5_UNORM_BLOCK, | ||
| 178 | VK_FORMAT_ASTC_6x6_SRGB_BLOCK, | ||
| 179 | VK_FORMAT_ASTC_6x6_UNORM_BLOCK, | ||
| 180 | VK_FORMAT_ASTC_8x5_SRGB_BLOCK, | ||
| 181 | VK_FORMAT_ASTC_8x5_UNORM_BLOCK, | ||
| 182 | VK_FORMAT_ASTC_8x6_SRGB_BLOCK, | ||
| 183 | VK_FORMAT_ASTC_8x6_UNORM_BLOCK, | ||
| 184 | VK_FORMAT_ASTC_8x8_SRGB_BLOCK, | ||
| 185 | VK_FORMAT_ASTC_8x8_UNORM_BLOCK, | ||
| 186 | VK_FORMAT_B10G11R11_UFLOAT_PACK32, | ||
| 187 | VK_FORMAT_B4G4R4A4_UNORM_PACK16, | ||
| 133 | VK_FORMAT_B5G5R5A1_UNORM_PACK16, | 188 | VK_FORMAT_B5G5R5A1_UNORM_PACK16, |
| 134 | VK_FORMAT_A2B10G10R10_UNORM_PACK32, | 189 | VK_FORMAT_B5G6R5_UNORM_PACK16, |
| 135 | VK_FORMAT_A2B10G10R10_UINT_PACK32, | 190 | VK_FORMAT_B8G8R8A8_SRGB, |
| 136 | VK_FORMAT_A1R5G5B5_UNORM_PACK16, | 191 | VK_FORMAT_B8G8R8A8_UNORM, |
| 137 | VK_FORMAT_R32G32B32A32_SFLOAT, | 192 | VK_FORMAT_BC1_RGBA_SRGB_BLOCK, |
| 138 | VK_FORMAT_R32G32B32A32_SINT, | 193 | VK_FORMAT_BC1_RGBA_UNORM_BLOCK, |
| 139 | VK_FORMAT_R32G32B32A32_UINT, | 194 | VK_FORMAT_BC2_SRGB_BLOCK, |
| 140 | VK_FORMAT_R32G32_SFLOAT, | 195 | VK_FORMAT_BC2_UNORM_BLOCK, |
| 141 | VK_FORMAT_R32G32_SINT, | 196 | VK_FORMAT_BC3_SRGB_BLOCK, |
| 142 | VK_FORMAT_R32G32_UINT, | 197 | VK_FORMAT_BC3_UNORM_BLOCK, |
| 198 | VK_FORMAT_BC4_SNORM_BLOCK, | ||
| 199 | VK_FORMAT_BC4_UNORM_BLOCK, | ||
| 200 | VK_FORMAT_BC5_SNORM_BLOCK, | ||
| 201 | VK_FORMAT_BC5_UNORM_BLOCK, | ||
| 202 | VK_FORMAT_BC6H_SFLOAT_BLOCK, | ||
| 203 | VK_FORMAT_BC6H_UFLOAT_BLOCK, | ||
| 204 | VK_FORMAT_BC7_SRGB_BLOCK, | ||
| 205 | VK_FORMAT_BC7_UNORM_BLOCK, | ||
| 206 | VK_FORMAT_D16_UNORM, | ||
| 207 | VK_FORMAT_D16_UNORM_S8_UINT, | ||
| 208 | VK_FORMAT_D24_UNORM_S8_UINT, | ||
| 209 | VK_FORMAT_D32_SFLOAT, | ||
| 210 | VK_FORMAT_D32_SFLOAT_S8_UINT, | ||
| 211 | VK_FORMAT_E5B9G9R9_UFLOAT_PACK32, | ||
| 212 | VK_FORMAT_R16G16B16A16_SFLOAT, | ||
| 143 | VK_FORMAT_R16G16B16A16_SINT, | 213 | VK_FORMAT_R16G16B16A16_SINT, |
| 144 | VK_FORMAT_R16G16B16A16_UINT, | ||
| 145 | VK_FORMAT_R16G16B16A16_SNORM, | 214 | VK_FORMAT_R16G16B16A16_SNORM, |
| 215 | VK_FORMAT_R16G16B16A16_SSCALED, | ||
| 216 | VK_FORMAT_R16G16B16A16_UINT, | ||
| 146 | VK_FORMAT_R16G16B16A16_UNORM, | 217 | VK_FORMAT_R16G16B16A16_UNORM, |
| 147 | VK_FORMAT_R16G16_UNORM, | 218 | VK_FORMAT_R16G16B16A16_USCALED, |
| 148 | VK_FORMAT_R16G16_SNORM, | 219 | VK_FORMAT_R16G16B16_SFLOAT, |
| 220 | VK_FORMAT_R16G16B16_SINT, | ||
| 221 | VK_FORMAT_R16G16B16_SNORM, | ||
| 222 | VK_FORMAT_R16G16B16_SSCALED, | ||
| 223 | VK_FORMAT_R16G16B16_UINT, | ||
| 224 | VK_FORMAT_R16G16B16_UNORM, | ||
| 225 | VK_FORMAT_R16G16B16_USCALED, | ||
| 149 | VK_FORMAT_R16G16_SFLOAT, | 226 | VK_FORMAT_R16G16_SFLOAT, |
| 150 | VK_FORMAT_R16G16_UINT, | ||
| 151 | VK_FORMAT_R16G16_SINT, | 227 | VK_FORMAT_R16G16_SINT, |
| 152 | VK_FORMAT_R16_UNORM, | 228 | VK_FORMAT_R16G16_SNORM, |
| 229 | VK_FORMAT_R16G16_SSCALED, | ||
| 230 | VK_FORMAT_R16G16_UINT, | ||
| 231 | VK_FORMAT_R16G16_UNORM, | ||
| 232 | VK_FORMAT_R16G16_USCALED, | ||
| 233 | VK_FORMAT_R16_SFLOAT, | ||
| 234 | VK_FORMAT_R16_SINT, | ||
| 153 | VK_FORMAT_R16_SNORM, | 235 | VK_FORMAT_R16_SNORM, |
| 236 | VK_FORMAT_R16_SSCALED, | ||
| 154 | VK_FORMAT_R16_UINT, | 237 | VK_FORMAT_R16_UINT, |
| 238 | VK_FORMAT_R16_UNORM, | ||
| 239 | VK_FORMAT_R16_USCALED, | ||
| 240 | VK_FORMAT_R32G32B32A32_SFLOAT, | ||
| 241 | VK_FORMAT_R32G32B32A32_SINT, | ||
| 242 | VK_FORMAT_R32G32B32A32_UINT, | ||
| 243 | VK_FORMAT_R32G32B32_SFLOAT, | ||
| 244 | VK_FORMAT_R32G32B32_SINT, | ||
| 245 | VK_FORMAT_R32G32B32_UINT, | ||
| 246 | VK_FORMAT_R32G32_SFLOAT, | ||
| 247 | VK_FORMAT_R32G32_SINT, | ||
| 248 | VK_FORMAT_R32G32_UINT, | ||
| 249 | VK_FORMAT_R32_SFLOAT, | ||
| 250 | VK_FORMAT_R32_SINT, | ||
| 251 | VK_FORMAT_R32_UINT, | ||
| 252 | VK_FORMAT_R4G4B4A4_UNORM_PACK16, | ||
| 253 | VK_FORMAT_R4G4_UNORM_PACK8, | ||
| 254 | VK_FORMAT_R5G5B5A1_UNORM_PACK16, | ||
| 255 | VK_FORMAT_R5G6B5_UNORM_PACK16, | ||
| 256 | VK_FORMAT_R8G8B8A8_SINT, | ||
| 257 | VK_FORMAT_R8G8B8A8_SNORM, | ||
| 155 | VK_FORMAT_R8G8B8A8_SRGB, | 258 | VK_FORMAT_R8G8B8A8_SRGB, |
| 156 | VK_FORMAT_R8G8_UNORM, | 259 | VK_FORMAT_R8G8B8A8_SSCALED, |
| 157 | VK_FORMAT_R8G8_SNORM, | 260 | VK_FORMAT_R8G8B8A8_UINT, |
| 261 | VK_FORMAT_R8G8B8A8_UNORM, | ||
| 262 | VK_FORMAT_R8G8B8A8_USCALED, | ||
| 263 | VK_FORMAT_R8G8B8_SINT, | ||
| 264 | VK_FORMAT_R8G8B8_SNORM, | ||
| 265 | VK_FORMAT_R8G8B8_SSCALED, | ||
| 266 | VK_FORMAT_R8G8B8_UINT, | ||
| 267 | VK_FORMAT_R8G8B8_UNORM, | ||
| 268 | VK_FORMAT_R8G8B8_USCALED, | ||
| 158 | VK_FORMAT_R8G8_SINT, | 269 | VK_FORMAT_R8G8_SINT, |
| 270 | VK_FORMAT_R8G8_SNORM, | ||
| 271 | VK_FORMAT_R8G8_SSCALED, | ||
| 159 | VK_FORMAT_R8G8_UINT, | 272 | VK_FORMAT_R8G8_UINT, |
| 160 | VK_FORMAT_R8_UNORM, | 273 | VK_FORMAT_R8G8_UNORM, |
| 161 | VK_FORMAT_R8_SNORM, | 274 | VK_FORMAT_R8G8_USCALED, |
| 162 | VK_FORMAT_R8_SINT, | 275 | VK_FORMAT_R8_SINT, |
| 276 | VK_FORMAT_R8_SNORM, | ||
| 277 | VK_FORMAT_R8_SSCALED, | ||
| 163 | VK_FORMAT_R8_UINT, | 278 | VK_FORMAT_R8_UINT, |
| 164 | VK_FORMAT_B10G11R11_UFLOAT_PACK32, | 279 | VK_FORMAT_R8_UNORM, |
| 165 | VK_FORMAT_R32_SFLOAT, | 280 | VK_FORMAT_R8_USCALED, |
| 166 | VK_FORMAT_R32_UINT, | ||
| 167 | VK_FORMAT_R32_SINT, | ||
| 168 | VK_FORMAT_R16_SFLOAT, | ||
| 169 | VK_FORMAT_R16G16B16A16_SFLOAT, | ||
| 170 | VK_FORMAT_B8G8R8A8_UNORM, | ||
| 171 | VK_FORMAT_B8G8R8A8_SRGB, | ||
| 172 | VK_FORMAT_R4G4_UNORM_PACK8, | ||
| 173 | VK_FORMAT_R4G4B4A4_UNORM_PACK16, | ||
| 174 | VK_FORMAT_B4G4R4A4_UNORM_PACK16, | ||
| 175 | VK_FORMAT_D32_SFLOAT, | ||
| 176 | VK_FORMAT_D16_UNORM, | ||
| 177 | VK_FORMAT_S8_UINT, | 281 | VK_FORMAT_S8_UINT, |
| 178 | VK_FORMAT_D16_UNORM_S8_UINT, | ||
| 179 | VK_FORMAT_D24_UNORM_S8_UINT, | ||
| 180 | VK_FORMAT_D32_SFLOAT_S8_UINT, | ||
| 181 | VK_FORMAT_BC1_RGBA_UNORM_BLOCK, | ||
| 182 | VK_FORMAT_BC2_UNORM_BLOCK, | ||
| 183 | VK_FORMAT_BC3_UNORM_BLOCK, | ||
| 184 | VK_FORMAT_BC4_UNORM_BLOCK, | ||
| 185 | VK_FORMAT_BC4_SNORM_BLOCK, | ||
| 186 | VK_FORMAT_BC5_UNORM_BLOCK, | ||
| 187 | VK_FORMAT_BC5_SNORM_BLOCK, | ||
| 188 | VK_FORMAT_BC7_UNORM_BLOCK, | ||
| 189 | VK_FORMAT_BC6H_UFLOAT_BLOCK, | ||
| 190 | VK_FORMAT_BC6H_SFLOAT_BLOCK, | ||
| 191 | VK_FORMAT_BC1_RGBA_SRGB_BLOCK, | ||
| 192 | VK_FORMAT_BC2_SRGB_BLOCK, | ||
| 193 | VK_FORMAT_BC3_SRGB_BLOCK, | ||
| 194 | VK_FORMAT_BC7_SRGB_BLOCK, | ||
| 195 | VK_FORMAT_ASTC_4x4_UNORM_BLOCK, | ||
| 196 | VK_FORMAT_ASTC_4x4_SRGB_BLOCK, | ||
| 197 | VK_FORMAT_ASTC_5x4_UNORM_BLOCK, | ||
| 198 | VK_FORMAT_ASTC_5x4_SRGB_BLOCK, | ||
| 199 | VK_FORMAT_ASTC_5x5_UNORM_BLOCK, | ||
| 200 | VK_FORMAT_ASTC_5x5_SRGB_BLOCK, | ||
| 201 | VK_FORMAT_ASTC_6x5_UNORM_BLOCK, | ||
| 202 | VK_FORMAT_ASTC_6x5_SRGB_BLOCK, | ||
| 203 | VK_FORMAT_ASTC_6x6_UNORM_BLOCK, | ||
| 204 | VK_FORMAT_ASTC_6x6_SRGB_BLOCK, | ||
| 205 | VK_FORMAT_ASTC_8x5_UNORM_BLOCK, | ||
| 206 | VK_FORMAT_ASTC_8x5_SRGB_BLOCK, | ||
| 207 | VK_FORMAT_ASTC_8x6_UNORM_BLOCK, | ||
| 208 | VK_FORMAT_ASTC_8x6_SRGB_BLOCK, | ||
| 209 | VK_FORMAT_ASTC_8x8_UNORM_BLOCK, | ||
| 210 | VK_FORMAT_ASTC_8x8_SRGB_BLOCK, | ||
| 211 | VK_FORMAT_ASTC_10x5_UNORM_BLOCK, | ||
| 212 | VK_FORMAT_ASTC_10x5_SRGB_BLOCK, | ||
| 213 | VK_FORMAT_ASTC_10x6_UNORM_BLOCK, | ||
| 214 | VK_FORMAT_ASTC_10x6_SRGB_BLOCK, | ||
| 215 | VK_FORMAT_ASTC_10x8_UNORM_BLOCK, | ||
| 216 | VK_FORMAT_ASTC_10x8_SRGB_BLOCK, | ||
| 217 | VK_FORMAT_ASTC_10x10_UNORM_BLOCK, | ||
| 218 | VK_FORMAT_ASTC_10x10_SRGB_BLOCK, | ||
| 219 | VK_FORMAT_ASTC_12x10_UNORM_BLOCK, | ||
| 220 | VK_FORMAT_ASTC_12x10_SRGB_BLOCK, | ||
| 221 | VK_FORMAT_ASTC_12x12_UNORM_BLOCK, | ||
| 222 | VK_FORMAT_ASTC_12x12_SRGB_BLOCK, | ||
| 223 | VK_FORMAT_ASTC_8x6_UNORM_BLOCK, | ||
| 224 | VK_FORMAT_ASTC_8x6_SRGB_BLOCK, | ||
| 225 | VK_FORMAT_ASTC_6x5_UNORM_BLOCK, | ||
| 226 | VK_FORMAT_ASTC_6x5_SRGB_BLOCK, | ||
| 227 | VK_FORMAT_E5B9G9R9_UFLOAT_PACK32, | ||
| 228 | }; | 282 | }; |
| 229 | std::unordered_map<VkFormat, VkFormatProperties> format_properties; | 283 | std::unordered_map<VkFormat, VkFormatProperties> format_properties; |
| 230 | for (const auto format : formats) { | 284 | for (const auto format : formats) { |
| @@ -739,9 +793,9 @@ VkFormat Device::GetSupportedFormat(VkFormat wanted_format, VkFormatFeatureFlags | |||
| 739 | if (!IsFormatSupported(alternative, wanted_usage, format_type)) { | 793 | if (!IsFormatSupported(alternative, wanted_usage, format_type)) { |
| 740 | continue; | 794 | continue; |
| 741 | } | 795 | } |
| 742 | LOG_WARNING(Render_Vulkan, | 796 | LOG_DEBUG(Render_Vulkan, |
| 743 | "Emulating format={} with alternative format={} with usage={} and type={}", | 797 | "Emulating format={} with alternative format={} with usage={} and type={}", |
| 744 | wanted_format, alternative, wanted_usage, format_type); | 798 | wanted_format, alternative, wanted_usage, format_type); |
| 745 | return alternative; | 799 | return alternative; |
| 746 | } | 800 | } |
| 747 | 801 | ||
diff --git a/src/yuzu/applets/qt_profile_select.cpp b/src/yuzu/applets/qt_profile_select.cpp index 826c6c224..c8bcfb223 100644 --- a/src/yuzu/applets/qt_profile_select.cpp +++ b/src/yuzu/applets/qt_profile_select.cpp | |||
| @@ -100,6 +100,7 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(Core::HID::HIDCore& hid_core, | |||
| 100 | } | 100 | } |
| 101 | QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier); | 101 | QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier); |
| 102 | QCoreApplication::postEvent(tree_view, event); | 102 | QCoreApplication::postEvent(tree_view, event); |
| 103 | SelectUser(tree_view->currentIndex()); | ||
| 103 | }); | 104 | }); |
| 104 | 105 | ||
| 105 | const auto& profiles = profile_manager->GetAllUsers(); | 106 | const auto& profiles = profile_manager->GetAllUsers(); |
diff --git a/src/yuzu/loading_screen.cpp b/src/yuzu/loading_screen.cpp index e273744fd..e263a07a7 100644 --- a/src/yuzu/loading_screen.cpp +++ b/src/yuzu/loading_screen.cpp | |||
| @@ -147,6 +147,10 @@ void LoadingScreen::OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size | |||
| 147 | ui->progress_bar->setMaximum(static_cast<int>(total)); | 147 | ui->progress_bar->setMaximum(static_cast<int>(total)); |
| 148 | previous_total = total; | 148 | previous_total = total; |
| 149 | } | 149 | } |
| 150 | // Reset the progress bar ranges if compilation is done | ||
| 151 | if (stage == VideoCore::LoadCallbackStage::Complete) { | ||
| 152 | ui->progress_bar->setRange(0, 0); | ||
| 153 | } | ||
| 150 | 154 | ||
| 151 | QString estimate; | 155 | QString estimate; |
| 152 | // If theres a drastic slowdown in the rate, then display an estimate | 156 | // If theres a drastic slowdown in the rate, then display an estimate |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f8c234082..dc7b343d9 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1588,17 +1588,18 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p | |||
| 1588 | return true; | 1588 | return true; |
| 1589 | } | 1589 | } |
| 1590 | 1590 | ||
| 1591 | void GMainWindow::SelectAndSetCurrentUser() { | 1591 | bool GMainWindow::SelectAndSetCurrentUser() { |
| 1592 | QtProfileSelectionDialog dialog(system->HIDCore(), this); | 1592 | QtProfileSelectionDialog dialog(system->HIDCore(), this); |
| 1593 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | | 1593 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | |
| 1594 | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); | 1594 | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); |
| 1595 | dialog.setWindowModality(Qt::WindowModal); | 1595 | dialog.setWindowModality(Qt::WindowModal); |
| 1596 | 1596 | ||
| 1597 | if (dialog.exec() == QDialog::Rejected) { | 1597 | if (dialog.exec() == QDialog::Rejected) { |
| 1598 | return; | 1598 | return false; |
| 1599 | } | 1599 | } |
| 1600 | 1600 | ||
| 1601 | Settings::values.current_user = dialog.GetIndex(); | 1601 | Settings::values.current_user = dialog.GetIndex(); |
| 1602 | return true; | ||
| 1602 | } | 1603 | } |
| 1603 | 1604 | ||
| 1604 | void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t program_index, | 1605 | void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t program_index, |
| @@ -1632,11 +1633,14 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t | |||
| 1632 | Settings::LogSettings(); | 1633 | Settings::LogSettings(); |
| 1633 | 1634 | ||
| 1634 | if (UISettings::values.select_user_on_boot) { | 1635 | if (UISettings::values.select_user_on_boot) { |
| 1635 | SelectAndSetCurrentUser(); | 1636 | if (SelectAndSetCurrentUser() == false) { |
| 1637 | return; | ||
| 1638 | } | ||
| 1636 | } | 1639 | } |
| 1637 | 1640 | ||
| 1638 | if (!LoadROM(filename, program_id, program_index)) | 1641 | if (!LoadROM(filename, program_id, program_index)) { |
| 1639 | return; | 1642 | return; |
| 1643 | } | ||
| 1640 | 1644 | ||
| 1641 | system->SetShuttingDown(false); | 1645 | system->SetShuttingDown(false); |
| 1642 | 1646 | ||
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 23b67a14e..e13b38b24 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -218,7 +218,7 @@ private: | |||
| 218 | void SetDiscordEnabled(bool state); | 218 | void SetDiscordEnabled(bool state); |
| 219 | void LoadAmiibo(const QString& filename); | 219 | void LoadAmiibo(const QString& filename); |
| 220 | 220 | ||
| 221 | void SelectAndSetCurrentUser(); | 221 | bool SelectAndSetCurrentUser(); |
| 222 | 222 | ||
| 223 | /** | 223 | /** |
| 224 | * Stores the filename in the recently loaded files list. | 224 | * Stores the filename in the recently loaded files list. |