diff options
201 files changed, 1444 insertions, 1669 deletions
diff --git a/.ci/scripts/linux/docker.sh b/.ci/scripts/linux/docker.sh index 05f6ffe7d..e0c018cfd 100755 --- a/.ci/scripts/linux/docker.sh +++ b/.ci/scripts/linux/docker.sh | |||
| @@ -5,7 +5,7 @@ cd /yuzu | |||
| 5 | ccache -s | 5 | ccache -s |
| 6 | 6 | ||
| 7 | mkdir build || true && cd build | 7 | mkdir build || true && cd build |
| 8 | cmake .. -G Ninja -DDISPLAY_VERSION=$1 -DYUZU_USE_BUNDLED_UNICORN=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON | 8 | cmake .. -G Ninja -DDISPLAY_VERSION=$1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON |
| 9 | 9 | ||
| 10 | ninja | 10 | ninja |
| 11 | 11 | ||
diff --git a/.ci/scripts/windows/docker.sh b/.ci/scripts/windows/docker.sh index adfd636fa..2bc9f36ab 100755 --- a/.ci/scripts/windows/docker.sh +++ b/.ci/scripts/windows/docker.sh | |||
| @@ -5,7 +5,7 @@ cd /yuzu | |||
| 5 | ccache -s | 5 | ccache -s |
| 6 | 6 | ||
| 7 | mkdir build || true && cd build | 7 | mkdir build || true && cd build |
| 8 | cmake .. -G Ninja -DDISPLAY_VERSION=$1 -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../CMakeModules/MinGWCross.cmake" -DUSE_CCACHE=ON -DYUZU_USE_BUNDLED_UNICORN=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_QT_TRANSLATION=ON | 8 | cmake .. -G Ninja -DDISPLAY_VERSION=$1 -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../CMakeModules/MinGWCross.cmake" -DUSE_CCACHE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_QT_TRANSLATION=ON |
| 9 | ninja | 9 | ninja |
| 10 | 10 | ||
| 11 | ccache -s | 11 | ccache -s |
diff --git a/.ci/templates/build-msvc.yml b/.ci/templates/build-msvc.yml index 0b4bbd341..33ff8201f 100644 --- a/.ci/templates/build-msvc.yml +++ b/.ci/templates/build-msvc.yml | |||
| @@ -8,7 +8,7 @@ steps: | |||
| 8 | displayName: 'Install vulkan-sdk' | 8 | displayName: 'Install vulkan-sdk' |
| 9 | - script: python -m pip install --upgrade pip conan | 9 | - script: python -m pip install --upgrade pip conan |
| 10 | displayName: 'Install conan' | 10 | displayName: 'Install conan' |
| 11 | - script: refreshenv && mkdir build && cd build && cmake -G "Visual Studio 16 2019" -A x64 --config Release -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_UNICORN=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DUSE_DISCORD_PRESENCE=ON -DDISPLAY_VERSION=${{ parameters['version'] }} .. && cd .. | 11 | - script: refreshenv && mkdir build && cd build && cmake -G "Visual Studio 16 2019" -A x64 --config Release -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DUSE_DISCORD_PRESENCE=ON -DDISPLAY_VERSION=${{ parameters['version'] }} .. && cd .. |
| 12 | displayName: 'Configure CMake' | 12 | displayName: 'Configure CMake' |
| 13 | - task: MSBuild@1 | 13 | - task: MSBuild@1 |
| 14 | displayName: 'Build' | 14 | displayName: 'Build' |
diff --git a/CMakeLists.txt b/CMakeLists.txt index 273260378..2316f7684 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -113,6 +113,9 @@ if (NOT DEFINED ARCHITECTURE) | |||
| 113 | endif() | 113 | endif() |
| 114 | message(STATUS "Target architecture: ${ARCHITECTURE}") | 114 | message(STATUS "Target architecture: ${ARCHITECTURE}") |
| 115 | 115 | ||
| 116 | if (UNIX) | ||
| 117 | add_definitions(-DYUZU_UNIX=1) | ||
| 118 | endif() | ||
| 116 | 119 | ||
| 117 | # Configure C++ standard | 120 | # Configure C++ standard |
| 118 | # =========================== | 121 | # =========================== |
diff --git a/externals/cubeb b/externals/cubeb | |||
| Subproject 616d773441b5355800ce64197a699e6cd6b3617 | Subproject 1d66483ad2b93f0e00e175f9480c771af90003a | ||
diff --git a/src/audio_core/cubeb_sink.cpp b/src/audio_core/cubeb_sink.cpp index cf7b186e4..043447eaa 100644 --- a/src/audio_core/cubeb_sink.cpp +++ b/src/audio_core/cubeb_sink.cpp | |||
| @@ -30,6 +30,7 @@ public: | |||
| 30 | params.rate = sample_rate; | 30 | params.rate = sample_rate; |
| 31 | params.channels = num_channels; | 31 | params.channels = num_channels; |
| 32 | params.format = CUBEB_SAMPLE_S16NE; | 32 | params.format = CUBEB_SAMPLE_S16NE; |
| 33 | params.prefs = CUBEB_STREAM_PREF_PERSIST; | ||
| 33 | switch (num_channels) { | 34 | switch (num_channels) { |
| 34 | case 1: | 35 | case 1: |
| 35 | params.layout = CUBEB_LAYOUT_MONO; | 36 | params.layout = CUBEB_LAYOUT_MONO; |
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 18fbfa25b..a286b9341 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <array> | 5 | #include <array> |
| 6 | #include <filesystem> | ||
| 6 | #include <limits> | 7 | #include <limits> |
| 7 | #include <memory> | 8 | #include <memory> |
| 8 | #include <sstream> | 9 | #include <sstream> |
| @@ -67,290 +68,128 @@ | |||
| 67 | #include <algorithm> | 68 | #include <algorithm> |
| 68 | #include <sys/stat.h> | 69 | #include <sys/stat.h> |
| 69 | 70 | ||
| 70 | #ifndef S_ISDIR | ||
| 71 | #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) | ||
| 72 | #endif | ||
| 73 | |||
| 74 | // This namespace has various generic functions related to files and paths. | ||
| 75 | // The code still needs a ton of cleanup. | ||
| 76 | // REMEMBER: strdup considered harmful! | ||
| 77 | namespace Common::FS { | 71 | namespace Common::FS { |
| 72 | namespace fs = std::filesystem; | ||
| 78 | 73 | ||
| 79 | // Remove any ending forward slashes from directory paths | 74 | bool Exists(const fs::path& path) { |
| 80 | // Modifies argument. | 75 | std::error_code ec; |
| 81 | static void StripTailDirSlashes(std::string& fname) { | 76 | return fs::exists(path, ec); |
| 82 | if (fname.length() <= 1) { | ||
| 83 | return; | ||
| 84 | } | ||
| 85 | |||
| 86 | std::size_t i = fname.length(); | ||
| 87 | while (i > 0 && fname[i - 1] == DIR_SEP_CHR) { | ||
| 88 | --i; | ||
| 89 | } | ||
| 90 | fname.resize(i); | ||
| 91 | } | 77 | } |
| 92 | 78 | ||
| 93 | bool Exists(const std::string& filename) { | 79 | bool IsDirectory(const fs::path& path) { |
| 94 | struct stat file_info; | 80 | std::error_code ec; |
| 95 | 81 | return fs::is_directory(path, ec); | |
| 96 | std::string copy(filename); | ||
| 97 | StripTailDirSlashes(copy); | ||
| 98 | |||
| 99 | #ifdef _WIN32 | ||
| 100 | // Windows needs a slash to identify a driver root | ||
| 101 | if (copy.size() != 0 && copy.back() == ':') | ||
| 102 | copy += DIR_SEP_CHR; | ||
| 103 | |||
| 104 | int result = _wstat64(Common::UTF8ToUTF16W(copy).c_str(), &file_info); | ||
| 105 | #else | ||
| 106 | int result = stat(copy.c_str(), &file_info); | ||
| 107 | #endif | ||
| 108 | |||
| 109 | return (result == 0); | ||
| 110 | } | 82 | } |
| 111 | 83 | ||
| 112 | bool IsDirectory(const std::string& filename) { | 84 | bool Delete(const fs::path& path) { |
| 113 | struct stat file_info; | 85 | LOG_TRACE(Common_Filesystem, "file {}", path.string()); |
| 114 | |||
| 115 | std::string copy(filename); | ||
| 116 | StripTailDirSlashes(copy); | ||
| 117 | 86 | ||
| 118 | #ifdef _WIN32 | 87 | // Return true because we care about the file no |
| 119 | // Windows needs a slash to identify a driver root | 88 | // being there, not the actual delete. |
| 120 | if (copy.size() != 0 && copy.back() == ':') | 89 | if (!Exists(path)) { |
| 121 | copy += DIR_SEP_CHR; | 90 | LOG_DEBUG(Common_Filesystem, "{} does not exist", path.string()); |
| 122 | 91 | return true; | |
| 123 | int result = _wstat64(Common::UTF8ToUTF16W(copy).c_str(), &file_info); | ||
| 124 | #else | ||
| 125 | int result = stat(copy.c_str(), &file_info); | ||
| 126 | #endif | ||
| 127 | |||
| 128 | if (result < 0) { | ||
| 129 | LOG_DEBUG(Common_Filesystem, "stat failed on {}: {}", filename, GetLastErrorMsg()); | ||
| 130 | return false; | ||
| 131 | } | 92 | } |
| 132 | 93 | ||
| 133 | return S_ISDIR(file_info.st_mode); | 94 | std::error_code ec; |
| 95 | return fs::remove(path, ec); | ||
| 134 | } | 96 | } |
| 135 | 97 | ||
| 136 | bool Delete(const std::string& filename) { | 98 | bool CreateDir(const fs::path& path) { |
| 137 | LOG_TRACE(Common_Filesystem, "file {}", filename); | 99 | LOG_TRACE(Common_Filesystem, "directory {}", path.string()); |
| 138 | 100 | ||
| 139 | // Return true because we care about the file no | 101 | if (Exists(path)) { |
| 140 | // being there, not the actual delete. | 102 | LOG_DEBUG(Common_Filesystem, "path exists {}", path.string()); |
| 141 | if (!Exists(filename)) { | ||
| 142 | LOG_DEBUG(Common_Filesystem, "{} does not exist", filename); | ||
| 143 | return true; | 103 | return true; |
| 144 | } | 104 | } |
| 145 | 105 | ||
| 146 | // We can't delete a directory | 106 | std::error_code ec; |
| 147 | if (IsDirectory(filename)) { | 107 | const bool success = fs::create_directory(path, ec); |
| 148 | LOG_ERROR(Common_Filesystem, "Failed: {} is a directory", filename); | ||
| 149 | return false; | ||
| 150 | } | ||
| 151 | 108 | ||
| 152 | #ifdef _WIN32 | 109 | if (!success) { |
| 153 | if (!DeleteFileW(Common::UTF8ToUTF16W(filename).c_str())) { | 110 | LOG_ERROR(Common_Filesystem, "Unable to create directory: {}", ec.message()); |
| 154 | LOG_ERROR(Common_Filesystem, "DeleteFile failed on {}: {}", filename, GetLastErrorMsg()); | ||
| 155 | return false; | ||
| 156 | } | ||
| 157 | #else | ||
| 158 | if (unlink(filename.c_str()) == -1) { | ||
| 159 | LOG_ERROR(Common_Filesystem, "unlink failed on {}: {}", filename, GetLastErrorMsg()); | ||
| 160 | return false; | 111 | return false; |
| 161 | } | 112 | } |
| 162 | #endif | ||
| 163 | 113 | ||
| 164 | return true; | 114 | return true; |
| 165 | } | 115 | } |
| 166 | 116 | ||
| 167 | bool CreateDir(const std::string& path) { | 117 | bool CreateDirs(const fs::path& path) { |
| 168 | LOG_TRACE(Common_Filesystem, "directory {}", path); | 118 | LOG_TRACE(Common_Filesystem, "path {}", path.string()); |
| 169 | #ifdef _WIN32 | ||
| 170 | if (::CreateDirectoryW(Common::UTF8ToUTF16W(path).c_str(), nullptr)) | ||
| 171 | return true; | ||
| 172 | DWORD error = GetLastError(); | ||
| 173 | if (error == ERROR_ALREADY_EXISTS) { | ||
| 174 | LOG_DEBUG(Common_Filesystem, "CreateDirectory failed on {}: already exists", path); | ||
| 175 | return true; | ||
| 176 | } | ||
| 177 | LOG_ERROR(Common_Filesystem, "CreateDirectory failed on {}: {}", path, error); | ||
| 178 | return false; | ||
| 179 | #else | ||
| 180 | if (mkdir(path.c_str(), 0755) == 0) | ||
| 181 | return true; | ||
| 182 | |||
| 183 | int err = errno; | ||
| 184 | 119 | ||
| 185 | if (err == EEXIST) { | 120 | if (Exists(path)) { |
| 186 | LOG_DEBUG(Common_Filesystem, "mkdir failed on {}: already exists", path); | 121 | LOG_DEBUG(Common_Filesystem, "path exists {}", path.string()); |
| 187 | return true; | 122 | return true; |
| 188 | } | 123 | } |
| 189 | 124 | ||
| 190 | LOG_ERROR(Common_Filesystem, "mkdir failed on {}: {}", path, strerror(err)); | 125 | std::error_code ec; |
| 191 | return false; | 126 | const bool success = fs::create_directories(path, ec); |
| 192 | #endif | ||
| 193 | } | ||
| 194 | 127 | ||
| 195 | bool CreateFullPath(const std::string& fullPath) { | 128 | if (!success) { |
| 196 | int panicCounter = 100; | 129 | LOG_ERROR(Common_Filesystem, "Unable to create directories: {}", ec.message()); |
| 197 | LOG_TRACE(Common_Filesystem, "path {}", fullPath); | 130 | return false; |
| 198 | |||
| 199 | if (Exists(fullPath)) { | ||
| 200 | LOG_DEBUG(Common_Filesystem, "path exists {}", fullPath); | ||
| 201 | return true; | ||
| 202 | } | 131 | } |
| 203 | 132 | ||
| 204 | std::size_t position = 0; | 133 | return true; |
| 205 | while (true) { | 134 | } |
| 206 | // Find next sub path | ||
| 207 | position = fullPath.find(DIR_SEP_CHR, position); | ||
| 208 | 135 | ||
| 209 | // we're done, yay! | 136 | bool CreateFullPath(const fs::path& path) { |
| 210 | if (position == fullPath.npos) | 137 | LOG_TRACE(Common_Filesystem, "path {}", path); |
| 211 | return true; | ||
| 212 | 138 | ||
| 213 | // Include the '/' so the first call is CreateDir("/") rather than CreateDir("") | 139 | // Removes trailing slashes and turns any '\' into '/' |
| 214 | std::string const subPath(fullPath.substr(0, position + 1)); | 140 | const auto new_path = SanitizePath(path.string(), DirectorySeparator::ForwardSlash); |
| 215 | if (!IsDirectory(subPath) && !CreateDir(subPath)) { | ||
| 216 | LOG_ERROR(Common, "CreateFullPath: directory creation failed"); | ||
| 217 | return false; | ||
| 218 | } | ||
| 219 | 141 | ||
| 220 | // A safety check | 142 | if (new_path.rfind('.') == std::string::npos) { |
| 221 | panicCounter--; | 143 | // The path is a directory |
| 222 | if (panicCounter <= 0) { | 144 | return CreateDirs(new_path); |
| 223 | LOG_ERROR(Common, "CreateFullPath: directory structure is too deep"); | 145 | } else { |
| 224 | return false; | 146 | // The path is a file |
| 225 | } | 147 | // Creates directory preceding the last '/' |
| 226 | position++; | 148 | return CreateDirs(new_path.substr(0, new_path.rfind('/'))); |
| 227 | } | 149 | } |
| 228 | } | 150 | } |
| 229 | 151 | ||
| 230 | bool DeleteDir(const std::string& filename) { | 152 | bool Rename(const fs::path& src, const fs::path& dst) { |
| 231 | LOG_TRACE(Common_Filesystem, "directory {}", filename); | 153 | LOG_TRACE(Common_Filesystem, "{} --> {}", src.string(), dst.string()); |
| 232 | 154 | ||
| 233 | // check if a directory | 155 | std::error_code ec; |
| 234 | if (!IsDirectory(filename)) { | 156 | fs::rename(src, dst, ec); |
| 235 | LOG_ERROR(Common_Filesystem, "Not a directory {}", filename); | 157 | |
| 158 | if (ec) { | ||
| 159 | LOG_ERROR(Common_Filesystem, "Unable to rename file from {} to {}: {}", src.string(), | ||
| 160 | dst.string(), ec.message()); | ||
| 236 | return false; | 161 | return false; |
| 237 | } | 162 | } |
| 238 | 163 | ||
| 239 | #ifdef _WIN32 | 164 | return true; |
| 240 | if (::RemoveDirectoryW(Common::UTF8ToUTF16W(filename).c_str())) | ||
| 241 | return true; | ||
| 242 | #else | ||
| 243 | if (rmdir(filename.c_str()) == 0) | ||
| 244 | return true; | ||
| 245 | #endif | ||
| 246 | LOG_ERROR(Common_Filesystem, "failed {}: {}", filename, GetLastErrorMsg()); | ||
| 247 | |||
| 248 | return false; | ||
| 249 | } | ||
| 250 | |||
| 251 | bool Rename(const std::string& srcFilename, const std::string& destFilename) { | ||
| 252 | LOG_TRACE(Common_Filesystem, "{} --> {}", srcFilename, destFilename); | ||
| 253 | #ifdef _WIN32 | ||
| 254 | if (_wrename(Common::UTF8ToUTF16W(srcFilename).c_str(), | ||
| 255 | Common::UTF8ToUTF16W(destFilename).c_str()) == 0) | ||
| 256 | return true; | ||
| 257 | #else | ||
| 258 | if (rename(srcFilename.c_str(), destFilename.c_str()) == 0) | ||
| 259 | return true; | ||
| 260 | #endif | ||
| 261 | LOG_ERROR(Common_Filesystem, "failed {} --> {}: {}", srcFilename, destFilename, | ||
| 262 | GetLastErrorMsg()); | ||
| 263 | return false; | ||
| 264 | } | 165 | } |
| 265 | 166 | ||
| 266 | bool Copy(const std::string& srcFilename, const std::string& destFilename) { | 167 | bool Copy(const fs::path& src, const fs::path& dst) { |
| 267 | LOG_TRACE(Common_Filesystem, "{} --> {}", srcFilename, destFilename); | 168 | LOG_TRACE(Common_Filesystem, "{} --> {}", src.string(), dst.string()); |
| 268 | #ifdef _WIN32 | ||
| 269 | if (CopyFileW(Common::UTF8ToUTF16W(srcFilename).c_str(), | ||
| 270 | Common::UTF8ToUTF16W(destFilename).c_str(), FALSE)) | ||
| 271 | return true; | ||
| 272 | 169 | ||
| 273 | LOG_ERROR(Common_Filesystem, "failed {} --> {}: {}", srcFilename, destFilename, | 170 | std::error_code ec; |
| 274 | GetLastErrorMsg()); | 171 | const bool success = fs::copy_file(src, dst, fs::copy_options::overwrite_existing, ec); |
| 275 | return false; | ||
| 276 | #else | ||
| 277 | using CFilePointer = std::unique_ptr<FILE, decltype(&std::fclose)>; | ||
| 278 | 172 | ||
| 279 | // Open input file | 173 | if (!success) { |
| 280 | CFilePointer input{fopen(srcFilename.c_str(), "rb"), std::fclose}; | 174 | LOG_ERROR(Common_Filesystem, "Unable to copy file {} to {}: {}", src.string(), dst.string(), |
| 281 | if (!input) { | 175 | ec.message()); |
| 282 | LOG_ERROR(Common_Filesystem, "opening input failed {} --> {}: {}", srcFilename, | ||
| 283 | destFilename, GetLastErrorMsg()); | ||
| 284 | return false; | 176 | return false; |
| 285 | } | 177 | } |
| 286 | 178 | ||
| 287 | // open output file | ||
| 288 | CFilePointer output{fopen(destFilename.c_str(), "wb"), std::fclose}; | ||
| 289 | if (!output) { | ||
| 290 | LOG_ERROR(Common_Filesystem, "opening output failed {} --> {}: {}", srcFilename, | ||
| 291 | destFilename, GetLastErrorMsg()); | ||
| 292 | return false; | ||
| 293 | } | ||
| 294 | |||
| 295 | // copy loop | ||
| 296 | std::array<char, 1024> buffer; | ||
| 297 | while (!feof(input.get())) { | ||
| 298 | // read input | ||
| 299 | std::size_t rnum = fread(buffer.data(), sizeof(char), buffer.size(), input.get()); | ||
| 300 | if (rnum != buffer.size()) { | ||
| 301 | if (ferror(input.get()) != 0) { | ||
| 302 | LOG_ERROR(Common_Filesystem, "failed reading from source, {} --> {}: {}", | ||
| 303 | srcFilename, destFilename, GetLastErrorMsg()); | ||
| 304 | return false; | ||
| 305 | } | ||
| 306 | } | ||
| 307 | |||
| 308 | // write output | ||
| 309 | std::size_t wnum = fwrite(buffer.data(), sizeof(char), rnum, output.get()); | ||
| 310 | if (wnum != rnum) { | ||
| 311 | LOG_ERROR(Common_Filesystem, "failed writing to output, {} --> {}: {}", srcFilename, | ||
| 312 | destFilename, GetLastErrorMsg()); | ||
| 313 | return false; | ||
| 314 | } | ||
| 315 | } | ||
| 316 | |||
| 317 | return true; | 179 | return true; |
| 318 | #endif | ||
| 319 | } | 180 | } |
| 320 | 181 | ||
| 321 | u64 GetSize(const std::string& filename) { | 182 | u64 GetSize(const fs::path& path) { |
| 322 | if (!Exists(filename)) { | 183 | std::error_code ec; |
| 323 | LOG_ERROR(Common_Filesystem, "failed {}: No such file", filename); | 184 | const auto size = fs::file_size(path, ec); |
| 324 | return 0; | ||
| 325 | } | ||
| 326 | 185 | ||
| 327 | if (IsDirectory(filename)) { | 186 | if (ec) { |
| 328 | LOG_ERROR(Common_Filesystem, "failed {}: is a directory", filename); | 187 | LOG_ERROR(Common_Filesystem, "Unable to retrieve file size ({}): {}", path.string(), |
| 188 | ec.message()); | ||
| 329 | return 0; | 189 | return 0; |
| 330 | } | 190 | } |
| 331 | 191 | ||
| 332 | struct stat buf; | 192 | return size; |
| 333 | #ifdef _WIN32 | ||
| 334 | if (_wstat64(Common::UTF8ToUTF16W(filename).c_str(), &buf) == 0) | ||
| 335 | #else | ||
| 336 | if (stat(filename.c_str(), &buf) == 0) | ||
| 337 | #endif | ||
| 338 | { | ||
| 339 | LOG_TRACE(Common_Filesystem, "{}: {}", filename, buf.st_size); | ||
| 340 | return buf.st_size; | ||
| 341 | } | ||
| 342 | |||
| 343 | LOG_ERROR(Common_Filesystem, "Stat failed {}: {}", filename, GetLastErrorMsg()); | ||
| 344 | return 0; | ||
| 345 | } | ||
| 346 | |||
| 347 | u64 GetSize(const int fd) { | ||
| 348 | struct stat buf; | ||
| 349 | if (fstat(fd, &buf) != 0) { | ||
| 350 | LOG_ERROR(Common_Filesystem, "GetSize: stat failed {}: {}", fd, GetLastErrorMsg()); | ||
| 351 | return 0; | ||
| 352 | } | ||
| 353 | return buf.st_size; | ||
| 354 | } | 193 | } |
| 355 | 194 | ||
| 356 | u64 GetSize(FILE* f) { | 195 | u64 GetSize(FILE* f) { |
| @@ -400,7 +239,7 @@ bool ForeachDirectoryEntry(u64* num_entries_out, const std::string& directory, | |||
| 400 | } | 239 | } |
| 401 | // windows loop | 240 | // windows loop |
| 402 | do { | 241 | do { |
| 403 | const std::string virtual_name(Common::UTF16ToUTF8(ffd.cFileName)); | 242 | const std::string virtual_name = std::filesystem::path(ffd.cFileName).string(); |
| 404 | #else | 243 | #else |
| 405 | DIR* dirp = opendir(directory.c_str()); | 244 | DIR* dirp = opendir(directory.c_str()); |
| 406 | if (!dirp) | 245 | if (!dirp) |
| @@ -438,132 +277,58 @@ bool ForeachDirectoryEntry(u64* num_entries_out, const std::string& directory, | |||
| 438 | return true; | 277 | return true; |
| 439 | } | 278 | } |
| 440 | 279 | ||
| 441 | u64 ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry, | 280 | bool DeleteDirRecursively(const fs::path& path) { |
| 442 | unsigned int recursion) { | 281 | std::error_code ec; |
| 443 | const auto callback = [recursion, &parent_entry](u64* num_entries_out, | 282 | fs::remove_all(path, ec); |
| 444 | const std::string& directory, | ||
| 445 | const std::string& virtual_name) -> bool { | ||
| 446 | FSTEntry entry; | ||
| 447 | entry.virtualName = virtual_name; | ||
| 448 | entry.physicalName = directory + DIR_SEP + virtual_name; | ||
| 449 | |||
| 450 | if (IsDirectory(entry.physicalName)) { | ||
| 451 | entry.isDirectory = true; | ||
| 452 | // is a directory, lets go inside if we didn't recurse to often | ||
| 453 | if (recursion > 0) { | ||
| 454 | entry.size = ScanDirectoryTree(entry.physicalName, entry, recursion - 1); | ||
| 455 | *num_entries_out += entry.size; | ||
| 456 | } else { | ||
| 457 | entry.size = 0; | ||
| 458 | } | ||
| 459 | } else { // is a file | ||
| 460 | entry.isDirectory = false; | ||
| 461 | entry.size = GetSize(entry.physicalName); | ||
| 462 | } | ||
| 463 | (*num_entries_out)++; | ||
| 464 | |||
| 465 | // Push into the tree | ||
| 466 | parent_entry.children.push_back(std::move(entry)); | ||
| 467 | return true; | ||
| 468 | }; | ||
| 469 | |||
| 470 | u64 num_entries; | ||
| 471 | return ForeachDirectoryEntry(&num_entries, directory, callback) ? num_entries : 0; | ||
| 472 | } | ||
| 473 | |||
| 474 | bool DeleteDirRecursively(const std::string& directory, unsigned int recursion) { | ||
| 475 | const auto callback = [recursion](u64*, const std::string& directory, | ||
| 476 | const std::string& virtual_name) { | ||
| 477 | const std::string new_path = directory + DIR_SEP_CHR + virtual_name; | ||
| 478 | 283 | ||
| 479 | if (IsDirectory(new_path)) { | 284 | if (ec) { |
| 480 | if (recursion == 0) { | 285 | LOG_ERROR(Common_Filesystem, "Unable to completely delete directory {}: {}", path.string(), |
| 481 | return false; | 286 | ec.message()); |
| 482 | } | ||
| 483 | return DeleteDirRecursively(new_path, recursion - 1); | ||
| 484 | } | ||
| 485 | return Delete(new_path); | ||
| 486 | }; | ||
| 487 | |||
| 488 | if (!ForeachDirectoryEntry(nullptr, directory, callback)) | ||
| 489 | return false; | 287 | return false; |
| 288 | } | ||
| 490 | 289 | ||
| 491 | // Delete the outermost directory | ||
| 492 | DeleteDir(directory); | ||
| 493 | return true; | 290 | return true; |
| 494 | } | 291 | } |
| 495 | 292 | ||
| 496 | void CopyDir([[maybe_unused]] const std::string& source_path, | 293 | void CopyDir(const fs::path& src, const fs::path& dst) { |
| 497 | [[maybe_unused]] const std::string& dest_path) { | 294 | constexpr auto copy_flags = fs::copy_options::skip_existing | fs::copy_options::recursive; |
| 498 | #ifndef _WIN32 | 295 | |
| 499 | if (source_path == dest_path) { | 296 | std::error_code ec; |
| 500 | return; | 297 | fs::copy(src, dst, copy_flags, ec); |
| 501 | } | ||
| 502 | if (!Exists(source_path)) { | ||
| 503 | return; | ||
| 504 | } | ||
| 505 | if (!Exists(dest_path)) { | ||
| 506 | CreateFullPath(dest_path); | ||
| 507 | } | ||
| 508 | 298 | ||
| 509 | DIR* dirp = opendir(source_path.c_str()); | 299 | if (ec) { |
| 510 | if (!dirp) { | 300 | LOG_ERROR(Common_Filesystem, "Error copying directory {} to {}: {}", src.string(), |
| 301 | dst.string(), ec.message()); | ||
| 511 | return; | 302 | return; |
| 512 | } | 303 | } |
| 513 | 304 | ||
| 514 | while (struct dirent* result = readdir(dirp)) { | 305 | LOG_TRACE(Common_Filesystem, "Successfully copied directory."); |
| 515 | const std::string virtualName(result->d_name); | ||
| 516 | // check for "." and ".." | ||
| 517 | if (((virtualName[0] == '.') && (virtualName[1] == '\0')) || | ||
| 518 | ((virtualName[0] == '.') && (virtualName[1] == '.') && (virtualName[2] == '\0'))) { | ||
| 519 | continue; | ||
| 520 | } | ||
| 521 | |||
| 522 | std::string source, dest; | ||
| 523 | source = source_path + virtualName; | ||
| 524 | dest = dest_path + virtualName; | ||
| 525 | if (IsDirectory(source)) { | ||
| 526 | source += '/'; | ||
| 527 | dest += '/'; | ||
| 528 | if (!Exists(dest)) { | ||
| 529 | CreateFullPath(dest); | ||
| 530 | } | ||
| 531 | CopyDir(source, dest); | ||
| 532 | } else if (!Exists(dest)) { | ||
| 533 | Copy(source, dest); | ||
| 534 | } | ||
| 535 | } | ||
| 536 | closedir(dirp); | ||
| 537 | #endif | ||
| 538 | } | 306 | } |
| 539 | 307 | ||
| 540 | std::optional<std::string> GetCurrentDir() { | 308 | std::optional<fs::path> GetCurrentDir() { |
| 541 | // Get the current working directory (getcwd uses malloc) | 309 | std::error_code ec; |
| 542 | #ifdef _WIN32 | 310 | auto path = fs::current_path(ec); |
| 543 | wchar_t* dir = _wgetcwd(nullptr, 0); | 311 | |
| 544 | if (!dir) { | 312 | if (ec) { |
| 545 | #else | 313 | LOG_ERROR(Common_Filesystem, "Unable to retrieve current working directory: {}", |
| 546 | char* dir = getcwd(nullptr, 0); | 314 | ec.message()); |
| 547 | if (!dir) { | ||
| 548 | #endif | ||
| 549 | LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: {}", GetLastErrorMsg()); | ||
| 550 | return std::nullopt; | 315 | return std::nullopt; |
| 551 | } | 316 | } |
| 552 | #ifdef _WIN32 | 317 | |
| 553 | std::string strDir = Common::UTF16ToUTF8(dir); | 318 | return {std::move(path)}; |
| 554 | #else | ||
| 555 | std::string strDir = dir; | ||
| 556 | #endif | ||
| 557 | free(dir); | ||
| 558 | return strDir; | ||
| 559 | } | 319 | } |
| 560 | 320 | ||
| 561 | bool SetCurrentDir(const std::string& directory) { | 321 | bool SetCurrentDir(const fs::path& path) { |
| 562 | #ifdef _WIN32 | 322 | std::error_code ec; |
| 563 | return _wchdir(Common::UTF8ToUTF16W(directory).c_str()) == 0; | 323 | fs::current_path(path, ec); |
| 564 | #else | 324 | |
| 565 | return chdir(directory.c_str()) == 0; | 325 | if (ec) { |
| 566 | #endif | 326 | LOG_ERROR(Common_Filesystem, "Unable to set {} as working directory: {}", path.string(), |
| 327 | ec.message()); | ||
| 328 | return false; | ||
| 329 | } | ||
| 330 | |||
| 331 | return true; | ||
| 567 | } | 332 | } |
| 568 | 333 | ||
| 569 | #if defined(__APPLE__) | 334 | #if defined(__APPLE__) |
diff --git a/src/common/file_util.h b/src/common/file_util.h index 840cde2a6..cf006cc9d 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <cstdio> | 8 | #include <cstdio> |
| 9 | #include <filesystem> | ||
| 9 | #include <fstream> | 10 | #include <fstream> |
| 10 | #include <functional> | 11 | #include <functional> |
| 11 | #include <limits> | 12 | #include <limits> |
| @@ -38,48 +39,40 @@ enum class UserPath { | |||
| 38 | UserDir, | 39 | UserDir, |
| 39 | }; | 40 | }; |
| 40 | 41 | ||
| 41 | // FileSystem tree node/ | 42 | // Returns true if the path exists |
| 42 | struct FSTEntry { | 43 | [[nodiscard]] bool Exists(const std::filesystem::path& path); |
| 43 | bool isDirectory; | ||
| 44 | u64 size; // file length or number of entries from children | ||
| 45 | std::string physicalName; // name on disk | ||
| 46 | std::string virtualName; // name in FST names table | ||
| 47 | std::vector<FSTEntry> children; | ||
| 48 | }; | ||
| 49 | |||
| 50 | // Returns true if file filename exists | ||
| 51 | [[nodiscard]] bool Exists(const std::string& filename); | ||
| 52 | 44 | ||
| 53 | // Returns true if filename is a directory | 45 | // Returns true if path is a directory |
| 54 | [[nodiscard]] bool IsDirectory(const std::string& filename); | 46 | [[nodiscard]] bool IsDirectory(const std::filesystem::path& path); |
| 55 | 47 | ||
| 56 | // Returns the size of filename (64bit) | 48 | // Returns the size of filename (64bit) |
| 57 | [[nodiscard]] u64 GetSize(const std::string& filename); | 49 | [[nodiscard]] u64 GetSize(const std::filesystem::path& path); |
| 58 | |||
| 59 | // Overloaded GetSize, accepts file descriptor | ||
| 60 | [[nodiscard]] u64 GetSize(int fd); | ||
| 61 | 50 | ||
| 62 | // Overloaded GetSize, accepts FILE* | 51 | // Overloaded GetSize, accepts FILE* |
| 63 | [[nodiscard]] u64 GetSize(FILE* f); | 52 | [[nodiscard]] u64 GetSize(FILE* f); |
| 64 | 53 | ||
| 65 | // Returns true if successful, or path already exists. | 54 | // Returns true if successful, or path already exists. |
| 66 | bool CreateDir(const std::string& filename); | 55 | bool CreateDir(const std::filesystem::path& path); |
| 67 | 56 | ||
| 68 | // Creates the full path of fullPath returns true on success | 57 | // Create all directories in path |
| 69 | bool CreateFullPath(const std::string& fullPath); | 58 | // Returns true if successful, or path already exists. |
| 59 | [[nodiscard("Directory creation can fail and must be tested")]] bool CreateDirs( | ||
| 60 | const std::filesystem::path& path); | ||
| 70 | 61 | ||
| 71 | // Deletes a given filename, return true on success | 62 | // Creates directories in path. Returns true on success. |
| 72 | // Doesn't supports deleting a directory | 63 | [[deprecated("This function is deprecated, use CreateDirs")]] bool CreateFullPath( |
| 73 | bool Delete(const std::string& filename); | 64 | const std::filesystem::path& path); |
| 74 | 65 | ||
| 75 | // Deletes a directory filename, returns true on success | 66 | // Deletes a given file at the path. |
| 76 | bool DeleteDir(const std::string& filename); | 67 | // This will also delete empty directories. |
| 68 | // Return true on success | ||
| 69 | bool Delete(const std::filesystem::path& path); | ||
| 77 | 70 | ||
| 78 | // renames file srcFilename to destFilename, returns true on success | 71 | // Renames file src to dst, returns true on success |
| 79 | bool Rename(const std::string& srcFilename, const std::string& destFilename); | 72 | bool Rename(const std::filesystem::path& src, const std::filesystem::path& dst); |
| 80 | 73 | ||
| 81 | // copies file srcFilename to destFilename, returns true on success | 74 | // copies file src to dst, returns true on success |
| 82 | bool Copy(const std::string& srcFilename, const std::string& destFilename); | 75 | bool Copy(const std::filesystem::path& src, const std::filesystem::path& dst); |
| 83 | 76 | ||
| 84 | // creates an empty file filename, returns true on success | 77 | // creates an empty file filename, returns true on success |
| 85 | bool CreateEmptyFile(const std::string& filename); | 78 | bool CreateEmptyFile(const std::string& filename); |
| @@ -106,27 +99,17 @@ using DirectoryEntryCallable = std::function<bool( | |||
| 106 | bool ForeachDirectoryEntry(u64* num_entries_out, const std::string& directory, | 99 | bool ForeachDirectoryEntry(u64* num_entries_out, const std::string& directory, |
| 107 | DirectoryEntryCallable callback); | 100 | DirectoryEntryCallable callback); |
| 108 | 101 | ||
| 109 | /** | 102 | // Deletes the given path and anything under it. Returns true on success. |
| 110 | * Scans the directory tree, storing the results. | 103 | bool DeleteDirRecursively(const std::filesystem::path& path); |
| 111 | * @param directory the parent directory to start scanning from | ||
| 112 | * @param parent_entry FSTEntry where the filesystem tree results will be stored. | ||
| 113 | * @param recursion Number of children directories to read before giving up. | ||
| 114 | * @return the total number of files/directories found | ||
| 115 | */ | ||
| 116 | u64 ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry, | ||
| 117 | unsigned int recursion = 0); | ||
| 118 | |||
| 119 | // deletes the given directory and anything under it. Returns true on success. | ||
| 120 | bool DeleteDirRecursively(const std::string& directory, unsigned int recursion = 256); | ||
| 121 | 104 | ||
| 122 | // Returns the current directory | 105 | // Returns the current directory |
| 123 | [[nodiscard]] std::optional<std::string> GetCurrentDir(); | 106 | [[nodiscard]] std::optional<std::filesystem::path> GetCurrentDir(); |
| 124 | 107 | ||
| 125 | // Create directory and copy contents (does not overwrite existing files) | 108 | // Create directory and copy contents (does not overwrite existing files) |
| 126 | void CopyDir(const std::string& source_path, const std::string& dest_path); | 109 | void CopyDir(const std::filesystem::path& src, const std::filesystem::path& dst); |
| 127 | 110 | ||
| 128 | // Set the current directory to given directory | 111 | // Set the current directory to given path |
| 129 | bool SetCurrentDir(const std::string& directory); | 112 | bool SetCurrentDir(const std::filesystem::path& path); |
| 130 | 113 | ||
| 131 | // Returns a pointer to a string with a yuzu data dir in the user's home | 114 | // Returns a pointer to a string with a yuzu data dir in the user's home |
| 132 | // directory. To be used in "multi-user" mode (that is, installed). | 115 | // directory. To be used in "multi-user" mode (that is, installed). |
diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h index 68ef5f197..fa46cb394 100644 --- a/src/common/scope_exit.h +++ b/src/common/scope_exit.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | namespace detail { | 10 | namespace detail { |
| 11 | template <typename Func> | 11 | template <typename Func> |
| 12 | struct ScopeExitHelper { | 12 | struct ScopeExitHelper { |
| 13 | explicit ScopeExitHelper(Func&& func) : func(std::move(func)) {} | 13 | explicit ScopeExitHelper(Func&& func_) : func(std::move(func_)) {} |
| 14 | ~ScopeExitHelper() { | 14 | ~ScopeExitHelper() { |
| 15 | if (active) { | 15 | if (active) { |
| 16 | func(); | 16 | func(); |
diff --git a/src/common/telemetry.h b/src/common/telemetry.h index a50c5d1de..49186e848 100644 --- a/src/common/telemetry.h +++ b/src/common/telemetry.h | |||
| @@ -52,8 +52,8 @@ public: | |||
| 52 | template <typename T> | 52 | template <typename T> |
| 53 | class Field : public FieldInterface { | 53 | class Field : public FieldInterface { |
| 54 | public: | 54 | public: |
| 55 | Field(FieldType type, std::string name, T value) | 55 | Field(FieldType type_, std::string name_, T value_) |
| 56 | : name(std::move(name)), type(type), value(std::move(value)) {} | 56 | : name(std::move(name_)), type(type_), value(std::move(value_)) {} |
| 57 | 57 | ||
| 58 | Field(const Field&) = default; | 58 | Field(const Field&) = default; |
| 59 | Field& operator=(const Field&) = default; | 59 | Field& operator=(const Field&) = default; |
diff --git a/src/common/x64/xbyak_abi.h b/src/common/x64/xbyak_abi.h index 26e4bfda5..c2c9b6134 100644 --- a/src/common/x64/xbyak_abi.h +++ b/src/common/x64/xbyak_abi.h | |||
| @@ -11,25 +11,25 @@ | |||
| 11 | 11 | ||
| 12 | namespace Common::X64 { | 12 | namespace Common::X64 { |
| 13 | 13 | ||
| 14 | constexpr std::size_t RegToIndex(const Xbyak::Reg& reg) { | 14 | constexpr size_t RegToIndex(const Xbyak::Reg& reg) { |
| 15 | using Kind = Xbyak::Reg::Kind; | 15 | using Kind = Xbyak::Reg::Kind; |
| 16 | ASSERT_MSG((reg.getKind() & (Kind::REG | Kind::XMM)) != 0, | 16 | ASSERT_MSG((reg.getKind() & (Kind::REG | Kind::XMM)) != 0, |
| 17 | "RegSet only support GPRs and XMM registers."); | 17 | "RegSet only support GPRs and XMM registers."); |
| 18 | ASSERT_MSG(reg.getIdx() < 16, "RegSet only supports XXM0-15."); | 18 | ASSERT_MSG(reg.getIdx() < 16, "RegSet only supports XXM0-15."); |
| 19 | return reg.getIdx() + (reg.getKind() == Kind::REG ? 0 : 16); | 19 | return static_cast<size_t>(reg.getIdx()) + (reg.getKind() == Kind::REG ? 0 : 16); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | constexpr Xbyak::Reg64 IndexToReg64(std::size_t reg_index) { | 22 | constexpr Xbyak::Reg64 IndexToReg64(size_t reg_index) { |
| 23 | ASSERT(reg_index < 16); | 23 | ASSERT(reg_index < 16); |
| 24 | return Xbyak::Reg64(static_cast<int>(reg_index)); | 24 | return Xbyak::Reg64(static_cast<int>(reg_index)); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | constexpr Xbyak::Xmm IndexToXmm(std::size_t reg_index) { | 27 | constexpr Xbyak::Xmm IndexToXmm(size_t reg_index) { |
| 28 | ASSERT(reg_index >= 16 && reg_index < 32); | 28 | ASSERT(reg_index >= 16 && reg_index < 32); |
| 29 | return Xbyak::Xmm(static_cast<int>(reg_index - 16)); | 29 | return Xbyak::Xmm(static_cast<int>(reg_index - 16)); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | constexpr Xbyak::Reg IndexToReg(std::size_t reg_index) { | 32 | constexpr Xbyak::Reg IndexToReg(size_t reg_index) { |
| 33 | if (reg_index < 16) { | 33 | if (reg_index < 16) { |
| 34 | return IndexToReg64(reg_index); | 34 | return IndexToReg64(reg_index); |
| 35 | } else { | 35 | } else { |
| @@ -182,7 +182,7 @@ inline size_t ABI_PushRegistersAndAdjustStack(Xbyak::CodeGenerator& code, std::b | |||
| 182 | size_t rsp_alignment, size_t needed_frame_size = 0) { | 182 | size_t rsp_alignment, size_t needed_frame_size = 0) { |
| 183 | auto frame_info = ABI_CalculateFrameSize(regs, rsp_alignment, needed_frame_size); | 183 | auto frame_info = ABI_CalculateFrameSize(regs, rsp_alignment, needed_frame_size); |
| 184 | 184 | ||
| 185 | for (std::size_t i = 0; i < regs.size(); ++i) { | 185 | for (size_t i = 0; i < regs.size(); ++i) { |
| 186 | if (regs[i] && ABI_ALL_GPRS[i]) { | 186 | if (regs[i] && ABI_ALL_GPRS[i]) { |
| 187 | code.push(IndexToReg64(i)); | 187 | code.push(IndexToReg64(i)); |
| 188 | } | 188 | } |
| @@ -192,7 +192,7 @@ inline size_t ABI_PushRegistersAndAdjustStack(Xbyak::CodeGenerator& code, std::b | |||
| 192 | code.sub(code.rsp, frame_info.subtraction); | 192 | code.sub(code.rsp, frame_info.subtraction); |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | for (std::size_t i = 0; i < regs.size(); ++i) { | 195 | for (size_t i = 0; i < regs.size(); ++i) { |
| 196 | if (regs[i] && ABI_ALL_XMMS[i]) { | 196 | if (regs[i] && ABI_ALL_XMMS[i]) { |
| 197 | code.movaps(code.xword[code.rsp + frame_info.xmm_offset], IndexToXmm(i)); | 197 | code.movaps(code.xword[code.rsp + frame_info.xmm_offset], IndexToXmm(i)); |
| 198 | frame_info.xmm_offset += 0x10; | 198 | frame_info.xmm_offset += 0x10; |
| @@ -206,7 +206,7 @@ inline void ABI_PopRegistersAndAdjustStack(Xbyak::CodeGenerator& code, std::bits | |||
| 206 | size_t rsp_alignment, size_t needed_frame_size = 0) { | 206 | size_t rsp_alignment, size_t needed_frame_size = 0) { |
| 207 | auto frame_info = ABI_CalculateFrameSize(regs, rsp_alignment, needed_frame_size); | 207 | auto frame_info = ABI_CalculateFrameSize(regs, rsp_alignment, needed_frame_size); |
| 208 | 208 | ||
| 209 | for (std::size_t i = 0; i < regs.size(); ++i) { | 209 | for (size_t i = 0; i < regs.size(); ++i) { |
| 210 | if (regs[i] && ABI_ALL_XMMS[i]) { | 210 | if (regs[i] && ABI_ALL_XMMS[i]) { |
| 211 | code.movaps(IndexToXmm(i), code.xword[code.rsp + frame_info.xmm_offset]); | 211 | code.movaps(IndexToXmm(i), code.xword[code.rsp + frame_info.xmm_offset]); |
| 212 | frame_info.xmm_offset += 0x10; | 212 | frame_info.xmm_offset += 0x10; |
| @@ -218,8 +218,8 @@ inline void ABI_PopRegistersAndAdjustStack(Xbyak::CodeGenerator& code, std::bits | |||
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | // GPRs need to be popped in reverse order | 220 | // GPRs need to be popped in reverse order |
| 221 | for (std::size_t j = 0; j < regs.size(); ++j) { | 221 | for (size_t j = 0; j < regs.size(); ++j) { |
| 222 | const std::size_t i = regs.size() - j - 1; | 222 | const size_t i = regs.size() - j - 1; |
| 223 | if (regs[i] && ABI_ALL_GPRS[i]) { | 223 | if (regs[i] && ABI_ALL_GPRS[i]) { |
| 224 | code.pop(IndexToReg64(i)); | 224 | code.pop(IndexToReg64(i)); |
| 225 | } | 225 | } |
diff --git a/src/core/core.cpp b/src/core/core.cpp index 01e4faac8..7e3c54618 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -237,7 +237,7 @@ struct System::Impl { | |||
| 237 | Kernel::Process::Create(system, "main", Kernel::Process::ProcessType::Userland); | 237 | Kernel::Process::Create(system, "main", Kernel::Process::ProcessType::Userland); |
| 238 | const auto [load_result, load_parameters] = app_loader->Load(*main_process, system); | 238 | const auto [load_result, load_parameters] = app_loader->Load(*main_process, system); |
| 239 | if (load_result != Loader::ResultStatus::Success) { | 239 | if (load_result != Loader::ResultStatus::Success) { |
| 240 | LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", static_cast<int>(load_result)); | 240 | LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", load_result); |
| 241 | Shutdown(); | 241 | Shutdown(); |
| 242 | 242 | ||
| 243 | return static_cast<ResultStatus>(static_cast<u32>(ResultStatus::ErrorLoader) + | 243 | return static_cast<ResultStatus>(static_cast<u32>(ResultStatus::ErrorLoader) + |
| @@ -267,8 +267,7 @@ struct System::Impl { | |||
| 267 | 267 | ||
| 268 | u64 title_id{0}; | 268 | u64 title_id{0}; |
| 269 | if (app_loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) { | 269 | if (app_loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) { |
| 270 | LOG_ERROR(Core, "Failed to find title id for ROM (Error {})", | 270 | LOG_ERROR(Core, "Failed to find title id for ROM (Error {})", load_result); |
| 271 | static_cast<u32>(load_result)); | ||
| 272 | } | 271 | } |
| 273 | perf_stats = std::make_unique<PerfStats>(title_id); | 272 | perf_stats = std::make_unique<PerfStats>(title_id); |
| 274 | // Reset counters and set time origin to current frame | 273 | // Reset counters and set time origin to current frame |
diff --git a/src/core/file_sys/content_archive.cpp b/src/core/file_sys/content_archive.cpp index 76af47ff9..363ff980f 100644 --- a/src/core/file_sys/content_archive.cpp +++ b/src/core/file_sys/content_archive.cpp | |||
| @@ -410,8 +410,9 @@ u8 NCA::GetCryptoRevision() const { | |||
| 410 | std::optional<Core::Crypto::Key128> NCA::GetKeyAreaKey(NCASectionCryptoType type) const { | 410 | std::optional<Core::Crypto::Key128> NCA::GetKeyAreaKey(NCASectionCryptoType type) const { |
| 411 | const auto master_key_id = GetCryptoRevision(); | 411 | const auto master_key_id = GetCryptoRevision(); |
| 412 | 412 | ||
| 413 | if (!keys.HasKey(Core::Crypto::S128KeyType::KeyArea, master_key_id, header.key_index)) | 413 | if (!keys.HasKey(Core::Crypto::S128KeyType::KeyArea, master_key_id, header.key_index)) { |
| 414 | return {}; | 414 | return std::nullopt; |
| 415 | } | ||
| 415 | 416 | ||
| 416 | std::vector<u8> key_area(header.key_area.begin(), header.key_area.end()); | 417 | std::vector<u8> key_area(header.key_area.begin(), header.key_area.end()); |
| 417 | Core::Crypto::AESCipher<Core::Crypto::Key128> cipher( | 418 | Core::Crypto::AESCipher<Core::Crypto::Key128> cipher( |
| @@ -420,15 +421,17 @@ std::optional<Core::Crypto::Key128> NCA::GetKeyAreaKey(NCASectionCryptoType type | |||
| 420 | cipher.Transcode(key_area.data(), key_area.size(), key_area.data(), Core::Crypto::Op::Decrypt); | 421 | cipher.Transcode(key_area.data(), key_area.size(), key_area.data(), Core::Crypto::Op::Decrypt); |
| 421 | 422 | ||
| 422 | Core::Crypto::Key128 out; | 423 | Core::Crypto::Key128 out; |
| 423 | if (type == NCASectionCryptoType::XTS) | 424 | if (type == NCASectionCryptoType::XTS) { |
| 424 | std::copy(key_area.begin(), key_area.begin() + 0x10, out.begin()); | 425 | std::copy(key_area.begin(), key_area.begin() + 0x10, out.begin()); |
| 425 | else if (type == NCASectionCryptoType::CTR || type == NCASectionCryptoType::BKTR) | 426 | } else if (type == NCASectionCryptoType::CTR || type == NCASectionCryptoType::BKTR) { |
| 426 | std::copy(key_area.begin() + 0x20, key_area.begin() + 0x30, out.begin()); | 427 | std::copy(key_area.begin() + 0x20, key_area.begin() + 0x30, out.begin()); |
| 427 | else | 428 | } else { |
| 428 | LOG_CRITICAL(Crypto, "Called GetKeyAreaKey on invalid NCASectionCryptoType type={:02X}", | 429 | LOG_CRITICAL(Crypto, "Called GetKeyAreaKey on invalid NCASectionCryptoType type={:02X}", |
| 429 | static_cast<u8>(type)); | 430 | type); |
| 431 | } | ||
| 432 | |||
| 430 | u128 out_128{}; | 433 | u128 out_128{}; |
| 431 | memcpy(out_128.data(), out.data(), 16); | 434 | std::memcpy(out_128.data(), out.data(), sizeof(u128)); |
| 432 | LOG_TRACE(Crypto, "called with crypto_rev={:02X}, kak_index={:02X}, key={:016X}{:016X}", | 435 | LOG_TRACE(Crypto, "called with crypto_rev={:02X}, kak_index={:02X}, key={:016X}{:016X}", |
| 433 | master_key_id, header.key_index, out_128[1], out_128[0]); | 436 | master_key_id, header.key_index, out_128[1], out_128[0]); |
| 434 | 437 | ||
| @@ -507,7 +510,7 @@ VirtualFile NCA::Decrypt(const NCASectionHeader& s_header, VirtualFile in, u64 s | |||
| 507 | // TODO(DarkLordZach): Find a test case for XTS-encrypted NCAs | 510 | // TODO(DarkLordZach): Find a test case for XTS-encrypted NCAs |
| 508 | default: | 511 | default: |
| 509 | LOG_ERROR(Crypto, "called with unhandled crypto type={:02X}", | 512 | LOG_ERROR(Crypto, "called with unhandled crypto type={:02X}", |
| 510 | static_cast<u8>(s_header.raw.header.crypto_type)); | 513 | s_header.raw.header.crypto_type); |
| 511 | return nullptr; | 514 | return nullptr; |
| 512 | } | 515 | } |
| 513 | } | 516 | } |
diff --git a/src/core/file_sys/system_archive/system_version.cpp b/src/core/file_sys/system_archive/system_version.cpp index aa313de66..7bfbc9a67 100644 --- a/src/core/file_sys/system_archive/system_version.cpp +++ b/src/core/file_sys/system_archive/system_version.cpp | |||
| @@ -12,17 +12,17 @@ namespace SystemVersionData { | |||
| 12 | // This section should reflect the best system version to describe yuzu's HLE api. | 12 | // This section should reflect the best system version to describe yuzu's HLE api. |
| 13 | // TODO(DarkLordZach): Update when HLE gets better. | 13 | // TODO(DarkLordZach): Update when HLE gets better. |
| 14 | 14 | ||
| 15 | constexpr u8 VERSION_MAJOR = 10; | 15 | constexpr u8 VERSION_MAJOR = 11; |
| 16 | constexpr u8 VERSION_MINOR = 0; | 16 | constexpr u8 VERSION_MINOR = 0; |
| 17 | constexpr u8 VERSION_MICRO = 2; | 17 | constexpr u8 VERSION_MICRO = 0; |
| 18 | 18 | ||
| 19 | constexpr u8 REVISION_MAJOR = 1; | 19 | constexpr u8 REVISION_MAJOR = 5; |
| 20 | constexpr u8 REVISION_MINOR = 0; | 20 | constexpr u8 REVISION_MINOR = 0; |
| 21 | 21 | ||
| 22 | constexpr char PLATFORM_STRING[] = "NX"; | 22 | constexpr char PLATFORM_STRING[] = "NX"; |
| 23 | constexpr char VERSION_HASH[] = "f90143fa8bbc061d4f68c35f95f04f8080c0ecdc"; | 23 | constexpr char VERSION_HASH[] = "34197eba8810e2edd5e9dfcfbde7b340882e856d"; |
| 24 | constexpr char DISPLAY_VERSION[] = "10.0.2"; | 24 | constexpr char DISPLAY_VERSION[] = "11.0.0"; |
| 25 | constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 10.0.2-1.0"; | 25 | constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 11.0.0-5.0"; |
| 26 | 26 | ||
| 27 | } // namespace SystemVersionData | 27 | } // namespace SystemVersionData |
| 28 | 28 | ||
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp index 488687ba9..3b70f7755 100644 --- a/src/core/file_sys/vfs_real.cpp +++ b/src/core/file_sys/vfs_real.cpp | |||
| @@ -94,9 +94,13 @@ VirtualFile RealVfsFilesystem::OpenFile(std::string_view path_, Mode perms) { | |||
| 94 | 94 | ||
| 95 | VirtualFile RealVfsFilesystem::CreateFile(std::string_view path_, Mode perms) { | 95 | VirtualFile RealVfsFilesystem::CreateFile(std::string_view path_, Mode perms) { |
| 96 | const auto path = FS::SanitizePath(path_, FS::DirectorySeparator::PlatformDefault); | 96 | const auto path = FS::SanitizePath(path_, FS::DirectorySeparator::PlatformDefault); |
| 97 | const auto path_fwd = FS::SanitizePath(path, FS::DirectorySeparator::ForwardSlash); | 97 | const auto parent_path = FS::GetParentPath(path); |
| 98 | |||
| 98 | if (!FS::Exists(path)) { | 99 | if (!FS::Exists(path)) { |
| 99 | FS::CreateFullPath(path_fwd); | 100 | if (!FS::CreateDirs(parent_path)) { |
| 101 | return nullptr; | ||
| 102 | } | ||
| 103 | |||
| 100 | if (!FS::CreateEmptyFile(path)) { | 104 | if (!FS::CreateEmptyFile(path)) { |
| 101 | return nullptr; | 105 | return nullptr; |
| 102 | } | 106 | } |
diff --git a/src/core/file_sys/vfs_vector.h b/src/core/file_sys/vfs_vector.h index 95d3da2f2..c214db422 100644 --- a/src/core/file_sys/vfs_vector.h +++ b/src/core/file_sys/vfs_vector.h | |||
| @@ -17,9 +17,9 @@ namespace FileSys { | |||
| 17 | template <std::size_t size> | 17 | template <std::size_t size> |
| 18 | class ArrayVfsFile : public VfsFile { | 18 | class ArrayVfsFile : public VfsFile { |
| 19 | public: | 19 | public: |
| 20 | explicit ArrayVfsFile(const std::array<u8, size>& data, std::string name = "", | 20 | explicit ArrayVfsFile(const std::array<u8, size>& data_, std::string name_ = "", |
| 21 | VirtualDir parent = nullptr) | 21 | VirtualDir parent_ = nullptr) |
| 22 | : data(data), name(std::move(name)), parent(std::move(parent)) {} | 22 | : data(data_), name(std::move(name_)), parent(std::move(parent_)) {} |
| 23 | 23 | ||
| 24 | std::string GetName() const override { | 24 | std::string GetName() const override { |
| 25 | return name; | 25 | return name; |
| @@ -51,12 +51,12 @@ public: | |||
| 51 | return read; | 51 | return read; |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | std::size_t Write(const u8* data, std::size_t length, std::size_t offset) override { | 54 | std::size_t Write(const u8* data_, std::size_t length, std::size_t offset) override { |
| 55 | return 0; | 55 | return 0; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | bool Rename(std::string_view name) override { | 58 | bool Rename(std::string_view new_name) override { |
| 59 | this->name = name; | 59 | name = new_name; |
| 60 | return true; | 60 | return true; |
| 61 | } | 61 | } |
| 62 | 62 | ||
diff --git a/src/core/frontend/applets/error.cpp b/src/core/frontend/applets/error.cpp index 4002a9211..dceb20ff8 100644 --- a/src/core/frontend/applets/error.cpp +++ b/src/core/frontend/applets/error.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/logging/log.h" | ||
| 5 | #include "core/frontend/applets/error.h" | 6 | #include "core/frontend/applets/error.h" |
| 6 | 7 | ||
| 7 | namespace Core::Frontend { | 8 | namespace Core::Frontend { |
| @@ -10,7 +11,7 @@ ErrorApplet::~ErrorApplet() = default; | |||
| 10 | 11 | ||
| 11 | void DefaultErrorApplet::ShowError(ResultCode error, std::function<void()> finished) const { | 12 | void DefaultErrorApplet::ShowError(ResultCode error, std::function<void()> finished) const { |
| 12 | LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})", | 13 | LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})", |
| 13 | static_cast<u32>(error.module.Value()), error.description.Value(), error.raw); | 14 | error.module.Value(), error.description.Value(), error.raw); |
| 14 | } | 15 | } |
| 15 | 16 | ||
| 16 | void DefaultErrorApplet::ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time, | 17 | void DefaultErrorApplet::ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time, |
| @@ -18,7 +19,7 @@ void DefaultErrorApplet::ShowErrorWithTimestamp(ResultCode error, std::chrono::s | |||
| 18 | LOG_CRITICAL( | 19 | LOG_CRITICAL( |
| 19 | Service_Fatal, | 20 | Service_Fatal, |
| 20 | "Application requested error display: {:04X}-{:04X} (raw={:08X}) with timestamp={:016X}", | 21 | "Application requested error display: {:04X}-{:04X} (raw={:08X}) with timestamp={:016X}", |
| 21 | static_cast<u32>(error.module.Value()), error.description.Value(), error.raw, time.count()); | 22 | error.module.Value(), error.description.Value(), error.raw, time.count()); |
| 22 | } | 23 | } |
| 23 | 24 | ||
| 24 | void DefaultErrorApplet::ShowCustomErrorText(ResultCode error, std::string main_text, | 25 | void DefaultErrorApplet::ShowCustomErrorText(ResultCode error, std::string main_text, |
| @@ -26,7 +27,7 @@ void DefaultErrorApplet::ShowCustomErrorText(ResultCode error, std::string main_ | |||
| 26 | std::function<void()> finished) const { | 27 | std::function<void()> finished) const { |
| 27 | LOG_CRITICAL(Service_Fatal, | 28 | LOG_CRITICAL(Service_Fatal, |
| 28 | "Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})", | 29 | "Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})", |
| 29 | static_cast<u32>(error.module.Value()), error.description.Value(), error.raw); | 30 | error.module.Value(), error.description.Value(), error.raw); |
| 30 | LOG_CRITICAL(Service_Fatal, " Main Text: {}", main_text); | 31 | LOG_CRITICAL(Service_Fatal, " Main Text: {}", main_text); |
| 31 | LOG_CRITICAL(Service_Fatal, " Detail Text: {}", detail_text); | 32 | LOG_CRITICAL(Service_Fatal, " Detail Text: {}", detail_text); |
| 32 | } | 33 | } |
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index d57776ce9..56cc911d1 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h | |||
| @@ -166,8 +166,23 @@ public: | |||
| 166 | ValidateHeader(); | 166 | ValidateHeader(); |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | void PushImpl(s8 value); | ||
| 170 | void PushImpl(s16 value); | ||
| 171 | void PushImpl(s32 value); | ||
| 172 | void PushImpl(s64 value); | ||
| 173 | void PushImpl(u8 value); | ||
| 174 | void PushImpl(u16 value); | ||
| 175 | void PushImpl(u32 value); | ||
| 176 | void PushImpl(u64 value); | ||
| 177 | void PushImpl(float value); | ||
| 178 | void PushImpl(double value); | ||
| 179 | void PushImpl(bool value); | ||
| 180 | void PushImpl(ResultCode value); | ||
| 181 | |||
| 169 | template <typename T> | 182 | template <typename T> |
| 170 | void Push(T value); | 183 | void Push(T value) { |
| 184 | return PushImpl(value); | ||
| 185 | } | ||
| 171 | 186 | ||
| 172 | template <typename First, typename... Other> | 187 | template <typename First, typename... Other> |
| 173 | void Push(const First& first_value, const Other&... other_values); | 188 | void Push(const First& first_value, const Other&... other_values); |
| @@ -215,13 +230,11 @@ private: | |||
| 215 | 230 | ||
| 216 | /// Push /// | 231 | /// Push /// |
| 217 | 232 | ||
| 218 | template <> | 233 | inline void ResponseBuilder::PushImpl(s32 value) { |
| 219 | inline void ResponseBuilder::Push(s32 value) { | ||
| 220 | cmdbuf[index++] = static_cast<u32>(value); | 234 | cmdbuf[index++] = static_cast<u32>(value); |
| 221 | } | 235 | } |
| 222 | 236 | ||
| 223 | template <> | 237 | inline void ResponseBuilder::PushImpl(u32 value) { |
| 224 | inline void ResponseBuilder::Push(u32 value) { | ||
| 225 | cmdbuf[index++] = value; | 238 | cmdbuf[index++] = value; |
| 226 | } | 239 | } |
| 227 | 240 | ||
| @@ -233,62 +246,52 @@ void ResponseBuilder::PushRaw(const T& value) { | |||
| 233 | index += (sizeof(T) + 3) / 4; // round up to word length | 246 | index += (sizeof(T) + 3) / 4; // round up to word length |
| 234 | } | 247 | } |
| 235 | 248 | ||
| 236 | template <> | 249 | inline void ResponseBuilder::PushImpl(ResultCode value) { |
| 237 | inline void ResponseBuilder::Push(ResultCode value) { | ||
| 238 | // Result codes are actually 64-bit in the IPC buffer, but only the high part is discarded. | 250 | // Result codes are actually 64-bit in the IPC buffer, but only the high part is discarded. |
| 239 | Push(value.raw); | 251 | Push(value.raw); |
| 240 | Push<u32>(0); | 252 | Push<u32>(0); |
| 241 | } | 253 | } |
| 242 | 254 | ||
| 243 | template <> | 255 | inline void ResponseBuilder::PushImpl(s8 value) { |
| 244 | inline void ResponseBuilder::Push(s8 value) { | ||
| 245 | PushRaw(value); | 256 | PushRaw(value); |
| 246 | } | 257 | } |
| 247 | 258 | ||
| 248 | template <> | 259 | inline void ResponseBuilder::PushImpl(s16 value) { |
| 249 | inline void ResponseBuilder::Push(s16 value) { | ||
| 250 | PushRaw(value); | 260 | PushRaw(value); |
| 251 | } | 261 | } |
| 252 | 262 | ||
| 253 | template <> | 263 | inline void ResponseBuilder::PushImpl(s64 value) { |
| 254 | inline void ResponseBuilder::Push(s64 value) { | 264 | PushImpl(static_cast<u32>(value)); |
| 255 | Push(static_cast<u32>(value)); | 265 | PushImpl(static_cast<u32>(value >> 32)); |
| 256 | Push(static_cast<u32>(value >> 32)); | ||
| 257 | } | 266 | } |
| 258 | 267 | ||
| 259 | template <> | 268 | inline void ResponseBuilder::PushImpl(u8 value) { |
| 260 | inline void ResponseBuilder::Push(u8 value) { | ||
| 261 | PushRaw(value); | 269 | PushRaw(value); |
| 262 | } | 270 | } |
| 263 | 271 | ||
| 264 | template <> | 272 | inline void ResponseBuilder::PushImpl(u16 value) { |
| 265 | inline void ResponseBuilder::Push(u16 value) { | ||
| 266 | PushRaw(value); | 273 | PushRaw(value); |
| 267 | } | 274 | } |
| 268 | 275 | ||
| 269 | template <> | 276 | inline void ResponseBuilder::PushImpl(u64 value) { |
| 270 | inline void ResponseBuilder::Push(u64 value) { | 277 | PushImpl(static_cast<u32>(value)); |
| 271 | Push(static_cast<u32>(value)); | 278 | PushImpl(static_cast<u32>(value >> 32)); |
| 272 | Push(static_cast<u32>(value >> 32)); | ||
| 273 | } | 279 | } |
| 274 | 280 | ||
| 275 | template <> | 281 | inline void ResponseBuilder::PushImpl(float value) { |
| 276 | inline void ResponseBuilder::Push(float value) { | ||
| 277 | u32 integral; | 282 | u32 integral; |
| 278 | std::memcpy(&integral, &value, sizeof(u32)); | 283 | std::memcpy(&integral, &value, sizeof(u32)); |
| 279 | Push(integral); | 284 | PushImpl(integral); |
| 280 | } | 285 | } |
| 281 | 286 | ||
| 282 | template <> | 287 | inline void ResponseBuilder::PushImpl(double value) { |
| 283 | inline void ResponseBuilder::Push(double value) { | ||
| 284 | u64 integral; | 288 | u64 integral; |
| 285 | std::memcpy(&integral, &value, sizeof(u64)); | 289 | std::memcpy(&integral, &value, sizeof(u64)); |
| 286 | Push(integral); | 290 | PushImpl(integral); |
| 287 | } | 291 | } |
| 288 | 292 | ||
| 289 | template <> | 293 | inline void ResponseBuilder::PushImpl(bool value) { |
| 290 | inline void ResponseBuilder::Push(bool value) { | 294 | PushImpl(static_cast<u8>(value)); |
| 291 | Push(static_cast<u8>(value)); | ||
| 292 | } | 295 | } |
| 293 | 296 | ||
| 294 | template <typename First, typename... Other> | 297 | template <typename First, typename... Other> |
diff --git a/src/core/hle/kernel/memory/memory_block.h b/src/core/hle/kernel/memory/memory_block.h index 9d7839d08..37fe19916 100644 --- a/src/core/hle/kernel/memory/memory_block.h +++ b/src/core/hle/kernel/memory/memory_block.h | |||
| @@ -222,9 +222,9 @@ public: | |||
| 222 | 222 | ||
| 223 | public: | 223 | public: |
| 224 | constexpr MemoryBlock() = default; | 224 | constexpr MemoryBlock() = default; |
| 225 | constexpr MemoryBlock(VAddr addr, std::size_t num_pages, MemoryState state, | 225 | constexpr MemoryBlock(VAddr addr_, std::size_t num_pages_, MemoryState state_, |
| 226 | MemoryPermission perm, MemoryAttribute attribute) | 226 | MemoryPermission perm_, MemoryAttribute attribute_) |
| 227 | : addr{addr}, num_pages(num_pages), state{state}, perm{perm}, attribute{attribute} {} | 227 | : addr{addr_}, num_pages(num_pages_), state{state_}, perm{perm_}, attribute{attribute_} {} |
| 228 | 228 | ||
| 229 | constexpr VAddr GetAddress() const { | 229 | constexpr VAddr GetAddress() const { |
| 230 | return addr; | 230 | return addr; |
diff --git a/src/core/hle/kernel/memory/memory_block_manager.h b/src/core/hle/kernel/memory/memory_block_manager.h index 6e1d41075..f57d1bbcc 100644 --- a/src/core/hle/kernel/memory/memory_block_manager.h +++ b/src/core/hle/kernel/memory/memory_block_manager.h | |||
| @@ -57,8 +57,8 @@ public: | |||
| 57 | private: | 57 | private: |
| 58 | void MergeAdjacent(iterator it, iterator& next_it); | 58 | void MergeAdjacent(iterator it, iterator& next_it); |
| 59 | 59 | ||
| 60 | const VAddr start_addr; | 60 | [[maybe_unused]] const VAddr start_addr; |
| 61 | const VAddr end_addr; | 61 | [[maybe_unused]] const VAddr end_addr; |
| 62 | 62 | ||
| 63 | MemoryBlockTree memory_block_tree; | 63 | MemoryBlockTree memory_block_tree; |
| 64 | }; | 64 | }; |
diff --git a/src/core/hle/kernel/physical_core.h b/src/core/hle/kernel/physical_core.h index 37513130a..801d24c28 100644 --- a/src/core/hle/kernel/physical_core.h +++ b/src/core/hle/kernel/physical_core.h | |||
| @@ -36,7 +36,7 @@ public: | |||
| 36 | PhysicalCore& operator=(const PhysicalCore&) = delete; | 36 | PhysicalCore& operator=(const PhysicalCore&) = delete; |
| 37 | 37 | ||
| 38 | PhysicalCore(PhysicalCore&&) = default; | 38 | PhysicalCore(PhysicalCore&&) = default; |
| 39 | PhysicalCore& operator=(PhysicalCore&&) = default; | 39 | PhysicalCore& operator=(PhysicalCore&&) = delete; |
| 40 | 40 | ||
| 41 | /// Initialize the core for the specified parameters. | 41 | /// Initialize the core for the specified parameters. |
| 42 | void Initialize(bool is_64_bit); | 42 | void Initialize(bool is_64_bit); |
diff --git a/src/core/hle/kernel/process_capability.cpp b/src/core/hle/kernel/process_capability.cpp index 63880f13d..0f128c586 100644 --- a/src/core/hle/kernel/process_capability.cpp +++ b/src/core/hle/kernel/process_capability.cpp | |||
| @@ -199,7 +199,7 @@ ResultCode ProcessCapabilities::ParseSingleFlagCapability(u32& set_flags, u32& s | |||
| 199 | break; | 199 | break; |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | LOG_ERROR(Kernel, "Invalid capability type! type={}", static_cast<u32>(type)); | 202 | LOG_ERROR(Kernel, "Invalid capability type! type={}", type); |
| 203 | return ERR_INVALID_CAPABILITY_DESCRIPTOR; | 203 | return ERR_INVALID_CAPABILITY_DESCRIPTOR; |
| 204 | } | 204 | } |
| 205 | 205 | ||
diff --git a/src/core/hle/kernel/resource_limit.cpp b/src/core/hle/kernel/resource_limit.cpp index 212e442f4..7bf50339d 100644 --- a/src/core/hle/kernel/resource_limit.cpp +++ b/src/core/hle/kernel/resource_limit.cpp | |||
| @@ -65,8 +65,8 @@ ResultCode ResourceLimit::SetLimitValue(ResourceType resource, s64 value) { | |||
| 65 | limit[index] = value; | 65 | limit[index] = value; |
| 66 | return RESULT_SUCCESS; | 66 | return RESULT_SUCCESS; |
| 67 | } else { | 67 | } else { |
| 68 | LOG_ERROR(Kernel, "Limit value is too large! resource={}, value={}, index={}", | 68 | LOG_ERROR(Kernel, "Limit value is too large! resource={}, value={}, index={}", resource, |
| 69 | static_cast<u32>(resource), value, index); | 69 | value, index); |
| 70 | return ERR_INVALID_STATE; | 70 | return ERR_INVALID_STATE; |
| 71 | } | 71 | } |
| 72 | } | 72 | } |
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index 8c19f2534..ae088cf41 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp | |||
| @@ -130,8 +130,7 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con | |||
| 130 | } | 130 | } |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | LOG_CRITICAL(IPC, "Unknown domain command={}", | 133 | LOG_CRITICAL(IPC, "Unknown domain command={}", domain_message_header.command.Value()); |
| 134 | static_cast<int>(domain_message_header.command.Value())); | ||
| 135 | ASSERT(false); | 134 | ASSERT(false); |
| 136 | return RESULT_SUCCESS; | 135 | return RESULT_SUCCESS; |
| 137 | } | 136 | } |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 38d877f6e..cb13210e5 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -1092,14 +1092,14 @@ void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx) | |||
| 1092 | const auto applet_id = rp.PopRaw<Applets::AppletId>(); | 1092 | const auto applet_id = rp.PopRaw<Applets::AppletId>(); |
| 1093 | const auto applet_mode = rp.PopRaw<u32>(); | 1093 | const auto applet_mode = rp.PopRaw<u32>(); |
| 1094 | 1094 | ||
| 1095 | LOG_DEBUG(Service_AM, "called with applet_id={:08X}, applet_mode={:08X}", | 1095 | LOG_DEBUG(Service_AM, "called with applet_id={:08X}, applet_mode={:08X}", applet_id, |
| 1096 | static_cast<u32>(applet_id), applet_mode); | 1096 | applet_mode); |
| 1097 | 1097 | ||
| 1098 | const auto& applet_manager{system.GetAppletManager()}; | 1098 | const auto& applet_manager{system.GetAppletManager()}; |
| 1099 | const auto applet = applet_manager.GetApplet(applet_id); | 1099 | const auto applet = applet_manager.GetApplet(applet_id); |
| 1100 | 1100 | ||
| 1101 | if (applet == nullptr) { | 1101 | if (applet == nullptr) { |
| 1102 | LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", static_cast<u32>(applet_id)); | 1102 | LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id); |
| 1103 | 1103 | ||
| 1104 | IPC::ResponseBuilder rb{ctx, 2}; | 1104 | IPC::ResponseBuilder rb{ctx, 2}; |
| 1105 | rb.Push(RESULT_UNKNOWN); | 1105 | rb.Push(RESULT_UNKNOWN); |
| @@ -1290,7 +1290,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { | |||
| 1290 | IPC::RequestParser rp{ctx}; | 1290 | IPC::RequestParser rp{ctx}; |
| 1291 | const auto kind = rp.PopEnum<LaunchParameterKind>(); | 1291 | const auto kind = rp.PopEnum<LaunchParameterKind>(); |
| 1292 | 1292 | ||
| 1293 | LOG_DEBUG(Service_AM, "called, kind={:08X}", static_cast<u8>(kind)); | 1293 | LOG_DEBUG(Service_AM, "called, kind={:08X}", kind); |
| 1294 | 1294 | ||
| 1295 | if (kind == LaunchParameterKind::ApplicationSpecific && !launch_popped_application_specific) { | 1295 | if (kind == LaunchParameterKind::ApplicationSpecific && !launch_popped_application_specific) { |
| 1296 | const auto backend = BCAT::CreateBackendFromSettings(system, [this](u64 tid) { | 1296 | const auto backend = BCAT::CreateBackendFromSettings(system, [this](u64 tid) { |
| @@ -1537,8 +1537,8 @@ void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) { | |||
| 1537 | IPC::RequestParser rp{ctx}; | 1537 | IPC::RequestParser rp{ctx}; |
| 1538 | const auto [type, user_id] = rp.PopRaw<Parameters>(); | 1538 | const auto [type, user_id] = rp.PopRaw<Parameters>(); |
| 1539 | 1539 | ||
| 1540 | LOG_DEBUG(Service_AM, "called with type={:02X}, user_id={:016X}{:016X}", static_cast<u8>(type), | 1540 | LOG_DEBUG(Service_AM, "called with type={:02X}, user_id={:016X}{:016X}", type, user_id[1], |
| 1541 | user_id[1], user_id[0]); | 1541 | user_id[0]); |
| 1542 | 1542 | ||
| 1543 | const auto size = system.GetFileSystemController().ReadSaveDataSize( | 1543 | const auto size = system.GetFileSystemController().ReadSaveDataSize( |
| 1544 | type, system.CurrentProcess()->GetTitleID(), user_id); | 1544 | type, system.CurrentProcess()->GetTitleID(), user_id); |
diff --git a/src/core/hle/service/am/applets/controller.cpp b/src/core/hle/service/am/applets/controller.cpp index e8ea4248b..7edfca64e 100644 --- a/src/core/hle/service/am/applets/controller.cpp +++ b/src/core/hle/service/am/applets/controller.cpp | |||
| @@ -29,14 +29,14 @@ static Core::Frontend::ControllerParameters ConvertToFrontendParameters( | |||
| 29 | npad_style_set.raw = private_arg.style_set; | 29 | npad_style_set.raw = private_arg.style_set; |
| 30 | 30 | ||
| 31 | return { | 31 | return { |
| 32 | .min_players = std::max(s8(1), header.player_count_min), | 32 | .min_players = std::max(s8{1}, header.player_count_min), |
| 33 | .max_players = header.player_count_max, | 33 | .max_players = header.player_count_max, |
| 34 | .keep_controllers_connected = header.enable_take_over_connection, | 34 | .keep_controllers_connected = header.enable_take_over_connection, |
| 35 | .enable_single_mode = header.enable_single_mode, | 35 | .enable_single_mode = header.enable_single_mode, |
| 36 | .enable_border_color = header.enable_identification_color, | 36 | .enable_border_color = header.enable_identification_color, |
| 37 | .border_colors = identification_colors, | 37 | .border_colors = std::move(identification_colors), |
| 38 | .enable_explain_text = enable_text, | 38 | .enable_explain_text = enable_text, |
| 39 | .explain_text = text, | 39 | .explain_text = std::move(text), |
| 40 | .allow_pro_controller = npad_style_set.pro_controller == 1, | 40 | .allow_pro_controller = npad_style_set.pro_controller == 1, |
| 41 | .allow_handheld = npad_style_set.handheld == 1, | 41 | .allow_handheld = npad_style_set.handheld == 1, |
| 42 | .allow_dual_joycons = npad_style_set.joycon_dual == 1, | 42 | .allow_dual_joycons = npad_style_set.joycon_dual == 1, |
| @@ -227,15 +227,14 @@ void Controller::ConfigurationComplete() { | |||
| 227 | // If enable_single_mode is enabled, player_count is 1 regardless of any other parameters. | 227 | // If enable_single_mode is enabled, player_count is 1 regardless of any other parameters. |
| 228 | // Otherwise, only count connected players from P1-P8. | 228 | // Otherwise, only count connected players from P1-P8. |
| 229 | result_info.player_count = | 229 | result_info.player_count = |
| 230 | is_single_mode ? 1 | 230 | is_single_mode |
| 231 | : static_cast<s8>(std::count_if( | 231 | ? 1 |
| 232 | players.begin(), players.end() - 2, | 232 | : static_cast<s8>(std::count_if(players.begin(), players.end() - 2, |
| 233 | [](Settings::PlayerInput player) { return player.connected; })); | 233 | [](const auto& player) { return player.connected; })); |
| 234 | 234 | ||
| 235 | result_info.selected_id = HID::Controller_NPad::IndexToNPad( | 235 | result_info.selected_id = HID::Controller_NPad::IndexToNPad(std::distance( |
| 236 | std::distance(players.begin(), | 236 | players.begin(), std::find_if(players.begin(), players.end(), |
| 237 | std::find_if(players.begin(), players.end(), | 237 | [](const auto& player) { return player.connected; }))); |
| 238 | [](Settings::PlayerInput player) { return player.connected; }))); | ||
| 239 | 238 | ||
| 240 | result_info.result = 0; | 239 | result_info.result = 0; |
| 241 | 240 | ||
diff --git a/src/core/hle/service/am/applets/error.cpp b/src/core/hle/service/am/applets/error.cpp index dcd4b2a35..d85505082 100644 --- a/src/core/hle/service/am/applets/error.cpp +++ b/src/core/hle/service/am/applets/error.cpp | |||
| @@ -125,7 +125,7 @@ void Error::Initialize() { | |||
| 125 | error_code = Decode64BitError(args->error_record.error_code_64); | 125 | error_code = Decode64BitError(args->error_record.error_code_64); |
| 126 | break; | 126 | break; |
| 127 | default: | 127 | default: |
| 128 | UNIMPLEMENTED_MSG("Unimplemented LibAppletError mode={:02X}!", static_cast<u8>(mode)); | 128 | UNIMPLEMENTED_MSG("Unimplemented LibAppletError mode={:02X}!", mode); |
| 129 | } | 129 | } |
| 130 | } | 130 | } |
| 131 | 131 | ||
| @@ -179,7 +179,7 @@ void Error::Execute() { | |||
| 179 | error_code, std::chrono::seconds{args->error_record.posix_time}, callback); | 179 | error_code, std::chrono::seconds{args->error_record.posix_time}, callback); |
| 180 | break; | 180 | break; |
| 181 | default: | 181 | default: |
| 182 | UNIMPLEMENTED_MSG("Unimplemented LibAppletError mode={:02X}!", static_cast<u8>(mode)); | 182 | UNIMPLEMENTED_MSG("Unimplemented LibAppletError mode={:02X}!", mode); |
| 183 | DisplayCompleted(); | 183 | DisplayCompleted(); |
| 184 | } | 184 | } |
| 185 | } | 185 | } |
diff --git a/src/core/hle/service/am/applets/general_backend.cpp b/src/core/hle/service/am/applets/general_backend.cpp index bdb6fd464..4d1df5cbe 100644 --- a/src/core/hle/service/am/applets/general_backend.cpp +++ b/src/core/hle/service/am/applets/general_backend.cpp | |||
| @@ -90,7 +90,7 @@ void Auth::Execute() { | |||
| 90 | const auto unimplemented_log = [this] { | 90 | const auto unimplemented_log = [this] { |
| 91 | UNIMPLEMENTED_MSG("Unimplemented Auth applet type for type={:08X}, arg0={:02X}, " | 91 | UNIMPLEMENTED_MSG("Unimplemented Auth applet type for type={:08X}, arg0={:02X}, " |
| 92 | "arg1={:02X}, arg2={:02X}", | 92 | "arg1={:02X}, arg2={:02X}", |
| 93 | static_cast<u32>(type), arg0, arg1, arg2); | 93 | type, arg0, arg1, arg2); |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | switch (type) { | 96 | switch (type) { |
| @@ -136,7 +136,7 @@ void Auth::Execute() { | |||
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | void Auth::AuthFinished(bool is_successful) { | 138 | void Auth::AuthFinished(bool is_successful) { |
| 139 | this->successful = is_successful; | 139 | successful = is_successful; |
| 140 | 140 | ||
| 141 | struct Return { | 141 | struct Return { |
| 142 | ResultCode result_code; | 142 | ResultCode result_code; |
| @@ -193,7 +193,7 @@ void PhotoViewer::Execute() { | |||
| 193 | frontend.ShowAllPhotos(callback); | 193 | frontend.ShowAllPhotos(callback); |
| 194 | break; | 194 | break; |
| 195 | default: | 195 | default: |
| 196 | UNIMPLEMENTED_MSG("Unimplemented PhotoViewer applet mode={:02X}!", static_cast<u8>(mode)); | 196 | UNIMPLEMENTED_MSG("Unimplemented PhotoViewer applet mode={:02X}!", mode); |
| 197 | } | 197 | } |
| 198 | } | 198 | } |
| 199 | 199 | ||
diff --git a/src/core/hle/service/apm/controller.cpp b/src/core/hle/service/apm/controller.cpp index ce993bad3..03636642b 100644 --- a/src/core/hle/service/apm/controller.cpp +++ b/src/core/hle/service/apm/controller.cpp | |||
| @@ -48,8 +48,7 @@ void Controller::SetPerformanceConfiguration(PerformanceMode mode, | |||
| 48 | [config](const auto& entry) { return entry.first == config; }); | 48 | [config](const auto& entry) { return entry.first == config; }); |
| 49 | 49 | ||
| 50 | if (iter == config_to_speed.cend()) { | 50 | if (iter == config_to_speed.cend()) { |
| 51 | LOG_ERROR(Service_APM, "Invalid performance configuration value provided: {}", | 51 | LOG_ERROR(Service_APM, "Invalid performance configuration value provided: {}", config); |
| 52 | static_cast<u32>(config)); | ||
| 53 | return; | 52 | return; |
| 54 | } | 53 | } |
| 55 | 54 | ||
diff --git a/src/core/hle/service/apm/interface.cpp b/src/core/hle/service/apm/interface.cpp index 89442e21e..298f6d520 100644 --- a/src/core/hle/service/apm/interface.cpp +++ b/src/core/hle/service/apm/interface.cpp | |||
| @@ -28,8 +28,7 @@ private: | |||
| 28 | 28 | ||
| 29 | const auto mode = rp.PopEnum<PerformanceMode>(); | 29 | const auto mode = rp.PopEnum<PerformanceMode>(); |
| 30 | const auto config = rp.PopEnum<PerformanceConfiguration>(); | 30 | const auto config = rp.PopEnum<PerformanceConfiguration>(); |
| 31 | LOG_DEBUG(Service_APM, "called mode={} config={}", static_cast<u32>(mode), | 31 | LOG_DEBUG(Service_APM, "called mode={} config={}", mode, config); |
| 32 | static_cast<u32>(config)); | ||
| 33 | 32 | ||
| 34 | controller.SetPerformanceConfiguration(mode, config); | 33 | controller.SetPerformanceConfiguration(mode, config); |
| 35 | 34 | ||
| @@ -41,7 +40,7 @@ private: | |||
| 41 | IPC::RequestParser rp{ctx}; | 40 | IPC::RequestParser rp{ctx}; |
| 42 | 41 | ||
| 43 | const auto mode = rp.PopEnum<PerformanceMode>(); | 42 | const auto mode = rp.PopEnum<PerformanceMode>(); |
| 44 | LOG_DEBUG(Service_APM, "called mode={}", static_cast<u32>(mode)); | 43 | LOG_DEBUG(Service_APM, "called mode={}", mode); |
| 45 | 44 | ||
| 46 | IPC::ResponseBuilder rb{ctx, 3}; | 45 | IPC::ResponseBuilder rb{ctx, 3}; |
| 47 | rb.Push(RESULT_SUCCESS); | 46 | rb.Push(RESULT_SUCCESS); |
| @@ -111,7 +110,7 @@ void APM_Sys::SetCpuBoostMode(Kernel::HLERequestContext& ctx) { | |||
| 111 | IPC::RequestParser rp{ctx}; | 110 | IPC::RequestParser rp{ctx}; |
| 112 | const auto mode = rp.PopEnum<CpuBoostMode>(); | 111 | const auto mode = rp.PopEnum<CpuBoostMode>(); |
| 113 | 112 | ||
| 114 | LOG_DEBUG(Service_APM, "called, mode={:08X}", static_cast<u32>(mode)); | 113 | LOG_DEBUG(Service_APM, "called, mode={:08X}", mode); |
| 115 | 114 | ||
| 116 | controller.SetFromCpuBoostMode(mode); | 115 | controller.SetFromCpuBoostMode(mode); |
| 117 | 116 | ||
diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp index 3b6f7498e..e43f3f47f 100644 --- a/src/core/hle/service/bcat/backend/boxcat.cpp +++ b/src/core/hle/service/bcat/backend/boxcat.cpp | |||
| @@ -483,7 +483,7 @@ Boxcat::StatusResult Boxcat::GetStatus(std::optional<std::string>& global, | |||
| 483 | global = json["global"].get<std::string>(); | 483 | global = json["global"].get<std::string>(); |
| 484 | 484 | ||
| 485 | if (json["games"].is_array()) { | 485 | if (json["games"].is_array()) { |
| 486 | for (const auto object : json["games"]) { | 486 | for (const auto& object : json["games"]) { |
| 487 | if (object.is_object() && object.find("name") != object.end()) { | 487 | if (object.is_object() && object.find("name") != object.end()) { |
| 488 | EventStatus detail{}; | 488 | EventStatus detail{}; |
| 489 | if (object["header"].is_string()) { | 489 | if (object["header"].is_string()) { |
diff --git a/src/core/hle/service/fatal/fatal.cpp b/src/core/hle/service/fatal/fatal.cpp index 9b7672a91..13147472e 100644 --- a/src/core/hle/service/fatal/fatal.cpp +++ b/src/core/hle/service/fatal/fatal.cpp | |||
| @@ -111,8 +111,9 @@ static void GenerateErrorReport(Core::System& system, ResultCode error_code, | |||
| 111 | 111 | ||
| 112 | static void ThrowFatalError(Core::System& system, ResultCode error_code, FatalType fatal_type, | 112 | static void ThrowFatalError(Core::System& system, ResultCode error_code, FatalType fatal_type, |
| 113 | const FatalInfo& info) { | 113 | const FatalInfo& info) { |
| 114 | LOG_ERROR(Service_Fatal, "Threw fatal error type {} with error code 0x{:X}", | 114 | LOG_ERROR(Service_Fatal, "Threw fatal error type {} with error code 0x{:X}", fatal_type, |
| 115 | static_cast<u32>(fatal_type), error_code.raw); | 115 | error_code.raw); |
| 116 | |||
| 116 | switch (fatal_type) { | 117 | switch (fatal_type) { |
| 117 | case FatalType::ErrorReportAndScreen: | 118 | case FatalType::ErrorReportAndScreen: |
| 118 | GenerateErrorReport(system, error_code, info); | 119 | GenerateErrorReport(system, error_code, info); |
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index ca93062cf..6af818b5a 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp | |||
| @@ -301,7 +301,7 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFSCurrentProcess() | |||
| 301 | ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFS( | 301 | ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFS( |
| 302 | u64 title_id, FileSys::StorageId storage_id, FileSys::ContentRecordType type) const { | 302 | u64 title_id, FileSys::StorageId storage_id, FileSys::ContentRecordType type) const { |
| 303 | LOG_TRACE(Service_FS, "Opening RomFS for title_id={:016X}, storage_id={:02X}, type={:02X}", | 303 | LOG_TRACE(Service_FS, "Opening RomFS for title_id={:016X}, storage_id={:02X}, type={:02X}", |
| 304 | title_id, static_cast<u8>(storage_id), static_cast<u8>(type)); | 304 | title_id, storage_id, type); |
| 305 | 305 | ||
| 306 | if (romfs_factory == nullptr) { | 306 | if (romfs_factory == nullptr) { |
| 307 | // TODO(bunnei): Find a better error code for this | 307 | // TODO(bunnei): Find a better error code for this |
| @@ -313,8 +313,8 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFS( | |||
| 313 | 313 | ||
| 314 | ResultVal<FileSys::VirtualDir> FileSystemController::CreateSaveData( | 314 | ResultVal<FileSys::VirtualDir> FileSystemController::CreateSaveData( |
| 315 | FileSys::SaveDataSpaceId space, const FileSys::SaveDataAttribute& save_struct) const { | 315 | FileSys::SaveDataSpaceId space, const FileSys::SaveDataAttribute& save_struct) const { |
| 316 | LOG_TRACE(Service_FS, "Creating Save Data for space_id={:01X}, save_struct={}", | 316 | LOG_TRACE(Service_FS, "Creating Save Data for space_id={:01X}, save_struct={}", space, |
| 317 | static_cast<u8>(space), save_struct.DebugInfo()); | 317 | save_struct.DebugInfo()); |
| 318 | 318 | ||
| 319 | if (save_data_factory == nullptr) { | 319 | if (save_data_factory == nullptr) { |
| 320 | return FileSys::ERROR_ENTITY_NOT_FOUND; | 320 | return FileSys::ERROR_ENTITY_NOT_FOUND; |
| @@ -325,8 +325,8 @@ ResultVal<FileSys::VirtualDir> FileSystemController::CreateSaveData( | |||
| 325 | 325 | ||
| 326 | ResultVal<FileSys::VirtualDir> FileSystemController::OpenSaveData( | 326 | ResultVal<FileSys::VirtualDir> FileSystemController::OpenSaveData( |
| 327 | FileSys::SaveDataSpaceId space, const FileSys::SaveDataAttribute& attribute) const { | 327 | FileSys::SaveDataSpaceId space, const FileSys::SaveDataAttribute& attribute) const { |
| 328 | LOG_TRACE(Service_FS, "Opening Save Data for space_id={:01X}, save_struct={}", | 328 | LOG_TRACE(Service_FS, "Opening Save Data for space_id={:01X}, save_struct={}", space, |
| 329 | static_cast<u8>(space), attribute.DebugInfo()); | 329 | attribute.DebugInfo()); |
| 330 | 330 | ||
| 331 | if (save_data_factory == nullptr) { | 331 | if (save_data_factory == nullptr) { |
| 332 | return FileSys::ERROR_ENTITY_NOT_FOUND; | 332 | return FileSys::ERROR_ENTITY_NOT_FOUND; |
| @@ -337,7 +337,7 @@ ResultVal<FileSys::VirtualDir> FileSystemController::OpenSaveData( | |||
| 337 | 337 | ||
| 338 | ResultVal<FileSys::VirtualDir> FileSystemController::OpenSaveDataSpace( | 338 | ResultVal<FileSys::VirtualDir> FileSystemController::OpenSaveDataSpace( |
| 339 | FileSys::SaveDataSpaceId space) const { | 339 | FileSys::SaveDataSpaceId space) const { |
| 340 | LOG_TRACE(Service_FS, "Opening Save Data Space for space_id={:01X}", static_cast<u8>(space)); | 340 | LOG_TRACE(Service_FS, "Opening Save Data Space for space_id={:01X}", space); |
| 341 | 341 | ||
| 342 | if (save_data_factory == nullptr) { | 342 | if (save_data_factory == nullptr) { |
| 343 | return FileSys::ERROR_ENTITY_NOT_FOUND; | 343 | return FileSys::ERROR_ENTITY_NOT_FOUND; |
| @@ -358,7 +358,7 @@ ResultVal<FileSys::VirtualDir> FileSystemController::OpenSDMC() const { | |||
| 358 | 358 | ||
| 359 | ResultVal<FileSys::VirtualDir> FileSystemController::OpenBISPartition( | 359 | ResultVal<FileSys::VirtualDir> FileSystemController::OpenBISPartition( |
| 360 | FileSys::BisPartitionId id) const { | 360 | FileSys::BisPartitionId id) const { |
| 361 | LOG_TRACE(Service_FS, "Opening BIS Partition with id={:08X}", static_cast<u32>(id)); | 361 | LOG_TRACE(Service_FS, "Opening BIS Partition with id={:08X}", id); |
| 362 | 362 | ||
| 363 | if (bis_factory == nullptr) { | 363 | if (bis_factory == nullptr) { |
| 364 | return FileSys::ERROR_ENTITY_NOT_FOUND; | 364 | return FileSys::ERROR_ENTITY_NOT_FOUND; |
| @@ -374,7 +374,7 @@ ResultVal<FileSys::VirtualDir> FileSystemController::OpenBISPartition( | |||
| 374 | 374 | ||
| 375 | ResultVal<FileSys::VirtualFile> FileSystemController::OpenBISPartitionStorage( | 375 | ResultVal<FileSys::VirtualFile> FileSystemController::OpenBISPartitionStorage( |
| 376 | FileSys::BisPartitionId id) const { | 376 | FileSys::BisPartitionId id) const { |
| 377 | LOG_TRACE(Service_FS, "Opening BIS Partition Storage with id={:08X}", static_cast<u32>(id)); | 377 | LOG_TRACE(Service_FS, "Opening BIS Partition Storage with id={:08X}", id); |
| 378 | 378 | ||
| 379 | if (bis_factory == nullptr) { | 379 | if (bis_factory == nullptr) { |
| 380 | return FileSys::ERROR_ENTITY_NOT_FOUND; | 380 | return FileSys::ERROR_ENTITY_NOT_FOUND; |
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index b3480494c..ef15160bf 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp | |||
| @@ -413,7 +413,7 @@ public: | |||
| 413 | 413 | ||
| 414 | const auto mode = static_cast<FileSys::Mode>(rp.Pop<u32>()); | 414 | const auto mode = static_cast<FileSys::Mode>(rp.Pop<u32>()); |
| 415 | 415 | ||
| 416 | LOG_DEBUG(Service_FS, "called. file={}, mode={}", name, static_cast<u32>(mode)); | 416 | LOG_DEBUG(Service_FS, "called. file={}, mode={}", name, mode); |
| 417 | 417 | ||
| 418 | auto result = backend.OpenFile(name, mode); | 418 | auto result = backend.OpenFile(name, mode); |
| 419 | if (result.Failed()) { | 419 | if (result.Failed()) { |
| @@ -553,8 +553,7 @@ private: | |||
| 553 | const auto save_root = fsc.OpenSaveDataSpace(space); | 553 | const auto save_root = fsc.OpenSaveDataSpace(space); |
| 554 | 554 | ||
| 555 | if (save_root.Failed() || *save_root == nullptr) { | 555 | if (save_root.Failed() || *save_root == nullptr) { |
| 556 | LOG_ERROR(Service_FS, "The save root for the space_id={:02X} was invalid!", | 556 | LOG_ERROR(Service_FS, "The save root for the space_id={:02X} was invalid!", space); |
| 557 | static_cast<u8>(space)); | ||
| 558 | return; | 557 | return; |
| 559 | } | 558 | } |
| 560 | 559 | ||
| @@ -795,8 +794,7 @@ void FSP_SRV::OpenFileSystemWithPatch(Kernel::HLERequestContext& ctx) { | |||
| 795 | 794 | ||
| 796 | const auto type = rp.PopRaw<FileSystemType>(); | 795 | const auto type = rp.PopRaw<FileSystemType>(); |
| 797 | const auto title_id = rp.PopRaw<u64>(); | 796 | const auto title_id = rp.PopRaw<u64>(); |
| 798 | LOG_WARNING(Service_FS, "(STUBBED) called with type={}, title_id={:016X}", | 797 | LOG_WARNING(Service_FS, "(STUBBED) called with type={}, title_id={:016X}", type, title_id); |
| 799 | static_cast<u8>(type), title_id); | ||
| 800 | 798 | ||
| 801 | IPC::ResponseBuilder rb{ctx, 2, 0, 0}; | 799 | IPC::ResponseBuilder rb{ctx, 2, 0, 0}; |
| 802 | rb.Push(RESULT_UNKNOWN); | 800 | rb.Push(RESULT_UNKNOWN); |
| @@ -883,7 +881,7 @@ void FSP_SRV::OpenReadOnlySaveDataFileSystem(Kernel::HLERequestContext& ctx) { | |||
| 883 | void FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId(Kernel::HLERequestContext& ctx) { | 881 | void FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId(Kernel::HLERequestContext& ctx) { |
| 884 | IPC::RequestParser rp{ctx}; | 882 | IPC::RequestParser rp{ctx}; |
| 885 | const auto space = rp.PopRaw<FileSys::SaveDataSpaceId>(); | 883 | const auto space = rp.PopRaw<FileSys::SaveDataSpaceId>(); |
| 886 | LOG_INFO(Service_FS, "called, space={}", static_cast<u8>(space)); | 884 | LOG_INFO(Service_FS, "called, space={}", space); |
| 887 | 885 | ||
| 888 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 886 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 889 | rb.Push(RESULT_SUCCESS); | 887 | rb.Push(RESULT_SUCCESS); |
| @@ -915,10 +913,10 @@ void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( | |||
| 915 | "(STUBBED) called, flags={}, space_id={}, attribute.title_id={:016X}\n" | 913 | "(STUBBED) called, flags={}, space_id={}, attribute.title_id={:016X}\n" |
| 916 | "attribute.user_id={:016X}{:016X}, attribute.save_id={:016X}\n" | 914 | "attribute.user_id={:016X}{:016X}, attribute.save_id={:016X}\n" |
| 917 | "attribute.type={}, attribute.rank={}, attribute.index={}", | 915 | "attribute.type={}, attribute.rank={}, attribute.index={}", |
| 918 | flags, static_cast<u32>(parameters.space_id), parameters.attribute.title_id, | 916 | flags, parameters.space_id, parameters.attribute.title_id, |
| 919 | parameters.attribute.user_id[1], parameters.attribute.user_id[0], | 917 | parameters.attribute.user_id[1], parameters.attribute.user_id[0], |
| 920 | parameters.attribute.save_id, static_cast<u32>(parameters.attribute.type), | 918 | parameters.attribute.save_id, parameters.attribute.type, parameters.attribute.rank, |
| 921 | static_cast<u32>(parameters.attribute.rank), parameters.attribute.index); | 919 | parameters.attribute.index); |
| 922 | 920 | ||
| 923 | IPC::ResponseBuilder rb{ctx, 3}; | 921 | IPC::ResponseBuilder rb{ctx, 3}; |
| 924 | rb.Push(RESULT_SUCCESS); | 922 | rb.Push(RESULT_SUCCESS); |
| @@ -951,7 +949,7 @@ void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) { | |||
| 951 | const auto title_id = rp.PopRaw<u64>(); | 949 | const auto title_id = rp.PopRaw<u64>(); |
| 952 | 950 | ||
| 953 | LOG_DEBUG(Service_FS, "called with storage_id={:02X}, unknown={:08X}, title_id={:016X}", | 951 | LOG_DEBUG(Service_FS, "called with storage_id={:02X}, unknown={:08X}, title_id={:016X}", |
| 954 | static_cast<u8>(storage_id), unknown, title_id); | 952 | storage_id, unknown, title_id); |
| 955 | 953 | ||
| 956 | auto data = fsc.OpenRomFS(title_id, storage_id, FileSys::ContentRecordType::Data); | 954 | auto data = fsc.OpenRomFS(title_id, storage_id, FileSys::ContentRecordType::Data); |
| 957 | 955 | ||
| @@ -968,7 +966,7 @@ void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) { | |||
| 968 | // TODO(DarkLordZach): Find the right error code to use here | 966 | // TODO(DarkLordZach): Find the right error code to use here |
| 969 | LOG_ERROR(Service_FS, | 967 | LOG_ERROR(Service_FS, |
| 970 | "could not open data storage with title_id={:016X}, storage_id={:02X}", title_id, | 968 | "could not open data storage with title_id={:016X}, storage_id={:02X}", title_id, |
| 971 | static_cast<u8>(storage_id)); | 969 | storage_id); |
| 972 | IPC::ResponseBuilder rb{ctx, 2}; | 970 | IPC::ResponseBuilder rb{ctx, 2}; |
| 973 | rb.Push(RESULT_UNKNOWN); | 971 | rb.Push(RESULT_UNKNOWN); |
| 974 | return; | 972 | return; |
| @@ -987,11 +985,10 @@ void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) { | |||
| 987 | void FSP_SRV::OpenPatchDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) { | 985 | void FSP_SRV::OpenPatchDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) { |
| 988 | IPC::RequestParser rp{ctx}; | 986 | IPC::RequestParser rp{ctx}; |
| 989 | 987 | ||
| 990 | auto storage_id = rp.PopRaw<FileSys::StorageId>(); | 988 | const auto storage_id = rp.PopRaw<FileSys::StorageId>(); |
| 991 | auto title_id = rp.PopRaw<u64>(); | 989 | const auto title_id = rp.PopRaw<u64>(); |
| 992 | 990 | ||
| 993 | LOG_DEBUG(Service_FS, "called with storage_id={:02X}, title_id={:016X}", | 991 | LOG_DEBUG(Service_FS, "called with storage_id={:02X}, title_id={:016X}", storage_id, title_id); |
| 994 | static_cast<u8>(storage_id), title_id); | ||
| 995 | 992 | ||
| 996 | IPC::ResponseBuilder rb{ctx, 2}; | 993 | IPC::ResponseBuilder rb{ctx, 2}; |
| 997 | rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND); | 994 | rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND); |
| @@ -1001,7 +998,7 @@ void FSP_SRV::SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { | |||
| 1001 | IPC::RequestParser rp{ctx}; | 998 | IPC::RequestParser rp{ctx}; |
| 1002 | log_mode = rp.PopEnum<LogMode>(); | 999 | log_mode = rp.PopEnum<LogMode>(); |
| 1003 | 1000 | ||
| 1004 | LOG_DEBUG(Service_FS, "called, log_mode={:08X}", static_cast<u32>(log_mode)); | 1001 | LOG_DEBUG(Service_FS, "called, log_mode={:08X}", log_mode); |
| 1005 | 1002 | ||
| 1006 | IPC::ResponseBuilder rb{ctx, 2}; | 1003 | IPC::ResponseBuilder rb{ctx, 2}; |
| 1007 | rb.Push(RESULT_SUCCESS); | 1004 | rb.Push(RESULT_SUCCESS); |
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index 40a289594..c5b053c31 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp | |||
| @@ -229,8 +229,7 @@ private: | |||
| 229 | break; | 229 | break; |
| 230 | default: | 230 | default: |
| 231 | // HOS seems not have an error case for an unknown notification | 231 | // HOS seems not have an error case for an unknown notification |
| 232 | LOG_WARNING(Service_ACC, "Unknown notification {:08X}", | 232 | LOG_WARNING(Service_ACC, "Unknown notification {:08X}", notification.notification_type); |
| 233 | static_cast<u32>(notification.notification_type)); | ||
| 234 | break; | 233 | break; |
| 235 | } | 234 | } |
| 236 | 235 | ||
diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index f884b2735..8e49b068c 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp | |||
| @@ -68,7 +68,7 @@ private: | |||
| 68 | IPC::RequestParser rp{ctx}; | 68 | IPC::RequestParser rp{ctx}; |
| 69 | const auto destination = rp.PopEnum<DestinationFlag>(); | 69 | const auto destination = rp.PopEnum<DestinationFlag>(); |
| 70 | 70 | ||
| 71 | LOG_DEBUG(Service_LM, "called, destination={:08X}", static_cast<u32>(destination)); | 71 | LOG_DEBUG(Service_LM, "called, destination={:08X}", destination); |
| 72 | 72 | ||
| 73 | manager.SetDestination(destination); | 73 | manager.SetDestination(destination); |
| 74 | 74 | ||
diff --git a/src/core/hle/service/ncm/ncm.cpp b/src/core/hle/service/ncm/ncm.cpp index b8d627ca8..2dcda16f6 100644 --- a/src/core/hle/service/ncm/ncm.cpp +++ b/src/core/hle/service/ncm/ncm.cpp | |||
| @@ -45,7 +45,7 @@ public: | |||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | private: | 47 | private: |
| 48 | FileSys::StorageId storage; | 48 | [[maybe_unused]] FileSys::StorageId storage; |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | class IRegisteredLocationResolver final : public ServiceFramework<IRegisteredLocationResolver> { | 51 | class IRegisteredLocationResolver final : public ServiceFramework<IRegisteredLocationResolver> { |
diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp index ccc137e40..c8a215845 100644 --- a/src/core/hle/service/ns/pl_u.cpp +++ b/src/core/hle/service/ns/pl_u.cpp | |||
| @@ -182,21 +182,18 @@ PL_U::PL_U(Core::System& system_) | |||
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | if (!romfs) { | 184 | if (!romfs) { |
| 185 | LOG_ERROR(Service_NS, "Failed to find or synthesize {:016X}! Skipping", | 185 | LOG_ERROR(Service_NS, "Failed to find or synthesize {:016X}! Skipping", font.first); |
| 186 | static_cast<u64>(font.first)); | ||
| 187 | continue; | 186 | continue; |
| 188 | } | 187 | } |
| 189 | 188 | ||
| 190 | const auto extracted_romfs = FileSys::ExtractRomFS(romfs); | 189 | const auto extracted_romfs = FileSys::ExtractRomFS(romfs); |
| 191 | if (!extracted_romfs) { | 190 | if (!extracted_romfs) { |
| 192 | LOG_ERROR(Service_NS, "Failed to extract RomFS for {:016X}! Skipping", | 191 | LOG_ERROR(Service_NS, "Failed to extract RomFS for {:016X}! Skipping", font.first); |
| 193 | static_cast<u64>(font.first)); | ||
| 194 | continue; | 192 | continue; |
| 195 | } | 193 | } |
| 196 | const auto font_fp = extracted_romfs->GetFile(font.second); | 194 | const auto font_fp = extracted_romfs->GetFile(font.second); |
| 197 | if (!font_fp) { | 195 | if (!font_fp) { |
| 198 | LOG_ERROR(Service_NS, "{:016X} has no file \"{}\"! Skipping", | 196 | LOG_ERROR(Service_NS, "{:016X} has no file \"{}\"! Skipping", font.first, font.second); |
| 199 | static_cast<u64>(font.first), font.second); | ||
| 200 | continue; | 197 | continue; |
| 201 | } | 198 | } |
| 202 | std::vector<u32> font_data_u32(font_fp->GetSize() / sizeof(u32)); | 199 | std::vector<u32> font_data_u32(font_fp->GetSize() / sizeof(u32)); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h index ab152bf0e..d9f95ba58 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h | |||
| @@ -18,39 +18,6 @@ public: | |||
| 18 | explicit nvhost_nvdec_common(Core::System& system, std::shared_ptr<nvmap> nvmap_dev); | 18 | explicit nvhost_nvdec_common(Core::System& system, std::shared_ptr<nvmap> nvmap_dev); |
| 19 | ~nvhost_nvdec_common() override; | 19 | ~nvhost_nvdec_common() override; |
| 20 | 20 | ||
| 21 | /** | ||
| 22 | * Handles an ioctl1 request. | ||
| 23 | * @param command The ioctl command id. | ||
| 24 | * @param input A buffer containing the input data for the ioctl. | ||
| 25 | * @param output A buffer where the output data will be written to. | ||
| 26 | * @returns The result code of the ioctl. | ||
| 27 | */ | ||
| 28 | virtual NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | ||
| 29 | IoctlCtrl& ctrl) = 0; | ||
| 30 | |||
| 31 | /** | ||
| 32 | * Handles an ioctl2 request. | ||
| 33 | * @param command The ioctl command id. | ||
| 34 | * @param input A buffer containing the input data for the ioctl. | ||
| 35 | * @param inline_input A buffer containing the input data for the ioctl which has been inlined. | ||
| 36 | * @param output A buffer where the output data will be written to. | ||
| 37 | * @returns The result code of the ioctl. | ||
| 38 | */ | ||
| 39 | virtual NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | ||
| 40 | const std::vector<u8>& inline_input, std::vector<u8>& output, | ||
| 41 | IoctlCtrl& ctrl) = 0; | ||
| 42 | |||
| 43 | /** | ||
| 44 | * Handles an ioctl3 request. | ||
| 45 | * @param command The ioctl command id. | ||
| 46 | * @param input A buffer containing the input data for the ioctl. | ||
| 47 | * @param output A buffer where the output data will be written to. | ||
| 48 | * @param inline_output A buffer where the inlined output data will be written to. | ||
| 49 | * @returns The result code of the ioctl. | ||
| 50 | */ | ||
| 51 | virtual NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | ||
| 52 | std::vector<u8>& inline_output, IoctlCtrl& ctrl) = 0; | ||
| 53 | |||
| 54 | protected: | 21 | protected: |
| 55 | class BufferMap final { | 22 | class BufferMap final { |
| 56 | public: | 23 | public: |
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp index b89a2d41b..191286ce9 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue.cpp | |||
| @@ -153,7 +153,7 @@ void BufferQueue::Disconnect() { | |||
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | u32 BufferQueue::Query(QueryType type) { | 155 | u32 BufferQueue::Query(QueryType type) { |
| 156 | LOG_WARNING(Service, "(STUBBED) called type={}", static_cast<u32>(type)); | 156 | LOG_WARNING(Service, "(STUBBED) called type={}", type); |
| 157 | 157 | ||
| 158 | switch (type) { | 158 | switch (type) { |
| 159 | case QueryType::NativeWindowFormat: | 159 | case QueryType::NativeWindowFormat: |
diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp index 392fda73e..b417624c9 100644 --- a/src/core/hle/service/prepo/prepo.cpp +++ b/src/core/hle/service/prepo/prepo.cpp | |||
| @@ -65,7 +65,7 @@ private: | |||
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | LOG_DEBUG(Service_PREPO, "called, type={:02X}, process_id={:016X}, data1_size={:016X}", | 67 | LOG_DEBUG(Service_PREPO, "called, type={:02X}, process_id={:016X}, data1_size={:016X}", |
| 68 | static_cast<u8>(Type), process_id, data[0].size()); | 68 | Type, process_id, data[0].size()); |
| 69 | 69 | ||
| 70 | const auto& reporter{system.GetReporter()}; | 70 | const auto& reporter{system.GetReporter()}; |
| 71 | reporter.SavePlayReport(Type, system.CurrentProcess()->GetTitleID(), data, process_id); | 71 | reporter.SavePlayReport(Type, system.CurrentProcess()->GetTitleID(), data, process_id); |
| @@ -92,7 +92,7 @@ private: | |||
| 92 | LOG_DEBUG( | 92 | LOG_DEBUG( |
| 93 | Service_PREPO, | 93 | Service_PREPO, |
| 94 | "called, type={:02X}, user_id={:016X}{:016X}, process_id={:016X}, data1_size={:016X}", | 94 | "called, type={:02X}, user_id={:016X}{:016X}, process_id={:016X}, data1_size={:016X}", |
| 95 | static_cast<u8>(Type), user_id[1], user_id[0], process_id, data[0].size()); | 95 | Type, user_id[1], user_id[0], process_id, data[0].size()); |
| 96 | 96 | ||
| 97 | const auto& reporter{system.GetReporter()}; | 97 | const auto& reporter{system.GetReporter()}; |
| 98 | reporter.SavePlayReport(Type, system.CurrentProcess()->GetTitleID(), data, process_id, | 98 | reporter.SavePlayReport(Type, system.CurrentProcess()->GetTitleID(), data, process_id, |
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 360e0bf37..abf3d1ea3 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -181,7 +181,7 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& co | |||
| 181 | break; | 181 | break; |
| 182 | } | 182 | } |
| 183 | default: | 183 | default: |
| 184 | UNIMPLEMENTED_MSG("command_type={}", static_cast<int>(context.GetCommandType())); | 184 | UNIMPLEMENTED_MSG("command_type={}", context.GetCommandType()); |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | context.WriteToOutgoingCommandBuffer(context.GetThread()); | 187 | context.WriteToOutgoingCommandBuffer(context.GetThread()); |
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp index 19b8f113d..b58b2c8c5 100644 --- a/src/core/hle/service/set/set_sys.cpp +++ b/src/core/hle/service/set/set_sys.cpp | |||
| @@ -34,9 +34,9 @@ void GetFirmwareVersionImpl(Kernel::HLERequestContext& ctx, GetFirmwareVersionTy | |||
| 34 | // consistence (currently reports as 5.1.0-0.0) | 34 | // consistence (currently reports as 5.1.0-0.0) |
| 35 | const auto archive = FileSys::SystemArchive::SystemVersion(); | 35 | const auto archive = FileSys::SystemArchive::SystemVersion(); |
| 36 | 36 | ||
| 37 | const auto early_exit_failure = [&ctx](const std::string& desc, ResultCode code) { | 37 | const auto early_exit_failure = [&ctx](std::string_view desc, ResultCode code) { |
| 38 | LOG_ERROR(Service_SET, "General failure while attempting to resolve firmware version ({}).", | 38 | LOG_ERROR(Service_SET, "General failure while attempting to resolve firmware version ({}).", |
| 39 | desc.c_str()); | 39 | desc); |
| 40 | IPC::ResponseBuilder rb{ctx, 2}; | 40 | IPC::ResponseBuilder rb{ctx, 2}; |
| 41 | rb.Push(code); | 41 | rb.Push(code); |
| 42 | }; | 42 | }; |
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index a9875b9a6..67b419503 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp | |||
| @@ -30,7 +30,7 @@ bool IsConnectionBased(Type type) { | |||
| 30 | case Type::DGRAM: | 30 | case Type::DGRAM: |
| 31 | return false; | 31 | return false; |
| 32 | default: | 32 | default: |
| 33 | UNIMPLEMENTED_MSG("Unimplemented type={}", static_cast<int>(type)); | 33 | UNIMPLEMENTED_MSG("Unimplemented type={}", type); |
| 34 | return false; | 34 | return false; |
| 35 | } | 35 | } |
| 36 | } | 36 | } |
| @@ -489,18 +489,18 @@ std::pair<s32, Errno> BSD::PollImpl(std::vector<u8>& write_buffer, std::vector<u | |||
| 489 | } | 489 | } |
| 490 | 490 | ||
| 491 | for (PollFD& pollfd : fds) { | 491 | for (PollFD& pollfd : fds) { |
| 492 | ASSERT(pollfd.revents == 0); | 492 | ASSERT(False(pollfd.revents)); |
| 493 | 493 | ||
| 494 | if (pollfd.fd > static_cast<s32>(MAX_FD) || pollfd.fd < 0) { | 494 | if (pollfd.fd > static_cast<s32>(MAX_FD) || pollfd.fd < 0) { |
| 495 | LOG_ERROR(Service, "File descriptor handle={} is invalid", pollfd.fd); | 495 | LOG_ERROR(Service, "File descriptor handle={} is invalid", pollfd.fd); |
| 496 | pollfd.revents = 0; | 496 | pollfd.revents = PollEvents{}; |
| 497 | return {0, Errno::SUCCESS}; | 497 | return {0, Errno::SUCCESS}; |
| 498 | } | 498 | } |
| 499 | 499 | ||
| 500 | const std::optional<FileDescriptor>& descriptor = file_descriptors[pollfd.fd]; | 500 | const std::optional<FileDescriptor>& descriptor = file_descriptors[pollfd.fd]; |
| 501 | if (!descriptor) { | 501 | if (!descriptor) { |
| 502 | LOG_ERROR(Service, "File descriptor handle={} is not allocated", pollfd.fd); | 502 | LOG_ERROR(Service, "File descriptor handle={} is not allocated", pollfd.fd); |
| 503 | pollfd.revents = POLL_NVAL; | 503 | pollfd.revents = PollEvents::Nval; |
| 504 | return {0, Errno::SUCCESS}; | 504 | return {0, Errno::SUCCESS}; |
| 505 | } | 505 | } |
| 506 | } | 506 | } |
| @@ -510,7 +510,7 @@ std::pair<s32, Errno> BSD::PollImpl(std::vector<u8>& write_buffer, std::vector<u | |||
| 510 | Network::PollFD result; | 510 | Network::PollFD result; |
| 511 | result.socket = file_descriptors[pollfd.fd]->socket.get(); | 511 | result.socket = file_descriptors[pollfd.fd]->socket.get(); |
| 512 | result.events = TranslatePollEventsToHost(pollfd.events); | 512 | result.events = TranslatePollEventsToHost(pollfd.events); |
| 513 | result.revents = 0; | 513 | result.revents = Network::PollEvents{}; |
| 514 | return result; | 514 | return result; |
| 515 | }); | 515 | }); |
| 516 | 516 | ||
| @@ -636,7 +636,7 @@ std::pair<s32, Errno> BSD::FcntlImpl(s32 fd, FcntlCmd cmd, s32 arg) { | |||
| 636 | return {0, Errno::SUCCESS}; | 636 | return {0, Errno::SUCCESS}; |
| 637 | } | 637 | } |
| 638 | default: | 638 | default: |
| 639 | UNIMPLEMENTED_MSG("Unimplemented cmd={}", static_cast<int>(cmd)); | 639 | UNIMPLEMENTED_MSG("Unimplemented cmd={}", cmd); |
| 640 | return {-1, Errno::SUCCESS}; | 640 | return {-1, Errno::SUCCESS}; |
| 641 | } | 641 | } |
| 642 | } | 642 | } |
| @@ -679,7 +679,7 @@ Errno BSD::SetSockOptImpl(s32 fd, u32 level, OptName optname, size_t optlen, con | |||
| 679 | case OptName::RCVTIMEO: | 679 | case OptName::RCVTIMEO: |
| 680 | return Translate(socket->SetRcvTimeo(value)); | 680 | return Translate(socket->SetRcvTimeo(value)); |
| 681 | default: | 681 | default: |
| 682 | UNIMPLEMENTED_MSG("Unimplemented optname={}", static_cast<int>(optname)); | 682 | UNIMPLEMENTED_MSG("Unimplemented optname={}", optname); |
| 683 | return Errno::SUCCESS; | 683 | return Errno::SUCCESS; |
| 684 | } | 684 | } |
| 685 | } | 685 | } |
diff --git a/src/core/hle/service/sockets/sockets.h b/src/core/hle/service/sockets/sockets.h index 89a410076..5a65ed2a9 100644 --- a/src/core/hle/service/sockets/sockets.h +++ b/src/core/hle/service/sockets/sockets.h | |||
| @@ -69,10 +69,22 @@ struct SockAddrIn { | |||
| 69 | std::array<u8, 8> zeroes; | 69 | std::array<u8, 8> zeroes; |
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | enum class PollEvents : u16 { | ||
| 73 | // Using Pascal case because IN is a macro on Windows. | ||
| 74 | In = 1 << 0, | ||
| 75 | Pri = 1 << 1, | ||
| 76 | Out = 1 << 2, | ||
| 77 | Err = 1 << 3, | ||
| 78 | Hup = 1 << 4, | ||
| 79 | Nval = 1 << 5, | ||
| 80 | }; | ||
| 81 | |||
| 82 | DECLARE_ENUM_FLAG_OPERATORS(PollEvents); | ||
| 83 | |||
| 72 | struct PollFD { | 84 | struct PollFD { |
| 73 | s32 fd; | 85 | s32 fd; |
| 74 | u16 events; | 86 | PollEvents events; |
| 75 | u16 revents; | 87 | PollEvents revents; |
| 76 | }; | 88 | }; |
| 77 | 89 | ||
| 78 | struct Linger { | 90 | struct Linger { |
| @@ -80,13 +92,6 @@ struct Linger { | |||
| 80 | u32 linger; | 92 | u32 linger; |
| 81 | }; | 93 | }; |
| 82 | 94 | ||
| 83 | constexpr u16 POLL_IN = 0x01; | ||
| 84 | constexpr u16 POLL_PRI = 0x02; | ||
| 85 | constexpr u16 POLL_OUT = 0x04; | ||
| 86 | constexpr u16 POLL_ERR = 0x08; | ||
| 87 | constexpr u16 POLL_HUP = 0x10; | ||
| 88 | constexpr u16 POLL_NVAL = 0x20; | ||
| 89 | |||
| 90 | constexpr u32 FLAG_MSG_DONTWAIT = 0x80; | 95 | constexpr u32 FLAG_MSG_DONTWAIT = 0x80; |
| 91 | 96 | ||
| 92 | constexpr u32 FLAG_O_NONBLOCK = 0x800; | 97 | constexpr u32 FLAG_O_NONBLOCK = 0x800; |
diff --git a/src/core/hle/service/sockets/sockets_translate.cpp b/src/core/hle/service/sockets/sockets_translate.cpp index 2e626fd86..c822d21b8 100644 --- a/src/core/hle/service/sockets/sockets_translate.cpp +++ b/src/core/hle/service/sockets/sockets_translate.cpp | |||
| @@ -27,7 +27,7 @@ Errno Translate(Network::Errno value) { | |||
| 27 | case Network::Errno::NOTCONN: | 27 | case Network::Errno::NOTCONN: |
| 28 | return Errno::NOTCONN; | 28 | return Errno::NOTCONN; |
| 29 | default: | 29 | default: |
| 30 | UNIMPLEMENTED_MSG("Unimplemented errno={}", static_cast<int>(value)); | 30 | UNIMPLEMENTED_MSG("Unimplemented errno={}", value); |
| 31 | return Errno::SUCCESS; | 31 | return Errno::SUCCESS; |
| 32 | } | 32 | } |
| 33 | } | 33 | } |
| @@ -41,7 +41,7 @@ Network::Domain Translate(Domain domain) { | |||
| 41 | case Domain::INET: | 41 | case Domain::INET: |
| 42 | return Network::Domain::INET; | 42 | return Network::Domain::INET; |
| 43 | default: | 43 | default: |
| 44 | UNIMPLEMENTED_MSG("Unimplemented domain={}", static_cast<int>(domain)); | 44 | UNIMPLEMENTED_MSG("Unimplemented domain={}", domain); |
| 45 | return {}; | 45 | return {}; |
| 46 | } | 46 | } |
| 47 | } | 47 | } |
| @@ -51,7 +51,7 @@ Domain Translate(Network::Domain domain) { | |||
| 51 | case Network::Domain::INET: | 51 | case Network::Domain::INET: |
| 52 | return Domain::INET; | 52 | return Domain::INET; |
| 53 | default: | 53 | default: |
| 54 | UNIMPLEMENTED_MSG("Unimplemented domain={}", static_cast<int>(domain)); | 54 | UNIMPLEMENTED_MSG("Unimplemented domain={}", domain); |
| 55 | return {}; | 55 | return {}; |
| 56 | } | 56 | } |
| 57 | } | 57 | } |
| @@ -63,7 +63,7 @@ Network::Type Translate(Type type) { | |||
| 63 | case Type::DGRAM: | 63 | case Type::DGRAM: |
| 64 | return Network::Type::DGRAM; | 64 | return Network::Type::DGRAM; |
| 65 | default: | 65 | default: |
| 66 | UNIMPLEMENTED_MSG("Unimplemented type={}", static_cast<int>(type)); | 66 | UNIMPLEMENTED_MSG("Unimplemented type={}", type); |
| 67 | } | 67 | } |
| 68 | } | 68 | } |
| 69 | 69 | ||
| @@ -84,48 +84,48 @@ Network::Protocol Translate(Type type, Protocol protocol) { | |||
| 84 | case Protocol::UDP: | 84 | case Protocol::UDP: |
| 85 | return Network::Protocol::UDP; | 85 | return Network::Protocol::UDP; |
| 86 | default: | 86 | default: |
| 87 | UNIMPLEMENTED_MSG("Unimplemented protocol={}", static_cast<int>(protocol)); | 87 | UNIMPLEMENTED_MSG("Unimplemented protocol={}", protocol); |
| 88 | return Network::Protocol::TCP; | 88 | return Network::Protocol::TCP; |
| 89 | } | 89 | } |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | u16 TranslatePollEventsToHost(u32 flags) { | 92 | Network::PollEvents TranslatePollEventsToHost(PollEvents flags) { |
| 93 | u32 result = 0; | 93 | Network::PollEvents result{}; |
| 94 | const auto translate = [&result, &flags](u32 from, u32 to) { | 94 | const auto translate = [&result, &flags](PollEvents from, Network::PollEvents to) { |
| 95 | if ((flags & from) != 0) { | 95 | if (True(flags & from)) { |
| 96 | flags &= ~from; | 96 | flags &= ~from; |
| 97 | result |= to; | 97 | result |= to; |
| 98 | } | 98 | } |
| 99 | }; | 99 | }; |
| 100 | translate(POLL_IN, Network::POLL_IN); | 100 | translate(PollEvents::In, Network::PollEvents::In); |
| 101 | translate(POLL_PRI, Network::POLL_PRI); | 101 | translate(PollEvents::Pri, Network::PollEvents::Pri); |
| 102 | translate(POLL_OUT, Network::POLL_OUT); | 102 | translate(PollEvents::Out, Network::PollEvents::Out); |
| 103 | translate(POLL_ERR, Network::POLL_ERR); | 103 | translate(PollEvents::Err, Network::PollEvents::Err); |
| 104 | translate(POLL_HUP, Network::POLL_HUP); | 104 | translate(PollEvents::Hup, Network::PollEvents::Hup); |
| 105 | translate(POLL_NVAL, Network::POLL_NVAL); | 105 | translate(PollEvents::Nval, Network::PollEvents::Nval); |
| 106 | 106 | ||
| 107 | UNIMPLEMENTED_IF_MSG(flags != 0, "Unimplemented flags={}", flags); | 107 | UNIMPLEMENTED_IF_MSG((u16)flags != 0, "Unimplemented flags={}", (u16)flags); |
| 108 | return static_cast<u16>(result); | 108 | return result; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | u16 TranslatePollEventsToGuest(u32 flags) { | 111 | PollEvents TranslatePollEventsToGuest(Network::PollEvents flags) { |
| 112 | u32 result = 0; | 112 | PollEvents result{}; |
| 113 | const auto translate = [&result, &flags](u32 from, u32 to) { | 113 | const auto translate = [&result, &flags](Network::PollEvents from, PollEvents to) { |
| 114 | if ((flags & from) != 0) { | 114 | if (True(flags & from)) { |
| 115 | flags &= ~from; | 115 | flags &= ~from; |
| 116 | result |= to; | 116 | result |= to; |
| 117 | } | 117 | } |
| 118 | }; | 118 | }; |
| 119 | 119 | ||
| 120 | translate(Network::POLL_IN, POLL_IN); | 120 | translate(Network::PollEvents::In, PollEvents::In); |
| 121 | translate(Network::POLL_PRI, POLL_PRI); | 121 | translate(Network::PollEvents::Pri, PollEvents::Pri); |
| 122 | translate(Network::POLL_OUT, POLL_OUT); | 122 | translate(Network::PollEvents::Out, PollEvents::Out); |
| 123 | translate(Network::POLL_ERR, POLL_ERR); | 123 | translate(Network::PollEvents::Err, PollEvents::Err); |
| 124 | translate(Network::POLL_HUP, POLL_HUP); | 124 | translate(Network::PollEvents::Hup, PollEvents::Hup); |
| 125 | translate(Network::POLL_NVAL, POLL_NVAL); | 125 | translate(Network::PollEvents::Nval, PollEvents::Nval); |
| 126 | 126 | ||
| 127 | UNIMPLEMENTED_IF_MSG(flags != 0, "Unimplemented flags={}", flags); | 127 | UNIMPLEMENTED_IF_MSG((u16)flags != 0, "Unimplemented flags={}", (u16)flags); |
| 128 | return static_cast<u16>(result); | 128 | return result; |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | Network::SockAddrIn Translate(SockAddrIn value) { | 131 | Network::SockAddrIn Translate(SockAddrIn value) { |
| @@ -157,7 +157,7 @@ Network::ShutdownHow Translate(ShutdownHow how) { | |||
| 157 | case ShutdownHow::RDWR: | 157 | case ShutdownHow::RDWR: |
| 158 | return Network::ShutdownHow::RDWR; | 158 | return Network::ShutdownHow::RDWR; |
| 159 | default: | 159 | default: |
| 160 | UNIMPLEMENTED_MSG("Unimplemented how={}", static_cast<int>(how)); | 160 | UNIMPLEMENTED_MSG("Unimplemented how={}", how); |
| 161 | return {}; | 161 | return {}; |
| 162 | } | 162 | } |
| 163 | } | 163 | } |
diff --git a/src/core/hle/service/sockets/sockets_translate.h b/src/core/hle/service/sockets/sockets_translate.h index e498913d4..057d1ff22 100644 --- a/src/core/hle/service/sockets/sockets_translate.h +++ b/src/core/hle/service/sockets/sockets_translate.h | |||
| @@ -31,10 +31,10 @@ Network::Type Translate(Type type); | |||
| 31 | Network::Protocol Translate(Type type, Protocol protocol); | 31 | Network::Protocol Translate(Type type, Protocol protocol); |
| 32 | 32 | ||
| 33 | /// Translate abstract poll event flags to guest poll event flags | 33 | /// Translate abstract poll event flags to guest poll event flags |
| 34 | u16 TranslatePollEventsToHost(u32 flags); | 34 | Network::PollEvents TranslatePollEventsToHost(PollEvents flags); |
| 35 | 35 | ||
| 36 | /// Translate guest poll event flags to abstract poll event flags | 36 | /// Translate guest poll event flags to abstract poll event flags |
| 37 | u16 TranslatePollEventsToGuest(u32 flags); | 37 | PollEvents TranslatePollEventsToGuest(Network::PollEvents flags); |
| 38 | 38 | ||
| 39 | /// Translate guest socket address structure to abstract socket address structure | 39 | /// Translate guest socket address structure to abstract socket address structure |
| 40 | Network::SockAddrIn Translate(SockAddrIn value); | 40 | Network::SockAddrIn Translate(SockAddrIn value); |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index af5b8b0b9..5d8841ae8 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -528,7 +528,7 @@ private: | |||
| 528 | const u32 flags = rp.Pop<u32>(); | 528 | const u32 flags = rp.Pop<u32>(); |
| 529 | 529 | ||
| 530 | LOG_DEBUG(Service_VI, "called. id=0x{:08X} transaction={:X}, flags=0x{:08X}", id, | 530 | LOG_DEBUG(Service_VI, "called. id=0x{:08X} transaction={:X}, flags=0x{:08X}", id, |
| 531 | static_cast<u32>(transaction), flags); | 531 | transaction, flags); |
| 532 | 532 | ||
| 533 | const auto guard = nv_flinger.Lock(); | 533 | const auto guard = nv_flinger.Lock(); |
| 534 | auto& buffer_queue = nv_flinger.FindBufferQueue(id); | 534 | auto& buffer_queue = nv_flinger.FindBufferQueue(id); |
| @@ -1066,8 +1066,8 @@ private: | |||
| 1066 | const auto scaling_mode = rp.PopEnum<NintendoScaleMode>(); | 1066 | const auto scaling_mode = rp.PopEnum<NintendoScaleMode>(); |
| 1067 | const u64 unknown = rp.Pop<u64>(); | 1067 | const u64 unknown = rp.Pop<u64>(); |
| 1068 | 1068 | ||
| 1069 | LOG_DEBUG(Service_VI, "called. scaling_mode=0x{:08X}, unknown=0x{:016X}", | 1069 | LOG_DEBUG(Service_VI, "called. scaling_mode=0x{:08X}, unknown=0x{:016X}", scaling_mode, |
| 1070 | static_cast<u32>(scaling_mode), unknown); | 1070 | unknown); |
| 1071 | 1071 | ||
| 1072 | IPC::ResponseBuilder rb{ctx, 2}; | 1072 | IPC::ResponseBuilder rb{ctx, 2}; |
| 1073 | 1073 | ||
| @@ -1210,7 +1210,7 @@ private: | |||
| 1210 | void ConvertScalingMode(Kernel::HLERequestContext& ctx) { | 1210 | void ConvertScalingMode(Kernel::HLERequestContext& ctx) { |
| 1211 | IPC::RequestParser rp{ctx}; | 1211 | IPC::RequestParser rp{ctx}; |
| 1212 | const auto mode = rp.PopEnum<NintendoScaleMode>(); | 1212 | const auto mode = rp.PopEnum<NintendoScaleMode>(); |
| 1213 | LOG_DEBUG(Service_VI, "called mode={}", static_cast<u32>(mode)); | 1213 | LOG_DEBUG(Service_VI, "called mode={}", mode); |
| 1214 | 1214 | ||
| 1215 | const auto converted_mode = ConvertScalingModeImpl(mode); | 1215 | const auto converted_mode = ConvertScalingModeImpl(mode); |
| 1216 | 1216 | ||
| @@ -1230,8 +1230,8 @@ private: | |||
| 1230 | const auto height = rp.Pop<u64>(); | 1230 | const auto height = rp.Pop<u64>(); |
| 1231 | LOG_DEBUG(Service_VI, "called width={}, height={}", width, height); | 1231 | LOG_DEBUG(Service_VI, "called width={}, height={}", width, height); |
| 1232 | 1232 | ||
| 1233 | constexpr std::size_t base_size = 0x20000; | 1233 | constexpr u64 base_size = 0x20000; |
| 1234 | constexpr std::size_t alignment = 0x1000; | 1234 | constexpr u64 alignment = 0x1000; |
| 1235 | const auto texture_size = width * height * 4; | 1235 | const auto texture_size = width * height * 4; |
| 1236 | const auto out_size = (texture_size + base_size - 1) / base_size * base_size; | 1236 | const auto out_size = (texture_size + base_size - 1) / base_size * base_size; |
| 1237 | 1237 | ||
| @@ -1311,7 +1311,7 @@ void detail::GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, Core::System& | |||
| 1311 | const auto policy = rp.PopEnum<Policy>(); | 1311 | const auto policy = rp.PopEnum<Policy>(); |
| 1312 | 1312 | ||
| 1313 | if (!IsValidServiceAccess(permission, policy)) { | 1313 | if (!IsValidServiceAccess(permission, policy)) { |
| 1314 | LOG_ERROR(Service_VI, "Permission denied for policy {}", static_cast<u32>(policy)); | 1314 | LOG_ERROR(Service_VI, "Permission denied for policy {}", policy); |
| 1315 | IPC::ResponseBuilder rb{ctx, 2}; | 1315 | IPC::ResponseBuilder rb{ctx, 2}; |
| 1316 | rb.Push(ERR_PERMISSION_DENIED); | 1316 | rb.Push(ERR_PERMISSION_DENIED); |
| 1317 | return; | 1317 | return; |
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index b88aa5c40..b7f21698f 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp | |||
| @@ -667,8 +667,6 @@ struct Memory::Impl { | |||
| 667 | * @tparam T The data type to write to memory. This type *must* be | 667 | * @tparam T The data type to write to memory. This type *must* be |
| 668 | * trivially copyable, otherwise the behavior of this function | 668 | * trivially copyable, otherwise the behavior of this function |
| 669 | * is undefined. | 669 | * is undefined. |
| 670 | * | ||
| 671 | * @returns The instance of T write to the specified virtual address. | ||
| 672 | */ | 670 | */ |
| 673 | template <typename T> | 671 | template <typename T> |
| 674 | void Write(const VAddr vaddr, const T data) { | 672 | void Write(const VAddr vaddr, const T data) { |
diff --git a/src/core/network/network.cpp b/src/core/network/network.cpp index 5ef2e8511..681e93468 100644 --- a/src/core/network/network.cpp +++ b/src/core/network/network.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #ifdef _WIN32 | 11 | #ifdef _WIN32 |
| 12 | #define _WINSOCK_DEPRECATED_NO_WARNINGS // gethostname | 12 | #define _WINSOCK_DEPRECATED_NO_WARNINGS // gethostname |
| 13 | #include <winsock2.h> | 13 | #include <winsock2.h> |
| 14 | #elif __unix__ | 14 | #elif YUZU_UNIX |
| 15 | #include <errno.h> | 15 | #include <errno.h> |
| 16 | #include <fcntl.h> | 16 | #include <fcntl.h> |
| 17 | #include <netdb.h> | 17 | #include <netdb.h> |
| @@ -54,7 +54,7 @@ constexpr IPv4Address TranslateIPv4(in_addr addr) { | |||
| 54 | sockaddr TranslateFromSockAddrIn(SockAddrIn input) { | 54 | sockaddr TranslateFromSockAddrIn(SockAddrIn input) { |
| 55 | sockaddr_in result; | 55 | sockaddr_in result; |
| 56 | 56 | ||
| 57 | #ifdef __unix__ | 57 | #if YUZU_UNIX |
| 58 | result.sin_len = sizeof(result); | 58 | result.sin_len = sizeof(result); |
| 59 | #endif | 59 | #endif |
| 60 | 60 | ||
| @@ -63,7 +63,7 @@ sockaddr TranslateFromSockAddrIn(SockAddrIn input) { | |||
| 63 | result.sin_family = AF_INET; | 63 | result.sin_family = AF_INET; |
| 64 | break; | 64 | break; |
| 65 | default: | 65 | default: |
| 66 | UNIMPLEMENTED_MSG("Unhandled sockaddr family={}", static_cast<int>(input.family)); | 66 | UNIMPLEMENTED_MSG("Unhandled sockaddr family={}", input.family); |
| 67 | result.sin_family = AF_INET; | 67 | result.sin_family = AF_INET; |
| 68 | break; | 68 | break; |
| 69 | } | 69 | } |
| @@ -99,7 +99,7 @@ bool EnableNonBlock(SOCKET fd, bool enable) { | |||
| 99 | return ioctlsocket(fd, FIONBIO, &value) != SOCKET_ERROR; | 99 | return ioctlsocket(fd, FIONBIO, &value) != SOCKET_ERROR; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | #elif __unix__ // ^ _WIN32 v __unix__ | 102 | #elif YUZU_UNIX // ^ _WIN32 v YUZU_UNIX |
| 103 | 103 | ||
| 104 | using SOCKET = int; | 104 | using SOCKET = int; |
| 105 | using WSAPOLLFD = pollfd; | 105 | using WSAPOLLFD = pollfd; |
| @@ -133,7 +133,7 @@ sockaddr TranslateFromSockAddrIn(SockAddrIn input) { | |||
| 133 | result.sin_family = AF_INET; | 133 | result.sin_family = AF_INET; |
| 134 | break; | 134 | break; |
| 135 | default: | 135 | default: |
| 136 | UNIMPLEMENTED_MSG("Unhandled sockaddr family={}", static_cast<int>(input.family)); | 136 | UNIMPLEMENTED_MSG("Unhandled sockaddr family={}", input.family); |
| 137 | result.sin_family = AF_INET; | 137 | result.sin_family = AF_INET; |
| 138 | break; | 138 | break; |
| 139 | } | 139 | } |
| @@ -186,7 +186,7 @@ int TranslateDomain(Domain domain) { | |||
| 186 | case Domain::INET: | 186 | case Domain::INET: |
| 187 | return AF_INET; | 187 | return AF_INET; |
| 188 | default: | 188 | default: |
| 189 | UNIMPLEMENTED_MSG("Unimplemented domain={}", static_cast<int>(domain)); | 189 | UNIMPLEMENTED_MSG("Unimplemented domain={}", domain); |
| 190 | return 0; | 190 | return 0; |
| 191 | } | 191 | } |
| 192 | } | 192 | } |
| @@ -198,7 +198,7 @@ int TranslateType(Type type) { | |||
| 198 | case Type::DGRAM: | 198 | case Type::DGRAM: |
| 199 | return SOCK_DGRAM; | 199 | return SOCK_DGRAM; |
| 200 | default: | 200 | default: |
| 201 | UNIMPLEMENTED_MSG("Unimplemented type={}", static_cast<int>(type)); | 201 | UNIMPLEMENTED_MSG("Unimplemented type={}", type); |
| 202 | return 0; | 202 | return 0; |
| 203 | } | 203 | } |
| 204 | } | 204 | } |
| @@ -210,7 +210,7 @@ int TranslateProtocol(Protocol protocol) { | |||
| 210 | case Protocol::UDP: | 210 | case Protocol::UDP: |
| 211 | return IPPROTO_UDP; | 211 | return IPPROTO_UDP; |
| 212 | default: | 212 | default: |
| 213 | UNIMPLEMENTED_MSG("Unimplemented protocol={}", static_cast<int>(protocol)); | 213 | UNIMPLEMENTED_MSG("Unimplemented protocol={}", protocol); |
| 214 | return 0; | 214 | return 0; |
| 215 | } | 215 | } |
| 216 | } | 216 | } |
| @@ -238,49 +238,49 @@ SockAddrIn TranslateToSockAddrIn(sockaddr input_) { | |||
| 238 | return result; | 238 | return result; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | u16 TranslatePollEvents(u32 events) { | 241 | short TranslatePollEvents(PollEvents events) { |
| 242 | u32 result = 0; | 242 | short result = 0; |
| 243 | 243 | ||
| 244 | if ((events & POLL_IN) != 0) { | 244 | if (True(events & PollEvents::In)) { |
| 245 | events &= ~POLL_IN; | 245 | events &= ~PollEvents::In; |
| 246 | result |= POLLIN; | 246 | result |= POLLIN; |
| 247 | } | 247 | } |
| 248 | if ((events & POLL_PRI) != 0) { | 248 | if (True(events & PollEvents::Pri)) { |
| 249 | events &= ~POLL_PRI; | 249 | events &= ~PollEvents::Pri; |
| 250 | #ifdef _WIN32 | 250 | #ifdef _WIN32 |
| 251 | LOG_WARNING(Service, "Winsock doesn't support POLLPRI"); | 251 | LOG_WARNING(Service, "Winsock doesn't support POLLPRI"); |
| 252 | #else | 252 | #else |
| 253 | result |= POLL_PRI; | 253 | result |= POLLPRI; |
| 254 | #endif | 254 | #endif |
| 255 | } | 255 | } |
| 256 | if ((events & POLL_OUT) != 0) { | 256 | if (True(events & PollEvents::Out)) { |
| 257 | events &= ~POLL_OUT; | 257 | events &= ~PollEvents::Out; |
| 258 | result |= POLLOUT; | 258 | result |= POLLOUT; |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | UNIMPLEMENTED_IF_MSG(events != 0, "Unhandled guest events=0x{:x}", events); | 261 | UNIMPLEMENTED_IF_MSG((u16)events != 0, "Unhandled guest events=0x{:x}", (u16)events); |
| 262 | 262 | ||
| 263 | return static_cast<u16>(result); | 263 | return result; |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | u16 TranslatePollRevents(u32 revents) { | 266 | PollEvents TranslatePollRevents(short revents) { |
| 267 | u32 result = 0; | 267 | PollEvents result{}; |
| 268 | const auto translate = [&result, &revents](u32 host, u32 guest) { | 268 | const auto translate = [&result, &revents](short host, PollEvents guest) { |
| 269 | if ((revents & host) != 0) { | 269 | if ((revents & host) != 0) { |
| 270 | revents &= ~host; | 270 | revents &= static_cast<short>(~host); |
| 271 | result |= guest; | 271 | result |= guest; |
| 272 | } | 272 | } |
| 273 | }; | 273 | }; |
| 274 | 274 | ||
| 275 | translate(POLLIN, POLL_IN); | 275 | translate(POLLIN, PollEvents::In); |
| 276 | translate(POLLPRI, POLL_PRI); | 276 | translate(POLLPRI, PollEvents::Pri); |
| 277 | translate(POLLOUT, POLL_OUT); | 277 | translate(POLLOUT, PollEvents::Out); |
| 278 | translate(POLLERR, POLL_ERR); | 278 | translate(POLLERR, PollEvents::Err); |
| 279 | translate(POLLHUP, POLL_HUP); | 279 | translate(POLLHUP, PollEvents::Hup); |
| 280 | 280 | ||
| 281 | UNIMPLEMENTED_IF_MSG(revents != 0, "Unhandled host revents=0x{:x}", revents); | 281 | UNIMPLEMENTED_IF_MSG(revents != 0, "Unhandled host revents=0x{:x}", revents); |
| 282 | 282 | ||
| 283 | return static_cast<u16>(result); | 283 | return result; |
| 284 | } | 284 | } |
| 285 | 285 | ||
| 286 | template <typename T> | 286 | template <typename T> |
| @@ -350,7 +350,7 @@ std::pair<s32, Errno> Poll(std::vector<PollFD>& pollfds, s32 timeout) { | |||
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | for (size_t i = 0; i < num; ++i) { | 352 | for (size_t i = 0; i < num; ++i) { |
| 353 | pollfds[i].revents = TranslatePollRevents(static_cast<u32>(host_pollfds[i].revents)); | 353 | pollfds[i].revents = TranslatePollRevents(host_pollfds[i].revents); |
| 354 | } | 354 | } |
| 355 | 355 | ||
| 356 | if (result > 0) { | 356 | if (result > 0) { |
| @@ -482,7 +482,7 @@ Errno Socket::Shutdown(ShutdownHow how) { | |||
| 482 | host_how = SD_BOTH; | 482 | host_how = SD_BOTH; |
| 483 | break; | 483 | break; |
| 484 | default: | 484 | default: |
| 485 | UNIMPLEMENTED_MSG("Unimplemented flag how={}", static_cast<int>(how)); | 485 | UNIMPLEMENTED_MSG("Unimplemented flag how={}", how); |
| 486 | return Errno::SUCCESS; | 486 | return Errno::SUCCESS; |
| 487 | } | 487 | } |
| 488 | if (shutdown(fd, host_how) != SOCKET_ERROR) { | 488 | if (shutdown(fd, host_how) != SOCKET_ERROR) { |
diff --git a/src/core/network/network.h b/src/core/network/network.h index 0622e4593..76b2821f2 100644 --- a/src/core/network/network.h +++ b/src/core/network/network.h | |||
| @@ -61,19 +61,25 @@ struct SockAddrIn { | |||
| 61 | }; | 61 | }; |
| 62 | 62 | ||
| 63 | /// Cross-platform poll fd structure | 63 | /// Cross-platform poll fd structure |
| 64 | |||
| 65 | enum class PollEvents : u16 { | ||
| 66 | // Using Pascal case because IN is a macro on Windows. | ||
| 67 | In = 1 << 0, | ||
| 68 | Pri = 1 << 1, | ||
| 69 | Out = 1 << 2, | ||
| 70 | Err = 1 << 3, | ||
| 71 | Hup = 1 << 4, | ||
| 72 | Nval = 1 << 5, | ||
| 73 | }; | ||
| 74 | |||
| 75 | DECLARE_ENUM_FLAG_OPERATORS(PollEvents); | ||
| 76 | |||
| 64 | struct PollFD { | 77 | struct PollFD { |
| 65 | Socket* socket; | 78 | Socket* socket; |
| 66 | u16 events; | 79 | PollEvents events; |
| 67 | u16 revents; | 80 | PollEvents revents; |
| 68 | }; | 81 | }; |
| 69 | 82 | ||
| 70 | constexpr u16 POLL_IN = 1 << 0; | ||
| 71 | constexpr u16 POLL_PRI = 1 << 1; | ||
| 72 | constexpr u16 POLL_OUT = 1 << 2; | ||
| 73 | constexpr u16 POLL_ERR = 1 << 3; | ||
| 74 | constexpr u16 POLL_HUP = 1 << 4; | ||
| 75 | constexpr u16 POLL_NVAL = 1 << 5; | ||
| 76 | |||
| 77 | class NetworkInstance { | 83 | class NetworkInstance { |
| 78 | public: | 84 | public: |
| 79 | explicit NetworkInstance(); | 85 | explicit NetworkInstance(); |
diff --git a/src/core/network/sockets.h b/src/core/network/sockets.h index 7bdff0fe4..a44393325 100644 --- a/src/core/network/sockets.h +++ b/src/core/network/sockets.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | #if defined(_WIN32) | 10 | #if defined(_WIN32) |
| 11 | #include <winsock.h> | 11 | #include <winsock.h> |
| 12 | #elif !defined(__unix__) | 12 | #elif !YUZU_UNIX |
| 13 | #error "Platform not implemented" | 13 | #error "Platform not implemented" |
| 14 | #endif | 14 | #endif |
| 15 | 15 | ||
| @@ -84,7 +84,7 @@ public: | |||
| 84 | 84 | ||
| 85 | #if defined(_WIN32) | 85 | #if defined(_WIN32) |
| 86 | SOCKET fd = INVALID_SOCKET; | 86 | SOCKET fd = INVALID_SOCKET; |
| 87 | #elif defined(__unix__) | 87 | #elif YUZU_UNIX |
| 88 | int fd = -1; | 88 | int fd = -1; |
| 89 | #endif | 89 | #endif |
| 90 | }; | 90 | }; |
diff --git a/src/core/settings.h b/src/core/settings.h index 8e076f7ef..d5f8d2b7e 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -180,6 +180,8 @@ struct Values { | |||
| 180 | std::string motion_device; | 180 | std::string motion_device; |
| 181 | std::string udp_input_servers; | 181 | std::string udp_input_servers; |
| 182 | 182 | ||
| 183 | bool emulate_analog_keyboard; | ||
| 184 | |||
| 183 | bool mouse_enabled; | 185 | bool mouse_enabled; |
| 184 | std::string mouse_device; | 186 | std::string mouse_device; |
| 185 | MouseButtonsRaw mouse_buttons; | 187 | MouseButtonsRaw mouse_buttons; |
diff --git a/src/input_common/analog_from_button.cpp b/src/input_common/analog_from_button.cpp index d748c1c04..40b516f85 100755 --- a/src/input_common/analog_from_button.cpp +++ b/src/input_common/analog_from_button.cpp | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <cmath> | 6 | #include <cmath> |
| 7 | #include <thread> | 7 | #include <thread> |
| 8 | #include "common/math_util.h" | 8 | #include "common/math_util.h" |
| 9 | #include "core/settings.h" | ||
| 9 | #include "input_common/analog_from_button.h" | 10 | #include "input_common/analog_from_button.h" |
| 10 | 11 | ||
| 11 | namespace InputCommon { | 12 | namespace InputCommon { |
| @@ -112,7 +113,26 @@ public: | |||
| 112 | } | 113 | } |
| 113 | 114 | ||
| 114 | std::tuple<float, float> GetStatus() const override { | 115 | std::tuple<float, float> GetStatus() const override { |
| 115 | return std::make_tuple(std::cos(angle) * amplitude, std::sin(angle) * amplitude); | 116 | if (Settings::values.emulate_analog_keyboard) { |
| 117 | return std::make_tuple(std::cos(angle) * amplitude, std::sin(angle) * amplitude); | ||
| 118 | } | ||
| 119 | constexpr float SQRT_HALF = 0.707106781f; | ||
| 120 | int x = 0, y = 0; | ||
| 121 | if (right->GetStatus()) { | ||
| 122 | ++x; | ||
| 123 | } | ||
| 124 | if (left->GetStatus()) { | ||
| 125 | --x; | ||
| 126 | } | ||
| 127 | if (up->GetStatus()) { | ||
| 128 | ++y; | ||
| 129 | } | ||
| 130 | if (down->GetStatus()) { | ||
| 131 | --y; | ||
| 132 | } | ||
| 133 | const float coef = modifier->GetStatus() ? modifier_scale : 1.0f; | ||
| 134 | return std::make_tuple(static_cast<float>(x) * coef * (y == 0 ? 1.0f : SQRT_HALF), | ||
| 135 | static_cast<float>(y) * coef * (x == 0 ? 1.0f : SQRT_HALF)); | ||
| 116 | } | 136 | } |
| 117 | 137 | ||
| 118 | bool GetAnalogDirectionStatus(Input::AnalogDirection direction) const override { | 138 | bool GetAnalogDirectionStatus(Input::AnalogDirection direction) const override { |
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index abcee2a1c..a021d61f5 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -297,13 +297,20 @@ if (ENABLE_NSIGHT_AFTERMATH) | |||
| 297 | endif() | 297 | endif() |
| 298 | 298 | ||
| 299 | if (MSVC) | 299 | if (MSVC) |
| 300 | target_compile_options(video_core PRIVATE /we4267) | 300 | target_compile_options(video_core PRIVATE |
| 301 | /we4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data | ||
| 302 | /we4456 # Declaration of 'identifier' hides previous local declaration | ||
| 303 | /we4457 # Declaration of 'identifier' hides function parameter | ||
| 304 | /we4458 # Declaration of 'identifier' hides class member | ||
| 305 | /we4459 # Declaration of 'identifier' hides global declaration | ||
| 306 | ) | ||
| 301 | else() | 307 | else() |
| 302 | target_compile_options(video_core PRIVATE | 308 | target_compile_options(video_core PRIVATE |
| 303 | -Werror=conversion | 309 | -Werror=conversion |
| 304 | -Wno-error=sign-conversion | 310 | -Wno-error=sign-conversion |
| 305 | -Werror=pessimizing-move | 311 | -Werror=pessimizing-move |
| 306 | -Werror=redundant-move | 312 | -Werror=redundant-move |
| 313 | -Werror=shadow | ||
| 307 | -Werror=switch | 314 | -Werror=switch |
| 308 | -Werror=type-limits | 315 | -Werror=type-limits |
| 309 | -Werror=unused-variable | 316 | -Werror=unused-variable |
diff --git a/src/video_core/buffer_cache/buffer_block.h b/src/video_core/buffer_cache/buffer_block.h index e64170e66..e9306194a 100644 --- a/src/video_core/buffer_cache/buffer_block.h +++ b/src/video_core/buffer_cache/buffer_block.h | |||
| @@ -4,34 +4,29 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <unordered_set> | ||
| 8 | #include <utility> | ||
| 9 | |||
| 10 | #include "common/alignment.h" | ||
| 11 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 12 | #include "video_core/gpu.h" | ||
| 13 | 8 | ||
| 14 | namespace VideoCommon { | 9 | namespace VideoCommon { |
| 15 | 10 | ||
| 16 | class BufferBlock { | 11 | class BufferBlock { |
| 17 | public: | 12 | public: |
| 18 | bool Overlaps(VAddr start, VAddr end) const { | 13 | [[nodiscard]] bool Overlaps(VAddr start, VAddr end) const { |
| 19 | return (cpu_addr < end) && (cpu_addr_end > start); | 14 | return (cpu_addr < end) && (cpu_addr_end > start); |
| 20 | } | 15 | } |
| 21 | 16 | ||
| 22 | bool IsInside(VAddr other_start, VAddr other_end) const { | 17 | [[nodiscard]] bool IsInside(VAddr other_start, VAddr other_end) const { |
| 23 | return cpu_addr <= other_start && other_end <= cpu_addr_end; | 18 | return cpu_addr <= other_start && other_end <= cpu_addr_end; |
| 24 | } | 19 | } |
| 25 | 20 | ||
| 26 | std::size_t Offset(VAddr in_addr) const { | 21 | [[nodiscard]] std::size_t Offset(VAddr in_addr) const { |
| 27 | return static_cast<std::size_t>(in_addr - cpu_addr); | 22 | return static_cast<std::size_t>(in_addr - cpu_addr); |
| 28 | } | 23 | } |
| 29 | 24 | ||
| 30 | VAddr CpuAddr() const { | 25 | [[nodiscard]] VAddr CpuAddr() const { |
| 31 | return cpu_addr; | 26 | return cpu_addr; |
| 32 | } | 27 | } |
| 33 | 28 | ||
| 34 | VAddr CpuAddrEnd() const { | 29 | [[nodiscard]] VAddr CpuAddrEnd() const { |
| 35 | return cpu_addr_end; | 30 | return cpu_addr_end; |
| 36 | } | 31 | } |
| 37 | 32 | ||
| @@ -40,11 +35,11 @@ public: | |||
| 40 | cpu_addr_end = new_addr + size; | 35 | cpu_addr_end = new_addr + size; |
| 41 | } | 36 | } |
| 42 | 37 | ||
| 43 | std::size_t Size() const { | 38 | [[nodiscard]] std::size_t Size() const { |
| 44 | return size; | 39 | return size; |
| 45 | } | 40 | } |
| 46 | 41 | ||
| 47 | u64 Epoch() const { | 42 | [[nodiscard]] u64 Epoch() const { |
| 48 | return epoch; | 43 | return epoch; |
| 49 | } | 44 | } |
| 50 | 45 | ||
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index e7edd733f..38961f3fd 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -545,7 +545,7 @@ private: | |||
| 545 | bool IsRegionWritten(VAddr start, VAddr end) const { | 545 | bool IsRegionWritten(VAddr start, VAddr end) const { |
| 546 | const u64 page_end = end >> WRITE_PAGE_BIT; | 546 | const u64 page_end = end >> WRITE_PAGE_BIT; |
| 547 | for (u64 page_start = start >> WRITE_PAGE_BIT; page_start <= page_end; ++page_start) { | 547 | for (u64 page_start = start >> WRITE_PAGE_BIT; page_start <= page_end; ++page_start) { |
| 548 | if (written_pages.count(page_start) > 0) { | 548 | if (written_pages.contains(page_start)) { |
| 549 | return true; | 549 | return true; |
| 550 | } | 550 | } |
| 551 | } | 551 | } |
diff --git a/src/video_core/buffer_cache/map_interval.h b/src/video_core/buffer_cache/map_interval.h index fe0bcd1d8..ef974b08a 100644 --- a/src/video_core/buffer_cache/map_interval.h +++ b/src/video_core/buffer_cache/map_interval.h | |||
| @@ -84,9 +84,10 @@ private: | |||
| 84 | void FillFreeList(Chunk& chunk); | 84 | void FillFreeList(Chunk& chunk); |
| 85 | 85 | ||
| 86 | std::vector<MapInterval*> free_list; | 86 | std::vector<MapInterval*> free_list; |
| 87 | std::unique_ptr<Chunk>* new_chunk = &first_chunk.next; | ||
| 88 | 87 | ||
| 89 | Chunk first_chunk; | 88 | Chunk first_chunk; |
| 89 | |||
| 90 | std::unique_ptr<Chunk>* new_chunk = &first_chunk.next; | ||
| 90 | }; | 91 | }; |
| 91 | 92 | ||
| 92 | } // namespace VideoCommon | 93 | } // namespace VideoCommon |
diff --git a/src/video_core/cdma_pusher.cpp b/src/video_core/cdma_pusher.cpp index b60f86260..e3e7432f7 100644 --- a/src/video_core/cdma_pusher.cpp +++ b/src/video_core/cdma_pusher.cpp | |||
| @@ -29,8 +29,8 @@ | |||
| 29 | #include "video_core/memory_manager.h" | 29 | #include "video_core/memory_manager.h" |
| 30 | 30 | ||
| 31 | namespace Tegra { | 31 | namespace Tegra { |
| 32 | CDmaPusher::CDmaPusher(GPU& gpu) | 32 | CDmaPusher::CDmaPusher(GPU& gpu_) |
| 33 | : gpu(gpu), nvdec_processor(std::make_shared<Nvdec>(gpu)), | 33 | : gpu{gpu_}, nvdec_processor(std::make_shared<Nvdec>(gpu)), |
| 34 | vic_processor(std::make_unique<Vic>(gpu, nvdec_processor)), | 34 | vic_processor(std::make_unique<Vic>(gpu, nvdec_processor)), |
| 35 | host1x_processor(std::make_unique<Host1x>(gpu)), | 35 | host1x_processor(std::make_unique<Host1x>(gpu)), |
| 36 | nvdec_sync(std::make_unique<SyncptIncrManager>(gpu)), | 36 | nvdec_sync(std::make_unique<SyncptIncrManager>(gpu)), |
| @@ -100,11 +100,11 @@ void CDmaPusher::Step() { | |||
| 100 | } | 100 | } |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | void CDmaPusher::ExecuteCommand(u32 offset, u32 data) { | 103 | void CDmaPusher::ExecuteCommand(u32 state_offset, u32 data) { |
| 104 | switch (current_class) { | 104 | switch (current_class) { |
| 105 | case ChClassId::NvDec: | 105 | case ChClassId::NvDec: |
| 106 | ThiStateWrite(nvdec_thi_state, offset, {data}); | 106 | ThiStateWrite(nvdec_thi_state, state_offset, {data}); |
| 107 | switch (static_cast<ThiMethod>(offset)) { | 107 | switch (static_cast<ThiMethod>(state_offset)) { |
| 108 | case ThiMethod::IncSyncpt: { | 108 | case ThiMethod::IncSyncpt: { |
| 109 | LOG_DEBUG(Service_NVDRV, "NVDEC Class IncSyncpt Method"); | 109 | LOG_DEBUG(Service_NVDRV, "NVDEC Class IncSyncpt Method"); |
| 110 | const auto syncpoint_id = static_cast<u32>(data & 0xFF); | 110 | const auto syncpoint_id = static_cast<u32>(data & 0xFF); |
| @@ -120,16 +120,16 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) { | |||
| 120 | case ThiMethod::SetMethod1: | 120 | case ThiMethod::SetMethod1: |
| 121 | LOG_DEBUG(Service_NVDRV, "NVDEC method 0x{:X}", | 121 | LOG_DEBUG(Service_NVDRV, "NVDEC method 0x{:X}", |
| 122 | static_cast<u32>(nvdec_thi_state.method_0)); | 122 | static_cast<u32>(nvdec_thi_state.method_0)); |
| 123 | nvdec_processor->ProcessMethod( | 123 | nvdec_processor->ProcessMethod(static_cast<Nvdec::Method>(nvdec_thi_state.method_0), |
| 124 | static_cast<Tegra::Nvdec::Method>(nvdec_thi_state.method_0), {data}); | 124 | {data}); |
| 125 | break; | 125 | break; |
| 126 | default: | 126 | default: |
| 127 | break; | 127 | break; |
| 128 | } | 128 | } |
| 129 | break; | 129 | break; |
| 130 | case ChClassId::GraphicsVic: | 130 | case ChClassId::GraphicsVic: |
| 131 | ThiStateWrite(vic_thi_state, static_cast<u32>(offset), {data}); | 131 | ThiStateWrite(vic_thi_state, static_cast<u32>(state_offset), {data}); |
| 132 | switch (static_cast<ThiMethod>(offset)) { | 132 | switch (static_cast<ThiMethod>(state_offset)) { |
| 133 | case ThiMethod::IncSyncpt: { | 133 | case ThiMethod::IncSyncpt: { |
| 134 | LOG_DEBUG(Service_NVDRV, "VIC Class IncSyncpt Method"); | 134 | LOG_DEBUG(Service_NVDRV, "VIC Class IncSyncpt Method"); |
| 135 | const auto syncpoint_id = static_cast<u32>(data & 0xFF); | 135 | const auto syncpoint_id = static_cast<u32>(data & 0xFF); |
| @@ -145,8 +145,7 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) { | |||
| 145 | case ThiMethod::SetMethod1: | 145 | case ThiMethod::SetMethod1: |
| 146 | LOG_DEBUG(Service_NVDRV, "VIC method 0x{:X}, Args=({})", | 146 | LOG_DEBUG(Service_NVDRV, "VIC method 0x{:X}, Args=({})", |
| 147 | static_cast<u32>(vic_thi_state.method_0), data); | 147 | static_cast<u32>(vic_thi_state.method_0), data); |
| 148 | vic_processor->ProcessMethod(static_cast<Tegra::Vic::Method>(vic_thi_state.method_0), | 148 | vic_processor->ProcessMethod(static_cast<Vic::Method>(vic_thi_state.method_0), {data}); |
| 149 | {data}); | ||
| 150 | break; | 149 | break; |
| 151 | default: | 150 | default: |
| 152 | break; | 151 | break; |
| @@ -155,7 +154,7 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) { | |||
| 155 | case ChClassId::Host1x: | 154 | case ChClassId::Host1x: |
| 156 | // This device is mainly for syncpoint synchronization | 155 | // This device is mainly for syncpoint synchronization |
| 157 | LOG_DEBUG(Service_NVDRV, "Host1X Class Method"); | 156 | LOG_DEBUG(Service_NVDRV, "Host1X Class Method"); |
| 158 | host1x_processor->ProcessMethod(static_cast<Tegra::Host1x::Method>(offset), {data}); | 157 | host1x_processor->ProcessMethod(static_cast<Host1x::Method>(state_offset), {data}); |
| 159 | break; | 158 | break; |
| 160 | default: | 159 | default: |
| 161 | UNIMPLEMENTED_MSG("Current class not implemented {:X}", static_cast<u32>(current_class)); | 160 | UNIMPLEMENTED_MSG("Current class not implemented {:X}", static_cast<u32>(current_class)); |
| @@ -163,9 +162,10 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) { | |||
| 163 | } | 162 | } |
| 164 | } | 163 | } |
| 165 | 164 | ||
| 166 | void CDmaPusher::ThiStateWrite(ThiRegisters& state, u32 offset, const std::vector<u32>& arguments) { | 165 | void CDmaPusher::ThiStateWrite(ThiRegisters& state, u32 state_offset, |
| 167 | u8* const state_offset = reinterpret_cast<u8*>(&state) + sizeof(u32) * offset; | 166 | const std::vector<u32>& arguments) { |
| 168 | std::memcpy(state_offset, arguments.data(), sizeof(u32) * arguments.size()); | 167 | u8* const state_offset_ptr = reinterpret_cast<u8*>(&state) + sizeof(u32) * state_offset; |
| 168 | std::memcpy(state_offset_ptr, arguments.data(), sizeof(u32) * arguments.size()); | ||
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | } // namespace Tegra | 171 | } // namespace Tegra |
diff --git a/src/video_core/cdma_pusher.h b/src/video_core/cdma_pusher.h index 982f309c5..0db1cd646 100644 --- a/src/video_core/cdma_pusher.h +++ b/src/video_core/cdma_pusher.h | |||
| @@ -68,8 +68,8 @@ struct ChCommand { | |||
| 68 | std::vector<u32> arguments; | 68 | std::vector<u32> arguments; |
| 69 | }; | 69 | }; |
| 70 | 70 | ||
| 71 | using ChCommandHeaderList = std::vector<Tegra::ChCommandHeader>; | 71 | using ChCommandHeaderList = std::vector<ChCommandHeader>; |
| 72 | using ChCommandList = std::vector<Tegra::ChCommand>; | 72 | using ChCommandList = std::vector<ChCommand>; |
| 73 | 73 | ||
| 74 | struct ThiRegisters { | 74 | struct ThiRegisters { |
| 75 | u32_le increment_syncpt{}; | 75 | u32_le increment_syncpt{}; |
| @@ -96,7 +96,7 @@ enum class ThiMethod : u32 { | |||
| 96 | 96 | ||
| 97 | class CDmaPusher { | 97 | class CDmaPusher { |
| 98 | public: | 98 | public: |
| 99 | explicit CDmaPusher(GPU& gpu); | 99 | explicit CDmaPusher(GPU& gpu_); |
| 100 | ~CDmaPusher(); | 100 | ~CDmaPusher(); |
| 101 | 101 | ||
| 102 | /// Push NVDEC command buffer entries into queue | 102 | /// Push NVDEC command buffer entries into queue |
| @@ -109,17 +109,17 @@ public: | |||
| 109 | void Step(); | 109 | void Step(); |
| 110 | 110 | ||
| 111 | /// Invoke command class devices to execute the command based on the current state | 111 | /// Invoke command class devices to execute the command based on the current state |
| 112 | void ExecuteCommand(u32 offset, u32 data); | 112 | void ExecuteCommand(u32 state_offset, u32 data); |
| 113 | 113 | ||
| 114 | private: | 114 | private: |
| 115 | /// Write arguments value to the ThiRegisters member at the specified offset | 115 | /// Write arguments value to the ThiRegisters member at the specified offset |
| 116 | void ThiStateWrite(ThiRegisters& state, u32 offset, const std::vector<u32>& arguments); | 116 | void ThiStateWrite(ThiRegisters& state, u32 state_offset, const std::vector<u32>& arguments); |
| 117 | 117 | ||
| 118 | GPU& gpu; | 118 | GPU& gpu; |
| 119 | 119 | ||
| 120 | std::shared_ptr<Tegra::Nvdec> nvdec_processor; | 120 | std::shared_ptr<Nvdec> nvdec_processor; |
| 121 | std::unique_ptr<Tegra::Vic> vic_processor; | 121 | std::unique_ptr<Vic> vic_processor; |
| 122 | std::unique_ptr<Tegra::Host1x> host1x_processor; | 122 | std::unique_ptr<Host1x> host1x_processor; |
| 123 | std::unique_ptr<SyncptIncrManager> nvdec_sync; | 123 | std::unique_ptr<SyncptIncrManager> nvdec_sync; |
| 124 | std::unique_ptr<SyncptIncrManager> vic_sync; | 124 | std::unique_ptr<SyncptIncrManager> vic_sync; |
| 125 | ChClassId current_class{}; | 125 | ChClassId current_class{}; |
diff --git a/src/video_core/command_classes/codecs/codec.cpp b/src/video_core/command_classes/codecs/codec.cpp index 9a88f64e4..39bc923a5 100644 --- a/src/video_core/command_classes/codecs/codec.cpp +++ b/src/video_core/command_classes/codecs/codec.cpp | |||
| @@ -44,7 +44,7 @@ Codec::~Codec() { | |||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | void Codec::SetTargetCodec(NvdecCommon::VideoCodec codec) { | 46 | void Codec::SetTargetCodec(NvdecCommon::VideoCodec codec) { |
| 47 | LOG_INFO(Service_NVDRV, "NVDEC video codec initialized to {}", static_cast<u32>(codec)); | 47 | LOG_INFO(Service_NVDRV, "NVDEC video codec initialized to {}", codec); |
| 48 | current_codec = codec; | 48 | current_codec = codec; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| @@ -62,12 +62,11 @@ void Codec::Decode() { | |||
| 62 | } else if (current_codec == NvdecCommon::VideoCodec::Vp9) { | 62 | } else if (current_codec == NvdecCommon::VideoCodec::Vp9) { |
| 63 | av_codec = avcodec_find_decoder(AV_CODEC_ID_VP9); | 63 | av_codec = avcodec_find_decoder(AV_CODEC_ID_VP9); |
| 64 | } else { | 64 | } else { |
| 65 | LOG_ERROR(Service_NVDRV, "Unknown video codec {}", static_cast<u32>(current_codec)); | 65 | LOG_ERROR(Service_NVDRV, "Unknown video codec {}", current_codec); |
| 66 | return; | 66 | return; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | av_codec_ctx = avcodec_alloc_context3(av_codec); | 69 | av_codec_ctx = avcodec_alloc_context3(av_codec); |
| 70 | av_codec_ctx->refcounted_frames = 1; | ||
| 71 | av_opt_set(av_codec_ctx->priv_data, "tune", "zerolatency", 0); | 70 | av_opt_set(av_codec_ctx->priv_data, "tune", "zerolatency", 0); |
| 72 | 71 | ||
| 73 | // TODO(ameerj): libavcodec gpu hw acceleration | 72 | // TODO(ameerj): libavcodec gpu hw acceleration |
diff --git a/src/video_core/command_classes/codecs/vp9.cpp b/src/video_core/command_classes/codecs/vp9.cpp index 7d8d6ee3c..59e586695 100644 --- a/src/video_core/command_classes/codecs/vp9.cpp +++ b/src/video_core/command_classes/codecs/vp9.cpp | |||
| @@ -233,7 +233,7 @@ constexpr std::array<s32, 254> map_lut{ | |||
| 233 | } | 233 | } |
| 234 | } // Anonymous namespace | 234 | } // Anonymous namespace |
| 235 | 235 | ||
| 236 | VP9::VP9(GPU& gpu) : gpu(gpu) {} | 236 | VP9::VP9(GPU& gpu_) : gpu{gpu_} {} |
| 237 | 237 | ||
| 238 | VP9::~VP9() = default; | 238 | VP9::~VP9() = default; |
| 239 | 239 | ||
| @@ -374,43 +374,43 @@ void VP9::InsertEntropy(u64 offset, Vp9EntropyProbs& dst) { | |||
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | Vp9FrameContainer VP9::GetCurrentFrame(const NvdecCommon::NvdecRegisters& state) { | 376 | Vp9FrameContainer VP9::GetCurrentFrame(const NvdecCommon::NvdecRegisters& state) { |
| 377 | Vp9FrameContainer frame{}; | 377 | Vp9FrameContainer current_frame{}; |
| 378 | { | 378 | { |
| 379 | gpu.SyncGuestHost(); | 379 | gpu.SyncGuestHost(); |
| 380 | frame.info = GetVp9PictureInfo(state); | 380 | current_frame.info = GetVp9PictureInfo(state); |
| 381 | frame.bit_stream.resize(frame.info.bitstream_size); | 381 | current_frame.bit_stream.resize(current_frame.info.bitstream_size); |
| 382 | gpu.MemoryManager().ReadBlock(state.frame_bitstream_offset, frame.bit_stream.data(), | 382 | gpu.MemoryManager().ReadBlock(state.frame_bitstream_offset, current_frame.bit_stream.data(), |
| 383 | frame.info.bitstream_size); | 383 | current_frame.info.bitstream_size); |
| 384 | } | 384 | } |
| 385 | // Buffer two frames, saving the last show frame info | 385 | // Buffer two frames, saving the last show frame info |
| 386 | if (!next_next_frame.bit_stream.empty()) { | 386 | if (!next_next_frame.bit_stream.empty()) { |
| 387 | Vp9FrameContainer temp{ | 387 | Vp9FrameContainer temp{ |
| 388 | .info = frame.info, | 388 | .info = current_frame.info, |
| 389 | .bit_stream = std::move(frame.bit_stream), | 389 | .bit_stream = std::move(current_frame.bit_stream), |
| 390 | }; | 390 | }; |
| 391 | next_next_frame.info.show_frame = frame.info.last_frame_shown; | 391 | next_next_frame.info.show_frame = current_frame.info.last_frame_shown; |
| 392 | frame.info = next_next_frame.info; | 392 | current_frame.info = next_next_frame.info; |
| 393 | frame.bit_stream = std::move(next_next_frame.bit_stream); | 393 | current_frame.bit_stream = std::move(next_next_frame.bit_stream); |
| 394 | next_next_frame = std::move(temp); | 394 | next_next_frame = std::move(temp); |
| 395 | 395 | ||
| 396 | if (!next_frame.bit_stream.empty()) { | 396 | if (!next_frame.bit_stream.empty()) { |
| 397 | Vp9FrameContainer temp2{ | 397 | Vp9FrameContainer temp2{ |
| 398 | .info = frame.info, | 398 | .info = current_frame.info, |
| 399 | .bit_stream = std::move(frame.bit_stream), | 399 | .bit_stream = std::move(current_frame.bit_stream), |
| 400 | }; | 400 | }; |
| 401 | next_frame.info.show_frame = frame.info.last_frame_shown; | 401 | next_frame.info.show_frame = current_frame.info.last_frame_shown; |
| 402 | frame.info = next_frame.info; | 402 | current_frame.info = next_frame.info; |
| 403 | frame.bit_stream = std::move(next_frame.bit_stream); | 403 | current_frame.bit_stream = std::move(next_frame.bit_stream); |
| 404 | next_frame = std::move(temp2); | 404 | next_frame = std::move(temp2); |
| 405 | } else { | 405 | } else { |
| 406 | next_frame.info = frame.info; | 406 | next_frame.info = current_frame.info; |
| 407 | next_frame.bit_stream = std::move(frame.bit_stream); | 407 | next_frame.bit_stream = std::move(current_frame.bit_stream); |
| 408 | } | 408 | } |
| 409 | } else { | 409 | } else { |
| 410 | next_next_frame.info = frame.info; | 410 | next_next_frame.info = current_frame.info; |
| 411 | next_next_frame.bit_stream = std::move(frame.bit_stream); | 411 | next_next_frame.bit_stream = std::move(current_frame.bit_stream); |
| 412 | } | 412 | } |
| 413 | return frame; | 413 | return current_frame; |
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | std::vector<u8> VP9::ComposeCompressedHeader() { | 416 | std::vector<u8> VP9::ComposeCompressedHeader() { |
diff --git a/src/video_core/command_classes/codecs/vp9.h b/src/video_core/command_classes/codecs/vp9.h index 9ebbbf59e..8396c8105 100644 --- a/src/video_core/command_classes/codecs/vp9.h +++ b/src/video_core/command_classes/codecs/vp9.h | |||
| @@ -108,7 +108,7 @@ private: | |||
| 108 | 108 | ||
| 109 | class VP9 { | 109 | class VP9 { |
| 110 | public: | 110 | public: |
| 111 | explicit VP9(GPU& gpu); | 111 | explicit VP9(GPU& gpu_); |
| 112 | ~VP9(); | 112 | ~VP9(); |
| 113 | 113 | ||
| 114 | VP9(const VP9&) = delete; | 114 | VP9(const VP9&) = delete; |
diff --git a/src/video_core/command_classes/vic.cpp b/src/video_core/command_classes/vic.cpp index 6cfc193fa..66e21ce9c 100644 --- a/src/video_core/command_classes/vic.cpp +++ b/src/video_core/command_classes/vic.cpp | |||
| @@ -27,7 +27,7 @@ void Vic::VicStateWrite(u32 offset, u32 arguments) { | |||
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | void Vic::ProcessMethod(Method method, const std::vector<u32>& arguments) { | 29 | void Vic::ProcessMethod(Method method, const std::vector<u32>& arguments) { |
| 30 | LOG_DEBUG(HW_GPU, "Vic method 0x{:X}", static_cast<u32>(method)); | 30 | LOG_DEBUG(HW_GPU, "Vic method 0x{:X}", method); |
| 31 | VicStateWrite(static_cast<u32>(method), arguments[0]); | 31 | VicStateWrite(static_cast<u32>(method), arguments[0]); |
| 32 | const u64 arg = static_cast<u64>(arguments[0]) << 8; | 32 | const u64 arg = static_cast<u64>(arguments[0]) << 8; |
| 33 | switch (method) { | 33 | switch (method) { |
diff --git a/src/video_core/dirty_flags.cpp b/src/video_core/dirty_flags.cpp index e16075993..2faa6ef0e 100644 --- a/src/video_core/dirty_flags.cpp +++ b/src/video_core/dirty_flags.cpp | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "video_core/dirty_flags.h" | 9 | #include "video_core/dirty_flags.h" |
| 10 | 10 | ||
| 11 | #define OFF(field_name) MAXWELL3D_REG_INDEX(field_name) | 11 | #define OFF(field_name) MAXWELL3D_REG_INDEX(field_name) |
| 12 | #define NUM(field_name) (sizeof(::Tegra::Engines::Maxwell3D::Regs::field_name) / sizeof(u32)) | 12 | #define NUM(field_name) (sizeof(::Tegra::Engines::Maxwell3D::Regs::field_name) / (sizeof(u32))) |
| 13 | 13 | ||
| 14 | namespace VideoCommon::Dirty { | 14 | namespace VideoCommon::Dirty { |
| 15 | 15 | ||
diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp index d8801b1f5..2c8b20024 100644 --- a/src/video_core/dma_pusher.cpp +++ b/src/video_core/dma_pusher.cpp | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | namespace Tegra { | 14 | namespace Tegra { |
| 15 | 15 | ||
| 16 | DmaPusher::DmaPusher(Core::System& system, GPU& gpu) : gpu{gpu}, system{system} {} | 16 | DmaPusher::DmaPusher(Core::System& system_, GPU& gpu_) : gpu{gpu_}, system{system_} {} |
| 17 | 17 | ||
| 18 | DmaPusher::~DmaPusher() = default; | 18 | DmaPusher::~DmaPusher() = default; |
| 19 | 19 | ||
| @@ -152,7 +152,12 @@ void DmaPusher::SetState(const CommandHeader& command_header) { | |||
| 152 | 152 | ||
| 153 | void DmaPusher::CallMethod(u32 argument) const { | 153 | void DmaPusher::CallMethod(u32 argument) const { |
| 154 | if (dma_state.method < non_puller_methods) { | 154 | if (dma_state.method < non_puller_methods) { |
| 155 | gpu.CallMethod({dma_state.method, argument, dma_state.subchannel, dma_state.method_count}); | 155 | gpu.CallMethod(GPU::MethodCall{ |
| 156 | dma_state.method, | ||
| 157 | argument, | ||
| 158 | dma_state.subchannel, | ||
| 159 | dma_state.method_count, | ||
| 160 | }); | ||
| 156 | } else { | 161 | } else { |
| 157 | subchannels[dma_state.subchannel]->CallMethod(dma_state.method, argument, | 162 | subchannels[dma_state.subchannel]->CallMethod(dma_state.method, argument, |
| 158 | dma_state.is_last_call); | 163 | dma_state.is_last_call); |
diff --git a/src/video_core/dma_pusher.h b/src/video_core/dma_pusher.h index 96ac267f7..19f286fa7 100644 --- a/src/video_core/dma_pusher.h +++ b/src/video_core/dma_pusher.h | |||
| @@ -87,11 +87,11 @@ inline CommandHeader BuildCommandHeader(BufferMethods method, u32 arg_count, Sub | |||
| 87 | struct CommandList final { | 87 | struct CommandList final { |
| 88 | CommandList() = default; | 88 | CommandList() = default; |
| 89 | explicit CommandList(std::size_t size) : command_lists(size) {} | 89 | explicit CommandList(std::size_t size) : command_lists(size) {} |
| 90 | explicit CommandList(std::vector<Tegra::CommandHeader>&& prefetch_command_list) | 90 | explicit CommandList(std::vector<CommandHeader>&& prefetch_command_list_) |
| 91 | : prefetch_command_list{std::move(prefetch_command_list)} {} | 91 | : prefetch_command_list{std::move(prefetch_command_list_)} {} |
| 92 | 92 | ||
| 93 | std::vector<Tegra::CommandListHeader> command_lists; | 93 | std::vector<CommandListHeader> command_lists; |
| 94 | std::vector<Tegra::CommandHeader> prefetch_command_list; | 94 | std::vector<CommandHeader> prefetch_command_list; |
| 95 | }; | 95 | }; |
| 96 | 96 | ||
| 97 | /** | 97 | /** |
| @@ -103,7 +103,7 @@ struct CommandList final { | |||
| 103 | */ | 103 | */ |
| 104 | class DmaPusher final { | 104 | class DmaPusher final { |
| 105 | public: | 105 | public: |
| 106 | explicit DmaPusher(Core::System& system, GPU& gpu); | 106 | explicit DmaPusher(Core::System& system_, GPU& gpu_); |
| 107 | ~DmaPusher(); | 107 | ~DmaPusher(); |
| 108 | 108 | ||
| 109 | void Push(CommandList&& entries) { | 109 | void Push(CommandList&& entries) { |
| @@ -112,7 +112,7 @@ public: | |||
| 112 | 112 | ||
| 113 | void DispatchCalls(); | 113 | void DispatchCalls(); |
| 114 | 114 | ||
| 115 | void BindSubchannel(Tegra::Engines::EngineInterface* engine, u32 subchannel_id) { | 115 | void BindSubchannel(Engines::EngineInterface* engine, u32 subchannel_id) { |
| 116 | subchannels[subchannel_id] = engine; | 116 | subchannels[subchannel_id] = engine; |
| 117 | } | 117 | } |
| 118 | 118 | ||
| @@ -145,7 +145,7 @@ private: | |||
| 145 | 145 | ||
| 146 | bool ib_enable{true}; ///< IB mode enabled | 146 | bool ib_enable{true}; ///< IB mode enabled |
| 147 | 147 | ||
| 148 | std::array<Tegra::Engines::EngineInterface*, max_subchannels> subchannels{}; | 148 | std::array<Engines::EngineInterface*, max_subchannels> subchannels{}; |
| 149 | 149 | ||
| 150 | GPU& gpu; | 150 | GPU& gpu; |
| 151 | Core::System& system; | 151 | Core::System& system; |
diff --git a/src/video_core/engines/engine_upload.cpp b/src/video_core/engines/engine_upload.cpp index d44ad0cd8..71d7e1473 100644 --- a/src/video_core/engines/engine_upload.cpp +++ b/src/video_core/engines/engine_upload.cpp | |||
| @@ -11,16 +11,16 @@ | |||
| 11 | 11 | ||
| 12 | namespace Tegra::Engines::Upload { | 12 | namespace Tegra::Engines::Upload { |
| 13 | 13 | ||
| 14 | State::State(MemoryManager& memory_manager, Registers& regs) | 14 | State::State(MemoryManager& memory_manager_, Registers& regs_) |
| 15 | : regs{regs}, memory_manager{memory_manager} {} | 15 | : regs{regs_}, memory_manager{memory_manager_} {} |
| 16 | 16 | ||
| 17 | State::~State() = default; | 17 | State::~State() = default; |
| 18 | 18 | ||
| 19 | void State::ProcessExec(const bool is_linear) { | 19 | void State::ProcessExec(const bool is_linear_) { |
| 20 | write_offset = 0; | 20 | write_offset = 0; |
| 21 | copy_size = regs.line_length_in * regs.line_count; | 21 | copy_size = regs.line_length_in * regs.line_count; |
| 22 | inner_buffer.resize(copy_size); | 22 | inner_buffer.resize(copy_size); |
| 23 | this->is_linear = is_linear; | 23 | is_linear = is_linear_; |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | void State::ProcessData(const u32 data, const bool is_last_call) { | 26 | void State::ProcessData(const u32 data, const bool is_last_call) { |
diff --git a/src/video_core/engines/engine_upload.h b/src/video_core/engines/engine_upload.h index 462da419e..1c7f1effa 100644 --- a/src/video_core/engines/engine_upload.h +++ b/src/video_core/engines/engine_upload.h | |||
| @@ -54,10 +54,10 @@ struct Registers { | |||
| 54 | 54 | ||
| 55 | class State { | 55 | class State { |
| 56 | public: | 56 | public: |
| 57 | State(MemoryManager& memory_manager, Registers& regs); | 57 | explicit State(MemoryManager& memory_manager_, Registers& regs_); |
| 58 | ~State(); | 58 | ~State(); |
| 59 | 59 | ||
| 60 | void ProcessExec(bool is_linear); | 60 | void ProcessExec(bool is_linear_); |
| 61 | void ProcessData(u32 data, bool is_last_call); | 61 | void ProcessData(u32 data, bool is_last_call); |
| 62 | 62 | ||
| 63 | private: | 63 | private: |
diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp index 9409c4075..4293d676c 100644 --- a/src/video_core/engines/fermi_2d.cpp +++ b/src/video_core/engines/fermi_2d.cpp | |||
| @@ -48,8 +48,7 @@ static std::pair<u32, u32> DelimitLine(u32 src_1, u32 src_2, u32 dst_1, u32 dst_ | |||
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | void Fermi2D::HandleSurfaceCopy() { | 50 | void Fermi2D::HandleSurfaceCopy() { |
| 51 | LOG_DEBUG(HW_GPU, "Requested a surface copy with operation {}", | 51 | LOG_DEBUG(HW_GPU, "Requested a surface copy with operation {}", regs.operation); |
| 52 | static_cast<u32>(regs.operation)); | ||
| 53 | 52 | ||
| 54 | // TODO(Subv): Only raw copies are implemented. | 53 | // TODO(Subv): Only raw copies are implemented. |
| 55 | ASSERT(regs.operation == Operation::SrcCopy); | 54 | ASSERT(regs.operation == Operation::SrcCopy); |
diff --git a/src/video_core/engines/kepler_memory.cpp b/src/video_core/engines/kepler_memory.cpp index dc71b2eec..9911140e9 100644 --- a/src/video_core/engines/kepler_memory.cpp +++ b/src/video_core/engines/kepler_memory.cpp | |||
| @@ -14,8 +14,8 @@ | |||
| 14 | 14 | ||
| 15 | namespace Tegra::Engines { | 15 | namespace Tegra::Engines { |
| 16 | 16 | ||
| 17 | KeplerMemory::KeplerMemory(Core::System& system, MemoryManager& memory_manager) | 17 | KeplerMemory::KeplerMemory(Core::System& system_, MemoryManager& memory_manager) |
| 18 | : system{system}, upload_state{memory_manager, regs.upload} {} | 18 | : system{system_}, upload_state{memory_manager, regs.upload} {} |
| 19 | 19 | ||
| 20 | KeplerMemory::~KeplerMemory() = default; | 20 | KeplerMemory::~KeplerMemory() = default; |
| 21 | 21 | ||
diff --git a/src/video_core/engines/kepler_memory.h b/src/video_core/engines/kepler_memory.h index 5b7f71a00..62483589e 100644 --- a/src/video_core/engines/kepler_memory.h +++ b/src/video_core/engines/kepler_memory.h | |||
| @@ -35,7 +35,7 @@ namespace Tegra::Engines { | |||
| 35 | 35 | ||
| 36 | class KeplerMemory final : public EngineInterface { | 36 | class KeplerMemory final : public EngineInterface { |
| 37 | public: | 37 | public: |
| 38 | KeplerMemory(Core::System& system, MemoryManager& memory_manager); | 38 | explicit KeplerMemory(Core::System& system_, MemoryManager& memory_manager); |
| 39 | ~KeplerMemory(); | 39 | ~KeplerMemory(); |
| 40 | 40 | ||
| 41 | /// Write the value to the register identified by method. | 41 | /// Write the value to the register identified by method. |
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 6287df633..761962ed0 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -359,7 +359,7 @@ void Maxwell3D::CallMethodFromMME(u32 method, u32 method_argument) { | |||
| 359 | } | 359 | } |
| 360 | 360 | ||
| 361 | void Maxwell3D::FlushMMEInlineDraw() { | 361 | void Maxwell3D::FlushMMEInlineDraw() { |
| 362 | LOG_TRACE(HW_GPU, "called, topology={}, count={}", static_cast<u32>(regs.draw.topology.Value()), | 362 | LOG_TRACE(HW_GPU, "called, topology={}, count={}", regs.draw.topology.Value(), |
| 363 | regs.vertex_buffer.count); | 363 | regs.vertex_buffer.count); |
| 364 | ASSERT_MSG(!(regs.index_array.count && regs.vertex_buffer.count), "Both indexed and direct?"); | 364 | ASSERT_MSG(!(regs.index_array.count && regs.vertex_buffer.count), "Both indexed and direct?"); |
| 365 | ASSERT(mme_draw.instance_count == mme_draw.gl_end_count); | 365 | ASSERT(mme_draw.instance_count == mme_draw.gl_end_count); |
| @@ -504,8 +504,7 @@ void Maxwell3D::ProcessCounterReset() { | |||
| 504 | rasterizer->ResetCounter(QueryType::SamplesPassed); | 504 | rasterizer->ResetCounter(QueryType::SamplesPassed); |
| 505 | break; | 505 | break; |
| 506 | default: | 506 | default: |
| 507 | LOG_DEBUG(Render_OpenGL, "Unimplemented counter reset={}", | 507 | LOG_DEBUG(Render_OpenGL, "Unimplemented counter reset={}", regs.counter_reset); |
| 508 | static_cast<int>(regs.counter_reset)); | ||
| 509 | break; | 508 | break; |
| 510 | } | 509 | } |
| 511 | } | 510 | } |
| @@ -520,7 +519,7 @@ void Maxwell3D::ProcessSyncPoint() { | |||
| 520 | } | 519 | } |
| 521 | 520 | ||
| 522 | void Maxwell3D::DrawArrays() { | 521 | void Maxwell3D::DrawArrays() { |
| 523 | LOG_TRACE(HW_GPU, "called, topology={}, count={}", static_cast<u32>(regs.draw.topology.Value()), | 522 | LOG_TRACE(HW_GPU, "called, topology={}, count={}", regs.draw.topology.Value(), |
| 524 | regs.vertex_buffer.count); | 523 | regs.vertex_buffer.count); |
| 525 | ASSERT_MSG(!(regs.index_array.count && regs.vertex_buffer.count), "Both indexed and direct?"); | 524 | ASSERT_MSG(!(regs.index_array.count && regs.vertex_buffer.count), "Both indexed and direct?"); |
| 526 | 525 | ||
| @@ -558,12 +557,12 @@ std::optional<u64> Maxwell3D::GetQueryResult() { | |||
| 558 | return 0; | 557 | return 0; |
| 559 | case Regs::QuerySelect::SamplesPassed: | 558 | case Regs::QuerySelect::SamplesPassed: |
| 560 | // Deferred. | 559 | // Deferred. |
| 561 | rasterizer->Query(regs.query.QueryAddress(), VideoCore::QueryType::SamplesPassed, | 560 | rasterizer->Query(regs.query.QueryAddress(), QueryType::SamplesPassed, |
| 562 | system.GPU().GetTicks()); | 561 | system.GPU().GetTicks()); |
| 563 | return std::nullopt; | 562 | return std::nullopt; |
| 564 | default: | 563 | default: |
| 565 | LOG_DEBUG(HW_GPU, "Unimplemented query select type {}", | 564 | LOG_DEBUG(HW_GPU, "Unimplemented query select type {}", |
| 566 | static_cast<u32>(regs.query.query_get.select.Value())); | 565 | regs.query.query_get.select.Value()); |
| 567 | return 1; | 566 | return 1; |
| 568 | } | 567 | } |
| 569 | } | 568 | } |
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index 8fa359d0a..1c29e895e 100644 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp | |||
| @@ -16,8 +16,10 @@ namespace Tegra::Engines { | |||
| 16 | 16 | ||
| 17 | using namespace Texture; | 17 | using namespace Texture; |
| 18 | 18 | ||
| 19 | MaxwellDMA::MaxwellDMA(Core::System& system, MemoryManager& memory_manager) | 19 | MaxwellDMA::MaxwellDMA(Core::System& system_, MemoryManager& memory_manager_) |
| 20 | : system{system}, memory_manager{memory_manager} {} | 20 | : system{system_}, memory_manager{memory_manager_} {} |
| 21 | |||
| 22 | MaxwellDMA::~MaxwellDMA() = default; | ||
| 21 | 23 | ||
| 22 | void MaxwellDMA::CallMethod(u32 method, u32 method_argument, bool is_last_call) { | 24 | void MaxwellDMA::CallMethod(u32 method, u32 method_argument, bool is_last_call) { |
| 23 | ASSERT_MSG(method < NUM_REGS, "Invalid MaxwellDMA register"); | 25 | ASSERT_MSG(method < NUM_REGS, "Invalid MaxwellDMA register"); |
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h index 50f445efc..3c59eeb13 100644 --- a/src/video_core/engines/maxwell_dma.h +++ b/src/video_core/engines/maxwell_dma.h | |||
| @@ -72,11 +72,13 @@ public: | |||
| 72 | 72 | ||
| 73 | struct RenderEnable { | 73 | struct RenderEnable { |
| 74 | enum class Mode : u32 { | 74 | enum class Mode : u32 { |
| 75 | FALSE = 0, | 75 | // Note: This uses Pascal case in order to avoid the identifiers |
| 76 | TRUE = 1, | 76 | // FALSE and TRUE, which are reserved on Darwin. |
| 77 | CONDITIONAL = 2, | 77 | False = 0, |
| 78 | RENDER_IF_EQUAL = 3, | 78 | True = 1, |
| 79 | RENDER_IF_NOT_EQUAL = 4, | 79 | Conditional = 2, |
| 80 | RenderIfEqual = 3, | ||
| 81 | RenderIfNotEqual = 4, | ||
| 80 | }; | 82 | }; |
| 81 | 83 | ||
| 82 | PackedGPUVAddr address; | 84 | PackedGPUVAddr address; |
| @@ -185,8 +187,8 @@ public: | |||
| 185 | }; | 187 | }; |
| 186 | static_assert(sizeof(RemapConst) == 12); | 188 | static_assert(sizeof(RemapConst) == 12); |
| 187 | 189 | ||
| 188 | explicit MaxwellDMA(Core::System& system, MemoryManager& memory_manager); | 190 | explicit MaxwellDMA(Core::System& system_, MemoryManager& memory_manager_); |
| 189 | ~MaxwellDMA() = default; | 191 | ~MaxwellDMA(); |
| 190 | 192 | ||
| 191 | /// Write the value to the register identified by method. | 193 | /// Write the value to the register identified by method. |
| 192 | void CallMethod(u32 method, u32 method_argument, bool is_last_call) override; | 194 | void CallMethod(u32 method, u32 method_argument, bool is_last_call) override; |
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 37d17efdc..8b45f1b62 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h | |||
| @@ -1437,8 +1437,7 @@ union Instruction { | |||
| 1437 | return TextureType::TextureCube; | 1437 | return TextureType::TextureCube; |
| 1438 | } | 1438 | } |
| 1439 | 1439 | ||
| 1440 | LOG_CRITICAL(HW_GPU, "Unhandled texture_info: {}", | 1440 | LOG_CRITICAL(HW_GPU, "Unhandled texture_info: {}", texture_info.Value()); |
| 1441 | static_cast<u32>(texture_info.Value())); | ||
| 1442 | UNREACHABLE(); | 1441 | UNREACHABLE(); |
| 1443 | return TextureType::Texture1D; | 1442 | return TextureType::Texture1D; |
| 1444 | } | 1443 | } |
| @@ -1533,8 +1532,7 @@ union Instruction { | |||
| 1533 | return TextureType::Texture3D; | 1532 | return TextureType::Texture3D; |
| 1534 | } | 1533 | } |
| 1535 | 1534 | ||
| 1536 | LOG_CRITICAL(HW_GPU, "Unhandled texture_info: {}", | 1535 | LOG_CRITICAL(HW_GPU, "Unhandled texture_info: {}", texture_info.Value()); |
| 1537 | static_cast<u32>(texture_info.Value())); | ||
| 1538 | UNREACHABLE(); | 1536 | UNREACHABLE(); |
| 1539 | return TextureType::Texture1D; | 1537 | return TextureType::Texture1D; |
| 1540 | } | 1538 | } |
diff --git a/src/video_core/fence_manager.h b/src/video_core/fence_manager.h index de6991ef6..c5f26896e 100644 --- a/src/video_core/fence_manager.h +++ b/src/video_core/fence_manager.h | |||
| @@ -17,11 +17,11 @@ namespace VideoCommon { | |||
| 17 | 17 | ||
| 18 | class FenceBase { | 18 | class FenceBase { |
| 19 | public: | 19 | public: |
| 20 | FenceBase(u32 payload, bool is_stubbed) | 20 | explicit FenceBase(u32 payload_, bool is_stubbed_) |
| 21 | : address{}, payload{payload}, is_semaphore{false}, is_stubbed{is_stubbed} {} | 21 | : address{}, payload{payload_}, is_semaphore{false}, is_stubbed{is_stubbed_} {} |
| 22 | 22 | ||
| 23 | FenceBase(GPUVAddr address, u32 payload, bool is_stubbed) | 23 | explicit FenceBase(GPUVAddr address_, u32 payload_, bool is_stubbed_) |
| 24 | : address{address}, payload{payload}, is_semaphore{true}, is_stubbed{is_stubbed} {} | 24 | : address{address_}, payload{payload_}, is_semaphore{true}, is_stubbed{is_stubbed_} {} |
| 25 | 25 | ||
| 26 | GPUVAddr GetAddress() const { | 26 | GPUVAddr GetAddress() const { |
| 27 | return address; | 27 | return address; |
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index e91f52938..e2512a7f2 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -232,8 +232,12 @@ void GPU::CallMultiMethod(u32 method, u32 subchannel, const u32* base_start, u32 | |||
| 232 | CallEngineMultiMethod(method, subchannel, base_start, amount, methods_pending); | 232 | CallEngineMultiMethod(method, subchannel, base_start, amount, methods_pending); |
| 233 | } else { | 233 | } else { |
| 234 | for (std::size_t i = 0; i < amount; i++) { | 234 | for (std::size_t i = 0; i < amount; i++) { |
| 235 | CallPullerMethod( | 235 | CallPullerMethod(MethodCall{ |
| 236 | {method, base_start[i], subchannel, methods_pending - static_cast<u32>(i)}); | 236 | method, |
| 237 | base_start[i], | ||
| 238 | subchannel, | ||
| 239 | methods_pending - static_cast<u32>(i), | ||
| 240 | }); | ||
| 237 | } | 241 | } |
| 238 | } | 242 | } |
| 239 | } | 243 | } |
| @@ -295,8 +299,7 @@ void GPU::CallPullerMethod(const MethodCall& method_call) { | |||
| 295 | break; | 299 | break; |
| 296 | } | 300 | } |
| 297 | default: | 301 | default: |
| 298 | LOG_ERROR(HW_GPU, "Special puller engine method {:X} not implemented", | 302 | LOG_ERROR(HW_GPU, "Special puller engine method {:X} not implemented", method); |
| 299 | static_cast<u32>(method)); | ||
| 300 | break; | 303 | break; |
| 301 | } | 304 | } |
| 302 | } | 305 | } |
| @@ -375,7 +378,7 @@ void GPU::ProcessBindMethod(const MethodCall& method_call) { | |||
| 375 | dma_pusher->BindSubchannel(kepler_memory.get(), method_call.subchannel); | 378 | dma_pusher->BindSubchannel(kepler_memory.get(), method_call.subchannel); |
| 376 | break; | 379 | break; |
| 377 | default: | 380 | default: |
| 378 | UNIMPLEMENTED_MSG("Unimplemented engine {:04X}", static_cast<u32>(engine_id)); | 381 | UNIMPLEMENTED_MSG("Unimplemented engine {:04X}", engine_id); |
| 379 | } | 382 | } |
| 380 | } | 383 | } |
| 381 | 384 | ||
| @@ -388,8 +391,7 @@ void GPU::ProcessFenceActionMethod() { | |||
| 388 | IncrementSyncPoint(regs.fence_action.syncpoint_id); | 391 | IncrementSyncPoint(regs.fence_action.syncpoint_id); |
| 389 | break; | 392 | break; |
| 390 | default: | 393 | default: |
| 391 | UNIMPLEMENTED_MSG("Unimplemented operation {}", | 394 | UNIMPLEMENTED_MSG("Unimplemented operation {}", regs.fence_action.op.Value()); |
| 392 | static_cast<u32>(regs.fence_action.op.Value())); | ||
| 393 | } | 395 | } |
| 394 | } | 396 | } |
| 395 | 397 | ||
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 21410e125..660641d04 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -149,16 +149,16 @@ public: | |||
| 149 | u32 subchannel{}; | 149 | u32 subchannel{}; |
| 150 | u32 method_count{}; | 150 | u32 method_count{}; |
| 151 | 151 | ||
| 152 | MethodCall(u32 method, u32 argument, u32 subchannel = 0, u32 method_count = 0) | 152 | explicit MethodCall(u32 method_, u32 argument_, u32 subchannel_ = 0, u32 method_count_ = 0) |
| 153 | : method(method), argument(argument), subchannel(subchannel), | 153 | : method(method_), argument(argument_), subchannel(subchannel_), |
| 154 | method_count(method_count) {} | 154 | method_count(method_count_) {} |
| 155 | 155 | ||
| 156 | [[nodiscard]] bool IsLastCall() const { | 156 | [[nodiscard]] bool IsLastCall() const { |
| 157 | return method_count <= 1; | 157 | return method_count <= 1; |
| 158 | } | 158 | } |
| 159 | }; | 159 | }; |
| 160 | 160 | ||
| 161 | explicit GPU(Core::System& system, bool is_async, bool use_nvdec); | 161 | explicit GPU(Core::System& system_, bool is_async_, bool use_nvdec_); |
| 162 | virtual ~GPU(); | 162 | virtual ~GPU(); |
| 163 | 163 | ||
| 164 | /// Binds a renderer to the GPU. | 164 | /// Binds a renderer to the GPU. |
| @@ -414,8 +414,8 @@ private: | |||
| 414 | std::condition_variable sync_cv; | 414 | std::condition_variable sync_cv; |
| 415 | 415 | ||
| 416 | struct FlushRequest { | 416 | struct FlushRequest { |
| 417 | FlushRequest(u64 fence, VAddr addr, std::size_t size) | 417 | explicit FlushRequest(u64 fence_, VAddr addr_, std::size_t size_) |
| 418 | : fence{fence}, addr{addr}, size{size} {} | 418 | : fence{fence_}, addr{addr_}, size{size_} {} |
| 419 | u64 fence; | 419 | u64 fence; |
| 420 | VAddr addr; | 420 | VAddr addr; |
| 421 | std::size_t size; | 421 | std::size_t size; |
diff --git a/src/video_core/gpu_asynch.cpp b/src/video_core/gpu_asynch.cpp index a9baaf7ef..6cc091ecd 100644 --- a/src/video_core/gpu_asynch.cpp +++ b/src/video_core/gpu_asynch.cpp | |||
| @@ -10,8 +10,8 @@ | |||
| 10 | 10 | ||
| 11 | namespace VideoCommon { | 11 | namespace VideoCommon { |
| 12 | 12 | ||
| 13 | GPUAsynch::GPUAsynch(Core::System& system, bool use_nvdec) | 13 | GPUAsynch::GPUAsynch(Core::System& system_, bool use_nvdec_) |
| 14 | : GPU{system, true, use_nvdec}, gpu_thread{system} {} | 14 | : GPU{system_, true, use_nvdec_}, gpu_thread{system_} {} |
| 15 | 15 | ||
| 16 | GPUAsynch::~GPUAsynch() = default; | 16 | GPUAsynch::~GPUAsynch() = default; |
| 17 | 17 | ||
diff --git a/src/video_core/gpu_asynch.h b/src/video_core/gpu_asynch.h index 0c0872e73..a384113f4 100644 --- a/src/video_core/gpu_asynch.h +++ b/src/video_core/gpu_asynch.h | |||
| @@ -20,7 +20,7 @@ namespace VideoCommon { | |||
| 20 | /// Implementation of GPU interface that runs the GPU asynchronously | 20 | /// Implementation of GPU interface that runs the GPU asynchronously |
| 21 | class GPUAsynch final : public Tegra::GPU { | 21 | class GPUAsynch final : public Tegra::GPU { |
| 22 | public: | 22 | public: |
| 23 | explicit GPUAsynch(Core::System& system, bool use_nvdec); | 23 | explicit GPUAsynch(Core::System& system_, bool use_nvdec_); |
| 24 | ~GPUAsynch() override; | 24 | ~GPUAsynch() override; |
| 25 | 25 | ||
| 26 | void Start() override; | 26 | void Start() override; |
diff --git a/src/video_core/gpu_synch.cpp b/src/video_core/gpu_synch.cpp index ecf7bbdf3..1e9d4b9b2 100644 --- a/src/video_core/gpu_synch.cpp +++ b/src/video_core/gpu_synch.cpp | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | namespace VideoCommon { | 8 | namespace VideoCommon { |
| 9 | 9 | ||
| 10 | GPUSynch::GPUSynch(Core::System& system, bool use_nvdec) : GPU{system, false, use_nvdec} {} | 10 | GPUSynch::GPUSynch(Core::System& system_, bool use_nvdec_) : GPU{system_, false, use_nvdec_} {} |
| 11 | 11 | ||
| 12 | GPUSynch::~GPUSynch() = default; | 12 | GPUSynch::~GPUSynch() = default; |
| 13 | 13 | ||
diff --git a/src/video_core/gpu_synch.h b/src/video_core/gpu_synch.h index 9d778c71a..c5904b8db 100644 --- a/src/video_core/gpu_synch.h +++ b/src/video_core/gpu_synch.h | |||
| @@ -19,7 +19,7 @@ namespace VideoCommon { | |||
| 19 | /// Implementation of GPU interface that runs the GPU synchronously | 19 | /// Implementation of GPU interface that runs the GPU synchronously |
| 20 | class GPUSynch final : public Tegra::GPU { | 20 | class GPUSynch final : public Tegra::GPU { |
| 21 | public: | 21 | public: |
| 22 | explicit GPUSynch(Core::System& system, bool use_nvdec); | 22 | explicit GPUSynch(Core::System& system_, bool use_nvdec_); |
| 23 | ~GPUSynch() override; | 23 | ~GPUSynch() override; |
| 24 | 24 | ||
| 25 | void Start() override; | 25 | void Start() override; |
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp index 4b8f58283..e27218b96 100644 --- a/src/video_core/gpu_thread.cpp +++ b/src/video_core/gpu_thread.cpp | |||
| @@ -39,23 +39,23 @@ static void RunThread(Core::System& system, VideoCore::RendererBase& renderer, | |||
| 39 | CommandDataContainer next; | 39 | CommandDataContainer next; |
| 40 | while (state.is_running) { | 40 | while (state.is_running) { |
| 41 | next = state.queue.PopWait(); | 41 | next = state.queue.PopWait(); |
| 42 | if (const auto submit_list = std::get_if<SubmitListCommand>(&next.data)) { | 42 | if (auto* submit_list = std::get_if<SubmitListCommand>(&next.data)) { |
| 43 | dma_pusher.Push(std::move(submit_list->entries)); | 43 | dma_pusher.Push(std::move(submit_list->entries)); |
| 44 | dma_pusher.DispatchCalls(); | 44 | dma_pusher.DispatchCalls(); |
| 45 | } else if (const auto command_list = std::get_if<SubmitChCommandEntries>(&next.data)) { | 45 | } else if (auto* command_list = std::get_if<SubmitChCommandEntries>(&next.data)) { |
| 46 | // NVDEC | 46 | // NVDEC |
| 47 | cdma_pusher.Push(std::move(command_list->entries)); | 47 | cdma_pusher.Push(std::move(command_list->entries)); |
| 48 | cdma_pusher.DispatchCalls(); | 48 | cdma_pusher.DispatchCalls(); |
| 49 | } else if (const auto data = std::get_if<SwapBuffersCommand>(&next.data)) { | 49 | } else if (const auto* data = std::get_if<SwapBuffersCommand>(&next.data)) { |
| 50 | renderer.SwapBuffers(data->framebuffer ? &*data->framebuffer : nullptr); | 50 | renderer.SwapBuffers(data->framebuffer ? &*data->framebuffer : nullptr); |
| 51 | } else if (std::holds_alternative<OnCommandListEndCommand>(next.data)) { | 51 | } else if (std::holds_alternative<OnCommandListEndCommand>(next.data)) { |
| 52 | renderer.Rasterizer().ReleaseFences(); | 52 | renderer.Rasterizer().ReleaseFences(); |
| 53 | } else if (std::holds_alternative<GPUTickCommand>(next.data)) { | 53 | } else if (std::holds_alternative<GPUTickCommand>(next.data)) { |
| 54 | system.GPU().TickWork(); | 54 | system.GPU().TickWork(); |
| 55 | } else if (const auto data = std::get_if<FlushRegionCommand>(&next.data)) { | 55 | } else if (const auto* flush = std::get_if<FlushRegionCommand>(&next.data)) { |
| 56 | renderer.Rasterizer().FlushRegion(data->addr, data->size); | 56 | renderer.Rasterizer().FlushRegion(flush->addr, flush->size); |
| 57 | } else if (const auto data = std::get_if<InvalidateRegionCommand>(&next.data)) { | 57 | } else if (const auto* invalidate = std::get_if<InvalidateRegionCommand>(&next.data)) { |
| 58 | renderer.Rasterizer().OnCPUWrite(data->addr, data->size); | 58 | renderer.Rasterizer().OnCPUWrite(invalidate->addr, invalidate->size); |
| 59 | } else if (std::holds_alternative<EndProcessingCommand>(next.data)) { | 59 | } else if (std::holds_alternative<EndProcessingCommand>(next.data)) { |
| 60 | return; | 60 | return; |
| 61 | } else { | 61 | } else { |
| @@ -65,7 +65,7 @@ static void RunThread(Core::System& system, VideoCore::RendererBase& renderer, | |||
| 65 | } | 65 | } |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | ThreadManager::ThreadManager(Core::System& system) : system{system} {} | 68 | ThreadManager::ThreadManager(Core::System& system_) : system{system_} {} |
| 69 | 69 | ||
| 70 | ThreadManager::~ThreadManager() { | 70 | ThreadManager::~ThreadManager() { |
| 71 | if (!thread.joinable()) { | 71 | if (!thread.joinable()) { |
diff --git a/src/video_core/gpu_thread.h b/src/video_core/gpu_thread.h index 32a34e3a7..f1c52cd9e 100644 --- a/src/video_core/gpu_thread.h +++ b/src/video_core/gpu_thread.h | |||
| @@ -32,30 +32,30 @@ struct EndProcessingCommand final {}; | |||
| 32 | 32 | ||
| 33 | /// Command to signal to the GPU thread that a command list is ready for processing | 33 | /// Command to signal to the GPU thread that a command list is ready for processing |
| 34 | struct SubmitListCommand final { | 34 | struct SubmitListCommand final { |
| 35 | explicit SubmitListCommand(Tegra::CommandList&& entries) : entries{std::move(entries)} {} | 35 | explicit SubmitListCommand(Tegra::CommandList&& entries_) : entries{std::move(entries_)} {} |
| 36 | 36 | ||
| 37 | Tegra::CommandList entries; | 37 | Tegra::CommandList entries; |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | /// Command to signal to the GPU thread that a cdma command list is ready for processing | 40 | /// Command to signal to the GPU thread that a cdma command list is ready for processing |
| 41 | struct SubmitChCommandEntries final { | 41 | struct SubmitChCommandEntries final { |
| 42 | explicit SubmitChCommandEntries(Tegra::ChCommandHeaderList&& entries) | 42 | explicit SubmitChCommandEntries(Tegra::ChCommandHeaderList&& entries_) |
| 43 | : entries{std::move(entries)} {} | 43 | : entries{std::move(entries_)} {} |
| 44 | 44 | ||
| 45 | Tegra::ChCommandHeaderList entries; | 45 | Tegra::ChCommandHeaderList entries; |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | /// Command to signal to the GPU thread that a swap buffers is pending | 48 | /// Command to signal to the GPU thread that a swap buffers is pending |
| 49 | struct SwapBuffersCommand final { | 49 | struct SwapBuffersCommand final { |
| 50 | explicit SwapBuffersCommand(std::optional<const Tegra::FramebufferConfig> framebuffer) | 50 | explicit SwapBuffersCommand(std::optional<const Tegra::FramebufferConfig> framebuffer_) |
| 51 | : framebuffer{std::move(framebuffer)} {} | 51 | : framebuffer{std::move(framebuffer_)} {} |
| 52 | 52 | ||
| 53 | std::optional<Tegra::FramebufferConfig> framebuffer; | 53 | std::optional<Tegra::FramebufferConfig> framebuffer; |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | /// Command to signal to the GPU thread to flush a region | 56 | /// Command to signal to the GPU thread to flush a region |
| 57 | struct FlushRegionCommand final { | 57 | struct FlushRegionCommand final { |
| 58 | explicit constexpr FlushRegionCommand(VAddr addr, u64 size) : addr{addr}, size{size} {} | 58 | explicit constexpr FlushRegionCommand(VAddr addr_, u64 size_) : addr{addr_}, size{size_} {} |
| 59 | 59 | ||
| 60 | VAddr addr; | 60 | VAddr addr; |
| 61 | u64 size; | 61 | u64 size; |
| @@ -63,7 +63,7 @@ struct FlushRegionCommand final { | |||
| 63 | 63 | ||
| 64 | /// Command to signal to the GPU thread to invalidate a region | 64 | /// Command to signal to the GPU thread to invalidate a region |
| 65 | struct InvalidateRegionCommand final { | 65 | struct InvalidateRegionCommand final { |
| 66 | explicit constexpr InvalidateRegionCommand(VAddr addr, u64 size) : addr{addr}, size{size} {} | 66 | explicit constexpr InvalidateRegionCommand(VAddr addr_, u64 size_) : addr{addr_}, size{size_} {} |
| 67 | 67 | ||
| 68 | VAddr addr; | 68 | VAddr addr; |
| 69 | u64 size; | 69 | u64 size; |
| @@ -71,8 +71,8 @@ struct InvalidateRegionCommand final { | |||
| 71 | 71 | ||
| 72 | /// Command to signal to the GPU thread to flush and invalidate a region | 72 | /// Command to signal to the GPU thread to flush and invalidate a region |
| 73 | struct FlushAndInvalidateRegionCommand final { | 73 | struct FlushAndInvalidateRegionCommand final { |
| 74 | explicit constexpr FlushAndInvalidateRegionCommand(VAddr addr, u64 size) | 74 | explicit constexpr FlushAndInvalidateRegionCommand(VAddr addr_, u64 size_) |
| 75 | : addr{addr}, size{size} {} | 75 | : addr{addr_}, size{size_} {} |
| 76 | 76 | ||
| 77 | VAddr addr; | 77 | VAddr addr; |
| 78 | u64 size; | 78 | u64 size; |
| @@ -92,8 +92,8 @@ using CommandData = | |||
| 92 | struct CommandDataContainer { | 92 | struct CommandDataContainer { |
| 93 | CommandDataContainer() = default; | 93 | CommandDataContainer() = default; |
| 94 | 94 | ||
| 95 | CommandDataContainer(CommandData&& data, u64 next_fence) | 95 | explicit CommandDataContainer(CommandData&& data_, u64 next_fence_) |
| 96 | : data{std::move(data)}, fence{next_fence} {} | 96 | : data{std::move(data_)}, fence{next_fence_} {} |
| 97 | 97 | ||
| 98 | CommandData data; | 98 | CommandData data; |
| 99 | u64 fence{}; | 99 | u64 fence{}; |
| @@ -112,7 +112,7 @@ struct SynchState final { | |||
| 112 | /// Class used to manage the GPU thread | 112 | /// Class used to manage the GPU thread |
| 113 | class ThreadManager final { | 113 | class ThreadManager final { |
| 114 | public: | 114 | public: |
| 115 | explicit ThreadManager(Core::System& system); | 115 | explicit ThreadManager(Core::System& system_); |
| 116 | ~ThreadManager(); | 116 | ~ThreadManager(); |
| 117 | 117 | ||
| 118 | /// Creates and starts the GPU thread. | 118 | /// Creates and starts the GPU thread. |
| @@ -146,7 +146,6 @@ private: | |||
| 146 | /// Pushes a command to be executed by the GPU thread | 146 | /// Pushes a command to be executed by the GPU thread |
| 147 | u64 PushCommand(CommandData&& command_data); | 147 | u64 PushCommand(CommandData&& command_data); |
| 148 | 148 | ||
| 149 | private: | ||
| 150 | SynchState state; | 149 | SynchState state; |
| 151 | Core::System& system; | 150 | Core::System& system; |
| 152 | std::thread thread; | 151 | std::thread thread; |
diff --git a/src/video_core/guest_driver.h b/src/video_core/guest_driver.h index 99450777e..21e569ba1 100644 --- a/src/video_core/guest_driver.h +++ b/src/video_core/guest_driver.h | |||
| @@ -19,8 +19,8 @@ namespace VideoCore { | |||
| 19 | class GuestDriverProfile { | 19 | class GuestDriverProfile { |
| 20 | public: | 20 | public: |
| 21 | explicit GuestDriverProfile() = default; | 21 | explicit GuestDriverProfile() = default; |
| 22 | explicit GuestDriverProfile(std::optional<u32> texture_handler_size) | 22 | explicit GuestDriverProfile(std::optional<u32> texture_handler_size_) |
| 23 | : texture_handler_size{texture_handler_size} {} | 23 | : texture_handler_size{texture_handler_size_} {} |
| 24 | 24 | ||
| 25 | void DeduceTextureHandlerSize(std::vector<u32> bound_offsets); | 25 | void DeduceTextureHandlerSize(std::vector<u32> bound_offsets); |
| 26 | 26 | ||
diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index df00b57df..70ac7c620 100644 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp | |||
| @@ -85,7 +85,7 @@ constexpr std::array<std::pair<u64, HLEFunction>, 3> hle_funcs{{ | |||
| 85 | {0x0217920100488FF7, &HLE_0217920100488FF7}, | 85 | {0x0217920100488FF7, &HLE_0217920100488FF7}, |
| 86 | }}; | 86 | }}; |
| 87 | 87 | ||
| 88 | HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d) : maxwell3d(maxwell3d) {} | 88 | HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {} |
| 89 | HLEMacro::~HLEMacro() = default; | 89 | HLEMacro::~HLEMacro() = default; |
| 90 | 90 | ||
| 91 | std::optional<std::unique_ptr<CachedMacro>> HLEMacro::GetHLEProgram(u64 hash) const { | 91 | std::optional<std::unique_ptr<CachedMacro>> HLEMacro::GetHLEProgram(u64 hash) const { |
| @@ -99,8 +99,8 @@ std::optional<std::unique_ptr<CachedMacro>> HLEMacro::GetHLEProgram(u64 hash) co | |||
| 99 | 99 | ||
| 100 | HLEMacroImpl::~HLEMacroImpl() = default; | 100 | HLEMacroImpl::~HLEMacroImpl() = default; |
| 101 | 101 | ||
| 102 | HLEMacroImpl::HLEMacroImpl(Engines::Maxwell3D& maxwell3d, HLEFunction func) | 102 | HLEMacroImpl::HLEMacroImpl(Engines::Maxwell3D& maxwell3d_, HLEFunction func_) |
| 103 | : maxwell3d(maxwell3d), func(func) {} | 103 | : maxwell3d{maxwell3d_}, func{func_} {} |
| 104 | 104 | ||
| 105 | void HLEMacroImpl::Execute(const std::vector<u32>& parameters, u32 method) { | 105 | void HLEMacroImpl::Execute(const std::vector<u32>& parameters, u32 method) { |
| 106 | func(maxwell3d, parameters); | 106 | func(maxwell3d, parameters); |
diff --git a/src/video_core/macro/macro_hle.h b/src/video_core/macro/macro_hle.h index 37af875a0..cb3bd1600 100644 --- a/src/video_core/macro/macro_hle.h +++ b/src/video_core/macro/macro_hle.h | |||
| @@ -20,7 +20,7 @@ using HLEFunction = void (*)(Engines::Maxwell3D& maxwell3d, const std::vector<u3 | |||
| 20 | 20 | ||
| 21 | class HLEMacro { | 21 | class HLEMacro { |
| 22 | public: | 22 | public: |
| 23 | explicit HLEMacro(Engines::Maxwell3D& maxwell3d); | 23 | explicit HLEMacro(Engines::Maxwell3D& maxwell3d_); |
| 24 | ~HLEMacro(); | 24 | ~HLEMacro(); |
| 25 | 25 | ||
| 26 | std::optional<std::unique_ptr<CachedMacro>> GetHLEProgram(u64 hash) const; | 26 | std::optional<std::unique_ptr<CachedMacro>> GetHLEProgram(u64 hash) const; |
diff --git a/src/video_core/macro/macro_interpreter.cpp b/src/video_core/macro/macro_interpreter.cpp index bd01fd1f2..8da26fd59 100644 --- a/src/video_core/macro/macro_interpreter.cpp +++ b/src/video_core/macro/macro_interpreter.cpp | |||
| @@ -11,29 +11,29 @@ | |||
| 11 | MICROPROFILE_DEFINE(MacroInterp, "GPU", "Execute macro interpreter", MP_RGB(128, 128, 192)); | 11 | MICROPROFILE_DEFINE(MacroInterp, "GPU", "Execute macro interpreter", MP_RGB(128, 128, 192)); |
| 12 | 12 | ||
| 13 | namespace Tegra { | 13 | namespace Tegra { |
| 14 | MacroInterpreter::MacroInterpreter(Engines::Maxwell3D& maxwell3d) | 14 | MacroInterpreter::MacroInterpreter(Engines::Maxwell3D& maxwell3d_) |
| 15 | : MacroEngine::MacroEngine(maxwell3d), maxwell3d(maxwell3d) {} | 15 | : MacroEngine{maxwell3d_}, maxwell3d{maxwell3d_} {} |
| 16 | 16 | ||
| 17 | std::unique_ptr<CachedMacro> MacroInterpreter::Compile(const std::vector<u32>& code) { | 17 | std::unique_ptr<CachedMacro> MacroInterpreter::Compile(const std::vector<u32>& code) { |
| 18 | return std::make_unique<MacroInterpreterImpl>(maxwell3d, code); | 18 | return std::make_unique<MacroInterpreterImpl>(maxwell3d, code); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | MacroInterpreterImpl::MacroInterpreterImpl(Engines::Maxwell3D& maxwell3d, | 21 | MacroInterpreterImpl::MacroInterpreterImpl(Engines::Maxwell3D& maxwell3d_, |
| 22 | const std::vector<u32>& code) | 22 | const std::vector<u32>& code_) |
| 23 | : maxwell3d(maxwell3d), code(code) {} | 23 | : maxwell3d{maxwell3d_}, code{code_} {} |
| 24 | 24 | ||
| 25 | void MacroInterpreterImpl::Execute(const std::vector<u32>& parameters, u32 method) { | 25 | void MacroInterpreterImpl::Execute(const std::vector<u32>& params, u32 method) { |
| 26 | MICROPROFILE_SCOPE(MacroInterp); | 26 | MICROPROFILE_SCOPE(MacroInterp); |
| 27 | Reset(); | 27 | Reset(); |
| 28 | 28 | ||
| 29 | registers[1] = parameters[0]; | 29 | registers[1] = params[0]; |
| 30 | num_parameters = parameters.size(); | 30 | num_parameters = params.size(); |
| 31 | 31 | ||
| 32 | if (num_parameters > parameters_capacity) { | 32 | if (num_parameters > parameters_capacity) { |
| 33 | parameters_capacity = num_parameters; | 33 | parameters_capacity = num_parameters; |
| 34 | this->parameters = std::make_unique<u32[]>(num_parameters); | 34 | parameters = std::make_unique<u32[]>(num_parameters); |
| 35 | } | 35 | } |
| 36 | std::memcpy(this->parameters.get(), parameters.data(), num_parameters * sizeof(u32)); | 36 | std::memcpy(parameters.get(), params.data(), num_parameters * sizeof(u32)); |
| 37 | 37 | ||
| 38 | // Execute the code until we hit an exit condition. | 38 | // Execute the code until we hit an exit condition. |
| 39 | bool keep_executing = true; | 39 | bool keep_executing = true; |
| @@ -133,8 +133,7 @@ bool MacroInterpreterImpl::Step(bool is_delay_slot) { | |||
| 133 | break; | 133 | break; |
| 134 | } | 134 | } |
| 135 | default: | 135 | default: |
| 136 | UNIMPLEMENTED_MSG("Unimplemented macro operation {}", | 136 | UNIMPLEMENTED_MSG("Unimplemented macro operation {}", opcode.operation.Value()); |
| 137 | static_cast<u32>(opcode.operation.Value())); | ||
| 138 | } | 137 | } |
| 139 | 138 | ||
| 140 | // An instruction with the Exit flag will not actually | 139 | // An instruction with the Exit flag will not actually |
| @@ -182,7 +181,7 @@ u32 MacroInterpreterImpl::GetALUResult(Macro::ALUOperation operation, u32 src_a, | |||
| 182 | return ~(src_a & src_b); | 181 | return ~(src_a & src_b); |
| 183 | 182 | ||
| 184 | default: | 183 | default: |
| 185 | UNIMPLEMENTED_MSG("Unimplemented ALU operation {}", static_cast<u32>(operation)); | 184 | UNIMPLEMENTED_MSG("Unimplemented ALU operation {}", operation); |
| 186 | return 0; | 185 | return 0; |
| 187 | } | 186 | } |
| 188 | } | 187 | } |
| @@ -230,7 +229,7 @@ void MacroInterpreterImpl::ProcessResult(Macro::ResultOperation operation, u32 r | |||
| 230 | Send((result >> 12) & 0b111111); | 229 | Send((result >> 12) & 0b111111); |
| 231 | break; | 230 | break; |
| 232 | default: | 231 | default: |
| 233 | UNIMPLEMENTED_MSG("Unimplemented result operation {}", static_cast<u32>(operation)); | 232 | UNIMPLEMENTED_MSG("Unimplemented result operation {}", operation); |
| 234 | } | 233 | } |
| 235 | } | 234 | } |
| 236 | 235 | ||
diff --git a/src/video_core/macro/macro_interpreter.h b/src/video_core/macro/macro_interpreter.h index 90217fc89..d50c619ce 100644 --- a/src/video_core/macro/macro_interpreter.h +++ b/src/video_core/macro/macro_interpreter.h | |||
| @@ -17,7 +17,7 @@ class Maxwell3D; | |||
| 17 | 17 | ||
| 18 | class MacroInterpreter final : public MacroEngine { | 18 | class MacroInterpreter final : public MacroEngine { |
| 19 | public: | 19 | public: |
| 20 | explicit MacroInterpreter(Engines::Maxwell3D& maxwell3d); | 20 | explicit MacroInterpreter(Engines::Maxwell3D& maxwell3d_); |
| 21 | 21 | ||
| 22 | protected: | 22 | protected: |
| 23 | std::unique_ptr<CachedMacro> Compile(const std::vector<u32>& code) override; | 23 | std::unique_ptr<CachedMacro> Compile(const std::vector<u32>& code) override; |
| @@ -28,8 +28,8 @@ private: | |||
| 28 | 28 | ||
| 29 | class MacroInterpreterImpl : public CachedMacro { | 29 | class MacroInterpreterImpl : public CachedMacro { |
| 30 | public: | 30 | public: |
| 31 | MacroInterpreterImpl(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& code); | 31 | explicit MacroInterpreterImpl(Engines::Maxwell3D& maxwell3d_, const std::vector<u32>& code_); |
| 32 | void Execute(const std::vector<u32>& parameters, u32 method) override; | 32 | void Execute(const std::vector<u32>& params, u32 method) override; |
| 33 | 33 | ||
| 34 | private: | 34 | private: |
| 35 | /// Resets the execution engine state, zeroing registers, etc. | 35 | /// Resets the execution engine state, zeroing registers, etc. |
| @@ -38,9 +38,9 @@ private: | |||
| 38 | /** | 38 | /** |
| 39 | * Executes a single macro instruction located at the current program counter. Returns whether | 39 | * Executes a single macro instruction located at the current program counter. Returns whether |
| 40 | * the interpreter should keep running. | 40 | * the interpreter should keep running. |
| 41 | * @param offset Offset to start execution at. | 41 | * |
| 42 | * @param is_delay_slot Whether the current step is being executed due to a delay slot in a | 42 | * @param is_delay_slot Whether the current step is being executed due to a delay slot in a |
| 43 | * previous instruction. | 43 | * previous instruction. |
| 44 | */ | 44 | */ |
| 45 | bool Step(bool is_delay_slot); | 45 | bool Step(bool is_delay_slot); |
| 46 | 46 | ||
diff --git a/src/video_core/macro/macro_jit_x64.cpp b/src/video_core/macro/macro_jit_x64.cpp index 954b87515..c6b2b2109 100644 --- a/src/video_core/macro/macro_jit_x64.cpp +++ b/src/video_core/macro/macro_jit_x64.cpp | |||
| @@ -28,15 +28,15 @@ static const std::bitset<32> PERSISTENT_REGISTERS = Common::X64::BuildRegSet({ | |||
| 28 | BRANCH_HOLDER, | 28 | BRANCH_HOLDER, |
| 29 | }); | 29 | }); |
| 30 | 30 | ||
| 31 | MacroJITx64::MacroJITx64(Engines::Maxwell3D& maxwell3d) | 31 | MacroJITx64::MacroJITx64(Engines::Maxwell3D& maxwell3d_) |
| 32 | : MacroEngine::MacroEngine(maxwell3d), maxwell3d(maxwell3d) {} | 32 | : MacroEngine{maxwell3d_}, maxwell3d{maxwell3d_} {} |
| 33 | 33 | ||
| 34 | std::unique_ptr<CachedMacro> MacroJITx64::Compile(const std::vector<u32>& code) { | 34 | std::unique_ptr<CachedMacro> MacroJITx64::Compile(const std::vector<u32>& code) { |
| 35 | return std::make_unique<MacroJITx64Impl>(maxwell3d, code); | 35 | return std::make_unique<MacroJITx64Impl>(maxwell3d, code); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | MacroJITx64Impl::MacroJITx64Impl(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& code) | 38 | MacroJITx64Impl::MacroJITx64Impl(Engines::Maxwell3D& maxwell3d_, const std::vector<u32>& code_) |
| 39 | : Xbyak::CodeGenerator(MAX_CODE_SIZE), code(code), maxwell3d(maxwell3d) { | 39 | : CodeGenerator{MAX_CODE_SIZE}, code{code_}, maxwell3d{maxwell3d_} { |
| 40 | Compile(); | 40 | Compile(); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| @@ -165,8 +165,7 @@ void MacroJITx64Impl::Compile_ALU(Macro::Opcode opcode) { | |||
| 165 | } | 165 | } |
| 166 | break; | 166 | break; |
| 167 | default: | 167 | default: |
| 168 | UNIMPLEMENTED_MSG("Unimplemented ALU operation {}", | 168 | UNIMPLEMENTED_MSG("Unimplemented ALU operation {}", opcode.alu_operation.Value()); |
| 169 | static_cast<std::size_t>(opcode.alu_operation.Value())); | ||
| 170 | break; | 169 | break; |
| 171 | } | 170 | } |
| 172 | Compile_ProcessResult(opcode.result_operation, opcode.dst); | 171 | Compile_ProcessResult(opcode.result_operation, opcode.dst); |
| @@ -553,15 +552,15 @@ Xbyak::Reg32 MacroJITx64Impl::Compile_GetRegister(u32 index, Xbyak::Reg32 dst) { | |||
| 553 | } | 552 | } |
| 554 | 553 | ||
| 555 | void MacroJITx64Impl::Compile_ProcessResult(Macro::ResultOperation operation, u32 reg) { | 554 | void MacroJITx64Impl::Compile_ProcessResult(Macro::ResultOperation operation, u32 reg) { |
| 556 | const auto SetRegister = [this](u32 reg, const Xbyak::Reg32& result) { | 555 | const auto SetRegister = [this](u32 reg_index, const Xbyak::Reg32& result) { |
| 557 | // Register 0 is supposed to always return 0. NOP is implemented as a store to the zero | 556 | // Register 0 is supposed to always return 0. NOP is implemented as a store to the zero |
| 558 | // register. | 557 | // register. |
| 559 | if (reg == 0) { | 558 | if (reg_index == 0) { |
| 560 | return; | 559 | return; |
| 561 | } | 560 | } |
| 562 | mov(dword[STATE + offsetof(JITState, registers) + reg * sizeof(u32)], result); | 561 | mov(dword[STATE + offsetof(JITState, registers) + reg_index * sizeof(u32)], result); |
| 563 | }; | 562 | }; |
| 564 | const auto SetMethodAddress = [this](const Xbyak::Reg32& reg) { mov(METHOD_ADDRESS, reg); }; | 563 | const auto SetMethodAddress = [this](const Xbyak::Reg32& reg32) { mov(METHOD_ADDRESS, reg32); }; |
| 565 | 564 | ||
| 566 | switch (operation) { | 565 | switch (operation) { |
| 567 | case Macro::ResultOperation::IgnoreAndFetch: | 566 | case Macro::ResultOperation::IgnoreAndFetch: |
| @@ -604,7 +603,7 @@ void MacroJITx64Impl::Compile_ProcessResult(Macro::ResultOperation operation, u3 | |||
| 604 | Compile_Send(RESULT); | 603 | Compile_Send(RESULT); |
| 605 | break; | 604 | break; |
| 606 | default: | 605 | default: |
| 607 | UNIMPLEMENTED_MSG("Unimplemented macro operation {}", static_cast<std::size_t>(operation)); | 606 | UNIMPLEMENTED_MSG("Unimplemented macro operation {}", operation); |
| 608 | } | 607 | } |
| 609 | } | 608 | } |
| 610 | 609 | ||
diff --git a/src/video_core/macro/macro_jit_x64.h b/src/video_core/macro/macro_jit_x64.h index a180e7428..7f50ac2f8 100644 --- a/src/video_core/macro/macro_jit_x64.h +++ b/src/video_core/macro/macro_jit_x64.h | |||
| @@ -23,7 +23,7 @@ constexpr size_t MAX_CODE_SIZE = 0x10000; | |||
| 23 | 23 | ||
| 24 | class MacroJITx64 final : public MacroEngine { | 24 | class MacroJITx64 final : public MacroEngine { |
| 25 | public: | 25 | public: |
| 26 | explicit MacroJITx64(Engines::Maxwell3D& maxwell3d); | 26 | explicit MacroJITx64(Engines::Maxwell3D& maxwell3d_); |
| 27 | 27 | ||
| 28 | protected: | 28 | protected: |
| 29 | std::unique_ptr<CachedMacro> Compile(const std::vector<u32>& code) override; | 29 | std::unique_ptr<CachedMacro> Compile(const std::vector<u32>& code) override; |
| @@ -34,7 +34,7 @@ private: | |||
| 34 | 34 | ||
| 35 | class MacroJITx64Impl : public Xbyak::CodeGenerator, public CachedMacro { | 35 | class MacroJITx64Impl : public Xbyak::CodeGenerator, public CachedMacro { |
| 36 | public: | 36 | public: |
| 37 | MacroJITx64Impl(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& code); | 37 | explicit MacroJITx64Impl(Engines::Maxwell3D& maxwell3d_, const std::vector<u32>& code_); |
| 38 | ~MacroJITx64Impl(); | 38 | ~MacroJITx64Impl(); |
| 39 | 39 | ||
| 40 | void Execute(const std::vector<u32>& parameters, u32 method) override; | 40 | void Execute(const std::vector<u32>& parameters, u32 method) override; |
diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h index c078193d9..c35e57689 100644 --- a/src/video_core/memory_manager.h +++ b/src/video_core/memory_manager.h | |||
| @@ -28,7 +28,7 @@ public: | |||
| 28 | }; | 28 | }; |
| 29 | 29 | ||
| 30 | constexpr PageEntry() = default; | 30 | constexpr PageEntry() = default; |
| 31 | constexpr PageEntry(State state) : state{state} {} | 31 | constexpr PageEntry(State state_) : state{state_} {} |
| 32 | constexpr PageEntry(VAddr addr) : state{static_cast<State>(addr >> ShiftBits)} {} | 32 | constexpr PageEntry(VAddr addr) : state{static_cast<State>(addr >> ShiftBits)} {} |
| 33 | 33 | ||
| 34 | [[nodiscard]] constexpr bool IsUnmapped() const { | 34 | [[nodiscard]] constexpr bool IsUnmapped() const { |
| @@ -68,7 +68,7 @@ static_assert(sizeof(PageEntry) == 4, "PageEntry is too large"); | |||
| 68 | 68 | ||
| 69 | class MemoryManager final { | 69 | class MemoryManager final { |
| 70 | public: | 70 | public: |
| 71 | explicit MemoryManager(Core::System& system); | 71 | explicit MemoryManager(Core::System& system_); |
| 72 | ~MemoryManager(); | 72 | ~MemoryManager(); |
| 73 | 73 | ||
| 74 | /// Binds a renderer to the memory manager. | 74 | /// Binds a renderer to the memory manager. |
diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h index fc54ca0ef..203f2af05 100644 --- a/src/video_core/query_cache.h +++ b/src/video_core/query_cache.h | |||
| @@ -28,8 +28,8 @@ namespace VideoCommon { | |||
| 28 | template <class QueryCache, class HostCounter> | 28 | template <class QueryCache, class HostCounter> |
| 29 | class CounterStreamBase { | 29 | class CounterStreamBase { |
| 30 | public: | 30 | public: |
| 31 | explicit CounterStreamBase(QueryCache& cache, VideoCore::QueryType type) | 31 | explicit CounterStreamBase(QueryCache& cache_, VideoCore::QueryType type_) |
| 32 | : cache{cache}, type{type} {} | 32 | : cache{cache_}, type{type_} {} |
| 33 | 33 | ||
| 34 | /// Updates the state of the stream, enabling or disabling as needed. | 34 | /// Updates the state of the stream, enabling or disabling as needed. |
| 35 | void Update(bool enabled) { | 35 | void Update(bool enabled) { |
| @@ -334,8 +334,8 @@ private: | |||
| 334 | template <class HostCounter> | 334 | template <class HostCounter> |
| 335 | class CachedQueryBase { | 335 | class CachedQueryBase { |
| 336 | public: | 336 | public: |
| 337 | explicit CachedQueryBase(VAddr cpu_addr, u8* host_ptr) | 337 | explicit CachedQueryBase(VAddr cpu_addr_, u8* host_ptr_) |
| 338 | : cpu_addr{cpu_addr}, host_ptr{host_ptr} {} | 338 | : cpu_addr{cpu_addr_}, host_ptr{host_ptr_} {} |
| 339 | virtual ~CachedQueryBase() = default; | 339 | virtual ~CachedQueryBase() = default; |
| 340 | 340 | ||
| 341 | CachedQueryBase(CachedQueryBase&&) noexcept = default; | 341 | CachedQueryBase(CachedQueryBase&&) noexcept = default; |
diff --git a/src/video_core/renderer_opengl/gl_arb_decompiler.cpp b/src/video_core/renderer_opengl/gl_arb_decompiler.cpp index d6120c23e..3e4d88c30 100644 --- a/src/video_core/renderer_opengl/gl_arb_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_arb_decompiler.cpp | |||
| @@ -71,7 +71,7 @@ std::string_view GetInputFlags(PixelImap attribute) { | |||
| 71 | case PixelImap::Unused: | 71 | case PixelImap::Unused: |
| 72 | break; | 72 | break; |
| 73 | } | 73 | } |
| 74 | UNIMPLEMENTED_MSG("Unknown attribute usage index={}", static_cast<int>(attribute)); | 74 | UNIMPLEMENTED_MSG("Unknown attribute usage index={}", attribute); |
| 75 | return {}; | 75 | return {}; |
| 76 | } | 76 | } |
| 77 | 77 | ||
| @@ -123,7 +123,7 @@ std::string_view PrimitiveDescription(Tegra::Engines::Maxwell3D::Regs::Primitive | |||
| 123 | case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::TriangleStripAdjacency: | 123 | case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::TriangleStripAdjacency: |
| 124 | return "TRIANGLES_ADJACENCY"; | 124 | return "TRIANGLES_ADJACENCY"; |
| 125 | default: | 125 | default: |
| 126 | UNIMPLEMENTED_MSG("topology={}", static_cast<int>(topology)); | 126 | UNIMPLEMENTED_MSG("topology={}", topology); |
| 127 | return "POINTS"; | 127 | return "POINTS"; |
| 128 | } | 128 | } |
| 129 | } | 129 | } |
| @@ -137,7 +137,7 @@ std::string_view TopologyName(Tegra::Shader::OutputTopology topology) { | |||
| 137 | case Tegra::Shader::OutputTopology::TriangleStrip: | 137 | case Tegra::Shader::OutputTopology::TriangleStrip: |
| 138 | return "TRIANGLE_STRIP"; | 138 | return "TRIANGLE_STRIP"; |
| 139 | default: | 139 | default: |
| 140 | UNIMPLEMENTED_MSG("Unknown output topology: {}", static_cast<u32>(topology)); | 140 | UNIMPLEMENTED_MSG("Unknown output topology: {}", topology); |
| 141 | return "points"; | 141 | return "points"; |
| 142 | } | 142 | } |
| 143 | } | 143 | } |
| @@ -187,8 +187,8 @@ std::string TextureType(const MetaTexture& meta) { | |||
| 187 | 187 | ||
| 188 | class ARBDecompiler final { | 188 | class ARBDecompiler final { |
| 189 | public: | 189 | public: |
| 190 | explicit ARBDecompiler(const Device& device, const ShaderIR& ir, const Registry& registry, | 190 | explicit ARBDecompiler(const Device& device_, const ShaderIR& ir_, const Registry& registry_, |
| 191 | ShaderType stage, std::string_view identifier); | 191 | ShaderType stage_, std::string_view identifier); |
| 192 | 192 | ||
| 193 | std::string Code() const { | 193 | std::string Code() const { |
| 194 | return shader_source; | 194 | return shader_source; |
| @@ -802,9 +802,9 @@ private: | |||
| 802 | }; | 802 | }; |
| 803 | }; | 803 | }; |
| 804 | 804 | ||
| 805 | ARBDecompiler::ARBDecompiler(const Device& device, const ShaderIR& ir, const Registry& registry, | 805 | ARBDecompiler::ARBDecompiler(const Device& device_, const ShaderIR& ir_, const Registry& registry_, |
| 806 | ShaderType stage, std::string_view identifier) | 806 | ShaderType stage_, std::string_view identifier) |
| 807 | : device{device}, ir{ir}, registry{registry}, stage{stage} { | 807 | : device{device_}, ir{ir_}, registry{registry_}, stage{stage_} { |
| 808 | DefineGlobalMemory(); | 808 | DefineGlobalMemory(); |
| 809 | 809 | ||
| 810 | AddLine("TEMP RC;"); | 810 | AddLine("TEMP RC;"); |
| @@ -1134,44 +1134,44 @@ void ARBDecompiler::VisitAST(const ASTNode& node) { | |||
| 1134 | for (ASTNode current = ast->nodes.GetFirst(); current; current = current->GetNext()) { | 1134 | for (ASTNode current = ast->nodes.GetFirst(); current; current = current->GetNext()) { |
| 1135 | VisitAST(current); | 1135 | VisitAST(current); |
| 1136 | } | 1136 | } |
| 1137 | } else if (const auto ast = std::get_if<ASTIfThen>(&*node->GetInnerData())) { | 1137 | } else if (const auto if_then = std::get_if<ASTIfThen>(&*node->GetInnerData())) { |
| 1138 | const std::string condition = VisitExpression(ast->condition); | 1138 | const std::string condition = VisitExpression(if_then->condition); |
| 1139 | ResetTemporaries(); | 1139 | ResetTemporaries(); |
| 1140 | 1140 | ||
| 1141 | AddLine("MOVC.U RC.x, {};", condition); | 1141 | AddLine("MOVC.U RC.x, {};", condition); |
| 1142 | AddLine("IF NE.x;"); | 1142 | AddLine("IF NE.x;"); |
| 1143 | for (ASTNode current = ast->nodes.GetFirst(); current; current = current->GetNext()) { | 1143 | for (ASTNode current = if_then->nodes.GetFirst(); current; current = current->GetNext()) { |
| 1144 | VisitAST(current); | 1144 | VisitAST(current); |
| 1145 | } | 1145 | } |
| 1146 | AddLine("ENDIF;"); | 1146 | AddLine("ENDIF;"); |
| 1147 | } else if (const auto ast = std::get_if<ASTIfElse>(&*node->GetInnerData())) { | 1147 | } else if (const auto if_else = std::get_if<ASTIfElse>(&*node->GetInnerData())) { |
| 1148 | AddLine("ELSE;"); | 1148 | AddLine("ELSE;"); |
| 1149 | for (ASTNode current = ast->nodes.GetFirst(); current; current = current->GetNext()) { | 1149 | for (ASTNode current = if_else->nodes.GetFirst(); current; current = current->GetNext()) { |
| 1150 | VisitAST(current); | 1150 | VisitAST(current); |
| 1151 | } | 1151 | } |
| 1152 | } else if (const auto ast = std::get_if<ASTBlockDecoded>(&*node->GetInnerData())) { | 1152 | } else if (const auto decoded = std::get_if<ASTBlockDecoded>(&*node->GetInnerData())) { |
| 1153 | VisitBlock(ast->nodes); | 1153 | VisitBlock(decoded->nodes); |
| 1154 | } else if (const auto ast = std::get_if<ASTVarSet>(&*node->GetInnerData())) { | 1154 | } else if (const auto var_set = std::get_if<ASTVarSet>(&*node->GetInnerData())) { |
| 1155 | AddLine("MOV.U F{}, {};", ast->index, VisitExpression(ast->condition)); | 1155 | AddLine("MOV.U F{}, {};", var_set->index, VisitExpression(var_set->condition)); |
| 1156 | ResetTemporaries(); | 1156 | ResetTemporaries(); |
| 1157 | } else if (const auto ast = std::get_if<ASTDoWhile>(&*node->GetInnerData())) { | 1157 | } else if (const auto do_while = std::get_if<ASTDoWhile>(&*node->GetInnerData())) { |
| 1158 | const std::string condition = VisitExpression(ast->condition); | 1158 | const std::string condition = VisitExpression(do_while->condition); |
| 1159 | ResetTemporaries(); | 1159 | ResetTemporaries(); |
| 1160 | AddLine("REP;"); | 1160 | AddLine("REP;"); |
| 1161 | for (ASTNode current = ast->nodes.GetFirst(); current; current = current->GetNext()) { | 1161 | for (ASTNode current = do_while->nodes.GetFirst(); current; current = current->GetNext()) { |
| 1162 | VisitAST(current); | 1162 | VisitAST(current); |
| 1163 | } | 1163 | } |
| 1164 | AddLine("MOVC.U RC.x, {};", condition); | 1164 | AddLine("MOVC.U RC.x, {};", condition); |
| 1165 | AddLine("BRK (NE.x);"); | 1165 | AddLine("BRK (NE.x);"); |
| 1166 | AddLine("ENDREP;"); | 1166 | AddLine("ENDREP;"); |
| 1167 | } else if (const auto ast = std::get_if<ASTReturn>(&*node->GetInnerData())) { | 1167 | } else if (const auto ast_return = std::get_if<ASTReturn>(&*node->GetInnerData())) { |
| 1168 | const bool is_true = ExprIsTrue(ast->condition); | 1168 | const bool is_true = ExprIsTrue(ast_return->condition); |
| 1169 | if (!is_true) { | 1169 | if (!is_true) { |
| 1170 | AddLine("MOVC.U RC.x, {};", VisitExpression(ast->condition)); | 1170 | AddLine("MOVC.U RC.x, {};", VisitExpression(ast_return->condition)); |
| 1171 | AddLine("IF NE.x;"); | 1171 | AddLine("IF NE.x;"); |
| 1172 | ResetTemporaries(); | 1172 | ResetTemporaries(); |
| 1173 | } | 1173 | } |
| 1174 | if (ast->kills) { | 1174 | if (ast_return->kills) { |
| 1175 | AddLine("KIL TR;"); | 1175 | AddLine("KIL TR;"); |
| 1176 | } else { | 1176 | } else { |
| 1177 | Exit(); | 1177 | Exit(); |
| @@ -1179,11 +1179,11 @@ void ARBDecompiler::VisitAST(const ASTNode& node) { | |||
| 1179 | if (!is_true) { | 1179 | if (!is_true) { |
| 1180 | AddLine("ENDIF;"); | 1180 | AddLine("ENDIF;"); |
| 1181 | } | 1181 | } |
| 1182 | } else if (const auto ast = std::get_if<ASTBreak>(&*node->GetInnerData())) { | 1182 | } else if (const auto ast_break = std::get_if<ASTBreak>(&*node->GetInnerData())) { |
| 1183 | if (ExprIsTrue(ast->condition)) { | 1183 | if (ExprIsTrue(ast_break->condition)) { |
| 1184 | AddLine("BRK;"); | 1184 | AddLine("BRK;"); |
| 1185 | } else { | 1185 | } else { |
| 1186 | AddLine("MOVC.U RC.x, {};", VisitExpression(ast->condition)); | 1186 | AddLine("MOVC.U RC.x, {};", VisitExpression(ast_break->condition)); |
| 1187 | AddLine("BRK (NE.x);"); | 1187 | AddLine("BRK (NE.x);"); |
| 1188 | ResetTemporaries(); | 1188 | ResetTemporaries(); |
| 1189 | } | 1189 | } |
| @@ -1351,7 +1351,7 @@ std::string ARBDecompiler::Visit(const Node& node) { | |||
| 1351 | GetGenericAttributeIndex(index), swizzle); | 1351 | GetGenericAttributeIndex(index), swizzle); |
| 1352 | } | 1352 | } |
| 1353 | } | 1353 | } |
| 1354 | UNIMPLEMENTED_MSG("Unimplemented input attribute={}", static_cast<int>(index)); | 1354 | UNIMPLEMENTED_MSG("Unimplemented input attribute={}", index); |
| 1355 | break; | 1355 | break; |
| 1356 | } | 1356 | } |
| 1357 | return "{0, 0, 0, 0}.x"; | 1357 | return "{0, 0, 0, 0}.x"; |
| @@ -1485,9 +1485,7 @@ void ARBDecompiler::Exit() { | |||
| 1485 | } | 1485 | } |
| 1486 | 1486 | ||
| 1487 | const auto safe_get_register = [this](u32 reg) -> std::string { | 1487 | const auto safe_get_register = [this](u32 reg) -> std::string { |
| 1488 | // TODO(Rodrigo): Replace with contains once C++20 releases | 1488 | if (ir.GetRegisters().contains(reg)) { |
| 1489 | const auto& used_registers = ir.GetRegisters(); | ||
| 1490 | if (used_registers.find(reg) != used_registers.end()) { | ||
| 1491 | return fmt::format("R{}.x", reg); | 1489 | return fmt::format("R{}.x", reg); |
| 1492 | } | 1490 | } |
| 1493 | return "{0, 0, 0, 0}.x"; | 1491 | return "{0, 0, 0, 0}.x"; |
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.cpp b/src/video_core/renderer_opengl/gl_buffer_cache.cpp index b1c4cd62f..60735d502 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_buffer_cache.cpp | |||
| @@ -22,11 +22,11 @@ using Maxwell = Tegra::Engines::Maxwell3D::Regs; | |||
| 22 | 22 | ||
| 23 | MICROPROFILE_DEFINE(OpenGL_Buffer_Download, "OpenGL", "Buffer Download", MP_RGB(192, 192, 128)); | 23 | MICROPROFILE_DEFINE(OpenGL_Buffer_Download, "OpenGL", "Buffer Download", MP_RGB(192, 192, 128)); |
| 24 | 24 | ||
| 25 | Buffer::Buffer(const Device& device, VAddr cpu_addr, std::size_t size) | 25 | Buffer::Buffer(const Device& device_, VAddr cpu_addr_, std::size_t size_) |
| 26 | : VideoCommon::BufferBlock{cpu_addr, size} { | 26 | : BufferBlock{cpu_addr_, size_} { |
| 27 | gl_buffer.Create(); | 27 | gl_buffer.Create(); |
| 28 | glNamedBufferData(gl_buffer.handle, static_cast<GLsizeiptr>(size), nullptr, GL_DYNAMIC_DRAW); | 28 | glNamedBufferData(gl_buffer.handle, static_cast<GLsizeiptr>(size_), nullptr, GL_DYNAMIC_DRAW); |
| 29 | if (device.UseAssemblyShaders() || device.HasVertexBufferUnifiedMemory()) { | 29 | if (device_.UseAssemblyShaders() || device_.HasVertexBufferUnifiedMemory()) { |
| 30 | glMakeNamedBufferResidentNV(gl_buffer.handle, GL_READ_WRITE); | 30 | glMakeNamedBufferResidentNV(gl_buffer.handle, GL_READ_WRITE); |
| 31 | glGetNamedBufferParameterui64vNV(gl_buffer.handle, GL_BUFFER_GPU_ADDRESS_NV, &gpu_address); | 31 | glGetNamedBufferParameterui64vNV(gl_buffer.handle, GL_BUFFER_GPU_ADDRESS_NV, &gpu_address); |
| 32 | } | 32 | } |
| @@ -34,14 +34,14 @@ Buffer::Buffer(const Device& device, VAddr cpu_addr, std::size_t size) | |||
| 34 | 34 | ||
| 35 | Buffer::~Buffer() = default; | 35 | Buffer::~Buffer() = default; |
| 36 | 36 | ||
| 37 | void Buffer::Upload(std::size_t offset, std::size_t size, const u8* data) { | 37 | void Buffer::Upload(std::size_t offset, std::size_t data_size, const u8* data) { |
| 38 | glNamedBufferSubData(Handle(), static_cast<GLintptr>(offset), static_cast<GLsizeiptr>(size), | 38 | glNamedBufferSubData(Handle(), static_cast<GLintptr>(offset), |
| 39 | data); | 39 | static_cast<GLsizeiptr>(data_size), data); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | void Buffer::Download(std::size_t offset, std::size_t size, u8* data) { | 42 | void Buffer::Download(std::size_t offset, std::size_t data_size, u8* data) { |
| 43 | MICROPROFILE_SCOPE(OpenGL_Buffer_Download); | 43 | MICROPROFILE_SCOPE(OpenGL_Buffer_Download); |
| 44 | const GLsizeiptr gl_size = static_cast<GLsizeiptr>(size); | 44 | const GLsizeiptr gl_size = static_cast<GLsizeiptr>(data_size); |
| 45 | const GLintptr gl_offset = static_cast<GLintptr>(offset); | 45 | const GLintptr gl_offset = static_cast<GLintptr>(offset); |
| 46 | if (read_buffer.handle == 0) { | 46 | if (read_buffer.handle == 0) { |
| 47 | read_buffer.Create(); | 47 | read_buffer.Create(); |
| @@ -54,16 +54,16 @@ void Buffer::Download(std::size_t offset, std::size_t size, u8* data) { | |||
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, | 56 | void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, |
| 57 | std::size_t size) { | 57 | std::size_t copy_size) { |
| 58 | glCopyNamedBufferSubData(src.Handle(), Handle(), static_cast<GLintptr>(src_offset), | 58 | glCopyNamedBufferSubData(src.Handle(), Handle(), static_cast<GLintptr>(src_offset), |
| 59 | static_cast<GLintptr>(dst_offset), static_cast<GLsizeiptr>(size)); | 59 | static_cast<GLintptr>(dst_offset), static_cast<GLsizeiptr>(copy_size)); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | OGLBufferCache::OGLBufferCache(VideoCore::RasterizerInterface& rasterizer, | 62 | OGLBufferCache::OGLBufferCache(VideoCore::RasterizerInterface& rasterizer_, |
| 63 | Tegra::MemoryManager& gpu_memory, Core::Memory::Memory& cpu_memory, | 63 | Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_, |
| 64 | const Device& device_, std::size_t stream_size) | 64 | const Device& device_, std::size_t stream_size_) |
| 65 | : GenericBufferCache{rasterizer, gpu_memory, cpu_memory, | 65 | : GenericBufferCache{rasterizer_, gpu_memory_, cpu_memory_, |
| 66 | std::make_unique<OGLStreamBuffer>(device_, stream_size, true)}, | 66 | std::make_unique<OGLStreamBuffer>(device_, stream_size_, true)}, |
| 67 | device{device_} { | 67 | device{device_} { |
| 68 | if (!device.HasFastBufferSubData()) { | 68 | if (!device.HasFastBufferSubData()) { |
| 69 | return; | 69 | return; |
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h index f75b32e31..95251e26b 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.h +++ b/src/video_core/renderer_opengl/gl_buffer_cache.h | |||
| @@ -25,15 +25,15 @@ class RasterizerOpenGL; | |||
| 25 | 25 | ||
| 26 | class Buffer : public VideoCommon::BufferBlock { | 26 | class Buffer : public VideoCommon::BufferBlock { |
| 27 | public: | 27 | public: |
| 28 | explicit Buffer(const Device& device, VAddr cpu_addr, std::size_t size); | 28 | explicit Buffer(const Device& device_, VAddr cpu_addr_, std::size_t size_); |
| 29 | ~Buffer(); | 29 | ~Buffer(); |
| 30 | 30 | ||
| 31 | void Upload(std::size_t offset, std::size_t size, const u8* data); | 31 | void Upload(std::size_t offset, std::size_t data_size, const u8* data); |
| 32 | 32 | ||
| 33 | void Download(std::size_t offset, std::size_t size, u8* data); | 33 | void Download(std::size_t offset, std::size_t data_size, u8* data); |
| 34 | 34 | ||
| 35 | void CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, | 35 | void CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, |
| 36 | std::size_t size); | 36 | std::size_t copy_size); |
| 37 | 37 | ||
| 38 | GLuint Handle() const noexcept { | 38 | GLuint Handle() const noexcept { |
| 39 | return gl_buffer.handle; | 39 | return gl_buffer.handle; |
| @@ -52,9 +52,9 @@ private: | |||
| 52 | using GenericBufferCache = VideoCommon::BufferCache<Buffer, GLuint, OGLStreamBuffer>; | 52 | using GenericBufferCache = VideoCommon::BufferCache<Buffer, GLuint, OGLStreamBuffer>; |
| 53 | class OGLBufferCache final : public GenericBufferCache { | 53 | class OGLBufferCache final : public GenericBufferCache { |
| 54 | public: | 54 | public: |
| 55 | explicit OGLBufferCache(VideoCore::RasterizerInterface& rasterizer, | 55 | explicit OGLBufferCache(VideoCore::RasterizerInterface& rasterizer_, |
| 56 | Tegra::MemoryManager& gpu_memory, Core::Memory::Memory& cpu_memory, | 56 | Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_, |
| 57 | const Device& device, std::size_t stream_size); | 57 | const Device& device_, std::size_t stream_size_); |
| 58 | ~OGLBufferCache(); | 58 | ~OGLBufferCache(); |
| 59 | 59 | ||
| 60 | BufferInfo GetEmptyBuffer(std::size_t) override; | 60 | BufferInfo GetEmptyBuffer(std::size_t) override; |
diff --git a/src/video_core/renderer_opengl/gl_fence_manager.cpp b/src/video_core/renderer_opengl/gl_fence_manager.cpp index b532fdcc2..6040646cb 100644 --- a/src/video_core/renderer_opengl/gl_fence_manager.cpp +++ b/src/video_core/renderer_opengl/gl_fence_manager.cpp | |||
| @@ -11,10 +11,10 @@ | |||
| 11 | 11 | ||
| 12 | namespace OpenGL { | 12 | namespace OpenGL { |
| 13 | 13 | ||
| 14 | GLInnerFence::GLInnerFence(u32 payload, bool is_stubbed) : FenceBase(payload, is_stubbed) {} | 14 | GLInnerFence::GLInnerFence(u32 payload_, bool is_stubbed_) : FenceBase{payload_, is_stubbed_} {} |
| 15 | 15 | ||
| 16 | GLInnerFence::GLInnerFence(GPUVAddr address, u32 payload, bool is_stubbed) | 16 | GLInnerFence::GLInnerFence(GPUVAddr address_, u32 payload_, bool is_stubbed_) |
| 17 | : FenceBase(address, payload, is_stubbed) {} | 17 | : FenceBase{address_, payload_, is_stubbed_} {} |
| 18 | 18 | ||
| 19 | GLInnerFence::~GLInnerFence() = default; | 19 | GLInnerFence::~GLInnerFence() = default; |
| 20 | 20 | ||
| @@ -45,10 +45,10 @@ void GLInnerFence::Wait() { | |||
| 45 | glClientWaitSync(sync_object.handle, 0, GL_TIMEOUT_IGNORED); | 45 | glClientWaitSync(sync_object.handle, 0, GL_TIMEOUT_IGNORED); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | FenceManagerOpenGL::FenceManagerOpenGL(VideoCore::RasterizerInterface& rasterizer, Tegra::GPU& gpu, | 48 | FenceManagerOpenGL::FenceManagerOpenGL(VideoCore::RasterizerInterface& rasterizer_, |
| 49 | TextureCacheOpenGL& texture_cache, | 49 | Tegra::GPU& gpu_, TextureCacheOpenGL& texture_cache_, |
| 50 | OGLBufferCache& buffer_cache, QueryCache& query_cache) | 50 | OGLBufferCache& buffer_cache_, QueryCache& query_cache_) |
| 51 | : GenericFenceManager{rasterizer, gpu, texture_cache, buffer_cache, query_cache} {} | 51 | : GenericFenceManager{rasterizer_, gpu_, texture_cache_, buffer_cache_, query_cache_} {} |
| 52 | 52 | ||
| 53 | Fence FenceManagerOpenGL::CreateFence(u32 value, bool is_stubbed) { | 53 | Fence FenceManagerOpenGL::CreateFence(u32 value, bool is_stubbed) { |
| 54 | return std::make_shared<GLInnerFence>(value, is_stubbed); | 54 | return std::make_shared<GLInnerFence>(value, is_stubbed); |
diff --git a/src/video_core/renderer_opengl/gl_fence_manager.h b/src/video_core/renderer_opengl/gl_fence_manager.h index da1dcdace..39ca6125b 100644 --- a/src/video_core/renderer_opengl/gl_fence_manager.h +++ b/src/video_core/renderer_opengl/gl_fence_manager.h | |||
| @@ -17,8 +17,8 @@ namespace OpenGL { | |||
| 17 | 17 | ||
| 18 | class GLInnerFence : public VideoCommon::FenceBase { | 18 | class GLInnerFence : public VideoCommon::FenceBase { |
| 19 | public: | 19 | public: |
| 20 | GLInnerFence(u32 payload, bool is_stubbed); | 20 | explicit GLInnerFence(u32 payload_, bool is_stubbed_); |
| 21 | GLInnerFence(GPUVAddr address, u32 payload, bool is_stubbed); | 21 | explicit GLInnerFence(GPUVAddr address_, u32 payload_, bool is_stubbed_); |
| 22 | ~GLInnerFence(); | 22 | ~GLInnerFence(); |
| 23 | 23 | ||
| 24 | void Queue(); | 24 | void Queue(); |
| @@ -37,9 +37,9 @@ using GenericFenceManager = | |||
| 37 | 37 | ||
| 38 | class FenceManagerOpenGL final : public GenericFenceManager { | 38 | class FenceManagerOpenGL final : public GenericFenceManager { |
| 39 | public: | 39 | public: |
| 40 | explicit FenceManagerOpenGL(VideoCore::RasterizerInterface& rasterizer, Tegra::GPU& gpu, | 40 | explicit FenceManagerOpenGL(VideoCore::RasterizerInterface& rasterizer_, Tegra::GPU& gpu_, |
| 41 | TextureCacheOpenGL& texture_cache, OGLBufferCache& buffer_cache, | 41 | TextureCacheOpenGL& texture_cache_, OGLBufferCache& buffer_cache_, |
| 42 | QueryCache& query_cache); | 42 | QueryCache& query_cache_); |
| 43 | 43 | ||
| 44 | protected: | 44 | protected: |
| 45 | Fence CreateFence(u32 value, bool is_stubbed) override; | 45 | Fence CreateFence(u32 value, bool is_stubbed) override; |
diff --git a/src/video_core/renderer_opengl/gl_query_cache.cpp b/src/video_core/renderer_opengl/gl_query_cache.cpp index 1a3d9720e..acebbf5f4 100644 --- a/src/video_core/renderer_opengl/gl_query_cache.cpp +++ b/src/video_core/renderer_opengl/gl_query_cache.cpp | |||
| @@ -30,11 +30,9 @@ constexpr GLenum GetTarget(VideoCore::QueryType type) { | |||
| 30 | 30 | ||
| 31 | } // Anonymous namespace | 31 | } // Anonymous namespace |
| 32 | 32 | ||
| 33 | QueryCache::QueryCache(RasterizerOpenGL& rasterizer, Tegra::Engines::Maxwell3D& maxwell3d, | 33 | QueryCache::QueryCache(RasterizerOpenGL& rasterizer_, Tegra::Engines::Maxwell3D& maxwell3d_, |
| 34 | Tegra::MemoryManager& gpu_memory) | 34 | Tegra::MemoryManager& gpu_memory_) |
| 35 | : VideoCommon::QueryCacheBase<QueryCache, CachedQuery, CounterStream, HostCounter>( | 35 | : QueryCacheBase(rasterizer_, maxwell3d_, gpu_memory_), gl_rasterizer{rasterizer_} {} |
| 36 | rasterizer, maxwell3d, gpu_memory), | ||
| 37 | gl_rasterizer{rasterizer} {} | ||
| 38 | 36 | ||
| 39 | QueryCache::~QueryCache() = default; | 37 | QueryCache::~QueryCache() = default; |
| 40 | 38 | ||
| @@ -59,10 +57,11 @@ bool QueryCache::AnyCommandQueued() const noexcept { | |||
| 59 | return gl_rasterizer.AnyCommandQueued(); | 57 | return gl_rasterizer.AnyCommandQueued(); |
| 60 | } | 58 | } |
| 61 | 59 | ||
| 62 | HostCounter::HostCounter(QueryCache& cache, std::shared_ptr<HostCounter> dependency, | 60 | HostCounter::HostCounter(QueryCache& cache_, std::shared_ptr<HostCounter> dependency_, |
| 63 | VideoCore::QueryType type) | 61 | VideoCore::QueryType type_) |
| 64 | : VideoCommon::HostCounterBase<QueryCache, HostCounter>{std::move(dependency)}, cache{cache}, | 62 | : HostCounterBase{std::move(dependency_)}, cache{cache_}, type{type_}, query{ |
| 65 | type{type}, query{cache.AllocateQuery(type)} { | 63 | cache.AllocateQuery( |
| 64 | type)} { | ||
| 66 | glBeginQuery(GetTarget(type), query.handle); | 65 | glBeginQuery(GetTarget(type), query.handle); |
| 67 | } | 66 | } |
| 68 | 67 | ||
| @@ -86,13 +85,14 @@ u64 HostCounter::BlockingQuery() const { | |||
| 86 | return static_cast<u64>(value); | 85 | return static_cast<u64>(value); |
| 87 | } | 86 | } |
| 88 | 87 | ||
| 89 | CachedQuery::CachedQuery(QueryCache& cache, VideoCore::QueryType type, VAddr cpu_addr, u8* host_ptr) | 88 | CachedQuery::CachedQuery(QueryCache& cache_, VideoCore::QueryType type_, VAddr cpu_addr_, |
| 90 | : VideoCommon::CachedQueryBase<HostCounter>{cpu_addr, host_ptr}, cache{&cache}, type{type} {} | 89 | u8* host_ptr_) |
| 90 | : CachedQueryBase{cpu_addr_, host_ptr_}, cache{&cache_}, type{type_} {} | ||
| 91 | 91 | ||
| 92 | CachedQuery::~CachedQuery() = default; | 92 | CachedQuery::~CachedQuery() = default; |
| 93 | 93 | ||
| 94 | CachedQuery::CachedQuery(CachedQuery&& rhs) noexcept | 94 | CachedQuery::CachedQuery(CachedQuery&& rhs) noexcept |
| 95 | : VideoCommon::CachedQueryBase<HostCounter>(std::move(rhs)), cache{rhs.cache}, type{rhs.type} {} | 95 | : CachedQueryBase(std::move(rhs)), cache{rhs.cache}, type{rhs.type} {} |
| 96 | 96 | ||
| 97 | CachedQuery& CachedQuery::operator=(CachedQuery&& rhs) noexcept { | 97 | CachedQuery& CachedQuery::operator=(CachedQuery&& rhs) noexcept { |
| 98 | cache = rhs.cache; | 98 | cache = rhs.cache; |
diff --git a/src/video_core/renderer_opengl/gl_query_cache.h b/src/video_core/renderer_opengl/gl_query_cache.h index 82cac51ee..7bbe5cfe9 100644 --- a/src/video_core/renderer_opengl/gl_query_cache.h +++ b/src/video_core/renderer_opengl/gl_query_cache.h | |||
| @@ -29,8 +29,8 @@ using CounterStream = VideoCommon::CounterStreamBase<QueryCache, HostCounter>; | |||
| 29 | class QueryCache final | 29 | class QueryCache final |
| 30 | : public VideoCommon::QueryCacheBase<QueryCache, CachedQuery, CounterStream, HostCounter> { | 30 | : public VideoCommon::QueryCacheBase<QueryCache, CachedQuery, CounterStream, HostCounter> { |
| 31 | public: | 31 | public: |
| 32 | explicit QueryCache(RasterizerOpenGL& rasterizer, Tegra::Engines::Maxwell3D& maxwell3d, | 32 | explicit QueryCache(RasterizerOpenGL& rasterizer_, Tegra::Engines::Maxwell3D& maxwell3d_, |
| 33 | Tegra::MemoryManager& gpu_memory); | 33 | Tegra::MemoryManager& gpu_memory_); |
| 34 | ~QueryCache(); | 34 | ~QueryCache(); |
| 35 | 35 | ||
| 36 | OGLQuery AllocateQuery(VideoCore::QueryType type); | 36 | OGLQuery AllocateQuery(VideoCore::QueryType type); |
| @@ -46,8 +46,8 @@ private: | |||
| 46 | 46 | ||
| 47 | class HostCounter final : public VideoCommon::HostCounterBase<QueryCache, HostCounter> { | 47 | class HostCounter final : public VideoCommon::HostCounterBase<QueryCache, HostCounter> { |
| 48 | public: | 48 | public: |
| 49 | explicit HostCounter(QueryCache& cache, std::shared_ptr<HostCounter> dependency, | 49 | explicit HostCounter(QueryCache& cache_, std::shared_ptr<HostCounter> dependency_, |
| 50 | VideoCore::QueryType type); | 50 | VideoCore::QueryType type_); |
| 51 | ~HostCounter(); | 51 | ~HostCounter(); |
| 52 | 52 | ||
| 53 | void EndQuery(); | 53 | void EndQuery(); |
| @@ -62,8 +62,8 @@ private: | |||
| 62 | 62 | ||
| 63 | class CachedQuery final : public VideoCommon::CachedQueryBase<HostCounter> { | 63 | class CachedQuery final : public VideoCommon::CachedQueryBase<HostCounter> { |
| 64 | public: | 64 | public: |
| 65 | explicit CachedQuery(QueryCache& cache, VideoCore::QueryType type, VAddr cpu_addr, | 65 | explicit CachedQuery(QueryCache& cache_, VideoCore::QueryType type_, VAddr cpu_addr_, |
| 66 | u8* host_ptr); | 66 | u8* host_ptr_); |
| 67 | ~CachedQuery() override; | 67 | ~CachedQuery() override; |
| 68 | 68 | ||
| 69 | CachedQuery(CachedQuery&& rhs) noexcept; | 69 | CachedQuery(CachedQuery&& rhs) noexcept; |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index cfddbde5d..e58e84759 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -131,7 +131,7 @@ std::pair<GLint, GLint> TransformFeedbackEnum(u8 location) { | |||
| 131 | case 43: | 131 | case 43: |
| 132 | return {GL_BACK_SECONDARY_COLOR_NV, 0}; | 132 | return {GL_BACK_SECONDARY_COLOR_NV, 0}; |
| 133 | } | 133 | } |
| 134 | UNIMPLEMENTED_MSG("index={}", static_cast<int>(index)); | 134 | UNIMPLEMENTED_MSG("index={}", index); |
| 135 | return {GL_POSITION, 0}; | 135 | return {GL_POSITION, 0}; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| @@ -149,19 +149,19 @@ void UpdateBindlessSSBOs(GLenum target, const BindlessSSBO* ssbos, size_t num_ss | |||
| 149 | 149 | ||
| 150 | } // Anonymous namespace | 150 | } // Anonymous namespace |
| 151 | 151 | ||
| 152 | RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& emu_window, Tegra::GPU& gpu_, | 152 | RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, |
| 153 | Core::Memory::Memory& cpu_memory, const Device& device_, | 153 | Core::Memory::Memory& cpu_memory_, const Device& device_, |
| 154 | ScreenInfo& screen_info_, ProgramManager& program_manager_, | 154 | ScreenInfo& screen_info_, ProgramManager& program_manager_, |
| 155 | StateTracker& state_tracker_) | 155 | StateTracker& state_tracker_) |
| 156 | : RasterizerAccelerated{cpu_memory}, gpu(gpu_), maxwell3d(gpu.Maxwell3D()), | 156 | : RasterizerAccelerated{cpu_memory_}, gpu(gpu_), maxwell3d(gpu.Maxwell3D()), |
| 157 | kepler_compute(gpu.KeplerCompute()), gpu_memory(gpu.MemoryManager()), device(device_), | 157 | kepler_compute(gpu.KeplerCompute()), gpu_memory(gpu.MemoryManager()), device(device_), |
| 158 | screen_info(screen_info_), program_manager(program_manager_), state_tracker(state_tracker_), | 158 | screen_info(screen_info_), program_manager(program_manager_), state_tracker(state_tracker_), |
| 159 | texture_cache(*this, maxwell3d, gpu_memory, device, state_tracker), | 159 | texture_cache(*this, maxwell3d, gpu_memory, device, state_tracker), |
| 160 | shader_cache(*this, emu_window, gpu, maxwell3d, kepler_compute, gpu_memory, device), | 160 | shader_cache(*this, emu_window_, gpu, maxwell3d, kepler_compute, gpu_memory, device), |
| 161 | query_cache(*this, maxwell3d, gpu_memory), | 161 | query_cache(*this, maxwell3d, gpu_memory), |
| 162 | buffer_cache(*this, gpu_memory, cpu_memory, device, STREAM_BUFFER_SIZE), | 162 | buffer_cache(*this, gpu_memory, cpu_memory_, device, STREAM_BUFFER_SIZE), |
| 163 | fence_manager(*this, gpu, texture_cache, buffer_cache, query_cache), | 163 | fence_manager(*this, gpu, texture_cache, buffer_cache, query_cache), |
| 164 | async_shaders(emu_window) { | 164 | async_shaders(emu_window_) { |
| 165 | CheckExtensions(); | 165 | CheckExtensions(); |
| 166 | 166 | ||
| 167 | unified_uniform_buffer.Create(); | 167 | unified_uniform_buffer.Create(); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 1d0f585fa..de28cff15 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h | |||
| @@ -62,10 +62,10 @@ static_assert(sizeof(BindlessSSBO) * CHAR_BIT == 128); | |||
| 62 | 62 | ||
| 63 | class RasterizerOpenGL : public VideoCore::RasterizerAccelerated { | 63 | class RasterizerOpenGL : public VideoCore::RasterizerAccelerated { |
| 64 | public: | 64 | public: |
| 65 | explicit RasterizerOpenGL(Core::Frontend::EmuWindow& emu_window, Tegra::GPU& gpu, | 65 | explicit RasterizerOpenGL(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, |
| 66 | Core::Memory::Memory& cpu_memory, const Device& device, | 66 | Core::Memory::Memory& cpu_memory_, const Device& device_, |
| 67 | ScreenInfo& screen_info, ProgramManager& program_manager, | 67 | ScreenInfo& screen_info_, ProgramManager& program_manager_, |
| 68 | StateTracker& state_tracker); | 68 | StateTracker& state_tracker_); |
| 69 | ~RasterizerOpenGL() override; | 69 | ~RasterizerOpenGL() override; |
| 70 | 70 | ||
| 71 | void Draw(bool is_indexed, bool is_instanced) override; | 71 | void Draw(bool is_indexed, bool is_instanced) override; |
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index bd56bed0c..eabfdea5d 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp | |||
| @@ -198,10 +198,10 @@ ProgramSharedPtr BuildShader(const Device& device, ShaderType shader_type, u64 u | |||
| 198 | return program; | 198 | return program; |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | Shader::Shader(std::shared_ptr<VideoCommon::Shader::Registry> registry_, ShaderEntries entries_, | 201 | Shader::Shader(std::shared_ptr<Registry> registry_, ShaderEntries entries_, |
| 202 | ProgramSharedPtr program_, bool is_built) | 202 | ProgramSharedPtr program_, bool is_built_) |
| 203 | : registry{std::move(registry_)}, entries{std::move(entries_)}, program{std::move(program_)}, | 203 | : registry{std::move(registry_)}, entries{std::move(entries_)}, program{std::move(program_)}, |
| 204 | is_built(is_built) { | 204 | is_built{is_built_} { |
| 205 | handle = program->assembly_program.handle; | 205 | handle = program->assembly_program.handle; |
| 206 | if (handle == 0) { | 206 | if (handle == 0) { |
| 207 | handle = program->source_program.handle; | 207 | handle = program->source_program.handle; |
| @@ -318,14 +318,13 @@ std::unique_ptr<Shader> Shader::CreateFromCache(const ShaderParameters& params, | |||
| 318 | precompiled_shader.registry, precompiled_shader.entries, precompiled_shader.program)); | 318 | precompiled_shader.registry, precompiled_shader.entries, precompiled_shader.program)); |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | ShaderCacheOpenGL::ShaderCacheOpenGL(RasterizerOpenGL& rasterizer, | 321 | ShaderCacheOpenGL::ShaderCacheOpenGL(RasterizerOpenGL& rasterizer_, |
| 322 | Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, | 322 | Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, |
| 323 | Tegra::Engines::Maxwell3D& maxwell3d_, | 323 | Tegra::Engines::Maxwell3D& maxwell3d_, |
| 324 | Tegra::Engines::KeplerCompute& kepler_compute_, | 324 | Tegra::Engines::KeplerCompute& kepler_compute_, |
| 325 | Tegra::MemoryManager& gpu_memory_, const Device& device_) | 325 | Tegra::MemoryManager& gpu_memory_, const Device& device_) |
| 326 | : VideoCommon::ShaderCache<Shader>{rasterizer}, emu_window{emu_window_}, gpu{gpu_}, | 326 | : ShaderCache{rasterizer_}, emu_window{emu_window_}, gpu{gpu_}, gpu_memory{gpu_memory_}, |
| 327 | gpu_memory{gpu_memory_}, maxwell3d{maxwell3d_}, | 327 | maxwell3d{maxwell3d_}, kepler_compute{kepler_compute_}, device{device_} {} |
| 328 | kepler_compute{kepler_compute_}, device{device_} {} | ||
| 329 | 328 | ||
| 330 | ShaderCacheOpenGL::~ShaderCacheOpenGL() = default; | 329 | ShaderCacheOpenGL::~ShaderCacheOpenGL() = default; |
| 331 | 330 | ||
| @@ -460,7 +459,7 @@ void ShaderCacheOpenGL::LoadDiskCache(u64 title_id, const std::atomic_bool& stop | |||
| 460 | ProgramSharedPtr ShaderCacheOpenGL::GeneratePrecompiledProgram( | 459 | ProgramSharedPtr ShaderCacheOpenGL::GeneratePrecompiledProgram( |
| 461 | const ShaderDiskCacheEntry& entry, const ShaderDiskCachePrecompiled& precompiled_entry, | 460 | const ShaderDiskCacheEntry& entry, const ShaderDiskCachePrecompiled& precompiled_entry, |
| 462 | const std::unordered_set<GLenum>& supported_formats) { | 461 | const std::unordered_set<GLenum>& supported_formats) { |
| 463 | if (supported_formats.find(precompiled_entry.binary_format) == supported_formats.end()) { | 462 | if (!supported_formats.contains(precompiled_entry.binary_format)) { |
| 464 | LOG_INFO(Render_OpenGL, "Precompiled cache entry with unsupported format, removing"); | 463 | LOG_INFO(Render_OpenGL, "Precompiled cache entry with unsupported format, removing"); |
| 465 | return {}; | 464 | return {}; |
| 466 | } | 465 | } |
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.h b/src/video_core/renderer_opengl/gl_shader_cache.h index 1708af06a..2aed0697e 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.h +++ b/src/video_core/renderer_opengl/gl_shader_cache.h | |||
| @@ -108,7 +108,7 @@ public: | |||
| 108 | 108 | ||
| 109 | private: | 109 | private: |
| 110 | explicit Shader(std::shared_ptr<VideoCommon::Shader::Registry> registry, ShaderEntries entries, | 110 | explicit Shader(std::shared_ptr<VideoCommon::Shader::Registry> registry, ShaderEntries entries, |
| 111 | ProgramSharedPtr program, bool is_built = true); | 111 | ProgramSharedPtr program, bool is_built_ = true); |
| 112 | 112 | ||
| 113 | std::shared_ptr<VideoCommon::Shader::Registry> registry; | 113 | std::shared_ptr<VideoCommon::Shader::Registry> registry; |
| 114 | ShaderEntries entries; | 114 | ShaderEntries entries; |
| @@ -119,10 +119,11 @@ private: | |||
| 119 | 119 | ||
| 120 | class ShaderCacheOpenGL final : public VideoCommon::ShaderCache<Shader> { | 120 | class ShaderCacheOpenGL final : public VideoCommon::ShaderCache<Shader> { |
| 121 | public: | 121 | public: |
| 122 | explicit ShaderCacheOpenGL(RasterizerOpenGL& rasterizer, Core::Frontend::EmuWindow& emu_window, | 122 | explicit ShaderCacheOpenGL(RasterizerOpenGL& rasterizer_, |
| 123 | Tegra::GPU& gpu, Tegra::Engines::Maxwell3D& maxwell3d, | 123 | Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu, |
| 124 | Tegra::Engines::KeplerCompute& kepler_compute, | 124 | Tegra::Engines::Maxwell3D& maxwell3d_, |
| 125 | Tegra::MemoryManager& gpu_memory, const Device& device); | 125 | Tegra::Engines::KeplerCompute& kepler_compute_, |
| 126 | Tegra::MemoryManager& gpu_memory_, const Device& device_); | ||
| 126 | ~ShaderCacheOpenGL() override; | 127 | ~ShaderCacheOpenGL() override; |
| 127 | 128 | ||
| 128 | /// Loads disk cache for the current game | 129 | /// Loads disk cache for the current game |
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 95ca96c8e..ccbdfe967 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -131,7 +131,7 @@ private: | |||
| 131 | 131 | ||
| 132 | class Expression final { | 132 | class Expression final { |
| 133 | public: | 133 | public: |
| 134 | Expression(std::string code, Type type) : code{std::move(code)}, type{type} { | 134 | Expression(std::string code_, Type type_) : code{std::move(code_)}, type{type_} { |
| 135 | ASSERT(type != Type::Void); | 135 | ASSERT(type != Type::Void); |
| 136 | } | 136 | } |
| 137 | Expression() : type{Type::Void} {} | 137 | Expression() : type{Type::Void} {} |
| @@ -148,8 +148,8 @@ public: | |||
| 148 | ASSERT(type == Type::Void); | 148 | ASSERT(type == Type::Void); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | std::string As(Type type) const { | 151 | std::string As(Type type_) const { |
| 152 | switch (type) { | 152 | switch (type_) { |
| 153 | case Type::Bool: | 153 | case Type::Bool: |
| 154 | return AsBool(); | 154 | return AsBool(); |
| 155 | case Type::Bool2: | 155 | case Type::Bool2: |
| @@ -316,7 +316,7 @@ std::pair<const char*, u32> GetPrimitiveDescription(Maxwell::PrimitiveTopology t | |||
| 316 | case Maxwell::PrimitiveTopology::TriangleStripAdjacency: | 316 | case Maxwell::PrimitiveTopology::TriangleStripAdjacency: |
| 317 | return {"triangles_adjacency", 6}; | 317 | return {"triangles_adjacency", 6}; |
| 318 | default: | 318 | default: |
| 319 | UNIMPLEMENTED_MSG("topology={}", static_cast<int>(topology)); | 319 | UNIMPLEMENTED_MSG("topology={}", topology); |
| 320 | return {"points", 1}; | 320 | return {"points", 1}; |
| 321 | } | 321 | } |
| 322 | } | 322 | } |
| @@ -342,7 +342,7 @@ std::string GetTopologyName(Tegra::Shader::OutputTopology topology) { | |||
| 342 | case Tegra::Shader::OutputTopology::TriangleStrip: | 342 | case Tegra::Shader::OutputTopology::TriangleStrip: |
| 343 | return "triangle_strip"; | 343 | return "triangle_strip"; |
| 344 | default: | 344 | default: |
| 345 | UNIMPLEMENTED_MSG("Unknown output topology: {}", static_cast<u32>(topology)); | 345 | UNIMPLEMENTED_MSG("Unknown output topology: {}", topology); |
| 346 | return "points"; | 346 | return "points"; |
| 347 | } | 347 | } |
| 348 | } | 348 | } |
| @@ -418,11 +418,12 @@ struct GenericVaryingDescription { | |||
| 418 | 418 | ||
| 419 | class GLSLDecompiler final { | 419 | class GLSLDecompiler final { |
| 420 | public: | 420 | public: |
| 421 | explicit GLSLDecompiler(const Device& device, const ShaderIR& ir, const Registry& registry, | 421 | explicit GLSLDecompiler(const Device& device_, const ShaderIR& ir_, const Registry& registry_, |
| 422 | ShaderType stage, std::string_view identifier, std::string_view suffix) | 422 | ShaderType stage_, std::string_view identifier_, |
| 423 | : device{device}, ir{ir}, registry{registry}, stage{stage}, identifier{identifier}, | 423 | std::string_view suffix_) |
| 424 | suffix{suffix}, header{ir.GetHeader()}, use_unified_uniforms{ | 424 | : device{device_}, ir{ir_}, registry{registry_}, stage{stage_}, identifier{identifier_}, |
| 425 | UseUnifiedUniforms(device, ir, stage)} { | 425 | suffix{suffix_}, header{ir.GetHeader()}, use_unified_uniforms{ |
| 426 | UseUnifiedUniforms(device_, ir_, stage_)} { | ||
| 426 | if (stage != ShaderType::Compute) { | 427 | if (stage != ShaderType::Compute) { |
| 427 | transform_feedback = BuildTransformFeedback(registry.GetGraphicsInfo()); | 428 | transform_feedback = BuildTransformFeedback(registry.GetGraphicsInfo()); |
| 428 | } | 429 | } |
| @@ -744,7 +745,7 @@ private: | |||
| 744 | case PixelImap::Unused: | 745 | case PixelImap::Unused: |
| 745 | break; | 746 | break; |
| 746 | } | 747 | } |
| 747 | UNIMPLEMENTED_MSG("Unknown attribute usage index={}", static_cast<int>(attribute)); | 748 | UNIMPLEMENTED_MSG("Unknown attribute usage index={}", attribute); |
| 748 | return {}; | 749 | return {}; |
| 749 | } | 750 | } |
| 750 | 751 | ||
| @@ -777,16 +778,16 @@ private: | |||
| 777 | name = "gs_" + name + "[]"; | 778 | name = "gs_" + name + "[]"; |
| 778 | } | 779 | } |
| 779 | 780 | ||
| 780 | std::string suffix; | 781 | std::string suffix_; |
| 781 | if (stage == ShaderType::Fragment) { | 782 | if (stage == ShaderType::Fragment) { |
| 782 | const auto input_mode{header.ps.GetPixelImap(location)}; | 783 | const auto input_mode{header.ps.GetPixelImap(location)}; |
| 783 | if (input_mode == PixelImap::Unused) { | 784 | if (input_mode == PixelImap::Unused) { |
| 784 | return; | 785 | return; |
| 785 | } | 786 | } |
| 786 | suffix = GetInputFlags(input_mode); | 787 | suffix_ = GetInputFlags(input_mode); |
| 787 | } | 788 | } |
| 788 | 789 | ||
| 789 | code.AddLine("layout (location = {}) {} in vec4 {};", location, suffix, name); | 790 | code.AddLine("layout (location = {}) {} in vec4 {};", location, suffix_, name); |
| 790 | } | 791 | } |
| 791 | 792 | ||
| 792 | void DeclareOutputAttributes() { | 793 | void DeclareOutputAttributes() { |
| @@ -877,7 +878,7 @@ private: | |||
| 877 | } | 878 | } |
| 878 | 879 | ||
| 879 | u32 binding = device.GetBaseBindings(stage).uniform_buffer; | 880 | u32 binding = device.GetBaseBindings(stage).uniform_buffer; |
| 880 | for (const auto [index, info] : ir.GetConstantBuffers()) { | 881 | for (const auto& [index, info] : ir.GetConstantBuffers()) { |
| 881 | const u32 num_elements = Common::AlignUp(info.GetSize(), 4) / 4; | 882 | const u32 num_elements = Common::AlignUp(info.GetSize(), 4) / 4; |
| 882 | const u32 size = info.IsIndirect() ? MAX_CONSTBUFFER_ELEMENTS : num_elements; | 883 | const u32 size = info.IsIndirect() ? MAX_CONSTBUFFER_ELEMENTS : num_elements; |
| 883 | code.AddLine("layout (std140, binding = {}) uniform {} {{", binding++, | 884 | code.AddLine("layout (std140, binding = {}) uniform {} {{", binding++, |
| @@ -1251,7 +1252,7 @@ private: | |||
| 1251 | } | 1252 | } |
| 1252 | break; | 1253 | break; |
| 1253 | } | 1254 | } |
| 1254 | UNIMPLEMENTED_MSG("Unhandled input attribute: {}", static_cast<u32>(attribute)); | 1255 | UNIMPLEMENTED_MSG("Unhandled input attribute: {}", attribute); |
| 1255 | return {"0", Type::Int}; | 1256 | return {"0", Type::Int}; |
| 1256 | } | 1257 | } |
| 1257 | 1258 | ||
| @@ -1331,7 +1332,7 @@ private: | |||
| 1331 | GetSwizzle(element)), | 1332 | GetSwizzle(element)), |
| 1332 | Type::Float}}; | 1333 | Type::Float}}; |
| 1333 | } | 1334 | } |
| 1334 | UNIMPLEMENTED_MSG("Unhandled output attribute: {}", static_cast<u32>(attribute)); | 1335 | UNIMPLEMENTED_MSG("Unhandled output attribute: {}", attribute); |
| 1335 | return std::nullopt; | 1336 | return std::nullopt; |
| 1336 | } | 1337 | } |
| 1337 | } | 1338 | } |
| @@ -2100,13 +2101,13 @@ private: | |||
| 2100 | const auto type = meta.sampler.is_shadow ? Type::Float : Type::Int; | 2101 | const auto type = meta.sampler.is_shadow ? Type::Float : Type::Int; |
| 2101 | const bool separate_dc = meta.sampler.is_shadow; | 2102 | const bool separate_dc = meta.sampler.is_shadow; |
| 2102 | 2103 | ||
| 2103 | std::vector<TextureIR> ir; | 2104 | std::vector<TextureIR> ir_; |
| 2104 | if (meta.sampler.is_shadow) { | 2105 | if (meta.sampler.is_shadow) { |
| 2105 | ir = {TextureOffset{}}; | 2106 | ir_ = {TextureOffset{}}; |
| 2106 | } else { | 2107 | } else { |
| 2107 | ir = {TextureOffset{}, TextureArgument{type, meta.component}}; | 2108 | ir_ = {TextureOffset{}, TextureArgument{type, meta.component}}; |
| 2108 | } | 2109 | } |
| 2109 | return {GenerateTexture(operation, "Gather", ir, separate_dc) + GetSwizzle(meta.element), | 2110 | return {GenerateTexture(operation, "Gather", ir_, separate_dc) + GetSwizzle(meta.element), |
| 2110 | Type::Float}; | 2111 | Type::Float}; |
| 2111 | } | 2112 | } |
| 2112 | 2113 | ||
| @@ -2801,7 +2802,7 @@ std::string GetFlowVariable(u32 index) { | |||
| 2801 | 2802 | ||
| 2802 | class ExprDecompiler { | 2803 | class ExprDecompiler { |
| 2803 | public: | 2804 | public: |
| 2804 | explicit ExprDecompiler(GLSLDecompiler& decomp) : decomp{decomp} {} | 2805 | explicit ExprDecompiler(GLSLDecompiler& decomp_) : decomp{decomp_} {} |
| 2805 | 2806 | ||
| 2806 | void operator()(const ExprAnd& expr) { | 2807 | void operator()(const ExprAnd& expr) { |
| 2807 | inner += '('; | 2808 | inner += '('; |
| @@ -2856,7 +2857,7 @@ private: | |||
| 2856 | 2857 | ||
| 2857 | class ASTDecompiler { | 2858 | class ASTDecompiler { |
| 2858 | public: | 2859 | public: |
| 2859 | explicit ASTDecompiler(GLSLDecompiler& decomp) : decomp{decomp} {} | 2860 | explicit ASTDecompiler(GLSLDecompiler& decomp_) : decomp{decomp_} {} |
| 2860 | 2861 | ||
| 2861 | void operator()(const ASTProgram& ast) { | 2862 | void operator()(const ASTProgram& ast) { |
| 2862 | ASTNode current = ast.nodes.GetFirst(); | 2863 | ASTNode current = ast.nodes.GetFirst(); |
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.h b/src/video_core/renderer_opengl/gl_shader_decompiler.h index 451c9689a..c4ff47875 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.h +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.h | |||
| @@ -25,8 +25,8 @@ using ImageEntry = VideoCommon::Shader::Image; | |||
| 25 | 25 | ||
| 26 | class ConstBufferEntry : public VideoCommon::Shader::ConstBuffer { | 26 | class ConstBufferEntry : public VideoCommon::Shader::ConstBuffer { |
| 27 | public: | 27 | public: |
| 28 | explicit ConstBufferEntry(u32 max_offset, bool is_indirect, u32 index) | 28 | explicit ConstBufferEntry(u32 max_offset_, bool is_indirect_, u32 index_) |
| 29 | : VideoCommon::Shader::ConstBuffer{max_offset, is_indirect}, index{index} {} | 29 | : ConstBuffer{max_offset_, is_indirect_}, index{index_} {} |
| 30 | 30 | ||
| 31 | u32 GetIndex() const { | 31 | u32 GetIndex() const { |
| 32 | return index; | 32 | return index; |
| @@ -37,10 +37,10 @@ private: | |||
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | struct GlobalMemoryEntry { | 39 | struct GlobalMemoryEntry { |
| 40 | constexpr explicit GlobalMemoryEntry(u32 cbuf_index, u32 cbuf_offset, bool is_read, | 40 | constexpr explicit GlobalMemoryEntry(u32 cbuf_index_, u32 cbuf_offset_, bool is_read_, |
| 41 | bool is_written) | 41 | bool is_written_) |
| 42 | : cbuf_index{cbuf_index}, cbuf_offset{cbuf_offset}, is_read{is_read}, is_written{ | 42 | : cbuf_index{cbuf_index_}, cbuf_offset{cbuf_offset_}, is_read{is_read_}, is_written{ |
| 43 | is_written} {} | 43 | is_written_} {} |
| 44 | 44 | ||
| 45 | u32 cbuf_index = 0; | 45 | u32 cbuf_index = 0; |
| 46 | u32 cbuf_offset = 0; | 46 | u32 cbuf_offset = 0; |
diff --git a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp index 70dd0c3c6..955b2abc4 100644 --- a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp | |||
| @@ -343,7 +343,7 @@ void ShaderDiskCacheOpenGL::SaveEntry(const ShaderDiskCacheEntry& entry) { | |||
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | const u64 id = entry.unique_identifier; | 345 | const u64 id = entry.unique_identifier; |
| 346 | if (stored_transferable.find(id) != stored_transferable.end()) { | 346 | if (stored_transferable.contains(id)) { |
| 347 | // The shader already exists | 347 | // The shader already exists |
| 348 | return; | 348 | return; |
| 349 | } | 349 | } |
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp index 6bcf831f2..45f4fc565 100644 --- a/src/video_core/renderer_opengl/gl_state_tracker.cpp +++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include "video_core/renderer_opengl/gl_state_tracker.h" | 13 | #include "video_core/renderer_opengl/gl_state_tracker.h" |
| 14 | 14 | ||
| 15 | #define OFF(field_name) MAXWELL3D_REG_INDEX(field_name) | 15 | #define OFF(field_name) MAXWELL3D_REG_INDEX(field_name) |
| 16 | #define NUM(field_name) (sizeof(Maxwell3D::Regs::field_name) / sizeof(u32)) | 16 | #define NUM(field_name) (sizeof(Maxwell3D::Regs::field_name) / (sizeof(u32))) |
| 17 | 17 | ||
| 18 | namespace OpenGL { | 18 | namespace OpenGL { |
| 19 | 19 | ||
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index a863ef218..daf352b50 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp | |||
| @@ -258,9 +258,9 @@ constexpr u32 EncodeSwizzle(SwizzleSource x_source, SwizzleSource y_source, Swiz | |||
| 258 | 258 | ||
| 259 | } // Anonymous namespace | 259 | } // Anonymous namespace |
| 260 | 260 | ||
| 261 | CachedSurface::CachedSurface(const GPUVAddr gpu_addr, const SurfaceParams& params, | 261 | CachedSurface::CachedSurface(const GPUVAddr gpu_addr_, const SurfaceParams& params_, |
| 262 | bool is_astc_supported) | 262 | bool is_astc_supported_) |
| 263 | : VideoCommon::SurfaceBase<View>(gpu_addr, params, is_astc_supported) { | 263 | : SurfaceBase<View>{gpu_addr_, params_, is_astc_supported_} { |
| 264 | if (is_converted) { | 264 | if (is_converted) { |
| 265 | internal_format = params.srgb_conversion ? GL_SRGB8_ALPHA8 : GL_RGBA8; | 265 | internal_format = params.srgb_conversion ? GL_SRGB8_ALPHA8 : GL_RGBA8; |
| 266 | format = GL_RGBA; | 266 | format = GL_RGBA; |
| @@ -347,14 +347,14 @@ void CachedSurface::UploadTextureMipmap(u32 level, const std::vector<u8>& stagin | |||
| 347 | internal_format, image_size, buffer); | 347 | internal_format, image_size, buffer); |
| 348 | break; | 348 | break; |
| 349 | case SurfaceTarget::TextureCubemap: { | 349 | case SurfaceTarget::TextureCubemap: { |
| 350 | const std::size_t layer_size{params.GetHostLayerSize(level)}; | 350 | const std::size_t host_layer_size{params.GetHostLayerSize(level)}; |
| 351 | for (std::size_t face = 0; face < params.depth; ++face) { | 351 | for (std::size_t face = 0; face < params.depth; ++face) { |
| 352 | glCompressedTextureSubImage3D(texture.handle, level, 0, 0, static_cast<GLint>(face), | 352 | glCompressedTextureSubImage3D(texture.handle, level, 0, 0, static_cast<GLint>(face), |
| 353 | static_cast<GLsizei>(params.GetMipWidth(level)), | 353 | static_cast<GLsizei>(params.GetMipWidth(level)), |
| 354 | static_cast<GLsizei>(params.GetMipHeight(level)), 1, | 354 | static_cast<GLsizei>(params.GetMipHeight(level)), 1, |
| 355 | internal_format, static_cast<GLsizei>(layer_size), | 355 | internal_format, |
| 356 | buffer); | 356 | static_cast<GLsizei>(host_layer_size), buffer); |
| 357 | buffer += layer_size; | 357 | buffer += host_layer_size; |
| 358 | } | 358 | } |
| 359 | break; | 359 | break; |
| 360 | } | 360 | } |
| @@ -419,11 +419,11 @@ View CachedSurface::CreateViewInner(const ViewParams& view_key, const bool is_pr | |||
| 419 | return view; | 419 | return view; |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | CachedSurfaceView::CachedSurfaceView(CachedSurface& surface, const ViewParams& params, | 422 | CachedSurfaceView::CachedSurfaceView(CachedSurface& surface_, const ViewParams& params_, |
| 423 | bool is_proxy) | 423 | bool is_proxy_) |
| 424 | : VideoCommon::ViewBase(params), surface{surface}, format{surface.internal_format}, | 424 | : ViewBase{params_}, surface{surface_}, format{surface_.internal_format}, |
| 425 | target{GetTextureTarget(params.target)}, is_proxy{is_proxy} { | 425 | target{GetTextureTarget(params_.target)}, is_proxy{is_proxy_} { |
| 426 | if (!is_proxy) { | 426 | if (!is_proxy_) { |
| 427 | main_view = CreateTextureView(); | 427 | main_view = CreateTextureView(); |
| 428 | } | 428 | } |
| 429 | } | 429 | } |
| @@ -493,13 +493,13 @@ GLuint CachedSurfaceView::GetTexture(SwizzleSource x_source, SwizzleSource y_sou | |||
| 493 | 493 | ||
| 494 | std::array swizzle{x_source, y_source, z_source, w_source}; | 494 | std::array swizzle{x_source, y_source, z_source, w_source}; |
| 495 | 495 | ||
| 496 | switch (const PixelFormat format = GetSurfaceParams().pixel_format) { | 496 | switch (const PixelFormat pixel_format = GetSurfaceParams().pixel_format) { |
| 497 | case PixelFormat::D24_UNORM_S8_UINT: | 497 | case PixelFormat::D24_UNORM_S8_UINT: |
| 498 | case PixelFormat::D32_FLOAT_S8_UINT: | 498 | case PixelFormat::D32_FLOAT_S8_UINT: |
| 499 | case PixelFormat::S8_UINT_D24_UNORM: | 499 | case PixelFormat::S8_UINT_D24_UNORM: |
| 500 | UNIMPLEMENTED_IF(x_source != SwizzleSource::R && x_source != SwizzleSource::G); | 500 | UNIMPLEMENTED_IF(x_source != SwizzleSource::R && x_source != SwizzleSource::G); |
| 501 | glTextureParameteri(view.handle, GL_DEPTH_STENCIL_TEXTURE_MODE, | 501 | glTextureParameteri(view.handle, GL_DEPTH_STENCIL_TEXTURE_MODE, |
| 502 | GetComponent(format, x_source == SwizzleSource::R)); | 502 | GetComponent(pixel_format, x_source == SwizzleSource::R)); |
| 503 | 503 | ||
| 504 | // Make sure we sample the first component | 504 | // Make sure we sample the first component |
| 505 | std::transform(swizzle.begin(), swizzle.end(), swizzle.begin(), [](SwizzleSource value) { | 505 | std::transform(swizzle.begin(), swizzle.end(), swizzle.begin(), [](SwizzleSource value) { |
| @@ -532,12 +532,12 @@ OGLTextureView CachedSurfaceView::CreateTextureView() const { | |||
| 532 | return texture_view; | 532 | return texture_view; |
| 533 | } | 533 | } |
| 534 | 534 | ||
| 535 | TextureCacheOpenGL::TextureCacheOpenGL(VideoCore::RasterizerInterface& rasterizer, | 535 | TextureCacheOpenGL::TextureCacheOpenGL(VideoCore::RasterizerInterface& rasterizer_, |
| 536 | Tegra::Engines::Maxwell3D& maxwell3d, | 536 | Tegra::Engines::Maxwell3D& maxwell3d_, |
| 537 | Tegra::MemoryManager& gpu_memory, const Device& device, | 537 | Tegra::MemoryManager& gpu_memory_, const Device& device_, |
| 538 | StateTracker& state_tracker_) | 538 | StateTracker& state_tracker_) |
| 539 | : TextureCacheBase{rasterizer, maxwell3d, gpu_memory, device.HasASTC()}, state_tracker{ | 539 | : TextureCacheBase{rasterizer_, maxwell3d_, gpu_memory_, device_.HasASTC()}, |
| 540 | state_tracker_} { | 540 | state_tracker{state_tracker_} { |
| 541 | src_framebuffer.Create(); | 541 | src_framebuffer.Create(); |
| 542 | dst_framebuffer.Create(); | 542 | dst_framebuffer.Create(); |
| 543 | } | 543 | } |
| @@ -689,8 +689,7 @@ void TextureCacheOpenGL::BufferCopy(Surface& src_surface, Surface& dst_surface) | |||
| 689 | dest_format.format, dest_format.type, nullptr); | 689 | dest_format.format, dest_format.type, nullptr); |
| 690 | break; | 690 | break; |
| 691 | default: | 691 | default: |
| 692 | LOG_CRITICAL(Render_OpenGL, "Unimplemented surface target={}", | 692 | LOG_CRITICAL(Render_OpenGL, "Unimplemented surface target={}", dst_params.target); |
| 693 | static_cast<u32>(dst_params.target)); | ||
| 694 | UNREACHABLE(); | 693 | UNREACHABLE(); |
| 695 | } | 694 | } |
| 696 | } | 695 | } |
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h index 7787134fc..72b284fab 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.h +++ b/src/video_core/renderer_opengl/gl_texture_cache.h | |||
| @@ -37,7 +37,8 @@ class CachedSurface final : public VideoCommon::SurfaceBase<View> { | |||
| 37 | friend CachedSurfaceView; | 37 | friend CachedSurfaceView; |
| 38 | 38 | ||
| 39 | public: | 39 | public: |
| 40 | explicit CachedSurface(GPUVAddr gpu_addr, const SurfaceParams& params, bool is_astc_supported); | 40 | explicit CachedSurface(GPUVAddr gpu_addr_, const SurfaceParams& params_, |
| 41 | bool is_astc_supported_); | ||
| 41 | ~CachedSurface(); | 42 | ~CachedSurface(); |
| 42 | 43 | ||
| 43 | void UploadTexture(const std::vector<u8>& staging_buffer) override; | 44 | void UploadTexture(const std::vector<u8>& staging_buffer) override; |
| @@ -77,7 +78,7 @@ private: | |||
| 77 | 78 | ||
| 78 | class CachedSurfaceView final : public VideoCommon::ViewBase { | 79 | class CachedSurfaceView final : public VideoCommon::ViewBase { |
| 79 | public: | 80 | public: |
| 80 | explicit CachedSurfaceView(CachedSurface& surface, const ViewParams& params, bool is_proxy); | 81 | explicit CachedSurfaceView(CachedSurface& surface_, const ViewParams& params_, bool is_proxy_); |
| 81 | ~CachedSurfaceView(); | 82 | ~CachedSurfaceView(); |
| 82 | 83 | ||
| 83 | /// @brief Attaches this texture view to the currently bound fb_target framebuffer | 84 | /// @brief Attaches this texture view to the currently bound fb_target framebuffer |
| @@ -129,9 +130,9 @@ private: | |||
| 129 | 130 | ||
| 130 | class TextureCacheOpenGL final : public TextureCacheBase { | 131 | class TextureCacheOpenGL final : public TextureCacheBase { |
| 131 | public: | 132 | public: |
| 132 | explicit TextureCacheOpenGL(VideoCore::RasterizerInterface& rasterizer, | 133 | explicit TextureCacheOpenGL(VideoCore::RasterizerInterface& rasterizer_, |
| 133 | Tegra::Engines::Maxwell3D& maxwell3d, | 134 | Tegra::Engines::Maxwell3D& maxwell3d_, |
| 134 | Tegra::MemoryManager& gpu_memory, const Device& device, | 135 | Tegra::MemoryManager& gpu_memory_, const Device& device_, |
| 135 | StateTracker& state_tracker); | 136 | StateTracker& state_tracker); |
| 136 | ~TextureCacheOpenGL(); | 137 | ~TextureCacheOpenGL(); |
| 137 | 138 | ||
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index a8be2aa37..dd4ee3361 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h | |||
| @@ -107,7 +107,7 @@ inline GLenum IndexFormat(Maxwell::IndexFormat index_format) { | |||
| 107 | case Maxwell::IndexFormat::UnsignedInt: | 107 | case Maxwell::IndexFormat::UnsignedInt: |
| 108 | return GL_UNSIGNED_INT; | 108 | return GL_UNSIGNED_INT; |
| 109 | } | 109 | } |
| 110 | UNREACHABLE_MSG("Invalid index_format={}", static_cast<u32>(index_format)); | 110 | UNREACHABLE_MSG("Invalid index_format={}", index_format); |
| 111 | return {}; | 111 | return {}; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| @@ -144,7 +144,7 @@ inline GLenum PrimitiveTopology(Maxwell::PrimitiveTopology topology) { | |||
| 144 | case Maxwell::PrimitiveTopology::Patches: | 144 | case Maxwell::PrimitiveTopology::Patches: |
| 145 | return GL_PATCHES; | 145 | return GL_PATCHES; |
| 146 | } | 146 | } |
| 147 | UNREACHABLE_MSG("Invalid topology={}", static_cast<int>(topology)); | 147 | UNREACHABLE_MSG("Invalid topology={}", topology); |
| 148 | return GL_POINTS; | 148 | return GL_POINTS; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| @@ -172,8 +172,8 @@ inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode, | |||
| 172 | } | 172 | } |
| 173 | break; | 173 | break; |
| 174 | } | 174 | } |
| 175 | UNREACHABLE_MSG("Invalid texture filter mode={} and mipmap filter mode={}", | 175 | UNREACHABLE_MSG("Invalid texture filter mode={} and mipmap filter mode={}", filter_mode, |
| 176 | static_cast<u32>(filter_mode), static_cast<u32>(mipmap_filter_mode)); | 176 | mipmap_filter_mode); |
| 177 | return GL_NEAREST; | 177 | return GL_NEAREST; |
| 178 | } | 178 | } |
| 179 | 179 | ||
| @@ -204,7 +204,7 @@ inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) { | |||
| 204 | return GL_MIRROR_CLAMP_TO_EDGE; | 204 | return GL_MIRROR_CLAMP_TO_EDGE; |
| 205 | } | 205 | } |
| 206 | } | 206 | } |
| 207 | UNIMPLEMENTED_MSG("Unimplemented texture wrap mode={}", static_cast<u32>(wrap_mode)); | 207 | UNIMPLEMENTED_MSG("Unimplemented texture wrap mode={}", wrap_mode); |
| 208 | return GL_REPEAT; | 208 | return GL_REPEAT; |
| 209 | } | 209 | } |
| 210 | 210 | ||
| @@ -227,7 +227,7 @@ inline GLenum DepthCompareFunc(Tegra::Texture::DepthCompareFunc func) { | |||
| 227 | case Tegra::Texture::DepthCompareFunc::Always: | 227 | case Tegra::Texture::DepthCompareFunc::Always: |
| 228 | return GL_ALWAYS; | 228 | return GL_ALWAYS; |
| 229 | } | 229 | } |
| 230 | UNIMPLEMENTED_MSG("Unimplemented texture depth compare function={}", static_cast<u32>(func)); | 230 | UNIMPLEMENTED_MSG("Unimplemented texture depth compare function={}", func); |
| 231 | return GL_GREATER; | 231 | return GL_GREATER; |
| 232 | } | 232 | } |
| 233 | 233 | ||
| @@ -249,7 +249,7 @@ inline GLenum BlendEquation(Maxwell::Blend::Equation equation) { | |||
| 249 | case Maxwell::Blend::Equation::MaxGL: | 249 | case Maxwell::Blend::Equation::MaxGL: |
| 250 | return GL_MAX; | 250 | return GL_MAX; |
| 251 | } | 251 | } |
| 252 | UNIMPLEMENTED_MSG("Unimplemented blend equation={}", static_cast<u32>(equation)); | 252 | UNIMPLEMENTED_MSG("Unimplemented blend equation={}", equation); |
| 253 | return GL_FUNC_ADD; | 253 | return GL_FUNC_ADD; |
| 254 | } | 254 | } |
| 255 | 255 | ||
| @@ -313,7 +313,7 @@ inline GLenum BlendFunc(Maxwell::Blend::Factor factor) { | |||
| 313 | case Maxwell::Blend::Factor::OneMinusConstantAlphaGL: | 313 | case Maxwell::Blend::Factor::OneMinusConstantAlphaGL: |
| 314 | return GL_ONE_MINUS_CONSTANT_ALPHA; | 314 | return GL_ONE_MINUS_CONSTANT_ALPHA; |
| 315 | } | 315 | } |
| 316 | UNIMPLEMENTED_MSG("Unimplemented blend factor={}", static_cast<u32>(factor)); | 316 | UNIMPLEMENTED_MSG("Unimplemented blend factor={}", factor); |
| 317 | return GL_ZERO; | 317 | return GL_ZERO; |
| 318 | } | 318 | } |
| 319 | 319 | ||
| @@ -333,7 +333,7 @@ inline GLenum SwizzleSource(Tegra::Texture::SwizzleSource source) { | |||
| 333 | case Tegra::Texture::SwizzleSource::OneFloat: | 333 | case Tegra::Texture::SwizzleSource::OneFloat: |
| 334 | return GL_ONE; | 334 | return GL_ONE; |
| 335 | } | 335 | } |
| 336 | UNIMPLEMENTED_MSG("Unimplemented swizzle source={}", static_cast<u32>(source)); | 336 | UNIMPLEMENTED_MSG("Unimplemented swizzle source={}", source); |
| 337 | return GL_ZERO; | 337 | return GL_ZERO; |
| 338 | } | 338 | } |
| 339 | 339 | ||
| @@ -364,7 +364,7 @@ inline GLenum ComparisonOp(Maxwell::ComparisonOp comparison) { | |||
| 364 | case Maxwell::ComparisonOp::AlwaysOld: | 364 | case Maxwell::ComparisonOp::AlwaysOld: |
| 365 | return GL_ALWAYS; | 365 | return GL_ALWAYS; |
| 366 | } | 366 | } |
| 367 | UNIMPLEMENTED_MSG("Unimplemented comparison op={}", static_cast<u32>(comparison)); | 367 | UNIMPLEMENTED_MSG("Unimplemented comparison op={}", comparison); |
| 368 | return GL_ALWAYS; | 368 | return GL_ALWAYS; |
| 369 | } | 369 | } |
| 370 | 370 | ||
| @@ -395,7 +395,7 @@ inline GLenum StencilOp(Maxwell::StencilOp stencil) { | |||
| 395 | case Maxwell::StencilOp::DecrWrapOGL: | 395 | case Maxwell::StencilOp::DecrWrapOGL: |
| 396 | return GL_DECR_WRAP; | 396 | return GL_DECR_WRAP; |
| 397 | } | 397 | } |
| 398 | UNIMPLEMENTED_MSG("Unimplemented stencil op={}", static_cast<u32>(stencil)); | 398 | UNIMPLEMENTED_MSG("Unimplemented stencil op={}", stencil); |
| 399 | return GL_KEEP; | 399 | return GL_KEEP; |
| 400 | } | 400 | } |
| 401 | 401 | ||
| @@ -406,7 +406,7 @@ inline GLenum FrontFace(Maxwell::FrontFace front_face) { | |||
| 406 | case Maxwell::FrontFace::CounterClockWise: | 406 | case Maxwell::FrontFace::CounterClockWise: |
| 407 | return GL_CCW; | 407 | return GL_CCW; |
| 408 | } | 408 | } |
| 409 | UNIMPLEMENTED_MSG("Unimplemented front face cull={}", static_cast<u32>(front_face)); | 409 | UNIMPLEMENTED_MSG("Unimplemented front face cull={}", front_face); |
| 410 | return GL_CCW; | 410 | return GL_CCW; |
| 411 | } | 411 | } |
| 412 | 412 | ||
| @@ -419,7 +419,7 @@ inline GLenum CullFace(Maxwell::CullFace cull_face) { | |||
| 419 | case Maxwell::CullFace::FrontAndBack: | 419 | case Maxwell::CullFace::FrontAndBack: |
| 420 | return GL_FRONT_AND_BACK; | 420 | return GL_FRONT_AND_BACK; |
| 421 | } | 421 | } |
| 422 | UNIMPLEMENTED_MSG("Unimplemented cull face={}", static_cast<u32>(cull_face)); | 422 | UNIMPLEMENTED_MSG("Unimplemented cull face={}", cull_face); |
| 423 | return GL_BACK; | 423 | return GL_BACK; |
| 424 | } | 424 | } |
| 425 | 425 | ||
| @@ -458,7 +458,7 @@ inline GLenum LogicOp(Maxwell::LogicOperation operation) { | |||
| 458 | case Maxwell::LogicOperation::Set: | 458 | case Maxwell::LogicOperation::Set: |
| 459 | return GL_SET; | 459 | return GL_SET; |
| 460 | } | 460 | } |
| 461 | UNIMPLEMENTED_MSG("Unimplemented logic operation={}", static_cast<u32>(operation)); | 461 | UNIMPLEMENTED_MSG("Unimplemented logic operation={}", operation); |
| 462 | return GL_COPY; | 462 | return GL_COPY; |
| 463 | } | 463 | } |
| 464 | 464 | ||
| @@ -471,7 +471,7 @@ inline GLenum PolygonMode(Maxwell::PolygonMode polygon_mode) { | |||
| 471 | case Maxwell::PolygonMode::Fill: | 471 | case Maxwell::PolygonMode::Fill: |
| 472 | return GL_FILL; | 472 | return GL_FILL; |
| 473 | } | 473 | } |
| 474 | UNREACHABLE_MSG("Invalid polygon mode={}", static_cast<int>(polygon_mode)); | 474 | UNREACHABLE_MSG("Invalid polygon mode={}", polygon_mode); |
| 475 | return GL_FILL; | 475 | return GL_FILL; |
| 476 | } | 476 | } |
| 477 | 477 | ||
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index c869bb0e2..cbfaaa99c 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -130,8 +130,8 @@ void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum severit | |||
| 130 | RendererOpenGL::RendererOpenGL(Core::TelemetrySession& telemetry_session_, | 130 | RendererOpenGL::RendererOpenGL(Core::TelemetrySession& telemetry_session_, |
| 131 | Core::Frontend::EmuWindow& emu_window_, | 131 | Core::Frontend::EmuWindow& emu_window_, |
| 132 | Core::Memory::Memory& cpu_memory_, Tegra::GPU& gpu_, | 132 | Core::Memory::Memory& cpu_memory_, Tegra::GPU& gpu_, |
| 133 | std::unique_ptr<Core::Frontend::GraphicsContext> context) | 133 | std::unique_ptr<Core::Frontend::GraphicsContext> context_) |
| 134 | : RendererBase{emu_window_, std::move(context)}, telemetry_session{telemetry_session_}, | 134 | : RendererBase{emu_window_, std::move(context_)}, telemetry_session{telemetry_session_}, |
| 135 | emu_window{emu_window_}, cpu_memory{cpu_memory_}, gpu{gpu_}, program_manager{device} {} | 135 | emu_window{emu_window_}, cpu_memory{cpu_memory_}, gpu{gpu_}, program_manager{device} {} |
| 136 | 136 | ||
| 137 | RendererOpenGL::~RendererOpenGL() = default; | 137 | RendererOpenGL::~RendererOpenGL() = default; |
| @@ -275,9 +275,9 @@ void RendererOpenGL::AddTelemetryFields() { | |||
| 275 | LOG_INFO(Render_OpenGL, "GL_RENDERER: {}", gpu_model); | 275 | LOG_INFO(Render_OpenGL, "GL_RENDERER: {}", gpu_model); |
| 276 | 276 | ||
| 277 | constexpr auto user_system = Common::Telemetry::FieldType::UserSystem; | 277 | constexpr auto user_system = Common::Telemetry::FieldType::UserSystem; |
| 278 | telemetry_session.AddField(user_system, "GPU_Vendor", gpu_vendor); | 278 | telemetry_session.AddField(user_system, "GPU_Vendor", std::string(gpu_vendor)); |
| 279 | telemetry_session.AddField(user_system, "GPU_Model", gpu_model); | 279 | telemetry_session.AddField(user_system, "GPU_Model", std::string(gpu_model)); |
| 280 | telemetry_session.AddField(user_system, "GPU_OpenGL_Version", gl_version); | 280 | telemetry_session.AddField(user_system, "GPU_OpenGL_Version", std::string(gl_version)); |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | void RendererOpenGL::CreateRasterizer() { | 283 | void RendererOpenGL::CreateRasterizer() { |
| @@ -348,7 +348,7 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) { | |||
| 348 | } else { | 348 | } else { |
| 349 | // Other transformations are unsupported | 349 | // Other transformations are unsupported |
| 350 | LOG_CRITICAL(Render_OpenGL, "Unsupported framebuffer_transform_flags={}", | 350 | LOG_CRITICAL(Render_OpenGL, "Unsupported framebuffer_transform_flags={}", |
| 351 | static_cast<u32>(framebuffer_transform_flags)); | 351 | framebuffer_transform_flags); |
| 352 | UNIMPLEMENTED(); | 352 | UNIMPLEMENTED(); |
| 353 | } | 353 | } |
| 354 | } | 354 | } |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index 9ef181f95..376f88766 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h | |||
| @@ -57,10 +57,10 @@ struct ScreenInfo { | |||
| 57 | 57 | ||
| 58 | class RendererOpenGL final : public VideoCore::RendererBase { | 58 | class RendererOpenGL final : public VideoCore::RendererBase { |
| 59 | public: | 59 | public: |
| 60 | explicit RendererOpenGL(Core::TelemetrySession& telemetry_session, | 60 | explicit RendererOpenGL(Core::TelemetrySession& telemetry_session_, |
| 61 | Core::Frontend::EmuWindow& emu_window, Core::Memory::Memory& cpu_memory, | 61 | Core::Frontend::EmuWindow& emu_window_, |
| 62 | Tegra::GPU& gpu, | 62 | Core::Memory::Memory& cpu_memory_, Tegra::GPU& gpu_, |
| 63 | std::unique_ptr<Core::Frontend::GraphicsContext> context); | 63 | std::unique_ptr<Core::Frontend::GraphicsContext> context_); |
| 64 | ~RendererOpenGL() override; | 64 | ~RendererOpenGL() override; |
| 65 | 65 | ||
| 66 | bool Init() override; | 66 | bool Init() override; |
diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp index d22de1d81..58e117eb3 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp | |||
| @@ -26,7 +26,7 @@ VkFilter Filter(Tegra::Texture::TextureFilter filter) { | |||
| 26 | case Tegra::Texture::TextureFilter::Linear: | 26 | case Tegra::Texture::TextureFilter::Linear: |
| 27 | return VK_FILTER_LINEAR; | 27 | return VK_FILTER_LINEAR; |
| 28 | } | 28 | } |
| 29 | UNREACHABLE_MSG("Invalid sampler filter={}", static_cast<u32>(filter)); | 29 | UNREACHABLE_MSG("Invalid sampler filter={}", filter); |
| 30 | return {}; | 30 | return {}; |
| 31 | } | 31 | } |
| 32 | 32 | ||
| @@ -43,7 +43,7 @@ VkSamplerMipmapMode MipmapMode(Tegra::Texture::TextureMipmapFilter mipmap_filter | |||
| 43 | case Tegra::Texture::TextureMipmapFilter::Linear: | 43 | case Tegra::Texture::TextureMipmapFilter::Linear: |
| 44 | return VK_SAMPLER_MIPMAP_MODE_LINEAR; | 44 | return VK_SAMPLER_MIPMAP_MODE_LINEAR; |
| 45 | } | 45 | } |
| 46 | UNREACHABLE_MSG("Invalid sampler mipmap mode={}", static_cast<u32>(mipmap_filter)); | 46 | UNREACHABLE_MSG("Invalid sampler mipmap mode={}", mipmap_filter); |
| 47 | return {}; | 47 | return {}; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| @@ -79,7 +79,7 @@ VkSamplerAddressMode WrapMode(const VKDevice& device, Tegra::Texture::WrapMode w | |||
| 79 | UNIMPLEMENTED(); | 79 | UNIMPLEMENTED(); |
| 80 | return VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE; | 80 | return VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE; |
| 81 | default: | 81 | default: |
| 82 | UNIMPLEMENTED_MSG("Unimplemented wrap mode={}", static_cast<u32>(wrap_mode)); | 82 | UNIMPLEMENTED_MSG("Unimplemented wrap mode={}", wrap_mode); |
| 83 | return {}; | 83 | return {}; |
| 84 | } | 84 | } |
| 85 | } | 85 | } |
| @@ -103,8 +103,7 @@ VkCompareOp DepthCompareFunction(Tegra::Texture::DepthCompareFunc depth_compare_ | |||
| 103 | case Tegra::Texture::DepthCompareFunc::Always: | 103 | case Tegra::Texture::DepthCompareFunc::Always: |
| 104 | return VK_COMPARE_OP_ALWAYS; | 104 | return VK_COMPARE_OP_ALWAYS; |
| 105 | } | 105 | } |
| 106 | UNIMPLEMENTED_MSG("Unimplemented sampler depth compare function={}", | 106 | UNIMPLEMENTED_MSG("Unimplemented sampler depth compare function={}", depth_compare_func); |
| 107 | static_cast<u32>(depth_compare_func)); | ||
| 108 | return {}; | 107 | return {}; |
| 109 | } | 108 | } |
| 110 | 109 | ||
| @@ -228,8 +227,7 @@ FormatInfo SurfaceFormat(const VKDevice& device, FormatType format_type, PixelFo | |||
| 228 | 227 | ||
| 229 | auto tuple = tex_format_tuples[static_cast<std::size_t>(pixel_format)]; | 228 | auto tuple = tex_format_tuples[static_cast<std::size_t>(pixel_format)]; |
| 230 | if (tuple.format == VK_FORMAT_UNDEFINED) { | 229 | if (tuple.format == VK_FORMAT_UNDEFINED) { |
| 231 | UNIMPLEMENTED_MSG("Unimplemented texture format with pixel format={}", | 230 | UNIMPLEMENTED_MSG("Unimplemented texture format with pixel format={}", pixel_format); |
| 232 | static_cast<u32>(pixel_format)); | ||
| 233 | return {VK_FORMAT_A8B8G8R8_UNORM_PACK32, true, true}; | 231 | return {VK_FORMAT_A8B8G8R8_UNORM_PACK32, true, true}; |
| 234 | } | 232 | } |
| 235 | 233 | ||
| @@ -275,7 +273,7 @@ VkShaderStageFlagBits ShaderStage(Tegra::Engines::ShaderType stage) { | |||
| 275 | case Tegra::Engines::ShaderType::Compute: | 273 | case Tegra::Engines::ShaderType::Compute: |
| 276 | return VK_SHADER_STAGE_COMPUTE_BIT; | 274 | return VK_SHADER_STAGE_COMPUTE_BIT; |
| 277 | } | 275 | } |
| 278 | UNIMPLEMENTED_MSG("Unimplemented shader stage={}", static_cast<u32>(stage)); | 276 | UNIMPLEMENTED_MSG("Unimplemented shader stage={}", stage); |
| 279 | return {}; | 277 | return {}; |
| 280 | } | 278 | } |
| 281 | 279 | ||
| @@ -300,7 +298,7 @@ VkPrimitiveTopology PrimitiveTopology([[maybe_unused]] const VKDevice& device, | |||
| 300 | case Maxwell::PrimitiveTopology::Patches: | 298 | case Maxwell::PrimitiveTopology::Patches: |
| 301 | return VK_PRIMITIVE_TOPOLOGY_PATCH_LIST; | 299 | return VK_PRIMITIVE_TOPOLOGY_PATCH_LIST; |
| 302 | default: | 300 | default: |
| 303 | UNIMPLEMENTED_MSG("Unimplemented topology={}", static_cast<u32>(topology)); | 301 | UNIMPLEMENTED_MSG("Unimplemented topology={}", topology); |
| 304 | return {}; | 302 | return {}; |
| 305 | } | 303 | } |
| 306 | } | 304 | } |
| @@ -490,8 +488,7 @@ VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttrib | |||
| 490 | } | 488 | } |
| 491 | break; | 489 | break; |
| 492 | } | 490 | } |
| 493 | UNIMPLEMENTED_MSG("Unimplemented vertex format of type={} and size={}", static_cast<u32>(type), | 491 | UNIMPLEMENTED_MSG("Unimplemented vertex format of type={} and size={}", type, size); |
| 494 | static_cast<u32>(size)); | ||
| 495 | return {}; | 492 | return {}; |
| 496 | } | 493 | } |
| 497 | 494 | ||
| @@ -522,7 +519,7 @@ VkCompareOp ComparisonOp(Maxwell::ComparisonOp comparison) { | |||
| 522 | case Maxwell::ComparisonOp::AlwaysOld: | 519 | case Maxwell::ComparisonOp::AlwaysOld: |
| 523 | return VK_COMPARE_OP_ALWAYS; | 520 | return VK_COMPARE_OP_ALWAYS; |
| 524 | } | 521 | } |
| 525 | UNIMPLEMENTED_MSG("Unimplemented comparison op={}", static_cast<u32>(comparison)); | 522 | UNIMPLEMENTED_MSG("Unimplemented comparison op={}", comparison); |
| 526 | return {}; | 523 | return {}; |
| 527 | } | 524 | } |
| 528 | 525 | ||
| @@ -539,7 +536,7 @@ VkIndexType IndexFormat(const VKDevice& device, Maxwell::IndexFormat index_forma | |||
| 539 | case Maxwell::IndexFormat::UnsignedInt: | 536 | case Maxwell::IndexFormat::UnsignedInt: |
| 540 | return VK_INDEX_TYPE_UINT32; | 537 | return VK_INDEX_TYPE_UINT32; |
| 541 | } | 538 | } |
| 542 | UNIMPLEMENTED_MSG("Unimplemented index_format={}", static_cast<u32>(index_format)); | 539 | UNIMPLEMENTED_MSG("Unimplemented index_format={}", index_format); |
| 543 | return {}; | 540 | return {}; |
| 544 | } | 541 | } |
| 545 | 542 | ||
| @@ -570,7 +567,7 @@ VkStencilOp StencilOp(Maxwell::StencilOp stencil_op) { | |||
| 570 | case Maxwell::StencilOp::DecrWrapOGL: | 567 | case Maxwell::StencilOp::DecrWrapOGL: |
| 571 | return VK_STENCIL_OP_DECREMENT_AND_WRAP; | 568 | return VK_STENCIL_OP_DECREMENT_AND_WRAP; |
| 572 | } | 569 | } |
| 573 | UNIMPLEMENTED_MSG("Unimplemented stencil op={}", static_cast<u32>(stencil_op)); | 570 | UNIMPLEMENTED_MSG("Unimplemented stencil op={}", stencil_op); |
| 574 | return {}; | 571 | return {}; |
| 575 | } | 572 | } |
| 576 | 573 | ||
| @@ -592,7 +589,7 @@ VkBlendOp BlendEquation(Maxwell::Blend::Equation equation) { | |||
| 592 | case Maxwell::Blend::Equation::MaxGL: | 589 | case Maxwell::Blend::Equation::MaxGL: |
| 593 | return VK_BLEND_OP_MAX; | 590 | return VK_BLEND_OP_MAX; |
| 594 | } | 591 | } |
| 595 | UNIMPLEMENTED_MSG("Unimplemented blend equation={}", static_cast<u32>(equation)); | 592 | UNIMPLEMENTED_MSG("Unimplemented blend equation={}", equation); |
| 596 | return {}; | 593 | return {}; |
| 597 | } | 594 | } |
| 598 | 595 | ||
| @@ -656,7 +653,7 @@ VkBlendFactor BlendFactor(Maxwell::Blend::Factor factor) { | |||
| 656 | case Maxwell::Blend::Factor::OneMinusConstantAlphaGL: | 653 | case Maxwell::Blend::Factor::OneMinusConstantAlphaGL: |
| 657 | return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA; | 654 | return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA; |
| 658 | } | 655 | } |
| 659 | UNIMPLEMENTED_MSG("Unimplemented blend factor={}", static_cast<u32>(factor)); | 656 | UNIMPLEMENTED_MSG("Unimplemented blend factor={}", factor); |
| 660 | return {}; | 657 | return {}; |
| 661 | } | 658 | } |
| 662 | 659 | ||
| @@ -667,7 +664,7 @@ VkFrontFace FrontFace(Maxwell::FrontFace front_face) { | |||
| 667 | case Maxwell::FrontFace::CounterClockWise: | 664 | case Maxwell::FrontFace::CounterClockWise: |
| 668 | return VK_FRONT_FACE_COUNTER_CLOCKWISE; | 665 | return VK_FRONT_FACE_COUNTER_CLOCKWISE; |
| 669 | } | 666 | } |
| 670 | UNIMPLEMENTED_MSG("Unimplemented front face={}", static_cast<u32>(front_face)); | 667 | UNIMPLEMENTED_MSG("Unimplemented front face={}", front_face); |
| 671 | return {}; | 668 | return {}; |
| 672 | } | 669 | } |
| 673 | 670 | ||
| @@ -680,7 +677,7 @@ VkCullModeFlags CullFace(Maxwell::CullFace cull_face) { | |||
| 680 | case Maxwell::CullFace::FrontAndBack: | 677 | case Maxwell::CullFace::FrontAndBack: |
| 681 | return VK_CULL_MODE_FRONT_AND_BACK; | 678 | return VK_CULL_MODE_FRONT_AND_BACK; |
| 682 | } | 679 | } |
| 683 | UNIMPLEMENTED_MSG("Unimplemented cull face={}", static_cast<u32>(cull_face)); | 680 | UNIMPLEMENTED_MSG("Unimplemented cull face={}", cull_face); |
| 684 | return {}; | 681 | return {}; |
| 685 | } | 682 | } |
| 686 | 683 | ||
| @@ -700,7 +697,7 @@ VkComponentSwizzle SwizzleSource(Tegra::Texture::SwizzleSource swizzle) { | |||
| 700 | case Tegra::Texture::SwizzleSource::OneFloat: | 697 | case Tegra::Texture::SwizzleSource::OneFloat: |
| 701 | return VK_COMPONENT_SWIZZLE_ONE; | 698 | return VK_COMPONENT_SWIZZLE_ONE; |
| 702 | } | 699 | } |
| 703 | UNIMPLEMENTED_MSG("Unimplemented swizzle source={}", static_cast<u32>(swizzle)); | 700 | UNIMPLEMENTED_MSG("Unimplemented swizzle source={}", swizzle); |
| 704 | return {}; | 701 | return {}; |
| 705 | } | 702 | } |
| 706 | 703 | ||
| @@ -723,7 +720,7 @@ VkViewportCoordinateSwizzleNV ViewportSwizzle(Maxwell::ViewportSwizzle swizzle) | |||
| 723 | case Maxwell::ViewportSwizzle::NegativeW: | 720 | case Maxwell::ViewportSwizzle::NegativeW: |
| 724 | return VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV; | 721 | return VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV; |
| 725 | } | 722 | } |
| 726 | UNREACHABLE_MSG("Invalid swizzle={}", static_cast<int>(swizzle)); | 723 | UNREACHABLE_MSG("Invalid swizzle={}", swizzle); |
| 727 | return {}; | 724 | return {}; |
| 728 | } | 725 | } |
| 729 | 726 | ||
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index a2173edd2..ea4b7c1e6 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp | |||
| @@ -243,8 +243,8 @@ std::string BuildCommaSeparatedExtensions(std::vector<std::string> available_ext | |||
| 243 | RendererVulkan::RendererVulkan(Core::TelemetrySession& telemetry_session_, | 243 | RendererVulkan::RendererVulkan(Core::TelemetrySession& telemetry_session_, |
| 244 | Core::Frontend::EmuWindow& emu_window, | 244 | Core::Frontend::EmuWindow& emu_window, |
| 245 | Core::Memory::Memory& cpu_memory_, Tegra::GPU& gpu_, | 245 | Core::Memory::Memory& cpu_memory_, Tegra::GPU& gpu_, |
| 246 | std::unique_ptr<Core::Frontend::GraphicsContext> context) | 246 | std::unique_ptr<Core::Frontend::GraphicsContext> context_) |
| 247 | : RendererBase{emu_window, std::move(context)}, telemetry_session{telemetry_session_}, | 247 | : RendererBase{emu_window, std::move(context_)}, telemetry_session{telemetry_session_}, |
| 248 | cpu_memory{cpu_memory_}, gpu{gpu_} {} | 248 | cpu_memory{cpu_memory_}, gpu{gpu_} {} |
| 249 | 249 | ||
| 250 | RendererVulkan::~RendererVulkan() { | 250 | RendererVulkan::~RendererVulkan() { |
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.h b/src/video_core/renderer_vulkan/renderer_vulkan.h index 1044ca124..977b86003 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.h +++ b/src/video_core/renderer_vulkan/renderer_vulkan.h | |||
| @@ -45,9 +45,9 @@ struct VKScreenInfo { | |||
| 45 | class RendererVulkan final : public VideoCore::RendererBase { | 45 | class RendererVulkan final : public VideoCore::RendererBase { |
| 46 | public: | 46 | public: |
| 47 | explicit RendererVulkan(Core::TelemetrySession& telemtry_session, | 47 | explicit RendererVulkan(Core::TelemetrySession& telemtry_session, |
| 48 | Core::Frontend::EmuWindow& emu_window, Core::Memory::Memory& cpu_memory, | 48 | Core::Frontend::EmuWindow& emu_window, |
| 49 | Tegra::GPU& gpu, | 49 | Core::Memory::Memory& cpu_memory_, Tegra::GPU& gpu_, |
| 50 | std::unique_ptr<Core::Frontend::GraphicsContext> context); | 50 | std::unique_ptr<Core::Frontend::GraphicsContext> context_); |
| 51 | ~RendererVulkan() override; | 51 | ~RendererVulkan() override; |
| 52 | 52 | ||
| 53 | bool Init() override; | 53 | bool Init() override; |
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp index d9d3da9ea..444d3fb93 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp | |||
| @@ -38,13 +38,13 @@ std::unique_ptr<VKStreamBuffer> CreateStreamBuffer(const VKDevice& device, VKSch | |||
| 38 | } // Anonymous namespace | 38 | } // Anonymous namespace |
| 39 | 39 | ||
| 40 | Buffer::Buffer(const VKDevice& device, VKMemoryManager& memory_manager, VKScheduler& scheduler_, | 40 | Buffer::Buffer(const VKDevice& device, VKMemoryManager& memory_manager, VKScheduler& scheduler_, |
| 41 | VKStagingBufferPool& staging_pool_, VAddr cpu_addr, std::size_t size) | 41 | VKStagingBufferPool& staging_pool_, VAddr cpu_addr_, std::size_t size_) |
| 42 | : BufferBlock{cpu_addr, size}, scheduler{scheduler_}, staging_pool{staging_pool_} { | 42 | : BufferBlock{cpu_addr_, size_}, scheduler{scheduler_}, staging_pool{staging_pool_} { |
| 43 | const VkBufferCreateInfo ci{ | 43 | const VkBufferCreateInfo ci{ |
| 44 | .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, | 44 | .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, |
| 45 | .pNext = nullptr, | 45 | .pNext = nullptr, |
| 46 | .flags = 0, | 46 | .flags = 0, |
| 47 | .size = static_cast<VkDeviceSize>(size), | 47 | .size = static_cast<VkDeviceSize>(size_), |
| 48 | .usage = BUFFER_USAGE | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, | 48 | .usage = BUFFER_USAGE | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, |
| 49 | .sharingMode = VK_SHARING_MODE_EXCLUSIVE, | 49 | .sharingMode = VK_SHARING_MODE_EXCLUSIVE, |
| 50 | .queueFamilyIndexCount = 0, | 50 | .queueFamilyIndexCount = 0, |
| @@ -57,69 +57,71 @@ Buffer::Buffer(const VKDevice& device, VKMemoryManager& memory_manager, VKSchedu | |||
| 57 | 57 | ||
| 58 | Buffer::~Buffer() = default; | 58 | Buffer::~Buffer() = default; |
| 59 | 59 | ||
| 60 | void Buffer::Upload(std::size_t offset, std::size_t size, const u8* data) { | 60 | void Buffer::Upload(std::size_t offset, std::size_t data_size, const u8* data) { |
| 61 | const auto& staging = staging_pool.GetUnusedBuffer(size, true); | 61 | const auto& staging = staging_pool.GetUnusedBuffer(data_size, true); |
| 62 | std::memcpy(staging.commit->Map(size), data, size); | 62 | std::memcpy(staging.commit->Map(data_size), data, data_size); |
| 63 | 63 | ||
| 64 | scheduler.RequestOutsideRenderPassOperationContext(); | 64 | scheduler.RequestOutsideRenderPassOperationContext(); |
| 65 | 65 | ||
| 66 | const VkBuffer handle = Handle(); | 66 | const VkBuffer handle = Handle(); |
| 67 | scheduler.Record([staging = *staging.handle, handle, offset, size](vk::CommandBuffer cmdbuf) { | 67 | scheduler.Record( |
| 68 | cmdbuf.CopyBuffer(staging, handle, VkBufferCopy{0, offset, size}); | 68 | [staging = *staging.handle, handle, offset, data_size](vk::CommandBuffer cmdbuf) { |
| 69 | 69 | cmdbuf.CopyBuffer(staging, handle, VkBufferCopy{0, offset, data_size}); | |
| 70 | const VkBufferMemoryBarrier barrier{ | 70 | |
| 71 | .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, | 71 | const VkBufferMemoryBarrier barrier{ |
| 72 | .pNext = nullptr, | 72 | .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, |
| 73 | .srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT, | 73 | .pNext = nullptr, |
| 74 | .dstAccessMask = UPLOAD_ACCESS_BARRIERS, | 74 | .srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT, |
| 75 | .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, | 75 | .dstAccessMask = UPLOAD_ACCESS_BARRIERS, |
| 76 | .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, | 76 | .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, |
| 77 | .buffer = handle, | 77 | .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, |
| 78 | .offset = offset, | 78 | .buffer = handle, |
| 79 | .size = size, | 79 | .offset = offset, |
| 80 | }; | 80 | .size = data_size, |
| 81 | cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, UPLOAD_PIPELINE_STAGE, 0, {}, | 81 | }; |
| 82 | barrier, {}); | 82 | cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, UPLOAD_PIPELINE_STAGE, 0, {}, |
| 83 | }); | 83 | barrier, {}); |
| 84 | }); | ||
| 84 | } | 85 | } |
| 85 | 86 | ||
| 86 | void Buffer::Download(std::size_t offset, std::size_t size, u8* data) { | 87 | void Buffer::Download(std::size_t offset, std::size_t data_size, u8* data) { |
| 87 | const auto& staging = staging_pool.GetUnusedBuffer(size, true); | 88 | const auto& staging = staging_pool.GetUnusedBuffer(data_size, true); |
| 88 | scheduler.RequestOutsideRenderPassOperationContext(); | 89 | scheduler.RequestOutsideRenderPassOperationContext(); |
| 89 | 90 | ||
| 90 | const VkBuffer handle = Handle(); | 91 | const VkBuffer handle = Handle(); |
| 91 | scheduler.Record([staging = *staging.handle, handle, offset, size](vk::CommandBuffer cmdbuf) { | 92 | scheduler.Record( |
| 92 | const VkBufferMemoryBarrier barrier{ | 93 | [staging = *staging.handle, handle, offset, data_size](vk::CommandBuffer cmdbuf) { |
| 93 | .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, | 94 | const VkBufferMemoryBarrier barrier{ |
| 94 | .pNext = nullptr, | 95 | .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, |
| 95 | .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT, | 96 | .pNext = nullptr, |
| 96 | .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT, | 97 | .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT, |
| 97 | .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, | 98 | .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT, |
| 98 | .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, | 99 | .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, |
| 99 | .buffer = handle, | 100 | .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, |
| 100 | .offset = offset, | 101 | .buffer = handle, |
| 101 | .size = size, | 102 | .offset = offset, |
| 102 | }; | 103 | .size = data_size, |
| 103 | 104 | }; | |
| 104 | cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | | 105 | |
| 105 | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | | 106 | cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | |
| 106 | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, | 107 | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | |
| 107 | VK_PIPELINE_STAGE_TRANSFER_BIT, 0, {}, barrier, {}); | 108 | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, |
| 108 | cmdbuf.CopyBuffer(handle, staging, VkBufferCopy{offset, 0, size}); | 109 | VK_PIPELINE_STAGE_TRANSFER_BIT, 0, {}, barrier, {}); |
| 109 | }); | 110 | cmdbuf.CopyBuffer(handle, staging, VkBufferCopy{offset, 0, data_size}); |
| 111 | }); | ||
| 110 | scheduler.Finish(); | 112 | scheduler.Finish(); |
| 111 | 113 | ||
| 112 | std::memcpy(data, staging.commit->Map(size), size); | 114 | std::memcpy(data, staging.commit->Map(data_size), data_size); |
| 113 | } | 115 | } |
| 114 | 116 | ||
| 115 | void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, | 117 | void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, |
| 116 | std::size_t size) { | 118 | std::size_t copy_size) { |
| 117 | scheduler.RequestOutsideRenderPassOperationContext(); | 119 | scheduler.RequestOutsideRenderPassOperationContext(); |
| 118 | 120 | ||
| 119 | const VkBuffer dst_buffer = Handle(); | 121 | const VkBuffer dst_buffer = Handle(); |
| 120 | scheduler.Record([src_buffer = src.Handle(), dst_buffer, src_offset, dst_offset, | 122 | scheduler.Record([src_buffer = src.Handle(), dst_buffer, src_offset, dst_offset, |
| 121 | size](vk::CommandBuffer cmdbuf) { | 123 | copy_size](vk::CommandBuffer cmdbuf) { |
| 122 | cmdbuf.CopyBuffer(src_buffer, dst_buffer, VkBufferCopy{src_offset, dst_offset, size}); | 124 | cmdbuf.CopyBuffer(src_buffer, dst_buffer, VkBufferCopy{src_offset, dst_offset, copy_size}); |
| 123 | 125 | ||
| 124 | std::array<VkBufferMemoryBarrier, 2> barriers; | 126 | std::array<VkBufferMemoryBarrier, 2> barriers; |
| 125 | barriers[0].sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER; | 127 | barriers[0].sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER; |
| @@ -130,7 +132,7 @@ void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst | |||
| 130 | barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; | 132 | barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; |
| 131 | barriers[0].buffer = src_buffer; | 133 | barriers[0].buffer = src_buffer; |
| 132 | barriers[0].offset = src_offset; | 134 | barriers[0].offset = src_offset; |
| 133 | barriers[0].size = size; | 135 | barriers[0].size = copy_size; |
| 134 | barriers[1].sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER; | 136 | barriers[1].sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER; |
| 135 | barriers[1].pNext = nullptr; | 137 | barriers[1].pNext = nullptr; |
| 136 | barriers[1].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; | 138 | barriers[1].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; |
| @@ -139,19 +141,17 @@ void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst | |||
| 139 | barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; | 141 | barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; |
| 140 | barriers[1].buffer = dst_buffer; | 142 | barriers[1].buffer = dst_buffer; |
| 141 | barriers[1].offset = dst_offset; | 143 | barriers[1].offset = dst_offset; |
| 142 | barriers[1].size = size; | 144 | barriers[1].size = copy_size; |
| 143 | cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, UPLOAD_PIPELINE_STAGE, 0, {}, | 145 | cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, UPLOAD_PIPELINE_STAGE, 0, {}, |
| 144 | barriers, {}); | 146 | barriers, {}); |
| 145 | }); | 147 | }); |
| 146 | } | 148 | } |
| 147 | 149 | ||
| 148 | VKBufferCache::VKBufferCache(VideoCore::RasterizerInterface& rasterizer, | 150 | VKBufferCache::VKBufferCache(VideoCore::RasterizerInterface& rasterizer_, |
| 149 | Tegra::MemoryManager& gpu_memory, Core::Memory::Memory& cpu_memory, | 151 | Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_, |
| 150 | const VKDevice& device_, VKMemoryManager& memory_manager_, | 152 | const VKDevice& device_, VKMemoryManager& memory_manager_, |
| 151 | VKScheduler& scheduler_, VKStagingBufferPool& staging_pool_) | 153 | VKScheduler& scheduler_, VKStagingBufferPool& staging_pool_) |
| 152 | : VideoCommon::BufferCache<Buffer, VkBuffer, VKStreamBuffer>{rasterizer, gpu_memory, cpu_memory, | 154 | : BufferCache{rasterizer_, gpu_memory_, cpu_memory_, CreateStreamBuffer(device_, scheduler_)}, |
| 153 | CreateStreamBuffer(device_, | ||
| 154 | scheduler_)}, | ||
| 155 | device{device_}, memory_manager{memory_manager_}, scheduler{scheduler_}, staging_pool{ | 155 | device{device_}, memory_manager{memory_manager_}, scheduler{scheduler_}, staging_pool{ |
| 156 | staging_pool_} {} | 156 | staging_pool_} {} |
| 157 | 157 | ||
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.h b/src/video_core/renderer_vulkan/vk_buffer_cache.h index 7fb5ceedf..6008b8373 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.h +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.h | |||
| @@ -22,15 +22,15 @@ class VKScheduler; | |||
| 22 | class Buffer final : public VideoCommon::BufferBlock { | 22 | class Buffer final : public VideoCommon::BufferBlock { |
| 23 | public: | 23 | public: |
| 24 | explicit Buffer(const VKDevice& device, VKMemoryManager& memory_manager, VKScheduler& scheduler, | 24 | explicit Buffer(const VKDevice& device, VKMemoryManager& memory_manager, VKScheduler& scheduler, |
| 25 | VKStagingBufferPool& staging_pool, VAddr cpu_addr, std::size_t size); | 25 | VKStagingBufferPool& staging_pool, VAddr cpu_addr_, std::size_t size_); |
| 26 | ~Buffer(); | 26 | ~Buffer(); |
| 27 | 27 | ||
| 28 | void Upload(std::size_t offset, std::size_t size, const u8* data); | 28 | void Upload(std::size_t offset, std::size_t data_size, const u8* data); |
| 29 | 29 | ||
| 30 | void Download(std::size_t offset, std::size_t size, u8* data); | 30 | void Download(std::size_t offset, std::size_t data_size, u8* data); |
| 31 | 31 | ||
| 32 | void CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, | 32 | void CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, |
| 33 | std::size_t size); | 33 | std::size_t copy_size); |
| 34 | 34 | ||
| 35 | VkBuffer Handle() const { | 35 | VkBuffer Handle() const { |
| 36 | return *buffer.handle; | 36 | return *buffer.handle; |
| @@ -49,10 +49,10 @@ private: | |||
| 49 | 49 | ||
| 50 | class VKBufferCache final : public VideoCommon::BufferCache<Buffer, VkBuffer, VKStreamBuffer> { | 50 | class VKBufferCache final : public VideoCommon::BufferCache<Buffer, VkBuffer, VKStreamBuffer> { |
| 51 | public: | 51 | public: |
| 52 | explicit VKBufferCache(VideoCore::RasterizerInterface& rasterizer, | 52 | explicit VKBufferCache(VideoCore::RasterizerInterface& rasterizer_, |
| 53 | Tegra::MemoryManager& gpu_memory, Core::Memory::Memory& cpu_memory, | 53 | Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_, |
| 54 | const VKDevice& device, VKMemoryManager& memory_manager, | 54 | const VKDevice& device_, VKMemoryManager& memory_manager_, |
| 55 | VKScheduler& scheduler, VKStagingBufferPool& staging_pool); | 55 | VKScheduler& scheduler_, VKStagingBufferPool& staging_pool_); |
| 56 | ~VKBufferCache(); | 56 | ~VKBufferCache(); |
| 57 | 57 | ||
| 58 | BufferInfo GetEmptyBuffer(std::size_t size) override; | 58 | BufferInfo GetEmptyBuffer(std::size_t size) override; |
diff --git a/src/video_core/renderer_vulkan/vk_command_pool.cpp b/src/video_core/renderer_vulkan/vk_command_pool.cpp index 6339f4fe0..8f7d6410e 100644 --- a/src/video_core/renderer_vulkan/vk_command_pool.cpp +++ b/src/video_core/renderer_vulkan/vk_command_pool.cpp | |||
| @@ -17,8 +17,8 @@ struct CommandPool::Pool { | |||
| 17 | vk::CommandBuffers cmdbufs; | 17 | vk::CommandBuffers cmdbufs; |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | CommandPool::CommandPool(MasterSemaphore& master_semaphore, const VKDevice& device) | 20 | CommandPool::CommandPool(MasterSemaphore& master_semaphore_, const VKDevice& device_) |
| 21 | : ResourcePool(master_semaphore, COMMAND_BUFFER_POOL_SIZE), device{device} {} | 21 | : ResourcePool(master_semaphore_, COMMAND_BUFFER_POOL_SIZE), device{device_} {} |
| 22 | 22 | ||
| 23 | CommandPool::~CommandPool() = default; | 23 | CommandPool::~CommandPool() = default; |
| 24 | 24 | ||
diff --git a/src/video_core/renderer_vulkan/vk_command_pool.h b/src/video_core/renderer_vulkan/vk_command_pool.h index b9cb3fb5d..62a7ce3f1 100644 --- a/src/video_core/renderer_vulkan/vk_command_pool.h +++ b/src/video_core/renderer_vulkan/vk_command_pool.h | |||
| @@ -17,7 +17,7 @@ class VKDevice; | |||
| 17 | 17 | ||
| 18 | class CommandPool final : public ResourcePool { | 18 | class CommandPool final : public ResourcePool { |
| 19 | public: | 19 | public: |
| 20 | explicit CommandPool(MasterSemaphore& master_semaphore, const VKDevice& device); | 20 | explicit CommandPool(MasterSemaphore& master_semaphore_, const VKDevice& device_); |
| 21 | ~CommandPool() override; | 21 | ~CommandPool() override; |
| 22 | 22 | ||
| 23 | void Allocate(size_t begin, size_t end) override; | 23 | void Allocate(size_t begin, size_t end) override; |
diff --git a/src/video_core/renderer_vulkan/vk_compute_pass.cpp b/src/video_core/renderer_vulkan/vk_compute_pass.cpp index 9637c6059..1ac7e2a30 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pass.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pass.cpp | |||
| @@ -461,15 +461,15 @@ VkDescriptorSet VKComputePass::CommitDescriptorSet( | |||
| 461 | return set; | 461 | return set; |
| 462 | } | 462 | } |
| 463 | 463 | ||
| 464 | QuadArrayPass::QuadArrayPass(const VKDevice& device, VKScheduler& scheduler, | 464 | QuadArrayPass::QuadArrayPass(const VKDevice& device_, VKScheduler& scheduler_, |
| 465 | VKDescriptorPool& descriptor_pool, | 465 | VKDescriptorPool& descriptor_pool_, |
| 466 | VKStagingBufferPool& staging_buffer_pool, | 466 | VKStagingBufferPool& staging_buffer_pool_, |
| 467 | VKUpdateDescriptorQueue& update_descriptor_queue) | 467 | VKUpdateDescriptorQueue& update_descriptor_queue_) |
| 468 | : VKComputePass(device, descriptor_pool, BuildQuadArrayPassDescriptorSetLayoutBinding(), | 468 | : VKComputePass(device_, descriptor_pool_, BuildQuadArrayPassDescriptorSetLayoutBinding(), |
| 469 | BuildQuadArrayPassDescriptorUpdateTemplateEntry(), | 469 | BuildQuadArrayPassDescriptorUpdateTemplateEntry(), |
| 470 | BuildComputePushConstantRange(sizeof(u32)), std::size(quad_array), quad_array), | 470 | BuildComputePushConstantRange(sizeof(u32)), std::size(quad_array), quad_array), |
| 471 | scheduler{scheduler}, staging_buffer_pool{staging_buffer_pool}, | 471 | scheduler{scheduler_}, staging_buffer_pool{staging_buffer_pool_}, |
| 472 | update_descriptor_queue{update_descriptor_queue} {} | 472 | update_descriptor_queue{update_descriptor_queue_} {} |
| 473 | 473 | ||
| 474 | QuadArrayPass::~QuadArrayPass() = default; | 474 | QuadArrayPass::~QuadArrayPass() = default; |
| 475 | 475 | ||
| @@ -510,14 +510,14 @@ std::pair<VkBuffer, VkDeviceSize> QuadArrayPass::Assemble(u32 num_vertices, u32 | |||
| 510 | return {*buffer.handle, 0}; | 510 | return {*buffer.handle, 0}; |
| 511 | } | 511 | } |
| 512 | 512 | ||
| 513 | Uint8Pass::Uint8Pass(const VKDevice& device, VKScheduler& scheduler, | 513 | Uint8Pass::Uint8Pass(const VKDevice& device_, VKScheduler& scheduler_, |
| 514 | VKDescriptorPool& descriptor_pool, VKStagingBufferPool& staging_buffer_pool, | 514 | VKDescriptorPool& descriptor_pool_, VKStagingBufferPool& staging_buffer_pool_, |
| 515 | VKUpdateDescriptorQueue& update_descriptor_queue) | 515 | VKUpdateDescriptorQueue& update_descriptor_queue_) |
| 516 | : VKComputePass(device, descriptor_pool, BuildInputOutputDescriptorSetBindings(), | 516 | : VKComputePass(device_, descriptor_pool_, BuildInputOutputDescriptorSetBindings(), |
| 517 | BuildInputOutputDescriptorUpdateTemplate(), {}, std::size(uint8_pass), | 517 | BuildInputOutputDescriptorUpdateTemplate(), {}, std::size(uint8_pass), |
| 518 | uint8_pass), | 518 | uint8_pass), |
| 519 | scheduler{scheduler}, staging_buffer_pool{staging_buffer_pool}, | 519 | scheduler{scheduler_}, staging_buffer_pool{staging_buffer_pool_}, |
| 520 | update_descriptor_queue{update_descriptor_queue} {} | 520 | update_descriptor_queue{update_descriptor_queue_} {} |
| 521 | 521 | ||
| 522 | Uint8Pass::~Uint8Pass() = default; | 522 | Uint8Pass::~Uint8Pass() = default; |
| 523 | 523 | ||
| @@ -555,16 +555,16 @@ std::pair<VkBuffer, u64> Uint8Pass::Assemble(u32 num_vertices, VkBuffer src_buff | |||
| 555 | return {*buffer.handle, 0}; | 555 | return {*buffer.handle, 0}; |
| 556 | } | 556 | } |
| 557 | 557 | ||
| 558 | QuadIndexedPass::QuadIndexedPass(const VKDevice& device, VKScheduler& scheduler, | 558 | QuadIndexedPass::QuadIndexedPass(const VKDevice& device_, VKScheduler& scheduler_, |
| 559 | VKDescriptorPool& descriptor_pool, | 559 | VKDescriptorPool& descriptor_pool_, |
| 560 | VKStagingBufferPool& staging_buffer_pool, | 560 | VKStagingBufferPool& staging_buffer_pool_, |
| 561 | VKUpdateDescriptorQueue& update_descriptor_queue) | 561 | VKUpdateDescriptorQueue& update_descriptor_queue_) |
| 562 | : VKComputePass(device, descriptor_pool, BuildInputOutputDescriptorSetBindings(), | 562 | : VKComputePass(device_, descriptor_pool_, BuildInputOutputDescriptorSetBindings(), |
| 563 | BuildInputOutputDescriptorUpdateTemplate(), | 563 | BuildInputOutputDescriptorUpdateTemplate(), |
| 564 | BuildComputePushConstantRange(sizeof(u32) * 2), std::size(QUAD_INDEXED_SPV), | 564 | BuildComputePushConstantRange(sizeof(u32) * 2), std::size(QUAD_INDEXED_SPV), |
| 565 | QUAD_INDEXED_SPV), | 565 | QUAD_INDEXED_SPV), |
| 566 | scheduler{scheduler}, staging_buffer_pool{staging_buffer_pool}, | 566 | scheduler{scheduler_}, staging_buffer_pool{staging_buffer_pool_}, |
| 567 | update_descriptor_queue{update_descriptor_queue} {} | 567 | update_descriptor_queue{update_descriptor_queue_} {} |
| 568 | 568 | ||
| 569 | QuadIndexedPass::~QuadIndexedPass() = default; | 569 | QuadIndexedPass::~QuadIndexedPass() = default; |
| 570 | 570 | ||
diff --git a/src/video_core/renderer_vulkan/vk_compute_pass.h b/src/video_core/renderer_vulkan/vk_compute_pass.h index acc94f27e..2dc87902c 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pass.h +++ b/src/video_core/renderer_vulkan/vk_compute_pass.h | |||
| @@ -43,10 +43,10 @@ private: | |||
| 43 | 43 | ||
| 44 | class QuadArrayPass final : public VKComputePass { | 44 | class QuadArrayPass final : public VKComputePass { |
| 45 | public: | 45 | public: |
| 46 | explicit QuadArrayPass(const VKDevice& device, VKScheduler& scheduler, | 46 | explicit QuadArrayPass(const VKDevice& device_, VKScheduler& scheduler_, |
| 47 | VKDescriptorPool& descriptor_pool, | 47 | VKDescriptorPool& descriptor_pool_, |
| 48 | VKStagingBufferPool& staging_buffer_pool, | 48 | VKStagingBufferPool& staging_buffer_pool_, |
| 49 | VKUpdateDescriptorQueue& update_descriptor_queue); | 49 | VKUpdateDescriptorQueue& update_descriptor_queue_); |
| 50 | ~QuadArrayPass(); | 50 | ~QuadArrayPass(); |
| 51 | 51 | ||
| 52 | std::pair<VkBuffer, VkDeviceSize> Assemble(u32 num_vertices, u32 first); | 52 | std::pair<VkBuffer, VkDeviceSize> Assemble(u32 num_vertices, u32 first); |
| @@ -59,9 +59,10 @@ private: | |||
| 59 | 59 | ||
| 60 | class Uint8Pass final : public VKComputePass { | 60 | class Uint8Pass final : public VKComputePass { |
| 61 | public: | 61 | public: |
| 62 | explicit Uint8Pass(const VKDevice& device, VKScheduler& scheduler, | 62 | explicit Uint8Pass(const VKDevice& device_, VKScheduler& scheduler_, |
| 63 | VKDescriptorPool& descriptor_pool, VKStagingBufferPool& staging_buffer_pool, | 63 | VKDescriptorPool& descriptor_pool_, |
| 64 | VKUpdateDescriptorQueue& update_descriptor_queue); | 64 | VKStagingBufferPool& staging_buffer_pool_, |
| 65 | VKUpdateDescriptorQueue& update_descriptor_queue_); | ||
| 65 | ~Uint8Pass(); | 66 | ~Uint8Pass(); |
| 66 | 67 | ||
| 67 | std::pair<VkBuffer, u64> Assemble(u32 num_vertices, VkBuffer src_buffer, u64 src_offset); | 68 | std::pair<VkBuffer, u64> Assemble(u32 num_vertices, VkBuffer src_buffer, u64 src_offset); |
| @@ -74,10 +75,10 @@ private: | |||
| 74 | 75 | ||
| 75 | class QuadIndexedPass final : public VKComputePass { | 76 | class QuadIndexedPass final : public VKComputePass { |
| 76 | public: | 77 | public: |
| 77 | explicit QuadIndexedPass(const VKDevice& device, VKScheduler& scheduler, | 78 | explicit QuadIndexedPass(const VKDevice& device_, VKScheduler& scheduler_, |
| 78 | VKDescriptorPool& descriptor_pool, | 79 | VKDescriptorPool& descriptor_pool_, |
| 79 | VKStagingBufferPool& staging_buffer_pool, | 80 | VKStagingBufferPool& staging_buffer_pool_, |
| 80 | VKUpdateDescriptorQueue& update_descriptor_queue); | 81 | VKUpdateDescriptorQueue& update_descriptor_queue_); |
| 81 | ~QuadIndexedPass(); | 82 | ~QuadIndexedPass(); |
| 82 | 83 | ||
| 83 | std::pair<VkBuffer, u64> Assemble(Tegra::Engines::Maxwell3D::Regs::IndexFormat index_format, | 84 | std::pair<VkBuffer, u64> Assemble(Tegra::Engines::Maxwell3D::Regs::IndexFormat index_format, |
diff --git a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp index 9be72dc9b..62f44d6da 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp | |||
| @@ -15,16 +15,16 @@ | |||
| 15 | 15 | ||
| 16 | namespace Vulkan { | 16 | namespace Vulkan { |
| 17 | 17 | ||
| 18 | VKComputePipeline::VKComputePipeline(const VKDevice& device, VKScheduler& scheduler, | 18 | VKComputePipeline::VKComputePipeline(const VKDevice& device_, VKScheduler& scheduler_, |
| 19 | VKDescriptorPool& descriptor_pool, | 19 | VKDescriptorPool& descriptor_pool_, |
| 20 | VKUpdateDescriptorQueue& update_descriptor_queue, | 20 | VKUpdateDescriptorQueue& update_descriptor_queue_, |
| 21 | const SPIRVShader& shader) | 21 | const SPIRVShader& shader_) |
| 22 | : device{device}, scheduler{scheduler}, entries{shader.entries}, | 22 | : device{device_}, scheduler{scheduler_}, entries{shader_.entries}, |
| 23 | descriptor_set_layout{CreateDescriptorSetLayout()}, | 23 | descriptor_set_layout{CreateDescriptorSetLayout()}, |
| 24 | descriptor_allocator{descriptor_pool, *descriptor_set_layout}, | 24 | descriptor_allocator{descriptor_pool_, *descriptor_set_layout}, |
| 25 | update_descriptor_queue{update_descriptor_queue}, layout{CreatePipelineLayout()}, | 25 | update_descriptor_queue{update_descriptor_queue_}, layout{CreatePipelineLayout()}, |
| 26 | descriptor_template{CreateDescriptorUpdateTemplate()}, | 26 | descriptor_template{CreateDescriptorUpdateTemplate()}, |
| 27 | shader_module{CreateShaderModule(shader.code)}, pipeline{CreatePipeline()} {} | 27 | shader_module{CreateShaderModule(shader_.code)}, pipeline{CreatePipeline()} {} |
| 28 | 28 | ||
| 29 | VKComputePipeline::~VKComputePipeline() = default; | 29 | VKComputePipeline::~VKComputePipeline() = default; |
| 30 | 30 | ||
diff --git a/src/video_core/renderer_vulkan/vk_compute_pipeline.h b/src/video_core/renderer_vulkan/vk_compute_pipeline.h index 6e2f22a4a..49e2113a2 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pipeline.h +++ b/src/video_core/renderer_vulkan/vk_compute_pipeline.h | |||
| @@ -17,10 +17,10 @@ class VKUpdateDescriptorQueue; | |||
| 17 | 17 | ||
| 18 | class VKComputePipeline final { | 18 | class VKComputePipeline final { |
| 19 | public: | 19 | public: |
| 20 | explicit VKComputePipeline(const VKDevice& device, VKScheduler& scheduler, | 20 | explicit VKComputePipeline(const VKDevice& device_, VKScheduler& scheduler_, |
| 21 | VKDescriptorPool& descriptor_pool, | 21 | VKDescriptorPool& descriptor_pool_, |
| 22 | VKUpdateDescriptorQueue& update_descriptor_queue, | 22 | VKUpdateDescriptorQueue& update_descriptor_queue_, |
| 23 | const SPIRVShader& shader); | 23 | const SPIRVShader& shader_); |
| 24 | ~VKComputePipeline(); | 24 | ~VKComputePipeline(); |
| 25 | 25 | ||
| 26 | VkDescriptorSet CommitDescriptorSet(); | 26 | VkDescriptorSet CommitDescriptorSet(); |
diff --git a/src/video_core/renderer_vulkan/vk_device.cpp b/src/video_core/renderer_vulkan/vk_device.cpp index f34ed6735..ce3846195 100644 --- a/src/video_core/renderer_vulkan/vk_device.cpp +++ b/src/video_core/renderer_vulkan/vk_device.cpp | |||
| @@ -491,8 +491,8 @@ bool VKDevice::IsOptimalAstcSupported(const VkPhysicalDeviceFeatures& features) | |||
| 491 | VK_FORMAT_FEATURE_BLIT_DST_BIT | VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | | 491 | VK_FORMAT_FEATURE_BLIT_DST_BIT | VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | |
| 492 | VK_FORMAT_FEATURE_TRANSFER_DST_BIT}; | 492 | VK_FORMAT_FEATURE_TRANSFER_DST_BIT}; |
| 493 | for (const auto format : astc_formats) { | 493 | for (const auto format : astc_formats) { |
| 494 | const auto format_properties{physical.GetFormatProperties(format)}; | 494 | const auto physical_format_properties{physical.GetFormatProperties(format)}; |
| 495 | if (!(format_properties.optimalTilingFeatures & format_feature_usage)) { | 495 | if ((physical_format_properties.optimalTilingFeatures & format_feature_usage) == 0) { |
| 496 | return false; | 496 | return false; |
| 497 | } | 497 | } |
| 498 | } | 498 | } |
| @@ -644,8 +644,8 @@ std::vector<const char*> VKDevice::LoadExtensions() { | |||
| 644 | VkPhysicalDeviceFeatures2KHR features; | 644 | VkPhysicalDeviceFeatures2KHR features; |
| 645 | features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR; | 645 | features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR; |
| 646 | 646 | ||
| 647 | VkPhysicalDeviceProperties2KHR properties; | 647 | VkPhysicalDeviceProperties2KHR physical_properties; |
| 648 | properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR; | 648 | physical_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR; |
| 649 | 649 | ||
| 650 | if (has_khr_shader_float16_int8) { | 650 | if (has_khr_shader_float16_int8) { |
| 651 | VkPhysicalDeviceFloat16Int8FeaturesKHR float16_int8_features; | 651 | VkPhysicalDeviceFloat16Int8FeaturesKHR float16_int8_features; |
| @@ -670,8 +670,8 @@ std::vector<const char*> VKDevice::LoadExtensions() { | |||
| 670 | subgroup_properties.sType = | 670 | subgroup_properties.sType = |
| 671 | VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES_EXT; | 671 | VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES_EXT; |
| 672 | subgroup_properties.pNext = nullptr; | 672 | subgroup_properties.pNext = nullptr; |
| 673 | properties.pNext = &subgroup_properties; | 673 | physical_properties.pNext = &subgroup_properties; |
| 674 | physical.GetProperties2KHR(properties); | 674 | physical.GetProperties2KHR(physical_properties); |
| 675 | 675 | ||
| 676 | is_warp_potentially_bigger = subgroup_properties.maxSubgroupSize > GuestWarpSize; | 676 | is_warp_potentially_bigger = subgroup_properties.maxSubgroupSize > GuestWarpSize; |
| 677 | 677 | ||
| @@ -695,8 +695,8 @@ std::vector<const char*> VKDevice::LoadExtensions() { | |||
| 695 | VkPhysicalDeviceTransformFeedbackPropertiesEXT tfb_properties; | 695 | VkPhysicalDeviceTransformFeedbackPropertiesEXT tfb_properties; |
| 696 | tfb_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT; | 696 | tfb_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT; |
| 697 | tfb_properties.pNext = nullptr; | 697 | tfb_properties.pNext = nullptr; |
| 698 | properties.pNext = &tfb_properties; | 698 | physical_properties.pNext = &tfb_properties; |
| 699 | physical.GetProperties2KHR(properties); | 699 | physical.GetProperties2KHR(physical_properties); |
| 700 | 700 | ||
| 701 | if (tfb_features.transformFeedback && tfb_features.geometryStreams && | 701 | if (tfb_features.transformFeedback && tfb_features.geometryStreams && |
| 702 | tfb_properties.maxTransformFeedbackStreams >= 4 && | 702 | tfb_properties.maxTransformFeedbackStreams >= 4 && |
diff --git a/src/video_core/renderer_vulkan/vk_fence_manager.cpp b/src/video_core/renderer_vulkan/vk_fence_manager.cpp index 5babbdd0b..0bcaee714 100644 --- a/src/video_core/renderer_vulkan/vk_fence_manager.cpp +++ b/src/video_core/renderer_vulkan/vk_fence_manager.cpp | |||
| @@ -14,12 +14,13 @@ | |||
| 14 | 14 | ||
| 15 | namespace Vulkan { | 15 | namespace Vulkan { |
| 16 | 16 | ||
| 17 | InnerFence::InnerFence(const VKDevice& device, VKScheduler& scheduler, u32 payload, bool is_stubbed) | 17 | InnerFence::InnerFence(const VKDevice& device_, VKScheduler& scheduler_, u32 payload_, |
| 18 | : VideoCommon::FenceBase(payload, is_stubbed), device{device}, scheduler{scheduler} {} | 18 | bool is_stubbed_) |
| 19 | : FenceBase{payload_, is_stubbed_}, device{device_}, scheduler{scheduler_} {} | ||
| 19 | 20 | ||
| 20 | InnerFence::InnerFence(const VKDevice& device, VKScheduler& scheduler, GPUVAddr address, | 21 | InnerFence::InnerFence(const VKDevice& device_, VKScheduler& scheduler_, GPUVAddr address_, |
| 21 | u32 payload, bool is_stubbed) | 22 | u32 payload_, bool is_stubbed_) |
| 22 | : VideoCommon::FenceBase(address, payload, is_stubbed), device{device}, scheduler{scheduler} {} | 23 | : FenceBase{address_, payload_, is_stubbed_}, device{device_}, scheduler{scheduler_} {} |
| 23 | 24 | ||
| 24 | InnerFence::~InnerFence() = default; | 25 | InnerFence::~InnerFence() = default; |
| 25 | 26 | ||
| @@ -71,11 +72,12 @@ bool InnerFence::IsEventSignalled() const { | |||
| 71 | } | 72 | } |
| 72 | } | 73 | } |
| 73 | 74 | ||
| 74 | VKFenceManager::VKFenceManager(VideoCore::RasterizerInterface& rasterizer, Tegra::GPU& gpu, | 75 | VKFenceManager::VKFenceManager(VideoCore::RasterizerInterface& rasterizer_, Tegra::GPU& gpu_, |
| 75 | Tegra::MemoryManager& memory_manager, VKTextureCache& texture_cache, | 76 | Tegra::MemoryManager& memory_manager_, |
| 76 | VKBufferCache& buffer_cache, VKQueryCache& query_cache, | 77 | VKTextureCache& texture_cache_, VKBufferCache& buffer_cache_, |
| 77 | const VKDevice& device_, VKScheduler& scheduler_) | 78 | VKQueryCache& query_cache_, const VKDevice& device_, |
| 78 | : GenericFenceManager(rasterizer, gpu, texture_cache, buffer_cache, query_cache), | 79 | VKScheduler& scheduler_) |
| 80 | : GenericFenceManager{rasterizer_, gpu_, texture_cache_, buffer_cache_, query_cache_}, | ||
| 79 | device{device_}, scheduler{scheduler_} {} | 81 | device{device_}, scheduler{scheduler_} {} |
| 80 | 82 | ||
| 81 | Fence VKFenceManager::CreateFence(u32 value, bool is_stubbed) { | 83 | Fence VKFenceManager::CreateFence(u32 value, bool is_stubbed) { |
diff --git a/src/video_core/renderer_vulkan/vk_fence_manager.h b/src/video_core/renderer_vulkan/vk_fence_manager.h index 1547d6d30..c8547cc24 100644 --- a/src/video_core/renderer_vulkan/vk_fence_manager.h +++ b/src/video_core/renderer_vulkan/vk_fence_manager.h | |||
| @@ -28,10 +28,10 @@ class VKTextureCache; | |||
| 28 | 28 | ||
| 29 | class InnerFence : public VideoCommon::FenceBase { | 29 | class InnerFence : public VideoCommon::FenceBase { |
| 30 | public: | 30 | public: |
| 31 | explicit InnerFence(const VKDevice& device, VKScheduler& scheduler, u32 payload, | 31 | explicit InnerFence(const VKDevice& device_, VKScheduler& scheduler_, u32 payload_, |
| 32 | bool is_stubbed); | 32 | bool is_stubbed_); |
| 33 | explicit InnerFence(const VKDevice& device, VKScheduler& scheduler, GPUVAddr address, | 33 | explicit InnerFence(const VKDevice& device_, VKScheduler& scheduler_, GPUVAddr address_, |
| 34 | u32 payload, bool is_stubbed); | 34 | u32 payload_, bool is_stubbed_); |
| 35 | ~InnerFence(); | 35 | ~InnerFence(); |
| 36 | 36 | ||
| 37 | void Queue(); | 37 | void Queue(); |
| @@ -55,10 +55,10 @@ using GenericFenceManager = | |||
| 55 | 55 | ||
| 56 | class VKFenceManager final : public GenericFenceManager { | 56 | class VKFenceManager final : public GenericFenceManager { |
| 57 | public: | 57 | public: |
| 58 | explicit VKFenceManager(VideoCore::RasterizerInterface& rasterizer, Tegra::GPU& gpu, | 58 | explicit VKFenceManager(VideoCore::RasterizerInterface& rasterizer_, Tegra::GPU& gpu_, |
| 59 | Tegra::MemoryManager& memory_manager, VKTextureCache& texture_cache, | 59 | Tegra::MemoryManager& memory_manager_, VKTextureCache& texture_cache_, |
| 60 | VKBufferCache& buffer_cache, VKQueryCache& query_cache, | 60 | VKBufferCache& buffer_cache_, VKQueryCache& query_cache_, |
| 61 | const VKDevice& device, VKScheduler& scheduler); | 61 | const VKDevice& device_, VKScheduler& scheduler_); |
| 62 | 62 | ||
| 63 | protected: | 63 | protected: |
| 64 | Fence CreateFence(u32 value, bool is_stubbed) override; | 64 | Fence CreateFence(u32 value, bool is_stubbed) override; |
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 0e8f9c352..970979fa1 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |||
| @@ -71,21 +71,21 @@ VkViewportSwizzleNV UnpackViewportSwizzle(u16 swizzle) { | |||
| 71 | 71 | ||
| 72 | } // Anonymous namespace | 72 | } // Anonymous namespace |
| 73 | 73 | ||
| 74 | VKGraphicsPipeline::VKGraphicsPipeline(const VKDevice& device, VKScheduler& scheduler, | 74 | VKGraphicsPipeline::VKGraphicsPipeline(const VKDevice& device_, VKScheduler& scheduler_, |
| 75 | VKDescriptorPool& descriptor_pool, | 75 | VKDescriptorPool& descriptor_pool_, |
| 76 | VKUpdateDescriptorQueue& update_descriptor_queue, | 76 | VKUpdateDescriptorQueue& update_descriptor_queue_, |
| 77 | VKRenderPassCache& renderpass_cache, | 77 | VKRenderPassCache& renderpass_cache_, |
| 78 | const GraphicsPipelineCacheKey& key, | 78 | const GraphicsPipelineCacheKey& key_, |
| 79 | vk::Span<VkDescriptorSetLayoutBinding> bindings, | 79 | vk::Span<VkDescriptorSetLayoutBinding> bindings_, |
| 80 | const SPIRVProgram& program) | 80 | const SPIRVProgram& program_) |
| 81 | : device{device}, scheduler{scheduler}, cache_key{key}, hash{cache_key.Hash()}, | 81 | : device{device_}, scheduler{scheduler_}, cache_key{key_}, hash{cache_key.Hash()}, |
| 82 | descriptor_set_layout{CreateDescriptorSetLayout(bindings)}, | 82 | descriptor_set_layout{CreateDescriptorSetLayout(bindings_)}, |
| 83 | descriptor_allocator{descriptor_pool, *descriptor_set_layout}, | 83 | descriptor_allocator{descriptor_pool_, *descriptor_set_layout}, |
| 84 | update_descriptor_queue{update_descriptor_queue}, layout{CreatePipelineLayout()}, | 84 | update_descriptor_queue{update_descriptor_queue_}, layout{CreatePipelineLayout()}, |
| 85 | descriptor_template{CreateDescriptorUpdateTemplate(program)}, modules{CreateShaderModules( | 85 | descriptor_template{CreateDescriptorUpdateTemplate(program_)}, modules{CreateShaderModules( |
| 86 | program)}, | 86 | program_)}, |
| 87 | renderpass{renderpass_cache.GetRenderPass(cache_key.renderpass_params)}, | 87 | renderpass{renderpass_cache_.GetRenderPass(cache_key.renderpass_params)}, |
| 88 | pipeline{CreatePipeline(cache_key.renderpass_params, program)} {} | 88 | pipeline{CreatePipeline(cache_key.renderpass_params, program_)} {} |
| 89 | 89 | ||
| 90 | VKGraphicsPipeline::~VKGraphicsPipeline() = default; | 90 | VKGraphicsPipeline::~VKGraphicsPipeline() = default; |
| 91 | 91 | ||
| @@ -162,8 +162,8 @@ std::vector<vk::ShaderModule> VKGraphicsPipeline::CreateShaderModules( | |||
| 162 | .codeSize = 0, | 162 | .codeSize = 0, |
| 163 | }; | 163 | }; |
| 164 | 164 | ||
| 165 | std::vector<vk::ShaderModule> modules; | 165 | std::vector<vk::ShaderModule> shader_modules; |
| 166 | modules.reserve(Maxwell::MaxShaderStage); | 166 | shader_modules.reserve(Maxwell::MaxShaderStage); |
| 167 | for (std::size_t i = 0; i < Maxwell::MaxShaderStage; ++i) { | 167 | for (std::size_t i = 0; i < Maxwell::MaxShaderStage; ++i) { |
| 168 | const auto& stage = program[i]; | 168 | const auto& stage = program[i]; |
| 169 | if (!stage) { | 169 | if (!stage) { |
| @@ -174,9 +174,9 @@ std::vector<vk::ShaderModule> VKGraphicsPipeline::CreateShaderModules( | |||
| 174 | 174 | ||
| 175 | ci.codeSize = stage->code.size() * sizeof(u32); | 175 | ci.codeSize = stage->code.size() * sizeof(u32); |
| 176 | ci.pCode = stage->code.data(); | 176 | ci.pCode = stage->code.data(); |
| 177 | modules.push_back(device.GetLogical().CreateShaderModule(ci)); | 177 | shader_modules.push_back(device.GetLogical().CreateShaderModule(ci)); |
| 178 | } | 178 | } |
| 179 | return modules; | 179 | return shader_modules; |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | vk::Pipeline VKGraphicsPipeline::CreatePipeline(const RenderPassParams& renderpass_params, | 182 | vk::Pipeline VKGraphicsPipeline::CreatePipeline(const RenderPassParams& renderpass_params, |
| @@ -230,7 +230,7 @@ vk::Pipeline VKGraphicsPipeline::CreatePipeline(const RenderPassParams& renderpa | |||
| 230 | if (!attribute.enabled) { | 230 | if (!attribute.enabled) { |
| 231 | continue; | 231 | continue; |
| 232 | } | 232 | } |
| 233 | if (input_attributes.find(static_cast<u32>(index)) == input_attributes.end()) { | 233 | if (!input_attributes.contains(static_cast<u32>(index))) { |
| 234 | // Skip attributes not used by the vertex shaders. | 234 | // Skip attributes not used by the vertex shaders. |
| 235 | continue; | 235 | continue; |
| 236 | } | 236 | } |
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.h b/src/video_core/renderer_vulkan/vk_graphics_pipeline.h index 58aa35efd..3fb31d55a 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.h +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.h | |||
| @@ -51,13 +51,13 @@ using SPIRVProgram = std::array<std::optional<SPIRVShader>, Maxwell::MaxShaderSt | |||
| 51 | 51 | ||
| 52 | class VKGraphicsPipeline final { | 52 | class VKGraphicsPipeline final { |
| 53 | public: | 53 | public: |
| 54 | explicit VKGraphicsPipeline(const VKDevice& device, VKScheduler& scheduler, | 54 | explicit VKGraphicsPipeline(const VKDevice& device_, VKScheduler& scheduler_, |
| 55 | VKDescriptorPool& descriptor_pool, | 55 | VKDescriptorPool& descriptor_pool_, |
| 56 | VKUpdateDescriptorQueue& update_descriptor_queue, | 56 | VKUpdateDescriptorQueue& update_descriptor_queue_, |
| 57 | VKRenderPassCache& renderpass_cache, | 57 | VKRenderPassCache& renderpass_cache_, |
| 58 | const GraphicsPipelineCacheKey& key, | 58 | const GraphicsPipelineCacheKey& key_, |
| 59 | vk::Span<VkDescriptorSetLayoutBinding> bindings, | 59 | vk::Span<VkDescriptorSetLayoutBinding> bindings_, |
| 60 | const SPIRVProgram& program); | 60 | const SPIRVProgram& program_); |
| 61 | ~VKGraphicsPipeline(); | 61 | ~VKGraphicsPipeline(); |
| 62 | 62 | ||
| 63 | VkDescriptorSet CommitDescriptorSet(); | 63 | VkDescriptorSet CommitDescriptorSet(); |
diff --git a/src/video_core/renderer_vulkan/vk_image.cpp b/src/video_core/renderer_vulkan/vk_image.cpp index 1c418ea17..072d14e3b 100644 --- a/src/video_core/renderer_vulkan/vk_image.cpp +++ b/src/video_core/renderer_vulkan/vk_image.cpp | |||
| @@ -13,18 +13,18 @@ | |||
| 13 | 13 | ||
| 14 | namespace Vulkan { | 14 | namespace Vulkan { |
| 15 | 15 | ||
| 16 | VKImage::VKImage(const VKDevice& device, VKScheduler& scheduler, const VkImageCreateInfo& image_ci, | 16 | VKImage::VKImage(const VKDevice& device_, VKScheduler& scheduler_, |
| 17 | VkImageAspectFlags aspect_mask) | 17 | const VkImageCreateInfo& image_ci_, VkImageAspectFlags aspect_mask_) |
| 18 | : device{device}, scheduler{scheduler}, format{image_ci.format}, aspect_mask{aspect_mask}, | 18 | : device{device_}, scheduler{scheduler_}, format{image_ci_.format}, aspect_mask{aspect_mask_}, |
| 19 | image_num_layers{image_ci.arrayLayers}, image_num_levels{image_ci.mipLevels} { | 19 | image_num_layers{image_ci_.arrayLayers}, image_num_levels{image_ci_.mipLevels} { |
| 20 | UNIMPLEMENTED_IF_MSG(image_ci.queueFamilyIndexCount != 0, | 20 | UNIMPLEMENTED_IF_MSG(image_ci_.queueFamilyIndexCount != 0, |
| 21 | "Queue family tracking is not implemented"); | 21 | "Queue family tracking is not implemented"); |
| 22 | 22 | ||
| 23 | image = device.GetLogical().CreateImage(image_ci); | 23 | image = device_.GetLogical().CreateImage(image_ci_); |
| 24 | 24 | ||
| 25 | const u32 num_ranges = image_num_layers * image_num_levels; | 25 | const u32 num_ranges = image_num_layers * image_num_levels; |
| 26 | barriers.resize(num_ranges); | 26 | barriers.resize(num_ranges); |
| 27 | subrange_states.resize(num_ranges, {{}, image_ci.initialLayout}); | 27 | subrange_states.resize(num_ranges, {{}, image_ci_.initialLayout}); |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | VKImage::~VKImage() = default; | 30 | VKImage::~VKImage() = default; |
diff --git a/src/video_core/renderer_vulkan/vk_image.h b/src/video_core/renderer_vulkan/vk_image.h index b4d7229e5..287ab90ca 100644 --- a/src/video_core/renderer_vulkan/vk_image.h +++ b/src/video_core/renderer_vulkan/vk_image.h | |||
| @@ -17,8 +17,8 @@ class VKScheduler; | |||
| 17 | 17 | ||
| 18 | class VKImage { | 18 | class VKImage { |
| 19 | public: | 19 | public: |
| 20 | explicit VKImage(const VKDevice& device, VKScheduler& scheduler, | 20 | explicit VKImage(const VKDevice& device_, VKScheduler& scheduler_, |
| 21 | const VkImageCreateInfo& image_ci, VkImageAspectFlags aspect_mask); | 21 | const VkImageCreateInfo& image_ci_, VkImageAspectFlags aspect_mask_); |
| 22 | ~VKImage(); | 22 | ~VKImage(); |
| 23 | 23 | ||
| 24 | /// Records in the passed command buffer an image transition and updates the state of the image. | 24 | /// Records in the passed command buffer an image transition and updates the state of the image. |
diff --git a/src/video_core/renderer_vulkan/vk_memory_manager.cpp b/src/video_core/renderer_vulkan/vk_memory_manager.cpp index 24c8960ac..be53d450f 100644 --- a/src/video_core/renderer_vulkan/vk_memory_manager.cpp +++ b/src/video_core/renderer_vulkan/vk_memory_manager.cpp | |||
| @@ -29,10 +29,10 @@ u64 GetAllocationChunkSize(u64 required_size) { | |||
| 29 | 29 | ||
| 30 | class VKMemoryAllocation final { | 30 | class VKMemoryAllocation final { |
| 31 | public: | 31 | public: |
| 32 | explicit VKMemoryAllocation(const VKDevice& device, vk::DeviceMemory memory, | 32 | explicit VKMemoryAllocation(const VKDevice& device_, vk::DeviceMemory memory_, |
| 33 | VkMemoryPropertyFlags properties, u64 allocation_size, u32 type) | 33 | VkMemoryPropertyFlags properties_, u64 allocation_size_, u32 type_) |
| 34 | : device{device}, memory{std::move(memory)}, properties{properties}, | 34 | : device{device_}, memory{std::move(memory_)}, properties{properties_}, |
| 35 | allocation_size{allocation_size}, shifted_type{ShiftType(type)} {} | 35 | allocation_size{allocation_size_}, shifted_type{ShiftType(type_)} {} |
| 36 | 36 | ||
| 37 | VKMemoryCommit Commit(VkDeviceSize commit_size, VkDeviceSize alignment) { | 37 | VKMemoryCommit Commit(VkDeviceSize commit_size, VkDeviceSize alignment) { |
| 38 | auto found = TryFindFreeSection(free_iterator, allocation_size, | 38 | auto found = TryFindFreeSection(free_iterator, allocation_size, |
| @@ -117,8 +117,8 @@ private: | |||
| 117 | std::vector<const VKMemoryCommitImpl*> commits; | 117 | std::vector<const VKMemoryCommitImpl*> commits; |
| 118 | }; | 118 | }; |
| 119 | 119 | ||
| 120 | VKMemoryManager::VKMemoryManager(const VKDevice& device) | 120 | VKMemoryManager::VKMemoryManager(const VKDevice& device_) |
| 121 | : device{device}, properties{device.GetPhysical().GetMemoryProperties()} {} | 121 | : device{device_}, properties{device_.GetPhysical().GetMemoryProperties()} {} |
| 122 | 122 | ||
| 123 | VKMemoryManager::~VKMemoryManager() = default; | 123 | VKMemoryManager::~VKMemoryManager() = default; |
| 124 | 124 | ||
| @@ -207,9 +207,9 @@ VKMemoryCommit VKMemoryManager::TryAllocCommit(const VkMemoryRequirements& requi | |||
| 207 | return {}; | 207 | return {}; |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | VKMemoryCommitImpl::VKMemoryCommitImpl(const VKDevice& device, VKMemoryAllocation* allocation, | 210 | VKMemoryCommitImpl::VKMemoryCommitImpl(const VKDevice& device_, VKMemoryAllocation* allocation_, |
| 211 | const vk::DeviceMemory& memory, u64 begin, u64 end) | 211 | const vk::DeviceMemory& memory_, u64 begin_, u64 end_) |
| 212 | : device{device}, memory{memory}, interval{begin, end}, allocation{allocation} {} | 212 | : device{device_}, memory{memory_}, interval{begin_, end_}, allocation{allocation_} {} |
| 213 | 213 | ||
| 214 | VKMemoryCommitImpl::~VKMemoryCommitImpl() { | 214 | VKMemoryCommitImpl::~VKMemoryCommitImpl() { |
| 215 | allocation->Free(this); | 215 | allocation->Free(this); |
diff --git a/src/video_core/renderer_vulkan/vk_memory_manager.h b/src/video_core/renderer_vulkan/vk_memory_manager.h index 1af88e3d4..39f903ec8 100644 --- a/src/video_core/renderer_vulkan/vk_memory_manager.h +++ b/src/video_core/renderer_vulkan/vk_memory_manager.h | |||
| @@ -21,7 +21,7 @@ using VKMemoryCommit = std::unique_ptr<VKMemoryCommitImpl>; | |||
| 21 | 21 | ||
| 22 | class VKMemoryManager final { | 22 | class VKMemoryManager final { |
| 23 | public: | 23 | public: |
| 24 | explicit VKMemoryManager(const VKDevice& device); | 24 | explicit VKMemoryManager(const VKDevice& device_); |
| 25 | VKMemoryManager(const VKMemoryManager&) = delete; | 25 | VKMemoryManager(const VKMemoryManager&) = delete; |
| 26 | ~VKMemoryManager(); | 26 | ~VKMemoryManager(); |
| 27 | 27 | ||
| @@ -58,8 +58,8 @@ class VKMemoryCommitImpl final { | |||
| 58 | friend MemoryMap; | 58 | friend MemoryMap; |
| 59 | 59 | ||
| 60 | public: | 60 | public: |
| 61 | explicit VKMemoryCommitImpl(const VKDevice& device, VKMemoryAllocation* allocation, | 61 | explicit VKMemoryCommitImpl(const VKDevice& device_, VKMemoryAllocation* allocation_, |
| 62 | const vk::DeviceMemory& memory, u64 begin, u64 end); | 62 | const vk::DeviceMemory& memory_, u64 begin_, u64 end_); |
| 63 | ~VKMemoryCommitImpl(); | 63 | ~VKMemoryCommitImpl(); |
| 64 | 64 | ||
| 65 | /// Maps a memory region and returns a pointer to it. | 65 | /// Maps a memory region and returns a pointer to it. |
| @@ -93,8 +93,8 @@ private: | |||
| 93 | /// Holds ownership of a memory map. | 93 | /// Holds ownership of a memory map. |
| 94 | class MemoryMap final { | 94 | class MemoryMap final { |
| 95 | public: | 95 | public: |
| 96 | explicit MemoryMap(const VKMemoryCommitImpl* commit, u8* address) | 96 | explicit MemoryMap(const VKMemoryCommitImpl* commit_, u8* address_) |
| 97 | : commit{commit}, address{address} {} | 97 | : commit{commit_}, address{address_} {} |
| 98 | 98 | ||
| 99 | ~MemoryMap() { | 99 | ~MemoryMap() { |
| 100 | if (commit) { | 100 | if (commit) { |
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index df7e8c864..3fb264d03 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |||
| @@ -75,7 +75,7 @@ ShaderType GetShaderType(Maxwell::ShaderProgram program) { | |||
| 75 | case Maxwell::ShaderProgram::Fragment: | 75 | case Maxwell::ShaderProgram::Fragment: |
| 76 | return ShaderType::Fragment; | 76 | return ShaderType::Fragment; |
| 77 | default: | 77 | default: |
| 78 | UNIMPLEMENTED_MSG("program={}", static_cast<u32>(program)); | 78 | UNIMPLEMENTED_MSG("program={}", program); |
| 79 | return ShaderType::Vertex; | 79 | return ShaderType::Vertex; |
| 80 | } | 80 | } |
| 81 | } | 81 | } |
| @@ -136,26 +136,25 @@ bool ComputePipelineCacheKey::operator==(const ComputePipelineCacheKey& rhs) con | |||
| 136 | return std::memcmp(&rhs, this, sizeof *this) == 0; | 136 | return std::memcmp(&rhs, this, sizeof *this) == 0; |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | Shader::Shader(Tegra::Engines::ConstBufferEngineInterface& engine, Tegra::Engines::ShaderType stage, | 139 | Shader::Shader(Tegra::Engines::ConstBufferEngineInterface& engine_, ShaderType stage_, |
| 140 | GPUVAddr gpu_addr_, VAddr cpu_addr, VideoCommon::Shader::ProgramCode program_code_, | 140 | GPUVAddr gpu_addr_, VAddr cpu_addr_, ProgramCode program_code_, u32 main_offset_) |
| 141 | u32 main_offset) | 141 | : gpu_addr(gpu_addr_), program_code(std::move(program_code_)), registry(stage_, engine_), |
| 142 | : gpu_addr(gpu_addr_), program_code(std::move(program_code_)), registry(stage, engine), | 142 | shader_ir(program_code, main_offset_, compiler_settings, registry), |
| 143 | shader_ir(program_code, main_offset, compiler_settings, registry), | ||
| 144 | entries(GenerateShaderEntries(shader_ir)) {} | 143 | entries(GenerateShaderEntries(shader_ir)) {} |
| 145 | 144 | ||
| 146 | Shader::~Shader() = default; | 145 | Shader::~Shader() = default; |
| 147 | 146 | ||
| 148 | VKPipelineCache::VKPipelineCache(RasterizerVulkan& rasterizer, Tegra::GPU& gpu_, | 147 | VKPipelineCache::VKPipelineCache(RasterizerVulkan& rasterizer_, Tegra::GPU& gpu_, |
| 149 | Tegra::Engines::Maxwell3D& maxwell3d_, | 148 | Tegra::Engines::Maxwell3D& maxwell3d_, |
| 150 | Tegra::Engines::KeplerCompute& kepler_compute_, | 149 | Tegra::Engines::KeplerCompute& kepler_compute_, |
| 151 | Tegra::MemoryManager& gpu_memory_, const VKDevice& device_, | 150 | Tegra::MemoryManager& gpu_memory_, const VKDevice& device_, |
| 152 | VKScheduler& scheduler_, VKDescriptorPool& descriptor_pool_, | 151 | VKScheduler& scheduler_, VKDescriptorPool& descriptor_pool_, |
| 153 | VKUpdateDescriptorQueue& update_descriptor_queue_, | 152 | VKUpdateDescriptorQueue& update_descriptor_queue_, |
| 154 | VKRenderPassCache& renderpass_cache_) | 153 | VKRenderPassCache& renderpass_cache_) |
| 155 | : VideoCommon::ShaderCache<Shader>{rasterizer}, gpu{gpu_}, maxwell3d{maxwell3d_}, | 154 | : ShaderCache{rasterizer_}, gpu{gpu_}, maxwell3d{maxwell3d_}, kepler_compute{kepler_compute_}, |
| 156 | kepler_compute{kepler_compute_}, gpu_memory{gpu_memory_}, device{device_}, | 155 | gpu_memory{gpu_memory_}, device{device_}, scheduler{scheduler_}, |
| 157 | scheduler{scheduler_}, descriptor_pool{descriptor_pool_}, | 156 | descriptor_pool{descriptor_pool_}, update_descriptor_queue{update_descriptor_queue_}, |
| 158 | update_descriptor_queue{update_descriptor_queue_}, renderpass_cache{renderpass_cache_} {} | 157 | renderpass_cache{renderpass_cache_} {} |
| 159 | 158 | ||
| 160 | VKPipelineCache::~VKPipelineCache() = default; | 159 | VKPipelineCache::~VKPipelineCache() = default; |
| 161 | 160 | ||
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.h b/src/video_core/renderer_vulkan/vk_pipeline_cache.h index e558e6658..9e1f8fcbb 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.h +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.h | |||
| @@ -84,9 +84,9 @@ namespace Vulkan { | |||
| 84 | 84 | ||
| 85 | class Shader { | 85 | class Shader { |
| 86 | public: | 86 | public: |
| 87 | explicit Shader(Tegra::Engines::ConstBufferEngineInterface& engine, | 87 | explicit Shader(Tegra::Engines::ConstBufferEngineInterface& engine_, |
| 88 | Tegra::Engines::ShaderType stage, GPUVAddr gpu_addr, VAddr cpu_addr, | 88 | Tegra::Engines::ShaderType stage_, GPUVAddr gpu_addr, VAddr cpu_addr_, |
| 89 | VideoCommon::Shader::ProgramCode program_code, u32 main_offset); | 89 | VideoCommon::Shader::ProgramCode program_code, u32 main_offset_); |
| 90 | ~Shader(); | 90 | ~Shader(); |
| 91 | 91 | ||
| 92 | GPUVAddr GetGpuAddr() const { | 92 | GPUVAddr GetGpuAddr() const { |
| @@ -119,13 +119,13 @@ private: | |||
| 119 | 119 | ||
| 120 | class VKPipelineCache final : public VideoCommon::ShaderCache<Shader> { | 120 | class VKPipelineCache final : public VideoCommon::ShaderCache<Shader> { |
| 121 | public: | 121 | public: |
| 122 | explicit VKPipelineCache(RasterizerVulkan& rasterizer, Tegra::GPU& gpu, | 122 | explicit VKPipelineCache(RasterizerVulkan& rasterizer_, Tegra::GPU& gpu_, |
| 123 | Tegra::Engines::Maxwell3D& maxwell3d, | 123 | Tegra::Engines::Maxwell3D& maxwell3d_, |
| 124 | Tegra::Engines::KeplerCompute& kepler_compute, | 124 | Tegra::Engines::KeplerCompute& kepler_compute_, |
| 125 | Tegra::MemoryManager& gpu_memory, const VKDevice& device, | 125 | Tegra::MemoryManager& gpu_memory_, const VKDevice& device_, |
| 126 | VKScheduler& scheduler, VKDescriptorPool& descriptor_pool, | 126 | VKScheduler& scheduler_, VKDescriptorPool& descriptor_pool_, |
| 127 | VKUpdateDescriptorQueue& update_descriptor_queue, | 127 | VKUpdateDescriptorQueue& update_descriptor_queue_, |
| 128 | VKRenderPassCache& renderpass_cache); | 128 | VKRenderPassCache& renderpass_cache_); |
| 129 | ~VKPipelineCache() override; | 129 | ~VKPipelineCache() override; |
| 130 | 130 | ||
| 131 | std::array<Shader*, Maxwell::MaxShaderProgram> GetShaders(); | 131 | std::array<Shader*, Maxwell::MaxShaderProgram> GetShaders(); |
diff --git a/src/video_core/renderer_vulkan/vk_query_cache.cpp b/src/video_core/renderer_vulkan/vk_query_cache.cpp index ee2d871e3..038760de3 100644 --- a/src/video_core/renderer_vulkan/vk_query_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_query_cache.cpp | |||
| @@ -66,15 +66,13 @@ void QueryPool::Reserve(std::pair<VkQueryPool, u32> query) { | |||
| 66 | usage[pool_index * GROW_STEP + static_cast<std::ptrdiff_t>(query.second)] = false; | 66 | usage[pool_index * GROW_STEP + static_cast<std::ptrdiff_t>(query.second)] = false; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | VKQueryCache::VKQueryCache(VideoCore::RasterizerInterface& rasterizer, | 69 | VKQueryCache::VKQueryCache(VideoCore::RasterizerInterface& rasterizer_, |
| 70 | Tegra::Engines::Maxwell3D& maxwell3d, Tegra::MemoryManager& gpu_memory, | 70 | Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_, |
| 71 | const VKDevice& device, VKScheduler& scheduler) | 71 | const VKDevice& device_, VKScheduler& scheduler_) |
| 72 | : VideoCommon::QueryCacheBase<VKQueryCache, CachedQuery, CounterStream, | 72 | : QueryCacheBase{rasterizer_, maxwell3d_, gpu_memory_}, device{device_}, scheduler{scheduler_}, |
| 73 | HostCounter>{rasterizer, maxwell3d, gpu_memory}, | 73 | query_pools{ |
| 74 | device{device}, scheduler{scheduler}, query_pools{ | 74 | QueryPool{device_, scheduler_, QueryType::SamplesPassed}, |
| 75 | QueryPool{device, scheduler, | 75 | } {} |
| 76 | QueryType::SamplesPassed}, | ||
| 77 | } {} | ||
| 78 | 76 | ||
| 79 | VKQueryCache::~VKQueryCache() { | 77 | VKQueryCache::~VKQueryCache() { |
| 80 | // TODO(Rodrigo): This is a hack to destroy all HostCounter instances before the base class | 78 | // TODO(Rodrigo): This is a hack to destroy all HostCounter instances before the base class |
| @@ -95,12 +93,12 @@ void VKQueryCache::Reserve(QueryType type, std::pair<VkQueryPool, u32> query) { | |||
| 95 | query_pools[static_cast<std::size_t>(type)].Reserve(query); | 93 | query_pools[static_cast<std::size_t>(type)].Reserve(query); |
| 96 | } | 94 | } |
| 97 | 95 | ||
| 98 | HostCounter::HostCounter(VKQueryCache& cache, std::shared_ptr<HostCounter> dependency, | 96 | HostCounter::HostCounter(VKQueryCache& cache_, std::shared_ptr<HostCounter> dependency_, |
| 99 | QueryType type) | 97 | QueryType type_) |
| 100 | : VideoCommon::HostCounterBase<VKQueryCache, HostCounter>{std::move(dependency)}, cache{cache}, | 98 | : HostCounterBase{std::move(dependency_)}, cache{cache_}, type{type_}, |
| 101 | type{type}, query{cache.AllocateQuery(type)}, tick{cache.Scheduler().CurrentTick()} { | 99 | query{cache_.AllocateQuery(type_)}, tick{cache_.Scheduler().CurrentTick()} { |
| 102 | const vk::Device* logical = &cache.Device().GetLogical(); | 100 | const vk::Device* logical = &cache_.Device().GetLogical(); |
| 103 | cache.Scheduler().Record([logical, query = query](vk::CommandBuffer cmdbuf) { | 101 | cache_.Scheduler().Record([logical, query = query](vk::CommandBuffer cmdbuf) { |
| 104 | logical->ResetQueryPoolEXT(query.first, query.second, 1); | 102 | logical->ResetQueryPoolEXT(query.first, query.second, 1); |
| 105 | cmdbuf.BeginQuery(query.first, query.second, VK_QUERY_CONTROL_PRECISE_BIT); | 103 | cmdbuf.BeginQuery(query.first, query.second, VK_QUERY_CONTROL_PRECISE_BIT); |
| 106 | }); | 104 | }); |
| @@ -119,18 +117,20 @@ u64 HostCounter::BlockingQuery() const { | |||
| 119 | if (tick >= cache.Scheduler().CurrentTick()) { | 117 | if (tick >= cache.Scheduler().CurrentTick()) { |
| 120 | cache.Scheduler().Flush(); | 118 | cache.Scheduler().Flush(); |
| 121 | } | 119 | } |
| 120 | |||
| 122 | u64 data; | 121 | u64 data; |
| 123 | const VkResult result = cache.Device().GetLogical().GetQueryResults( | 122 | const VkResult query_result = cache.Device().GetLogical().GetQueryResults( |
| 124 | query.first, query.second, 1, sizeof(data), &data, sizeof(data), | 123 | query.first, query.second, 1, sizeof(data), &data, sizeof(data), |
| 125 | VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT); | 124 | VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT); |
| 126 | switch (result) { | 125 | |
| 126 | switch (query_result) { | ||
| 127 | case VK_SUCCESS: | 127 | case VK_SUCCESS: |
| 128 | return data; | 128 | return data; |
| 129 | case VK_ERROR_DEVICE_LOST: | 129 | case VK_ERROR_DEVICE_LOST: |
| 130 | cache.Device().ReportLoss(); | 130 | cache.Device().ReportLoss(); |
| 131 | [[fallthrough]]; | 131 | [[fallthrough]]; |
| 132 | default: | 132 | default: |
| 133 | throw vk::Exception(result); | 133 | throw vk::Exception(query_result); |
| 134 | } | 134 | } |
| 135 | } | 135 | } |
| 136 | 136 | ||
diff --git a/src/video_core/renderer_vulkan/vk_query_cache.h b/src/video_core/renderer_vulkan/vk_query_cache.h index 2e57fb75d..837fe9ebf 100644 --- a/src/video_core/renderer_vulkan/vk_query_cache.h +++ b/src/video_core/renderer_vulkan/vk_query_cache.h | |||
| @@ -53,9 +53,9 @@ private: | |||
| 53 | class VKQueryCache final | 53 | class VKQueryCache final |
| 54 | : public VideoCommon::QueryCacheBase<VKQueryCache, CachedQuery, CounterStream, HostCounter> { | 54 | : public VideoCommon::QueryCacheBase<VKQueryCache, CachedQuery, CounterStream, HostCounter> { |
| 55 | public: | 55 | public: |
| 56 | explicit VKQueryCache(VideoCore::RasterizerInterface& rasterizer, | 56 | explicit VKQueryCache(VideoCore::RasterizerInterface& rasterizer_, |
| 57 | Tegra::Engines::Maxwell3D& maxwell3d, Tegra::MemoryManager& gpu_memory, | 57 | Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_, |
| 58 | const VKDevice& device, VKScheduler& scheduler); | 58 | const VKDevice& device_, VKScheduler& scheduler_); |
| 59 | ~VKQueryCache(); | 59 | ~VKQueryCache(); |
| 60 | 60 | ||
| 61 | std::pair<VkQueryPool, u32> AllocateQuery(VideoCore::QueryType type); | 61 | std::pair<VkQueryPool, u32> AllocateQuery(VideoCore::QueryType type); |
| @@ -78,8 +78,8 @@ private: | |||
| 78 | 78 | ||
| 79 | class HostCounter final : public VideoCommon::HostCounterBase<VKQueryCache, HostCounter> { | 79 | class HostCounter final : public VideoCommon::HostCounterBase<VKQueryCache, HostCounter> { |
| 80 | public: | 80 | public: |
| 81 | explicit HostCounter(VKQueryCache& cache, std::shared_ptr<HostCounter> dependency, | 81 | explicit HostCounter(VKQueryCache& cache_, std::shared_ptr<HostCounter> dependency_, |
| 82 | VideoCore::QueryType type); | 82 | VideoCore::QueryType type_); |
| 83 | ~HostCounter(); | 83 | ~HostCounter(); |
| 84 | 84 | ||
| 85 | void EndQuery(); | 85 | void EndQuery(); |
| @@ -95,8 +95,8 @@ private: | |||
| 95 | 95 | ||
| 96 | class CachedQuery : public VideoCommon::CachedQueryBase<HostCounter> { | 96 | class CachedQuery : public VideoCommon::CachedQueryBase<HostCounter> { |
| 97 | public: | 97 | public: |
| 98 | explicit CachedQuery(VKQueryCache&, VideoCore::QueryType, VAddr cpu_addr, u8* host_ptr) | 98 | explicit CachedQuery(VKQueryCache&, VideoCore::QueryType, VAddr cpu_addr_, u8* host_ptr_) |
| 99 | : VideoCommon::CachedQueryBase<HostCounter>{cpu_addr, host_ptr} {} | 99 | : CachedQueryBase{cpu_addr_, host_ptr_} {} |
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| 102 | } // namespace Vulkan | 102 | } // namespace Vulkan |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index e0fb8693f..f93986aab 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -128,12 +128,12 @@ Tegra::Texture::FullTextureInfo GetTextureInfo(const Engine& engine, const Entry | |||
| 128 | const u32 offset_2 = entry.secondary_offset; | 128 | const u32 offset_2 = entry.secondary_offset; |
| 129 | const u32 handle_1 = engine.AccessConstBuffer32(stage_type, buffer_1, offset_1); | 129 | const u32 handle_1 = engine.AccessConstBuffer32(stage_type, buffer_1, offset_1); |
| 130 | const u32 handle_2 = engine.AccessConstBuffer32(stage_type, buffer_2, offset_2); | 130 | const u32 handle_2 = engine.AccessConstBuffer32(stage_type, buffer_2, offset_2); |
| 131 | return engine.GetTextureInfo(handle_1 | handle_2); | 131 | return engine.GetTextureInfo(Tegra::Texture::TextureHandle{handle_1 | handle_2}); |
| 132 | } | 132 | } |
| 133 | } | 133 | } |
| 134 | if (entry.is_bindless) { | 134 | if (entry.is_bindless) { |
| 135 | const auto tex_handle = engine.AccessConstBuffer32(stage_type, entry.buffer, entry.offset); | 135 | const auto tex_handle = engine.AccessConstBuffer32(stage_type, entry.buffer, entry.offset); |
| 136 | return engine.GetTextureInfo(tex_handle); | 136 | return engine.GetTextureInfo(Tegra::Texture::TextureHandle{tex_handle}); |
| 137 | } | 137 | } |
| 138 | const auto& gpu_profile = engine.AccessGuestDriverProfile(); | 138 | const auto& gpu_profile = engine.AccessGuestDriverProfile(); |
| 139 | const u32 entry_offset = static_cast<u32>(index * gpu_profile.GetTextureHandlerSize()); | 139 | const u32 entry_offset = static_cast<u32>(index * gpu_profile.GetTextureHandlerSize()); |
| @@ -380,12 +380,12 @@ void RasterizerVulkan::DrawParameters::Draw(vk::CommandBuffer cmdbuf) const { | |||
| 380 | } | 380 | } |
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | RasterizerVulkan::RasterizerVulkan(Core::Frontend::EmuWindow& emu_window, Tegra::GPU& gpu_, | 383 | RasterizerVulkan::RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, |
| 384 | Tegra::MemoryManager& gpu_memory_, | 384 | Tegra::MemoryManager& gpu_memory_, |
| 385 | Core::Memory::Memory& cpu_memory, VKScreenInfo& screen_info_, | 385 | Core::Memory::Memory& cpu_memory_, VKScreenInfo& screen_info_, |
| 386 | const VKDevice& device_, VKMemoryManager& memory_manager_, | 386 | const VKDevice& device_, VKMemoryManager& memory_manager_, |
| 387 | StateTracker& state_tracker_, VKScheduler& scheduler_) | 387 | StateTracker& state_tracker_, VKScheduler& scheduler_) |
| 388 | : RasterizerAccelerated(cpu_memory), gpu(gpu_), gpu_memory(gpu_memory_), | 388 | : RasterizerAccelerated(cpu_memory_), gpu(gpu_), gpu_memory(gpu_memory_), |
| 389 | maxwell3d(gpu.Maxwell3D()), kepler_compute(gpu.KeplerCompute()), screen_info(screen_info_), | 389 | maxwell3d(gpu.Maxwell3D()), kepler_compute(gpu.KeplerCompute()), screen_info(screen_info_), |
| 390 | device(device_), memory_manager(memory_manager_), state_tracker(state_tracker_), | 390 | device(device_), memory_manager(memory_manager_), state_tracker(state_tracker_), |
| 391 | scheduler(scheduler_), staging_pool(device, memory_manager, scheduler), | 391 | scheduler(scheduler_), staging_pool(device, memory_manager, scheduler), |
| @@ -397,11 +397,11 @@ RasterizerVulkan::RasterizerVulkan(Core::Frontend::EmuWindow& emu_window, Tegra: | |||
| 397 | texture_cache(*this, maxwell3d, gpu_memory, device, memory_manager, scheduler, staging_pool), | 397 | texture_cache(*this, maxwell3d, gpu_memory, device, memory_manager, scheduler, staging_pool), |
| 398 | pipeline_cache(*this, gpu, maxwell3d, kepler_compute, gpu_memory, device, scheduler, | 398 | pipeline_cache(*this, gpu, maxwell3d, kepler_compute, gpu_memory, device, scheduler, |
| 399 | descriptor_pool, update_descriptor_queue, renderpass_cache), | 399 | descriptor_pool, update_descriptor_queue, renderpass_cache), |
| 400 | buffer_cache(*this, gpu_memory, cpu_memory, device, memory_manager, scheduler, staging_pool), | 400 | buffer_cache(*this, gpu_memory, cpu_memory_, device, memory_manager, scheduler, staging_pool), |
| 401 | sampler_cache(device), query_cache(*this, maxwell3d, gpu_memory, device, scheduler), | 401 | sampler_cache(device), query_cache(*this, maxwell3d, gpu_memory, device, scheduler), |
| 402 | fence_manager(*this, gpu, gpu_memory, texture_cache, buffer_cache, query_cache, device, | 402 | fence_manager(*this, gpu, gpu_memory, texture_cache, buffer_cache, query_cache, device, |
| 403 | scheduler), | 403 | scheduler), |
| 404 | wfi_event(device.GetLogical().CreateEvent()), async_shaders(emu_window) { | 404 | wfi_event(device.GetLogical().CreateEvent()), async_shaders(emu_window_) { |
| 405 | scheduler.SetQueryCache(query_cache); | 405 | scheduler.SetQueryCache(query_cache); |
| 406 | if (device.UseAsynchronousShaders()) { | 406 | if (device.UseAsynchronousShaders()) { |
| 407 | async_shaders.AllocateWorkers(); | 407 | async_shaders.AllocateWorkers(); |
| @@ -904,15 +904,14 @@ void RasterizerVulkan::SetupShaderDescriptors( | |||
| 904 | texture_cache.GuardSamplers(false); | 904 | texture_cache.GuardSamplers(false); |
| 905 | } | 905 | } |
| 906 | 906 | ||
| 907 | void RasterizerVulkan::SetupImageTransitions( | 907 | void RasterizerVulkan::SetupImageTransitions(Texceptions texceptions, const ColorAttachments& color, |
| 908 | Texceptions texceptions, const std::array<View, Maxwell::NumRenderTargets>& color_attachments, | 908 | const ZetaAttachment& zeta) { |
| 909 | const View& zeta_attachment) { | ||
| 910 | TransitionImages(sampled_views, VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, VK_ACCESS_SHADER_READ_BIT); | 909 | TransitionImages(sampled_views, VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, VK_ACCESS_SHADER_READ_BIT); |
| 911 | TransitionImages(image_views, VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, | 910 | TransitionImages(image_views, VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, |
| 912 | VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT); | 911 | VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT); |
| 913 | 912 | ||
| 914 | for (std::size_t rt = 0; rt < std::size(color_attachments); ++rt) { | 913 | for (std::size_t rt = 0; rt < color.size(); ++rt) { |
| 915 | const auto color_attachment = color_attachments[rt]; | 914 | const auto color_attachment = color[rt]; |
| 916 | if (color_attachment == nullptr) { | 915 | if (color_attachment == nullptr) { |
| 917 | continue; | 916 | continue; |
| 918 | } | 917 | } |
| @@ -923,13 +922,13 @@ void RasterizerVulkan::SetupImageTransitions( | |||
| 923 | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT); | 922 | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT); |
| 924 | } | 923 | } |
| 925 | 924 | ||
| 926 | if (zeta_attachment != nullptr) { | 925 | if (zeta != nullptr) { |
| 927 | const auto image_layout = texceptions[ZETA_TEXCEPTION_INDEX] | 926 | const auto image_layout = texceptions[ZETA_TEXCEPTION_INDEX] |
| 928 | ? VK_IMAGE_LAYOUT_GENERAL | 927 | ? VK_IMAGE_LAYOUT_GENERAL |
| 929 | : VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; | 928 | : VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; |
| 930 | zeta_attachment->Transition(image_layout, VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, | 929 | zeta->Transition(image_layout, VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, |
| 931 | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | | 930 | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | |
| 932 | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT); | 931 | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT); |
| 933 | } | 932 | } |
| 934 | } | 933 | } |
| 935 | 934 | ||
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index 237e51fa4..30ec58eb4 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h | |||
| @@ -105,11 +105,11 @@ struct ImageView { | |||
| 105 | 105 | ||
| 106 | class RasterizerVulkan final : public VideoCore::RasterizerAccelerated { | 106 | class RasterizerVulkan final : public VideoCore::RasterizerAccelerated { |
| 107 | public: | 107 | public: |
| 108 | explicit RasterizerVulkan(Core::Frontend::EmuWindow& emu_window, Tegra::GPU& gpu, | 108 | explicit RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, |
| 109 | Tegra::MemoryManager& gpu_memory, Core::Memory::Memory& cpu_memory, | 109 | Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_, |
| 110 | VKScreenInfo& screen_info, const VKDevice& device, | 110 | VKScreenInfo& screen_info_, const VKDevice& device_, |
| 111 | VKMemoryManager& memory_manager, StateTracker& state_tracker, | 111 | VKMemoryManager& memory_manager_, StateTracker& state_tracker_, |
| 112 | VKScheduler& scheduler); | 112 | VKScheduler& scheduler_); |
| 113 | ~RasterizerVulkan() override; | 113 | ~RasterizerVulkan() override; |
| 114 | 114 | ||
| 115 | void Draw(bool is_indexed, bool is_instanced) override; | 115 | void Draw(bool is_indexed, bool is_instanced) override; |
| @@ -160,6 +160,9 @@ private: | |||
| 160 | bool is_indexed = 0; | 160 | bool is_indexed = 0; |
| 161 | }; | 161 | }; |
| 162 | 162 | ||
| 163 | using ColorAttachments = std::array<View, Maxwell::NumRenderTargets>; | ||
| 164 | using ZetaAttachment = View; | ||
| 165 | |||
| 163 | using Texceptions = std::bitset<Maxwell::NumRenderTargets + 1>; | 166 | using Texceptions = std::bitset<Maxwell::NumRenderTargets + 1>; |
| 164 | 167 | ||
| 165 | static constexpr std::size_t ZETA_TEXCEPTION_INDEX = 8; | 168 | static constexpr std::size_t ZETA_TEXCEPTION_INDEX = 8; |
| @@ -181,9 +184,8 @@ private: | |||
| 181 | /// Setup descriptors in the graphics pipeline. | 184 | /// Setup descriptors in the graphics pipeline. |
| 182 | void SetupShaderDescriptors(const std::array<Shader*, Maxwell::MaxShaderProgram>& shaders); | 185 | void SetupShaderDescriptors(const std::array<Shader*, Maxwell::MaxShaderProgram>& shaders); |
| 183 | 186 | ||
| 184 | void SetupImageTransitions(Texceptions texceptions, | 187 | void SetupImageTransitions(Texceptions texceptions, const ColorAttachments& color, |
| 185 | const std::array<View, Maxwell::NumRenderTargets>& color_attachments, | 188 | const ZetaAttachment& zeta); |
| 186 | const View& zeta_attachment); | ||
| 187 | 189 | ||
| 188 | void UpdateDynamicStates(); | 190 | void UpdateDynamicStates(); |
| 189 | 191 | ||
| @@ -308,8 +310,8 @@ private: | |||
| 308 | vk::Event wfi_event; | 310 | vk::Event wfi_event; |
| 309 | VideoCommon::Shader::AsyncShaders async_shaders; | 311 | VideoCommon::Shader::AsyncShaders async_shaders; |
| 310 | 312 | ||
| 311 | std::array<View, Maxwell::NumRenderTargets> color_attachments; | 313 | ColorAttachments color_attachments; |
| 312 | View zeta_attachment; | 314 | ZetaAttachment zeta_attachment; |
| 313 | 315 | ||
| 314 | std::vector<ImageView> sampled_views; | 316 | std::vector<ImageView> sampled_views; |
| 315 | std::vector<ImageView> image_views; | 317 | std::vector<ImageView> image_views; |
diff --git a/src/video_core/renderer_vulkan/vk_renderpass_cache.cpp b/src/video_core/renderer_vulkan/vk_renderpass_cache.cpp index 80284cf92..e812c7dd6 100644 --- a/src/video_core/renderer_vulkan/vk_renderpass_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_renderpass_cache.cpp | |||
| @@ -24,7 +24,7 @@ bool RenderPassParams::operator==(const RenderPassParams& rhs) const noexcept { | |||
| 24 | return std::memcmp(&rhs, this, sizeof *this) == 0; | 24 | return std::memcmp(&rhs, this, sizeof *this) == 0; |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | VKRenderPassCache::VKRenderPassCache(const VKDevice& device) : device{device} {} | 27 | VKRenderPassCache::VKRenderPassCache(const VKDevice& device_) : device{device_} {} |
| 28 | 28 | ||
| 29 | VKRenderPassCache::~VKRenderPassCache() = default; | 29 | VKRenderPassCache::~VKRenderPassCache() = default; |
| 30 | 30 | ||
diff --git a/src/video_core/renderer_vulkan/vk_renderpass_cache.h b/src/video_core/renderer_vulkan/vk_renderpass_cache.h index 8b0fec720..652ecef7b 100644 --- a/src/video_core/renderer_vulkan/vk_renderpass_cache.h +++ b/src/video_core/renderer_vulkan/vk_renderpass_cache.h | |||
| @@ -55,7 +55,7 @@ namespace Vulkan { | |||
| 55 | 55 | ||
| 56 | class VKRenderPassCache final { | 56 | class VKRenderPassCache final { |
| 57 | public: | 57 | public: |
| 58 | explicit VKRenderPassCache(const VKDevice& device); | 58 | explicit VKRenderPassCache(const VKDevice& device_); |
| 59 | ~VKRenderPassCache(); | 59 | ~VKRenderPassCache(); |
| 60 | 60 | ||
| 61 | VkRenderPass GetRenderPass(const RenderPassParams& params); | 61 | VkRenderPass GetRenderPass(const RenderPassParams& params); |
diff --git a/src/video_core/renderer_vulkan/vk_sampler_cache.cpp b/src/video_core/renderer_vulkan/vk_sampler_cache.cpp index b068888f9..b859691fa 100644 --- a/src/video_core/renderer_vulkan/vk_sampler_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_sampler_cache.cpp | |||
| @@ -36,7 +36,7 @@ VkBorderColor ConvertBorderColor(std::array<float, 4> color) { | |||
| 36 | 36 | ||
| 37 | } // Anonymous namespace | 37 | } // Anonymous namespace |
| 38 | 38 | ||
| 39 | VKSamplerCache::VKSamplerCache(const VKDevice& device) : device{device} {} | 39 | VKSamplerCache::VKSamplerCache(const VKDevice& device_) : device{device_} {} |
| 40 | 40 | ||
| 41 | VKSamplerCache::~VKSamplerCache() = default; | 41 | VKSamplerCache::~VKSamplerCache() = default; |
| 42 | 42 | ||
diff --git a/src/video_core/renderer_vulkan/vk_sampler_cache.h b/src/video_core/renderer_vulkan/vk_sampler_cache.h index a33d1c0ee..3f22c4610 100644 --- a/src/video_core/renderer_vulkan/vk_sampler_cache.h +++ b/src/video_core/renderer_vulkan/vk_sampler_cache.h | |||
| @@ -14,7 +14,7 @@ class VKDevice; | |||
| 14 | 14 | ||
| 15 | class VKSamplerCache final : public VideoCommon::SamplerCache<VkSampler, vk::Sampler> { | 15 | class VKSamplerCache final : public VideoCommon::SamplerCache<VkSampler, vk::Sampler> { |
| 16 | public: | 16 | public: |
| 17 | explicit VKSamplerCache(const VKDevice& device); | 17 | explicit VKSamplerCache(const VKDevice& device_); |
| 18 | ~VKSamplerCache(); | 18 | ~VKSamplerCache(); |
| 19 | 19 | ||
| 20 | protected: | 20 | protected: |
diff --git a/src/video_core/renderer_vulkan/vk_scheduler.h b/src/video_core/renderer_vulkan/vk_scheduler.h index 7be8a19f0..6d3a5da0b 100644 --- a/src/video_core/renderer_vulkan/vk_scheduler.h +++ b/src/video_core/renderer_vulkan/vk_scheduler.h | |||
| @@ -104,7 +104,7 @@ private: | |||
| 104 | template <typename T> | 104 | template <typename T> |
| 105 | class TypedCommand final : public Command { | 105 | class TypedCommand final : public Command { |
| 106 | public: | 106 | public: |
| 107 | explicit TypedCommand(T&& command) : command{std::move(command)} {} | 107 | explicit TypedCommand(T&& command_) : command{std::move(command_)} {} |
| 108 | ~TypedCommand() override = default; | 108 | ~TypedCommand() override = default; |
| 109 | 109 | ||
| 110 | TypedCommand(TypedCommand&&) = delete; | 110 | TypedCommand(TypedCommand&&) = delete; |
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp index fed9ebecd..ca12b3793 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | |||
| @@ -55,8 +55,8 @@ enum class Type { Void, Bool, Bool2, Float, Int, Uint, HalfFloat }; | |||
| 55 | 55 | ||
| 56 | class Expression final { | 56 | class Expression final { |
| 57 | public: | 57 | public: |
| 58 | Expression(Id id, Type type) : id{id}, type{type} { | 58 | Expression(Id id_, Type type_) : id{id_}, type{type_} { |
| 59 | ASSERT(type != Type::Void); | 59 | ASSERT(type_ != Type::Void); |
| 60 | } | 60 | } |
| 61 | Expression() : type{Type::Void} {} | 61 | Expression() : type{Type::Void} {} |
| 62 | 62 | ||
| @@ -114,7 +114,7 @@ spv::Dim GetSamplerDim(const Sampler& sampler) { | |||
| 114 | case Tegra::Shader::TextureType::TextureCube: | 114 | case Tegra::Shader::TextureType::TextureCube: |
| 115 | return spv::Dim::Cube; | 115 | return spv::Dim::Cube; |
| 116 | default: | 116 | default: |
| 117 | UNIMPLEMENTED_MSG("Unimplemented sampler type={}", static_cast<int>(sampler.type)); | 117 | UNIMPLEMENTED_MSG("Unimplemented sampler type={}", sampler.type); |
| 118 | return spv::Dim::Dim2D; | 118 | return spv::Dim::Dim2D; |
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| @@ -134,7 +134,7 @@ std::pair<spv::Dim, bool> GetImageDim(const Image& image) { | |||
| 134 | case Tegra::Shader::ImageType::Texture3D: | 134 | case Tegra::Shader::ImageType::Texture3D: |
| 135 | return {spv::Dim::Dim3D, false}; | 135 | return {spv::Dim::Dim3D, false}; |
| 136 | default: | 136 | default: |
| 137 | UNIMPLEMENTED_MSG("Unimplemented image type={}", static_cast<int>(image.type)); | 137 | UNIMPLEMENTED_MSG("Unimplemented image type={}", image.type); |
| 138 | return {spv::Dim::Dim2D, false}; | 138 | return {spv::Dim::Dim2D, false}; |
| 139 | } | 139 | } |
| 140 | } | 140 | } |
| @@ -281,12 +281,12 @@ u32 ShaderVersion(const VKDevice& device) { | |||
| 281 | 281 | ||
| 282 | class SPIRVDecompiler final : public Sirit::Module { | 282 | class SPIRVDecompiler final : public Sirit::Module { |
| 283 | public: | 283 | public: |
| 284 | explicit SPIRVDecompiler(const VKDevice& device, const ShaderIR& ir, ShaderType stage, | 284 | explicit SPIRVDecompiler(const VKDevice& device_, const ShaderIR& ir_, ShaderType stage_, |
| 285 | const Registry& registry, const Specialization& specialization) | 285 | const Registry& registry_, const Specialization& specialization_) |
| 286 | : Module(ShaderVersion(device)), device{device}, ir{ir}, stage{stage}, | 286 | : Module(ShaderVersion(device_)), device{device_}, ir{ir_}, stage{stage_}, |
| 287 | header{ir.GetHeader()}, registry{registry}, specialization{specialization} { | 287 | header{ir_.GetHeader()}, registry{registry_}, specialization{specialization_} { |
| 288 | if (stage != ShaderType::Compute) { | 288 | if (stage_ != ShaderType::Compute) { |
| 289 | transform_feedback = BuildTransformFeedback(registry.GetGraphicsInfo()); | 289 | transform_feedback = BuildTransformFeedback(registry_.GetGraphicsInfo()); |
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | AddCapability(spv::Capability::Shader); | 292 | AddCapability(spv::Capability::Shader); |
| @@ -330,7 +330,7 @@ public: | |||
| 330 | if (device.IsFloat16Supported()) { | 330 | if (device.IsFloat16Supported()) { |
| 331 | AddCapability(spv::Capability::Float16); | 331 | AddCapability(spv::Capability::Float16); |
| 332 | } | 332 | } |
| 333 | t_scalar_half = Name(TypeFloat(device.IsFloat16Supported() ? 16 : 32), "scalar_half"); | 333 | t_scalar_half = Name(TypeFloat(device_.IsFloat16Supported() ? 16 : 32), "scalar_half"); |
| 334 | t_half = Name(TypeVector(t_scalar_half, 2), "half"); | 334 | t_half = Name(TypeVector(t_scalar_half, 2), "half"); |
| 335 | 335 | ||
| 336 | const Id main = Decompile(); | 336 | const Id main = Decompile(); |
| @@ -1088,9 +1088,9 @@ private: | |||
| 1088 | indices.point_size = AddBuiltIn(t_float, spv::BuiltIn::PointSize, "point_size"); | 1088 | indices.point_size = AddBuiltIn(t_float, spv::BuiltIn::PointSize, "point_size"); |
| 1089 | } | 1089 | } |
| 1090 | 1090 | ||
| 1091 | const auto& output_attributes = ir.GetOutputAttributes(); | 1091 | const auto& ir_output_attributes = ir.GetOutputAttributes(); |
| 1092 | const bool declare_clip_distances = | 1092 | const bool declare_clip_distances = std::any_of( |
| 1093 | std::any_of(output_attributes.begin(), output_attributes.end(), [](const auto& index) { | 1093 | ir_output_attributes.begin(), ir_output_attributes.end(), [](const auto& index) { |
| 1094 | return index == Attribute::Index::ClipDistances0123 || | 1094 | return index == Attribute::Index::ClipDistances0123 || |
| 1095 | index == Attribute::Index::ClipDistances4567; | 1095 | index == Attribute::Index::ClipDistances4567; |
| 1096 | }); | 1096 | }); |
| @@ -1254,7 +1254,7 @@ private: | |||
| 1254 | const Id pointer = ArrayPass(type_descriptor.scalar, attribute_id, elements); | 1254 | const Id pointer = ArrayPass(type_descriptor.scalar, attribute_id, elements); |
| 1255 | return {OpLoad(GetTypeDefinition(type), pointer), type}; | 1255 | return {OpLoad(GetTypeDefinition(type), pointer), type}; |
| 1256 | } | 1256 | } |
| 1257 | UNIMPLEMENTED_MSG("Unhandled input attribute: {}", static_cast<u32>(attribute)); | 1257 | UNIMPLEMENTED_MSG("Unhandled input attribute: {}", attribute); |
| 1258 | return {v_float_zero, Type::Float}; | 1258 | return {v_float_zero, Type::Float}; |
| 1259 | } | 1259 | } |
| 1260 | 1260 | ||
| @@ -1890,7 +1890,7 @@ private: | |||
| 1890 | case Tegra::Shader::TextureType::Texture3D: | 1890 | case Tegra::Shader::TextureType::Texture3D: |
| 1891 | return 3; | 1891 | return 3; |
| 1892 | default: | 1892 | default: |
| 1893 | UNREACHABLE_MSG("Invalid texture type={}", static_cast<int>(type)); | 1893 | UNREACHABLE_MSG("Invalid texture type={}", type); |
| 1894 | return 2; | 1894 | return 2; |
| 1895 | } | 1895 | } |
| 1896 | }(); | 1896 | }(); |
| @@ -2125,8 +2125,7 @@ private: | |||
| 2125 | OpStore(z_pointer, depth); | 2125 | OpStore(z_pointer, depth); |
| 2126 | } | 2126 | } |
| 2127 | if (stage == ShaderType::Fragment) { | 2127 | if (stage == ShaderType::Fragment) { |
| 2128 | const auto SafeGetRegister = [&](u32 reg) { | 2128 | const auto SafeGetRegister = [this](u32 reg) { |
| 2129 | // TODO(Rodrigo): Replace with contains once C++20 releases | ||
| 2130 | if (const auto it = registers.find(reg); it != registers.end()) { | 2129 | if (const auto it = registers.find(reg); it != registers.end()) { |
| 2131 | return OpLoad(t_float, it->second); | 2130 | return OpLoad(t_float, it->second); |
| 2132 | } | 2131 | } |
| @@ -2891,7 +2890,7 @@ private: | |||
| 2891 | 2890 | ||
| 2892 | class ExprDecompiler { | 2891 | class ExprDecompiler { |
| 2893 | public: | 2892 | public: |
| 2894 | explicit ExprDecompiler(SPIRVDecompiler& decomp) : decomp{decomp} {} | 2893 | explicit ExprDecompiler(SPIRVDecompiler& decomp_) : decomp{decomp_} {} |
| 2895 | 2894 | ||
| 2896 | Id operator()(const ExprAnd& expr) { | 2895 | Id operator()(const ExprAnd& expr) { |
| 2897 | const Id type_def = decomp.GetTypeDefinition(Type::Bool); | 2896 | const Id type_def = decomp.GetTypeDefinition(Type::Bool); |
| @@ -2947,7 +2946,7 @@ private: | |||
| 2947 | 2946 | ||
| 2948 | class ASTDecompiler { | 2947 | class ASTDecompiler { |
| 2949 | public: | 2948 | public: |
| 2950 | explicit ASTDecompiler(SPIRVDecompiler& decomp) : decomp{decomp} {} | 2949 | explicit ASTDecompiler(SPIRVDecompiler& decomp_) : decomp{decomp_} {} |
| 2951 | 2950 | ||
| 2952 | void operator()(const ASTProgram& ast) { | 2951 | void operator()(const ASTProgram& ast) { |
| 2953 | ASTNode current = ast.nodes.GetFirst(); | 2952 | ASTNode current = ast.nodes.GetFirst(); |
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.h b/src/video_core/renderer_vulkan/vk_shader_decompiler.h index 110848922..df1812514 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.h +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.h | |||
| @@ -30,8 +30,8 @@ constexpr u32 DESCRIPTOR_SET = 0; | |||
| 30 | 30 | ||
| 31 | class ConstBufferEntry : public VideoCommon::Shader::ConstBuffer { | 31 | class ConstBufferEntry : public VideoCommon::Shader::ConstBuffer { |
| 32 | public: | 32 | public: |
| 33 | explicit constexpr ConstBufferEntry(const VideoCommon::Shader::ConstBuffer& entry, u32 index) | 33 | explicit constexpr ConstBufferEntry(const ConstBuffer& entry_, u32 index_) |
| 34 | : VideoCommon::Shader::ConstBuffer{entry}, index{index} {} | 34 | : ConstBuffer{entry_}, index{index_} {} |
| 35 | 35 | ||
| 36 | constexpr u32 GetIndex() const { | 36 | constexpr u32 GetIndex() const { |
| 37 | return index; | 37 | return index; |
| @@ -43,8 +43,8 @@ private: | |||
| 43 | 43 | ||
| 44 | class GlobalBufferEntry { | 44 | class GlobalBufferEntry { |
| 45 | public: | 45 | public: |
| 46 | constexpr explicit GlobalBufferEntry(u32 cbuf_index, u32 cbuf_offset, bool is_written) | 46 | constexpr explicit GlobalBufferEntry(u32 cbuf_index_, u32 cbuf_offset_, bool is_written_) |
| 47 | : cbuf_index{cbuf_index}, cbuf_offset{cbuf_offset}, is_written{is_written} {} | 47 | : cbuf_index{cbuf_index_}, cbuf_offset{cbuf_offset_}, is_written{is_written_} {} |
| 48 | 48 | ||
| 49 | constexpr u32 GetCbufIndex() const { | 49 | constexpr u32 GetCbufIndex() const { |
| 50 | return cbuf_index; | 50 | return cbuf_index; |
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.cpp b/src/video_core/renderer_vulkan/vk_state_tracker.cpp index 5d2c4a796..50164cc08 100644 --- a/src/video_core/renderer_vulkan/vk_state_tracker.cpp +++ b/src/video_core/renderer_vulkan/vk_state_tracker.cpp | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #include "video_core/renderer_vulkan/vk_state_tracker.h" | 14 | #include "video_core/renderer_vulkan/vk_state_tracker.h" |
| 15 | 15 | ||
| 16 | #define OFF(field_name) MAXWELL3D_REG_INDEX(field_name) | 16 | #define OFF(field_name) MAXWELL3D_REG_INDEX(field_name) |
| 17 | #define NUM(field_name) (sizeof(Maxwell3D::Regs::field_name) / sizeof(u32)) | 17 | #define NUM(field_name) (sizeof(Maxwell3D::Regs::field_name) / (sizeof(u32))) |
| 18 | 18 | ||
| 19 | namespace Vulkan { | 19 | namespace Vulkan { |
| 20 | 20 | ||
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index f2c8f2ae1..ae2e3322c 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -52,7 +52,7 @@ VkImageType SurfaceTargetToImage(SurfaceTarget target) { | |||
| 52 | UNREACHABLE(); | 52 | UNREACHABLE(); |
| 53 | return {}; | 53 | return {}; |
| 54 | } | 54 | } |
| 55 | UNREACHABLE_MSG("Unknown texture target={}", static_cast<u32>(target)); | 55 | UNREACHABLE_MSG("Unknown texture target={}", target); |
| 56 | return {}; | 56 | return {}; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| @@ -64,7 +64,7 @@ VkImageAspectFlags PixelFormatToImageAspect(PixelFormat pixel_format) { | |||
| 64 | } else if (pixel_format < PixelFormat::MaxDepthStencilFormat) { | 64 | } else if (pixel_format < PixelFormat::MaxDepthStencilFormat) { |
| 65 | return VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; | 65 | return VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; |
| 66 | } else { | 66 | } else { |
| 67 | UNREACHABLE_MSG("Invalid pixel format={}", static_cast<int>(pixel_format)); | 67 | UNREACHABLE_MSG("Invalid pixel format={}", pixel_format); |
| 68 | return VK_IMAGE_ASPECT_COLOR_BIT; | 68 | return VK_IMAGE_ASPECT_COLOR_BIT; |
| 69 | } | 69 | } |
| 70 | } | 70 | } |
| @@ -180,19 +180,19 @@ VkImageCreateInfo GenerateImageCreateInfo(const VKDevice& device, const SurfaceP | |||
| 180 | return ci; | 180 | return ci; |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | u32 EncodeSwizzle(Tegra::Texture::SwizzleSource x_source, Tegra::Texture::SwizzleSource y_source, | 183 | u32 EncodeSwizzle(SwizzleSource x_source, SwizzleSource y_source, SwizzleSource z_source, |
| 184 | Tegra::Texture::SwizzleSource z_source, Tegra::Texture::SwizzleSource w_source) { | 184 | SwizzleSource w_source) { |
| 185 | return (static_cast<u32>(x_source) << 24) | (static_cast<u32>(y_source) << 16) | | 185 | return (static_cast<u32>(x_source) << 24) | (static_cast<u32>(y_source) << 16) | |
| 186 | (static_cast<u32>(z_source) << 8) | static_cast<u32>(w_source); | 186 | (static_cast<u32>(z_source) << 8) | static_cast<u32>(w_source); |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | } // Anonymous namespace | 189 | } // Anonymous namespace |
| 190 | 190 | ||
| 191 | CachedSurface::CachedSurface(const VKDevice& device, VKMemoryManager& memory_manager, | 191 | CachedSurface::CachedSurface(const VKDevice& device_, VKMemoryManager& memory_manager_, |
| 192 | VKScheduler& scheduler, VKStagingBufferPool& staging_pool, | 192 | VKScheduler& scheduler_, VKStagingBufferPool& staging_pool_, |
| 193 | GPUVAddr gpu_addr, const SurfaceParams& params) | 193 | GPUVAddr gpu_addr_, const SurfaceParams& params_) |
| 194 | : SurfaceBase<View>{gpu_addr, params, device.IsOptimalAstcSupported()}, device{device}, | 194 | : SurfaceBase<View>{gpu_addr_, params_, device_.IsOptimalAstcSupported()}, device{device_}, |
| 195 | memory_manager{memory_manager}, scheduler{scheduler}, staging_pool{staging_pool} { | 195 | memory_manager{memory_manager_}, scheduler{scheduler_}, staging_pool{staging_pool_} { |
| 196 | if (params.IsBuffer()) { | 196 | if (params.IsBuffer()) { |
| 197 | buffer = CreateBuffer(device, params, host_memory_size); | 197 | buffer = CreateBuffer(device, params, host_memory_size); |
| 198 | commit = memory_manager.Commit(buffer, false); | 198 | commit = memory_manager.Commit(buffer, false); |
| @@ -234,7 +234,7 @@ void CachedSurface::UploadTexture(const std::vector<u8>& staging_buffer) { | |||
| 234 | void CachedSurface::DownloadTexture(std::vector<u8>& staging_buffer) { | 234 | void CachedSurface::DownloadTexture(std::vector<u8>& staging_buffer) { |
| 235 | UNIMPLEMENTED_IF(params.IsBuffer()); | 235 | UNIMPLEMENTED_IF(params.IsBuffer()); |
| 236 | 236 | ||
| 237 | if (params.pixel_format == VideoCore::Surface::PixelFormat::A1B5G5R5_UNORM) { | 237 | if (params.pixel_format == PixelFormat::A1B5G5R5_UNORM) { |
| 238 | LOG_WARNING(Render_Vulkan, "A1B5G5R5 flushing is stubbed"); | 238 | LOG_WARNING(Render_Vulkan, "A1B5G5R5 flushing is stubbed"); |
| 239 | } | 239 | } |
| 240 | 240 | ||
| @@ -244,10 +244,10 @@ void CachedSurface::DownloadTexture(std::vector<u8>& staging_buffer) { | |||
| 244 | FullTransition(VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_READ_BIT, | 244 | FullTransition(VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_READ_BIT, |
| 245 | VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL); | 245 | VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL); |
| 246 | 246 | ||
| 247 | const auto& buffer = staging_pool.GetUnusedBuffer(host_memory_size, true); | 247 | const auto& unused_buffer = staging_pool.GetUnusedBuffer(host_memory_size, true); |
| 248 | // TODO(Rodrigo): Do this in a single copy | 248 | // TODO(Rodrigo): Do this in a single copy |
| 249 | for (u32 level = 0; level < params.num_levels; ++level) { | 249 | for (u32 level = 0; level < params.num_levels; ++level) { |
| 250 | scheduler.Record([image = *image->GetHandle(), buffer = *buffer.handle, | 250 | scheduler.Record([image = *image->GetHandle(), buffer = *unused_buffer.handle, |
| 251 | copy = GetBufferImageCopy(level)](vk::CommandBuffer cmdbuf) { | 251 | copy = GetBufferImageCopy(level)](vk::CommandBuffer cmdbuf) { |
| 252 | cmdbuf.CopyImageToBuffer(image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, buffer, copy); | 252 | cmdbuf.CopyImageToBuffer(image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, buffer, copy); |
| 253 | }); | 253 | }); |
| @@ -255,16 +255,17 @@ void CachedSurface::DownloadTexture(std::vector<u8>& staging_buffer) { | |||
| 255 | scheduler.Finish(); | 255 | scheduler.Finish(); |
| 256 | 256 | ||
| 257 | // TODO(Rodrigo): Use an intern buffer for staging buffers and avoid this unnecessary memcpy. | 257 | // TODO(Rodrigo): Use an intern buffer for staging buffers and avoid this unnecessary memcpy. |
| 258 | std::memcpy(staging_buffer.data(), buffer.commit->Map(host_memory_size), host_memory_size); | 258 | std::memcpy(staging_buffer.data(), unused_buffer.commit->Map(host_memory_size), |
| 259 | host_memory_size); | ||
| 259 | } | 260 | } |
| 260 | 261 | ||
| 261 | void CachedSurface::DecorateSurfaceName() { | 262 | void CachedSurface::DecorateSurfaceName() { |
| 262 | // TODO(Rodrigo): Add name decorations | 263 | // TODO(Rodrigo): Add name decorations |
| 263 | } | 264 | } |
| 264 | 265 | ||
| 265 | View CachedSurface::CreateView(const ViewParams& params) { | 266 | View CachedSurface::CreateView(const ViewParams& view_params) { |
| 266 | // TODO(Rodrigo): Add name decorations | 267 | // TODO(Rodrigo): Add name decorations |
| 267 | return views[params] = std::make_shared<CachedSurfaceView>(device, *this, params); | 268 | return views[view_params] = std::make_shared<CachedSurfaceView>(device, *this, view_params); |
| 268 | } | 269 | } |
| 269 | 270 | ||
| 270 | void CachedSurface::UploadBuffer(const std::vector<u8>& staging_buffer) { | 271 | void CachedSurface::UploadBuffer(const std::vector<u8>& staging_buffer) { |
| @@ -348,21 +349,21 @@ VkImageSubresourceRange CachedSurface::GetImageSubresourceRange() const { | |||
| 348 | static_cast<u32>(params.GetNumLayers())}; | 349 | static_cast<u32>(params.GetNumLayers())}; |
| 349 | } | 350 | } |
| 350 | 351 | ||
| 351 | CachedSurfaceView::CachedSurfaceView(const VKDevice& device, CachedSurface& surface, | 352 | CachedSurfaceView::CachedSurfaceView(const VKDevice& device_, CachedSurface& surface_, |
| 352 | const ViewParams& params) | 353 | const ViewParams& view_params_) |
| 353 | : VideoCommon::ViewBase{params}, params{surface.GetSurfaceParams()}, | 354 | : ViewBase{view_params_}, surface_params{surface_.GetSurfaceParams()}, |
| 354 | image{surface.GetImageHandle()}, buffer_view{surface.GetBufferViewHandle()}, | 355 | image{surface_.GetImageHandle()}, buffer_view{surface_.GetBufferViewHandle()}, |
| 355 | aspect_mask{surface.GetAspectMask()}, device{device}, surface{surface}, | 356 | aspect_mask{surface_.GetAspectMask()}, device{device_}, surface{surface_}, |
| 356 | base_level{params.base_level}, num_levels{params.num_levels}, | 357 | base_level{view_params_.base_level}, num_levels{view_params_.num_levels}, |
| 357 | image_view_type{image ? GetImageViewType(params.target) : VK_IMAGE_VIEW_TYPE_1D} { | 358 | image_view_type{image ? GetImageViewType(view_params_.target) : VK_IMAGE_VIEW_TYPE_1D} { |
| 358 | if (image_view_type == VK_IMAGE_VIEW_TYPE_3D) { | 359 | if (image_view_type == VK_IMAGE_VIEW_TYPE_3D) { |
| 359 | base_layer = 0; | 360 | base_layer = 0; |
| 360 | num_layers = 1; | 361 | num_layers = 1; |
| 361 | base_slice = params.base_layer; | 362 | base_slice = view_params_.base_layer; |
| 362 | num_slices = params.num_layers; | 363 | num_slices = view_params_.num_layers; |
| 363 | } else { | 364 | } else { |
| 364 | base_layer = params.base_layer; | 365 | base_layer = view_params_.base_layer; |
| 365 | num_layers = params.num_layers; | 366 | num_layers = view_params_.num_layers; |
| 366 | } | 367 | } |
| 367 | } | 368 | } |
| 368 | 369 | ||
| @@ -384,7 +385,7 @@ VkImageView CachedSurfaceView::GetImageView(SwizzleSource x_source, SwizzleSourc | |||
| 384 | 385 | ||
| 385 | std::array swizzle{MaxwellToVK::SwizzleSource(x_source), MaxwellToVK::SwizzleSource(y_source), | 386 | std::array swizzle{MaxwellToVK::SwizzleSource(x_source), MaxwellToVK::SwizzleSource(y_source), |
| 386 | MaxwellToVK::SwizzleSource(z_source), MaxwellToVK::SwizzleSource(w_source)}; | 387 | MaxwellToVK::SwizzleSource(z_source), MaxwellToVK::SwizzleSource(w_source)}; |
| 387 | if (params.pixel_format == VideoCore::Surface::PixelFormat::A1B5G5R5_UNORM) { | 388 | if (surface_params.pixel_format == PixelFormat::A1B5G5R5_UNORM) { |
| 388 | // A1B5G5R5 is implemented as A1R5G5B5, we have to change the swizzle here. | 389 | // A1B5G5R5 is implemented as A1R5G5B5, we have to change the swizzle here. |
| 389 | std::swap(swizzle[0], swizzle[2]); | 390 | std::swap(swizzle[0], swizzle[2]); |
| 390 | } | 391 | } |
| @@ -395,12 +396,12 @@ VkImageView CachedSurfaceView::GetImageView(SwizzleSource x_source, SwizzleSourc | |||
| 395 | if (aspect == (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) { | 396 | if (aspect == (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) { |
| 396 | UNIMPLEMENTED_IF(x_source != SwizzleSource::R && x_source != SwizzleSource::G); | 397 | UNIMPLEMENTED_IF(x_source != SwizzleSource::R && x_source != SwizzleSource::G); |
| 397 | const bool is_first = x_source == SwizzleSource::R; | 398 | const bool is_first = x_source == SwizzleSource::R; |
| 398 | switch (params.pixel_format) { | 399 | switch (surface_params.pixel_format) { |
| 399 | case VideoCore::Surface::PixelFormat::D24_UNORM_S8_UINT: | 400 | case PixelFormat::D24_UNORM_S8_UINT: |
| 400 | case VideoCore::Surface::PixelFormat::D32_FLOAT_S8_UINT: | 401 | case PixelFormat::D32_FLOAT_S8_UINT: |
| 401 | aspect = is_first ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_STENCIL_BIT; | 402 | aspect = is_first ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_STENCIL_BIT; |
| 402 | break; | 403 | break; |
| 403 | case VideoCore::Surface::PixelFormat::S8_UINT_D24_UNORM: | 404 | case PixelFormat::S8_UINT_D24_UNORM: |
| 404 | aspect = is_first ? VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT; | 405 | aspect = is_first ? VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT; |
| 405 | break; | 406 | break; |
| 406 | default: | 407 | default: |
| @@ -417,7 +418,7 @@ VkImageView CachedSurfaceView::GetImageView(SwizzleSource x_source, SwizzleSourc | |||
| 417 | 418 | ||
| 418 | if (image_view_type == VK_IMAGE_VIEW_TYPE_3D) { | 419 | if (image_view_type == VK_IMAGE_VIEW_TYPE_3D) { |
| 419 | ASSERT(base_slice == 0); | 420 | ASSERT(base_slice == 0); |
| 420 | ASSERT(num_slices == params.depth); | 421 | ASSERT(num_slices == surface_params.depth); |
| 421 | } | 422 | } |
| 422 | 423 | ||
| 423 | image_view = device.GetLogical().CreateImageView({ | 424 | image_view = device.GetLogical().CreateImageView({ |
| @@ -488,12 +489,12 @@ VkImageView CachedSurfaceView::GetAttachment() { | |||
| 488 | return *render_target; | 489 | return *render_target; |
| 489 | } | 490 | } |
| 490 | 491 | ||
| 491 | VKTextureCache::VKTextureCache(VideoCore::RasterizerInterface& rasterizer, | 492 | VKTextureCache::VKTextureCache(VideoCore::RasterizerInterface& rasterizer_, |
| 492 | Tegra::Engines::Maxwell3D& maxwell3d, | 493 | Tegra::Engines::Maxwell3D& maxwell3d_, |
| 493 | Tegra::MemoryManager& gpu_memory, const VKDevice& device_, | 494 | Tegra::MemoryManager& gpu_memory_, const VKDevice& device_, |
| 494 | VKMemoryManager& memory_manager_, VKScheduler& scheduler_, | 495 | VKMemoryManager& memory_manager_, VKScheduler& scheduler_, |
| 495 | VKStagingBufferPool& staging_pool_) | 496 | VKStagingBufferPool& staging_pool_) |
| 496 | : TextureCache(rasterizer, maxwell3d, gpu_memory, device_.IsOptimalAstcSupported()), | 497 | : TextureCache(rasterizer_, maxwell3d_, gpu_memory_, device_.IsOptimalAstcSupported()), |
| 497 | device{device_}, memory_manager{memory_manager_}, scheduler{scheduler_}, staging_pool{ | 498 | device{device_}, memory_manager{memory_manager_}, scheduler{scheduler_}, staging_pool{ |
| 498 | staging_pool_} {} | 499 | staging_pool_} {} |
| 499 | 500 | ||
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index 39202feba..b0be4cb0f 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h | |||
| @@ -40,9 +40,9 @@ class CachedSurface final : public VideoCommon::SurfaceBase<View> { | |||
| 40 | friend CachedSurfaceView; | 40 | friend CachedSurfaceView; |
| 41 | 41 | ||
| 42 | public: | 42 | public: |
| 43 | explicit CachedSurface(const VKDevice& device, VKMemoryManager& memory_manager, | 43 | explicit CachedSurface(const VKDevice& device_, VKMemoryManager& memory_manager_, |
| 44 | VKScheduler& scheduler, VKStagingBufferPool& staging_pool, | 44 | VKScheduler& scheduler_, VKStagingBufferPool& staging_pool_, |
| 45 | GPUVAddr gpu_addr, const SurfaceParams& params); | 45 | GPUVAddr gpu_addr_, const SurfaceParams& params_); |
| 46 | ~CachedSurface(); | 46 | ~CachedSurface(); |
| 47 | 47 | ||
| 48 | void UploadTexture(const std::vector<u8>& staging_buffer) override; | 48 | void UploadTexture(const std::vector<u8>& staging_buffer) override; |
| @@ -82,9 +82,9 @@ public: | |||
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | protected: | 84 | protected: |
| 85 | void DecorateSurfaceName(); | 85 | void DecorateSurfaceName() override; |
| 86 | 86 | ||
| 87 | View CreateView(const ViewParams& params) override; | 87 | View CreateView(const ViewParams& view_params) override; |
| 88 | 88 | ||
| 89 | private: | 89 | private: |
| 90 | void UploadBuffer(const std::vector<u8>& staging_buffer); | 90 | void UploadBuffer(const std::vector<u8>& staging_buffer); |
| @@ -110,8 +110,8 @@ private: | |||
| 110 | 110 | ||
| 111 | class CachedSurfaceView final : public VideoCommon::ViewBase { | 111 | class CachedSurfaceView final : public VideoCommon::ViewBase { |
| 112 | public: | 112 | public: |
| 113 | explicit CachedSurfaceView(const VKDevice& device, CachedSurface& surface, | 113 | explicit CachedSurfaceView(const VKDevice& device_, CachedSurface& surface_, |
| 114 | const ViewParams& params); | 114 | const ViewParams& view_params_); |
| 115 | ~CachedSurfaceView(); | 115 | ~CachedSurfaceView(); |
| 116 | 116 | ||
| 117 | VkImageView GetImageView(Tegra::Texture::SwizzleSource x_source, | 117 | VkImageView GetImageView(Tegra::Texture::SwizzleSource x_source, |
| @@ -126,11 +126,11 @@ public: | |||
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | u32 GetWidth() const { | 128 | u32 GetWidth() const { |
| 129 | return params.GetMipWidth(base_level); | 129 | return surface_params.GetMipWidth(base_level); |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | u32 GetHeight() const { | 132 | u32 GetHeight() const { |
| 133 | return params.GetMipHeight(base_level); | 133 | return surface_params.GetMipHeight(base_level); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | u32 GetNumLayers() const { | 136 | u32 GetNumLayers() const { |
| @@ -169,7 +169,7 @@ public: | |||
| 169 | 169 | ||
| 170 | private: | 170 | private: |
| 171 | // Store a copy of these values to avoid double dereference when reading them | 171 | // Store a copy of these values to avoid double dereference when reading them |
| 172 | const SurfaceParams params; | 172 | const SurfaceParams surface_params; |
| 173 | const VkImage image; | 173 | const VkImage image; |
| 174 | const VkBufferView buffer_view; | 174 | const VkBufferView buffer_view; |
| 175 | const VkImageAspectFlags aspect_mask; | 175 | const VkImageAspectFlags aspect_mask; |
| @@ -193,10 +193,11 @@ private: | |||
| 193 | 193 | ||
| 194 | class VKTextureCache final : public TextureCacheBase { | 194 | class VKTextureCache final : public TextureCacheBase { |
| 195 | public: | 195 | public: |
| 196 | explicit VKTextureCache(VideoCore::RasterizerInterface& rasterizer, | 196 | explicit VKTextureCache(VideoCore::RasterizerInterface& rasterizer_, |
| 197 | Tegra::Engines::Maxwell3D& maxwell3d, Tegra::MemoryManager& gpu_memory, | 197 | Tegra::Engines::Maxwell3D& maxwell3d_, |
| 198 | const VKDevice& device, VKMemoryManager& memory_manager, | 198 | Tegra::MemoryManager& gpu_memory_, const VKDevice& device_, |
| 199 | VKScheduler& scheduler, VKStagingBufferPool& staging_pool); | 199 | VKMemoryManager& memory_manager_, VKScheduler& scheduler_, |
| 200 | VKStagingBufferPool& staging_pool_); | ||
| 200 | ~VKTextureCache(); | 201 | ~VKTextureCache(); |
| 201 | 202 | ||
| 202 | private: | 203 | private: |
diff --git a/src/video_core/renderer_vulkan/vk_update_descriptor.cpp b/src/video_core/renderer_vulkan/vk_update_descriptor.cpp index 351c048d2..8826da325 100644 --- a/src/video_core/renderer_vulkan/vk_update_descriptor.cpp +++ b/src/video_core/renderer_vulkan/vk_update_descriptor.cpp | |||
| @@ -14,8 +14,8 @@ | |||
| 14 | 14 | ||
| 15 | namespace Vulkan { | 15 | namespace Vulkan { |
| 16 | 16 | ||
| 17 | VKUpdateDescriptorQueue::VKUpdateDescriptorQueue(const VKDevice& device, VKScheduler& scheduler) | 17 | VKUpdateDescriptorQueue::VKUpdateDescriptorQueue(const VKDevice& device_, VKScheduler& scheduler_) |
| 18 | : device{device}, scheduler{scheduler} {} | 18 | : device{device_}, scheduler{scheduler_} {} |
| 19 | 19 | ||
| 20 | VKUpdateDescriptorQueue::~VKUpdateDescriptorQueue() = default; | 20 | VKUpdateDescriptorQueue::~VKUpdateDescriptorQueue() = default; |
| 21 | 21 | ||
diff --git a/src/video_core/renderer_vulkan/vk_update_descriptor.h b/src/video_core/renderer_vulkan/vk_update_descriptor.h index 945320c72..f7e3c9821 100644 --- a/src/video_core/renderer_vulkan/vk_update_descriptor.h +++ b/src/video_core/renderer_vulkan/vk_update_descriptor.h | |||
| @@ -31,7 +31,7 @@ struct DescriptorUpdateEntry { | |||
| 31 | 31 | ||
| 32 | class VKUpdateDescriptorQueue final { | 32 | class VKUpdateDescriptorQueue final { |
| 33 | public: | 33 | public: |
| 34 | explicit VKUpdateDescriptorQueue(const VKDevice& device, VKScheduler& scheduler); | 34 | explicit VKUpdateDescriptorQueue(const VKDevice& device_, VKScheduler& scheduler_); |
| 35 | ~VKUpdateDescriptorQueue(); | 35 | ~VKUpdateDescriptorQueue(); |
| 36 | 36 | ||
| 37 | void TickFrame(); | 37 | void TickFrame(); |
diff --git a/src/video_core/renderer_vulkan/wrapper.cpp b/src/video_core/renderer_vulkan/wrapper.cpp index 4e83303d8..1eced809e 100644 --- a/src/video_core/renderer_vulkan/wrapper.cpp +++ b/src/video_core/renderer_vulkan/wrapper.cpp | |||
| @@ -417,7 +417,7 @@ VkResult Free(VkDevice device, VkCommandPool handle, Span<VkCommandBuffer> buffe | |||
| 417 | } | 417 | } |
| 418 | 418 | ||
| 419 | Instance Instance::Create(u32 version, Span<const char*> layers, Span<const char*> extensions, | 419 | Instance Instance::Create(u32 version, Span<const char*> layers, Span<const char*> extensions, |
| 420 | InstanceDispatch& dld) noexcept { | 420 | InstanceDispatch& dispatch) noexcept { |
| 421 | const VkApplicationInfo application_info{ | 421 | const VkApplicationInfo application_info{ |
| 422 | .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, | 422 | .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, |
| 423 | .pNext = nullptr, | 423 | .pNext = nullptr, |
| @@ -439,17 +439,17 @@ Instance Instance::Create(u32 version, Span<const char*> layers, Span<const char | |||
| 439 | }; | 439 | }; |
| 440 | 440 | ||
| 441 | VkInstance instance; | 441 | VkInstance instance; |
| 442 | if (dld.vkCreateInstance(&ci, nullptr, &instance) != VK_SUCCESS) { | 442 | if (dispatch.vkCreateInstance(&ci, nullptr, &instance) != VK_SUCCESS) { |
| 443 | // Failed to create the instance. | 443 | // Failed to create the instance. |
| 444 | return {}; | 444 | return {}; |
| 445 | } | 445 | } |
| 446 | if (!Proc(dld.vkDestroyInstance, dld, "vkDestroyInstance", instance)) { | 446 | if (!Proc(dispatch.vkDestroyInstance, dispatch, "vkDestroyInstance", instance)) { |
| 447 | // We successfully created an instance but the destroy function couldn't be loaded. | 447 | // We successfully created an instance but the destroy function couldn't be loaded. |
| 448 | // This is a good moment to panic. | 448 | // This is a good moment to panic. |
| 449 | return {}; | 449 | return {}; |
| 450 | } | 450 | } |
| 451 | 451 | ||
| 452 | return Instance(instance, dld); | 452 | return Instance(instance, dispatch); |
| 453 | } | 453 | } |
| 454 | 454 | ||
| 455 | std::optional<std::vector<VkPhysicalDevice>> Instance::EnumeratePhysicalDevices() { | 455 | std::optional<std::vector<VkPhysicalDevice>> Instance::EnumeratePhysicalDevices() { |
| @@ -540,7 +540,7 @@ std::vector<VkImage> SwapchainKHR::GetImages() const { | |||
| 540 | 540 | ||
| 541 | Device Device::Create(VkPhysicalDevice physical_device, Span<VkDeviceQueueCreateInfo> queues_ci, | 541 | Device Device::Create(VkPhysicalDevice physical_device, Span<VkDeviceQueueCreateInfo> queues_ci, |
| 542 | Span<const char*> enabled_extensions, const void* next, | 542 | Span<const char*> enabled_extensions, const void* next, |
| 543 | DeviceDispatch& dld) noexcept { | 543 | DeviceDispatch& dispatch) noexcept { |
| 544 | const VkDeviceCreateInfo ci{ | 544 | const VkDeviceCreateInfo ci{ |
| 545 | .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, | 545 | .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, |
| 546 | .pNext = next, | 546 | .pNext = next, |
| @@ -555,11 +555,11 @@ Device Device::Create(VkPhysicalDevice physical_device, Span<VkDeviceQueueCreate | |||
| 555 | }; | 555 | }; |
| 556 | 556 | ||
| 557 | VkDevice device; | 557 | VkDevice device; |
| 558 | if (dld.vkCreateDevice(physical_device, &ci, nullptr, &device) != VK_SUCCESS) { | 558 | if (dispatch.vkCreateDevice(physical_device, &ci, nullptr, &device) != VK_SUCCESS) { |
| 559 | return {}; | 559 | return {}; |
| 560 | } | 560 | } |
| 561 | Load(device, dld); | 561 | Load(device, dispatch); |
| 562 | return Device(device, dld); | 562 | return Device(device, dispatch); |
| 563 | } | 563 | } |
| 564 | 564 | ||
| 565 | Queue Device::GetQueue(u32 family_index) const noexcept { | 565 | Queue Device::GetQueue(u32 family_index) const noexcept { |
diff --git a/src/video_core/renderer_vulkan/wrapper.h b/src/video_core/renderer_vulkan/wrapper.h index f64919623..76f790eab 100644 --- a/src/video_core/renderer_vulkan/wrapper.h +++ b/src/video_core/renderer_vulkan/wrapper.h | |||
| @@ -52,7 +52,7 @@ public: | |||
| 52 | 52 | ||
| 53 | /// Construct a span from a pointer and a size. | 53 | /// Construct a span from a pointer and a size. |
| 54 | /// This is inteded for subranges. | 54 | /// This is inteded for subranges. |
| 55 | constexpr Span(const T* ptr, std::size_t num) noexcept : ptr{ptr}, num{num} {} | 55 | constexpr Span(const T* ptr_, std::size_t num_) noexcept : ptr{ptr_}, num{num_} {} |
| 56 | 56 | ||
| 57 | /// Returns the data pointer by the span. | 57 | /// Returns the data pointer by the span. |
| 58 | constexpr const T* data() const noexcept { | 58 | constexpr const T* data() const noexcept { |
| @@ -469,9 +469,10 @@ public: | |||
| 469 | PoolAllocations() = default; | 469 | PoolAllocations() = default; |
| 470 | 470 | ||
| 471 | /// Construct an allocation. Errors are reported through IsOutOfPoolMemory(). | 471 | /// Construct an allocation. Errors are reported through IsOutOfPoolMemory(). |
| 472 | explicit PoolAllocations(std::unique_ptr<AllocationType[]> allocations, std::size_t num, | 472 | explicit PoolAllocations(std::unique_ptr<AllocationType[]> allocations_, std::size_t num_, |
| 473 | VkDevice device, PoolType pool, const DeviceDispatch& dld) noexcept | 473 | VkDevice device_, PoolType pool_, const DeviceDispatch& dld_) noexcept |
| 474 | : allocations{std::move(allocations)}, num{num}, device{device}, pool{pool}, dld{&dld} {} | 474 | : allocations{std::move(allocations_)}, num{num_}, device{device_}, pool{pool_}, |
| 475 | dld{&dld_} {} | ||
| 475 | 476 | ||
| 476 | /// Copying Vulkan allocations is not supported and will never be. | 477 | /// Copying Vulkan allocations is not supported and will never be. |
| 477 | PoolAllocations(const PoolAllocations&) = delete; | 478 | PoolAllocations(const PoolAllocations&) = delete; |
| @@ -565,7 +566,7 @@ class Instance : public Handle<VkInstance, NoOwner, InstanceDispatch> { | |||
| 565 | public: | 566 | public: |
| 566 | /// Creates a Vulkan instance. Use "operator bool" for error handling. | 567 | /// Creates a Vulkan instance. Use "operator bool" for error handling. |
| 567 | static Instance Create(u32 version, Span<const char*> layers, Span<const char*> extensions, | 568 | static Instance Create(u32 version, Span<const char*> layers, Span<const char*> extensions, |
| 568 | InstanceDispatch& dld) noexcept; | 569 | InstanceDispatch& dispatch) noexcept; |
| 569 | 570 | ||
| 570 | /// Enumerates physical devices. | 571 | /// Enumerates physical devices. |
| 571 | /// @return Physical devices and an empty handle on failure. | 572 | /// @return Physical devices and an empty handle on failure. |
| @@ -581,7 +582,8 @@ public: | |||
| 581 | constexpr Queue() noexcept = default; | 582 | constexpr Queue() noexcept = default; |
| 582 | 583 | ||
| 583 | /// Construct a queue handle. | 584 | /// Construct a queue handle. |
| 584 | constexpr Queue(VkQueue queue, const DeviceDispatch& dld) noexcept : queue{queue}, dld{&dld} {} | 585 | constexpr Queue(VkQueue queue_, const DeviceDispatch& dld_) noexcept |
| 586 | : queue{queue_}, dld{&dld_} {} | ||
| 585 | 587 | ||
| 586 | VkResult Submit(Span<VkSubmitInfo> submit_infos, | 588 | VkResult Submit(Span<VkSubmitInfo> submit_infos, |
| 587 | VkFence fence = VK_NULL_HANDLE) const noexcept { | 589 | VkFence fence = VK_NULL_HANDLE) const noexcept { |
| @@ -720,7 +722,7 @@ class Device : public Handle<VkDevice, NoOwner, DeviceDispatch> { | |||
| 720 | public: | 722 | public: |
| 721 | static Device Create(VkPhysicalDevice physical_device, Span<VkDeviceQueueCreateInfo> queues_ci, | 723 | static Device Create(VkPhysicalDevice physical_device, Span<VkDeviceQueueCreateInfo> queues_ci, |
| 722 | Span<const char*> enabled_extensions, const void* next, | 724 | Span<const char*> enabled_extensions, const void* next, |
| 723 | DeviceDispatch& dld) noexcept; | 725 | DeviceDispatch& dispatch) noexcept; |
| 724 | 726 | ||
| 725 | Queue GetQueue(u32 family_index) const noexcept; | 727 | Queue GetQueue(u32 family_index) const noexcept; |
| 726 | 728 | ||
| @@ -809,8 +811,9 @@ class PhysicalDevice { | |||
| 809 | public: | 811 | public: |
| 810 | constexpr PhysicalDevice() noexcept = default; | 812 | constexpr PhysicalDevice() noexcept = default; |
| 811 | 813 | ||
| 812 | constexpr PhysicalDevice(VkPhysicalDevice physical_device, const InstanceDispatch& dld) noexcept | 814 | constexpr PhysicalDevice(VkPhysicalDevice physical_device_, |
| 813 | : physical_device{physical_device}, dld{&dld} {} | 815 | const InstanceDispatch& dld_) noexcept |
| 816 | : physical_device{physical_device_}, dld{&dld_} {} | ||
| 814 | 817 | ||
| 815 | constexpr operator VkPhysicalDevice() const noexcept { | 818 | constexpr operator VkPhysicalDevice() const noexcept { |
| 816 | return physical_device; | 819 | return physical_device; |
| @@ -849,8 +852,8 @@ class CommandBuffer { | |||
| 849 | public: | 852 | public: |
| 850 | CommandBuffer() noexcept = default; | 853 | CommandBuffer() noexcept = default; |
| 851 | 854 | ||
| 852 | explicit CommandBuffer(VkCommandBuffer handle, const DeviceDispatch& dld) noexcept | 855 | explicit CommandBuffer(VkCommandBuffer handle_, const DeviceDispatch& dld_) noexcept |
| 853 | : handle{handle}, dld{&dld} {} | 856 | : handle{handle_}, dld{&dld_} {} |
| 854 | 857 | ||
| 855 | const VkCommandBuffer* address() const noexcept { | 858 | const VkCommandBuffer* address() const noexcept { |
| 856 | return &handle; | 859 | return &handle; |
diff --git a/src/video_core/shader/ast.cpp b/src/video_core/shader/ast.cpp index 3f96d9076..db11144c7 100644 --- a/src/video_core/shader/ast.cpp +++ b/src/video_core/shader/ast.cpp | |||
| @@ -212,16 +212,15 @@ public: | |||
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | void operator()(const ExprPredicate& expr) { | 214 | void operator()(const ExprPredicate& expr) { |
| 215 | inner += "P" + std::to_string(expr.predicate); | 215 | inner += fmt::format("P{}", expr.predicate); |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | void operator()(const ExprCondCode& expr) { | 218 | void operator()(const ExprCondCode& expr) { |
| 219 | u32 cc = static_cast<u32>(expr.cc); | 219 | inner += fmt::format("CC{}", expr.cc); |
| 220 | inner += "CC" + std::to_string(cc); | ||
| 221 | } | 220 | } |
| 222 | 221 | ||
| 223 | void operator()(const ExprVar& expr) { | 222 | void operator()(const ExprVar& expr) { |
| 224 | inner += "V" + std::to_string(expr.var_index); | 223 | inner += fmt::format("V{}", expr.var_index); |
| 225 | } | 224 | } |
| 226 | 225 | ||
| 227 | void operator()(const ExprBoolean& expr) { | 226 | void operator()(const ExprBoolean& expr) { |
| @@ -229,7 +228,7 @@ public: | |||
| 229 | } | 228 | } |
| 230 | 229 | ||
| 231 | void operator()(const ExprGprEqual& expr) { | 230 | void operator()(const ExprGprEqual& expr) { |
| 232 | inner += "( gpr_" + std::to_string(expr.gpr) + " == " + std::to_string(expr.value) + ')'; | 231 | inner += fmt::format("(gpr_{} == {})", expr.gpr, expr.value); |
| 233 | } | 232 | } |
| 234 | 233 | ||
| 235 | const std::string& GetResult() const { | 234 | const std::string& GetResult() const { |
| @@ -374,8 +373,8 @@ std::string ASTManager::Print() const { | |||
| 374 | return printer.GetResult(); | 373 | return printer.GetResult(); |
| 375 | } | 374 | } |
| 376 | 375 | ||
| 377 | ASTManager::ASTManager(bool full_decompile, bool disable_else_derivation) | 376 | ASTManager::ASTManager(bool do_full_decompile, bool disable_else_derivation_) |
| 378 | : full_decompile{full_decompile}, disable_else_derivation{disable_else_derivation} {}; | 377 | : full_decompile{do_full_decompile}, disable_else_derivation{disable_else_derivation_} {} |
| 379 | 378 | ||
| 380 | ASTManager::~ASTManager() { | 379 | ASTManager::~ASTManager() { |
| 381 | Clear(); | 380 | Clear(); |
diff --git a/src/video_core/shader/ast.h b/src/video_core/shader/ast.h index 8e5a22ab3..dc49b369e 100644 --- a/src/video_core/shader/ast.h +++ b/src/video_core/shader/ast.h | |||
| @@ -76,7 +76,7 @@ public: | |||
| 76 | 76 | ||
| 77 | class ASTIfThen { | 77 | class ASTIfThen { |
| 78 | public: | 78 | public: |
| 79 | explicit ASTIfThen(Expr condition) : condition{std::move(condition)} {} | 79 | explicit ASTIfThen(Expr condition_) : condition{std::move(condition_)} {} |
| 80 | Expr condition; | 80 | Expr condition; |
| 81 | ASTZipper nodes{}; | 81 | ASTZipper nodes{}; |
| 82 | }; | 82 | }; |
| @@ -88,63 +88,68 @@ public: | |||
| 88 | 88 | ||
| 89 | class ASTBlockEncoded { | 89 | class ASTBlockEncoded { |
| 90 | public: | 90 | public: |
| 91 | explicit ASTBlockEncoded(u32 start, u32 end) : start{start}, end{end} {} | 91 | explicit ASTBlockEncoded(u32 start_, u32 _) : start{start_}, end{_} {} |
| 92 | u32 start; | 92 | u32 start; |
| 93 | u32 end; | 93 | u32 end; |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | class ASTBlockDecoded { | 96 | class ASTBlockDecoded { |
| 97 | public: | 97 | public: |
| 98 | explicit ASTBlockDecoded(NodeBlock&& new_nodes) : nodes(std::move(new_nodes)) {} | 98 | explicit ASTBlockDecoded(NodeBlock&& new_nodes_) : nodes(std::move(new_nodes_)) {} |
| 99 | NodeBlock nodes; | 99 | NodeBlock nodes; |
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| 102 | class ASTVarSet { | 102 | class ASTVarSet { |
| 103 | public: | 103 | public: |
| 104 | explicit ASTVarSet(u32 index, Expr condition) : index{index}, condition{std::move(condition)} {} | 104 | explicit ASTVarSet(u32 index_, Expr condition_) |
| 105 | : index{index_}, condition{std::move(condition_)} {} | ||
| 106 | |||
| 105 | u32 index; | 107 | u32 index; |
| 106 | Expr condition; | 108 | Expr condition; |
| 107 | }; | 109 | }; |
| 108 | 110 | ||
| 109 | class ASTLabel { | 111 | class ASTLabel { |
| 110 | public: | 112 | public: |
| 111 | explicit ASTLabel(u32 index) : index{index} {} | 113 | explicit ASTLabel(u32 index_) : index{index_} {} |
| 112 | u32 index; | 114 | u32 index; |
| 113 | bool unused{}; | 115 | bool unused{}; |
| 114 | }; | 116 | }; |
| 115 | 117 | ||
| 116 | class ASTGoto { | 118 | class ASTGoto { |
| 117 | public: | 119 | public: |
| 118 | explicit ASTGoto(Expr condition, u32 label) : condition{std::move(condition)}, label{label} {} | 120 | explicit ASTGoto(Expr condition_, u32 label_) |
| 121 | : condition{std::move(condition_)}, label{label_} {} | ||
| 122 | |||
| 119 | Expr condition; | 123 | Expr condition; |
| 120 | u32 label; | 124 | u32 label; |
| 121 | }; | 125 | }; |
| 122 | 126 | ||
| 123 | class ASTDoWhile { | 127 | class ASTDoWhile { |
| 124 | public: | 128 | public: |
| 125 | explicit ASTDoWhile(Expr condition) : condition{std::move(condition)} {} | 129 | explicit ASTDoWhile(Expr condition_) : condition{std::move(condition_)} {} |
| 126 | Expr condition; | 130 | Expr condition; |
| 127 | ASTZipper nodes{}; | 131 | ASTZipper nodes{}; |
| 128 | }; | 132 | }; |
| 129 | 133 | ||
| 130 | class ASTReturn { | 134 | class ASTReturn { |
| 131 | public: | 135 | public: |
| 132 | explicit ASTReturn(Expr condition, bool kills) | 136 | explicit ASTReturn(Expr condition_, bool kills_) |
| 133 | : condition{std::move(condition)}, kills{kills} {} | 137 | : condition{std::move(condition_)}, kills{kills_} {} |
| 138 | |||
| 134 | Expr condition; | 139 | Expr condition; |
| 135 | bool kills; | 140 | bool kills; |
| 136 | }; | 141 | }; |
| 137 | 142 | ||
| 138 | class ASTBreak { | 143 | class ASTBreak { |
| 139 | public: | 144 | public: |
| 140 | explicit ASTBreak(Expr condition) : condition{std::move(condition)} {} | 145 | explicit ASTBreak(Expr condition_) : condition{std::move(condition_)} {} |
| 141 | Expr condition; | 146 | Expr condition; |
| 142 | }; | 147 | }; |
| 143 | 148 | ||
| 144 | class ASTBase { | 149 | class ASTBase { |
| 145 | public: | 150 | public: |
| 146 | explicit ASTBase(ASTNode parent, ASTData data) | 151 | explicit ASTBase(ASTNode parent_, ASTData data_) |
| 147 | : data{std::move(data)}, parent{std::move(parent)} {} | 152 | : data{std::move(data_)}, parent{std::move(parent_)} {} |
| 148 | 153 | ||
| 149 | template <class U, class... Args> | 154 | template <class U, class... Args> |
| 150 | static ASTNode Make(ASTNode parent, Args&&... args) { | 155 | static ASTNode Make(ASTNode parent, Args&&... args) { |
| @@ -300,7 +305,7 @@ private: | |||
| 300 | 305 | ||
| 301 | class ASTManager final { | 306 | class ASTManager final { |
| 302 | public: | 307 | public: |
| 303 | ASTManager(bool full_decompile, bool disable_else_derivation); | 308 | explicit ASTManager(bool do_full_decompile, bool disable_else_derivation_); |
| 304 | ~ASTManager(); | 309 | ~ASTManager(); |
| 305 | 310 | ||
| 306 | ASTManager(const ASTManager& o) = delete; | 311 | ASTManager(const ASTManager& o) = delete; |
diff --git a/src/video_core/shader/async_shaders.cpp b/src/video_core/shader/async_shaders.cpp index 6920afdf2..78245473c 100644 --- a/src/video_core/shader/async_shaders.cpp +++ b/src/video_core/shader/async_shaders.cpp | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | namespace VideoCommon::Shader { | 14 | namespace VideoCommon::Shader { |
| 15 | 15 | ||
| 16 | AsyncShaders::AsyncShaders(Core::Frontend::EmuWindow& emu_window) : emu_window(emu_window) {} | 16 | AsyncShaders::AsyncShaders(Core::Frontend::EmuWindow& emu_window_) : emu_window(emu_window_) {} |
| 17 | 17 | ||
| 18 | AsyncShaders::~AsyncShaders() { | 18 | AsyncShaders::~AsyncShaders() { |
| 19 | KillWorkers(); | 19 | KillWorkers(); |
diff --git a/src/video_core/shader/async_shaders.h b/src/video_core/shader/async_shaders.h index 7a99e1dc5..5a7216019 100644 --- a/src/video_core/shader/async_shaders.h +++ b/src/video_core/shader/async_shaders.h | |||
| @@ -66,7 +66,7 @@ public: | |||
| 66 | Tegra::Engines::ShaderType shader_type; | 66 | Tegra::Engines::ShaderType shader_type; |
| 67 | }; | 67 | }; |
| 68 | 68 | ||
| 69 | explicit AsyncShaders(Core::Frontend::EmuWindow& emu_window); | 69 | explicit AsyncShaders(Core::Frontend::EmuWindow& emu_window_); |
| 70 | ~AsyncShaders(); | 70 | ~AsyncShaders(); |
| 71 | 71 | ||
| 72 | /// Start up shader worker threads | 72 | /// Start up shader worker threads |
diff --git a/src/video_core/shader/control_flow.cpp b/src/video_core/shader/control_flow.cpp index 4c8971615..43d965f2f 100644 --- a/src/video_core/shader/control_flow.cpp +++ b/src/video_core/shader/control_flow.cpp | |||
| @@ -66,8 +66,8 @@ struct BlockInfo { | |||
| 66 | }; | 66 | }; |
| 67 | 67 | ||
| 68 | struct CFGRebuildState { | 68 | struct CFGRebuildState { |
| 69 | explicit CFGRebuildState(const ProgramCode& program_code, u32 start, Registry& registry) | 69 | explicit CFGRebuildState(const ProgramCode& program_code_, u32 start_, Registry& registry_) |
| 70 | : program_code{program_code}, registry{registry}, start{start} {} | 70 | : program_code{program_code_}, registry{registry_}, start{start_} {} |
| 71 | 71 | ||
| 72 | const ProgramCode& program_code; | 72 | const ProgramCode& program_code; |
| 73 | Registry& registry; | 73 | Registry& registry; |
| @@ -241,10 +241,10 @@ std::pair<ParseResult, ParseInfo> ParseCode(CFGRebuildState& state, u32 address) | |||
| 241 | ParseInfo parse_info{}; | 241 | ParseInfo parse_info{}; |
| 242 | SingleBranch single_branch{}; | 242 | SingleBranch single_branch{}; |
| 243 | 243 | ||
| 244 | const auto insert_label = [](CFGRebuildState& state, u32 address) { | 244 | const auto insert_label = [](CFGRebuildState& rebuild_state, u32 label_address) { |
| 245 | const auto pair = state.labels.emplace(address); | 245 | const auto pair = rebuild_state.labels.emplace(label_address); |
| 246 | if (pair.second) { | 246 | if (pair.second) { |
| 247 | state.inspect_queries.push_back(address); | 247 | rebuild_state.inspect_queries.push_back(label_address); |
| 248 | } | 248 | } |
| 249 | }; | 249 | }; |
| 250 | 250 | ||
| @@ -257,7 +257,7 @@ std::pair<ParseResult, ParseInfo> ParseCode(CFGRebuildState& state, u32 address) | |||
| 257 | single_branch.ignore = false; | 257 | single_branch.ignore = false; |
| 258 | break; | 258 | break; |
| 259 | } | 259 | } |
| 260 | if (state.registered.count(offset) != 0) { | 260 | if (state.registered.contains(offset)) { |
| 261 | single_branch.address = offset; | 261 | single_branch.address = offset; |
| 262 | single_branch.ignore = true; | 262 | single_branch.ignore = true; |
| 263 | break; | 263 | break; |
| @@ -632,12 +632,12 @@ void DecompileShader(CFGRebuildState& state) { | |||
| 632 | for (auto label : state.labels) { | 632 | for (auto label : state.labels) { |
| 633 | state.manager->DeclareLabel(label); | 633 | state.manager->DeclareLabel(label); |
| 634 | } | 634 | } |
| 635 | for (auto& block : state.block_info) { | 635 | for (const auto& block : state.block_info) { |
| 636 | if (state.labels.count(block.start) != 0) { | 636 | if (state.labels.contains(block.start)) { |
| 637 | state.manager->InsertLabel(block.start); | 637 | state.manager->InsertLabel(block.start); |
| 638 | } | 638 | } |
| 639 | const bool ignore = BlockBranchIsIgnored(block.branch); | 639 | const bool ignore = BlockBranchIsIgnored(block.branch); |
| 640 | u32 end = ignore ? block.end + 1 : block.end; | 640 | const u32 end = ignore ? block.end + 1 : block.end; |
| 641 | state.manager->InsertBlock(block.start, end); | 641 | state.manager->InsertBlock(block.start, end); |
| 642 | if (!ignore) { | 642 | if (!ignore) { |
| 643 | InsertBranch(*state.manager, block.branch); | 643 | InsertBranch(*state.manager, block.branch); |
| @@ -737,7 +737,7 @@ std::unique_ptr<ShaderCharacteristics> ScanFlow(const ProgramCode& program_code, | |||
| 737 | auto back = result_out->blocks.begin(); | 737 | auto back = result_out->blocks.begin(); |
| 738 | auto next = std::next(back); | 738 | auto next = std::next(back); |
| 739 | while (next != result_out->blocks.end()) { | 739 | while (next != result_out->blocks.end()) { |
| 740 | if (state.labels.count(next->start) == 0 && next->start == back->end + 1) { | 740 | if (!state.labels.contains(next->start) && next->start == back->end + 1) { |
| 741 | back->end = next->end; | 741 | back->end = next->end; |
| 742 | next = result_out->blocks.erase(next); | 742 | next = result_out->blocks.erase(next); |
| 743 | continue; | 743 | continue; |
diff --git a/src/video_core/shader/control_flow.h b/src/video_core/shader/control_flow.h index 62a3510d8..37bf96492 100644 --- a/src/video_core/shader/control_flow.h +++ b/src/video_core/shader/control_flow.h | |||
| @@ -42,10 +42,10 @@ struct Condition { | |||
| 42 | class SingleBranch { | 42 | class SingleBranch { |
| 43 | public: | 43 | public: |
| 44 | SingleBranch() = default; | 44 | SingleBranch() = default; |
| 45 | SingleBranch(Condition condition, s32 address, bool kill, bool is_sync, bool is_brk, | 45 | explicit SingleBranch(Condition condition_, s32 address_, bool kill_, bool is_sync_, |
| 46 | bool ignore) | 46 | bool is_brk_, bool ignore_) |
| 47 | : condition{condition}, address{address}, kill{kill}, is_sync{is_sync}, is_brk{is_brk}, | 47 | : condition{condition_}, address{address_}, kill{kill_}, is_sync{is_sync_}, is_brk{is_brk_}, |
| 48 | ignore{ignore} {} | 48 | ignore{ignore_} {} |
| 49 | 49 | ||
| 50 | bool operator==(const SingleBranch& b) const { | 50 | bool operator==(const SingleBranch& b) const { |
| 51 | return std::tie(condition, address, kill, is_sync, is_brk, ignore) == | 51 | return std::tie(condition, address, kill, is_sync, is_brk, ignore) == |
| @@ -65,15 +65,15 @@ public: | |||
| 65 | }; | 65 | }; |
| 66 | 66 | ||
| 67 | struct CaseBranch { | 67 | struct CaseBranch { |
| 68 | CaseBranch(u32 cmp_value, u32 address) : cmp_value{cmp_value}, address{address} {} | 68 | explicit CaseBranch(u32 cmp_value_, u32 address_) : cmp_value{cmp_value_}, address{address_} {} |
| 69 | u32 cmp_value; | 69 | u32 cmp_value; |
| 70 | u32 address; | 70 | u32 address; |
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | class MultiBranch { | 73 | class MultiBranch { |
| 74 | public: | 74 | public: |
| 75 | MultiBranch(u32 gpr, std::vector<CaseBranch>&& branches) | 75 | explicit MultiBranch(u32 gpr_, std::vector<CaseBranch>&& branches_) |
| 76 | : gpr{gpr}, branches{std::move(branches)} {} | 76 | : gpr{gpr_}, branches{std::move(branches_)} {} |
| 77 | 77 | ||
| 78 | u32 gpr{}; | 78 | u32 gpr{}; |
| 79 | std::vector<CaseBranch> branches{}; | 79 | std::vector<CaseBranch> branches{}; |
diff --git a/src/video_core/shader/decode.cpp b/src/video_core/shader/decode.cpp index eeac328a6..ab14c1aa3 100644 --- a/src/video_core/shader/decode.cpp +++ b/src/video_core/shader/decode.cpp | |||
| @@ -66,7 +66,7 @@ std::optional<u32> TryDeduceSamplerSize(const Sampler& sampler_to_deduce, | |||
| 66 | 66 | ||
| 67 | class ASTDecoder { | 67 | class ASTDecoder { |
| 68 | public: | 68 | public: |
| 69 | ASTDecoder(ShaderIR& ir) : ir(ir) {} | 69 | explicit ASTDecoder(ShaderIR& ir_) : ir(ir_) {} |
| 70 | 70 | ||
| 71 | void operator()(ASTProgram& ast) { | 71 | void operator()(ASTProgram& ast) { |
| 72 | ASTNode current = ast.nodes.GetFirst(); | 72 | ASTNode current = ast.nodes.GetFirst(); |
| @@ -153,8 +153,8 @@ void ShaderIR::Decode() { | |||
| 153 | const auto& blocks = shader_info.blocks; | 153 | const auto& blocks = shader_info.blocks; |
| 154 | NodeBlock current_block; | 154 | NodeBlock current_block; |
| 155 | u32 current_label = static_cast<u32>(exit_branch); | 155 | u32 current_label = static_cast<u32>(exit_branch); |
| 156 | for (auto& block : blocks) { | 156 | for (const auto& block : blocks) { |
| 157 | if (shader_info.labels.count(block.start) != 0) { | 157 | if (shader_info.labels.contains(block.start)) { |
| 158 | insert_block(current_block, current_label); | 158 | insert_block(current_block, current_label); |
| 159 | current_block.clear(); | 159 | current_block.clear(); |
| 160 | current_label = block.start; | 160 | current_label = block.start; |
diff --git a/src/video_core/shader/decode/arithmetic.cpp b/src/video_core/shader/decode/arithmetic.cpp index afef5948d..15eb700e7 100644 --- a/src/video_core/shader/decode/arithmetic.cpp +++ b/src/video_core/shader/decode/arithmetic.cpp | |||
| @@ -110,8 +110,7 @@ u32 ShaderIR::DecodeArithmetic(NodeBlock& bb, u32 pc) { | |||
| 110 | case SubOp::Sqrt: | 110 | case SubOp::Sqrt: |
| 111 | return Operation(OperationCode::FSqrt, PRECISE, op_a); | 111 | return Operation(OperationCode::FSqrt, PRECISE, op_a); |
| 112 | default: | 112 | default: |
| 113 | UNIMPLEMENTED_MSG("Unhandled MUFU sub op={0:x}", | 113 | UNIMPLEMENTED_MSG("Unhandled MUFU sub op={0:x}", instr.sub_op.Value()); |
| 114 | static_cast<unsigned>(instr.sub_op.Value())); | ||
| 115 | return Immediate(0); | 114 | return Immediate(0); |
| 116 | } | 115 | } |
| 117 | }(); | 116 | }(); |
diff --git a/src/video_core/shader/decode/arithmetic_integer.cpp b/src/video_core/shader/decode/arithmetic_integer.cpp index 73155966f..7b5bb7003 100644 --- a/src/video_core/shader/decode/arithmetic_integer.cpp +++ b/src/video_core/shader/decode/arithmetic_integer.cpp | |||
| @@ -83,7 +83,7 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) { | |||
| 83 | case IAdd3Height::UpperHalfWord: | 83 | case IAdd3Height::UpperHalfWord: |
| 84 | return BitfieldExtract(value, 16, 16); | 84 | return BitfieldExtract(value, 16, 16); |
| 85 | default: | 85 | default: |
| 86 | UNIMPLEMENTED_MSG("Unhandled IADD3 height: {}", static_cast<u32>(height)); | 86 | UNIMPLEMENTED_MSG("Unhandled IADD3 height: {}", height); |
| 87 | return Immediate(0); | 87 | return Immediate(0); |
| 88 | } | 88 | } |
| 89 | }; | 89 | }; |
| @@ -258,7 +258,7 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) { | |||
| 258 | case OpCode::Id::LEA_IMM: | 258 | case OpCode::Id::LEA_IMM: |
| 259 | case OpCode::Id::LEA_RZ: | 259 | case OpCode::Id::LEA_RZ: |
| 260 | case OpCode::Id::LEA_HI: { | 260 | case OpCode::Id::LEA_HI: { |
| 261 | auto [op_a, op_b, op_c] = [&]() -> std::tuple<Node, Node, Node> { | 261 | auto [op_a_, op_b_, op_c_] = [&]() -> std::tuple<Node, Node, Node> { |
| 262 | switch (opcode->get().GetId()) { | 262 | switch (opcode->get().GetId()) { |
| 263 | case OpCode::Id::LEA_R2: { | 263 | case OpCode::Id::LEA_R2: { |
| 264 | return {GetRegister(instr.gpr20), GetRegister(instr.gpr39), | 264 | return {GetRegister(instr.gpr20), GetRegister(instr.gpr39), |
| @@ -294,8 +294,9 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) { | |||
| 294 | UNIMPLEMENTED_IF_MSG(instr.lea.pred48 != static_cast<u64>(Pred::UnusedIndex), | 294 | UNIMPLEMENTED_IF_MSG(instr.lea.pred48 != static_cast<u64>(Pred::UnusedIndex), |
| 295 | "Unhandled LEA Predicate"); | 295 | "Unhandled LEA Predicate"); |
| 296 | 296 | ||
| 297 | Node value = Operation(OperationCode::ILogicalShiftLeft, std::move(op_a), std::move(op_c)); | 297 | Node value = |
| 298 | value = Operation(OperationCode::IAdd, std::move(op_b), std::move(value)); | 298 | Operation(OperationCode::ILogicalShiftLeft, std::move(op_a_), std::move(op_c_)); |
| 299 | value = Operation(OperationCode::IAdd, std::move(op_b_), std::move(value)); | ||
| 299 | SetRegister(bb, instr.gpr0, std::move(value)); | 300 | SetRegister(bb, instr.gpr0, std::move(value)); |
| 300 | 301 | ||
| 301 | break; | 302 | break; |
diff --git a/src/video_core/shader/decode/arithmetic_integer_immediate.cpp b/src/video_core/shader/decode/arithmetic_integer_immediate.cpp index 2a30aab2b..73580277a 100644 --- a/src/video_core/shader/decode/arithmetic_integer_immediate.cpp +++ b/src/video_core/shader/decode/arithmetic_integer_immediate.cpp | |||
| @@ -72,7 +72,7 @@ void ShaderIR::WriteLogicOperation(NodeBlock& bb, Register dest, LogicOperation | |||
| 72 | case LogicOperation::PassB: | 72 | case LogicOperation::PassB: |
| 73 | return op_b; | 73 | return op_b; |
| 74 | default: | 74 | default: |
| 75 | UNIMPLEMENTED_MSG("Unimplemented logic operation={}", static_cast<u32>(logic_op)); | 75 | UNIMPLEMENTED_MSG("Unimplemented logic operation={}", logic_op); |
| 76 | return Immediate(0); | 76 | return Immediate(0); |
| 77 | } | 77 | } |
| 78 | }(); | 78 | }(); |
| @@ -92,8 +92,7 @@ void ShaderIR::WriteLogicOperation(NodeBlock& bb, Register dest, LogicOperation | |||
| 92 | break; | 92 | break; |
| 93 | } | 93 | } |
| 94 | default: | 94 | default: |
| 95 | UNIMPLEMENTED_MSG("Unimplemented predicate result mode: {}", | 95 | UNIMPLEMENTED_MSG("Unimplemented predicate result mode: {}", predicate_mode); |
| 96 | static_cast<u32>(predicate_mode)); | ||
| 97 | } | 96 | } |
| 98 | } | 97 | } |
| 99 | 98 | ||
diff --git a/src/video_core/shader/decode/conversion.cpp b/src/video_core/shader/decode/conversion.cpp index b9989c88c..fea7a54df 100644 --- a/src/video_core/shader/decode/conversion.cpp +++ b/src/video_core/shader/decode/conversion.cpp | |||
| @@ -244,7 +244,7 @@ u32 ShaderIR::DecodeConversion(NodeBlock& bb, u32 pc) { | |||
| 244 | return Operation(OperationCode::FTrunc, value); | 244 | return Operation(OperationCode::FTrunc, value); |
| 245 | default: | 245 | default: |
| 246 | UNIMPLEMENTED_MSG("Unimplemented F2F rounding mode {}", | 246 | UNIMPLEMENTED_MSG("Unimplemented F2F rounding mode {}", |
| 247 | static_cast<u32>(instr.conversion.f2f.rounding.Value())); | 247 | instr.conversion.f2f.rounding.Value()); |
| 248 | return value; | 248 | return value; |
| 249 | } | 249 | } |
| 250 | }(); | 250 | }(); |
| @@ -300,7 +300,7 @@ u32 ShaderIR::DecodeConversion(NodeBlock& bb, u32 pc) { | |||
| 300 | return Operation(OperationCode::FTrunc, PRECISE, value); | 300 | return Operation(OperationCode::FTrunc, PRECISE, value); |
| 301 | default: | 301 | default: |
| 302 | UNIMPLEMENTED_MSG("Unimplemented F2I rounding mode {}", | 302 | UNIMPLEMENTED_MSG("Unimplemented F2I rounding mode {}", |
| 303 | static_cast<u32>(instr.conversion.f2i.rounding.Value())); | 303 | instr.conversion.f2i.rounding.Value()); |
| 304 | return Immediate(0); | 304 | return Immediate(0); |
| 305 | } | 305 | } |
| 306 | }(); | 306 | }(); |
diff --git a/src/video_core/shader/decode/image.cpp b/src/video_core/shader/decode/image.cpp index 1ed4212ee..532f66d27 100644 --- a/src/video_core/shader/decode/image.cpp +++ b/src/video_core/shader/decode/image.cpp | |||
| @@ -358,9 +358,9 @@ u32 ShaderIR::DecodeImage(NodeBlock& bb, u32 pc) { | |||
| 358 | instr.suldst.GetStoreDataLayout() != StoreType::Bits64); | 358 | instr.suldst.GetStoreDataLayout() != StoreType::Bits64); |
| 359 | 359 | ||
| 360 | auto descriptor = [this, instr] { | 360 | auto descriptor = [this, instr] { |
| 361 | std::optional<Tegra::Engines::SamplerDescriptor> descriptor; | 361 | std::optional<Tegra::Engines::SamplerDescriptor> sampler_descriptor; |
| 362 | if (instr.suldst.is_immediate) { | 362 | if (instr.suldst.is_immediate) { |
| 363 | descriptor = | 363 | sampler_descriptor = |
| 364 | registry.ObtainBoundSampler(static_cast<u32>(instr.image.index.Value())); | 364 | registry.ObtainBoundSampler(static_cast<u32>(instr.image.index.Value())); |
| 365 | } else { | 365 | } else { |
| 366 | const Node image_register = GetRegister(instr.gpr39); | 366 | const Node image_register = GetRegister(instr.gpr39); |
| @@ -368,12 +368,12 @@ u32 ShaderIR::DecodeImage(NodeBlock& bb, u32 pc) { | |||
| 368 | static_cast<s64>(global_code.size())); | 368 | static_cast<s64>(global_code.size())); |
| 369 | const auto buffer = std::get<1>(result); | 369 | const auto buffer = std::get<1>(result); |
| 370 | const auto offset = std::get<2>(result); | 370 | const auto offset = std::get<2>(result); |
| 371 | descriptor = registry.ObtainBindlessSampler(buffer, offset); | 371 | sampler_descriptor = registry.ObtainBindlessSampler(buffer, offset); |
| 372 | } | 372 | } |
| 373 | if (!descriptor) { | 373 | if (!sampler_descriptor) { |
| 374 | UNREACHABLE_MSG("Failed to obtain image descriptor"); | 374 | UNREACHABLE_MSG("Failed to obtain image descriptor"); |
| 375 | } | 375 | } |
| 376 | return *descriptor; | 376 | return *sampler_descriptor; |
| 377 | }(); | 377 | }(); |
| 378 | 378 | ||
| 379 | const auto comp_mask = GetImageComponentMask(descriptor.format); | 379 | const auto comp_mask = GetImageComponentMask(descriptor.format); |
diff --git a/src/video_core/shader/decode/memory.cpp b/src/video_core/shader/decode/memory.cpp index e2bba88dd..50f4e7d35 100644 --- a/src/video_core/shader/decode/memory.cpp +++ b/src/video_core/shader/decode/memory.cpp | |||
| @@ -47,7 +47,7 @@ OperationCode GetAtomOperation(AtomicOp op) { | |||
| 47 | case AtomicOp::Exch: | 47 | case AtomicOp::Exch: |
| 48 | return OperationCode::AtomicIExchange; | 48 | return OperationCode::AtomicIExchange; |
| 49 | default: | 49 | default: |
| 50 | UNIMPLEMENTED_MSG("op={}", static_cast<int>(op)); | 50 | UNIMPLEMENTED_MSG("op={}", op); |
| 51 | return OperationCode::AtomicIAdd; | 51 | return OperationCode::AtomicIAdd; |
| 52 | } | 52 | } |
| 53 | } | 53 | } |
| @@ -83,7 +83,7 @@ u32 GetMemorySize(Tegra::Shader::UniformType uniform_type) { | |||
| 83 | case Tegra::Shader::UniformType::UnsignedQuad: | 83 | case Tegra::Shader::UniformType::UnsignedQuad: |
| 84 | return 128; | 84 | return 128; |
| 85 | default: | 85 | default: |
| 86 | UNIMPLEMENTED_MSG("Unimplemented size={}!", static_cast<u32>(uniform_type)); | 86 | UNIMPLEMENTED_MSG("Unimplemented size={}!", uniform_type); |
| 87 | return 32; | 87 | return 32; |
| 88 | } | 88 | } |
| 89 | } | 89 | } |
| @@ -175,12 +175,12 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) { | |||
| 175 | break; | 175 | break; |
| 176 | } | 176 | } |
| 177 | default: | 177 | default: |
| 178 | UNIMPLEMENTED_MSG("Unhandled type: {}", static_cast<unsigned>(instr.ld_c.type.Value())); | 178 | UNIMPLEMENTED_MSG("Unhandled type: {}", instr.ld_c.type.Value()); |
| 179 | } | 179 | } |
| 180 | break; | 180 | break; |
| 181 | } | 181 | } |
| 182 | case OpCode::Id::LD_L: | 182 | case OpCode::Id::LD_L: |
| 183 | LOG_DEBUG(HW_GPU, "LD_L cache management mode: {}", static_cast<u64>(instr.ld_l.unknown)); | 183 | LOG_DEBUG(HW_GPU, "LD_L cache management mode: {}", instr.ld_l.unknown); |
| 184 | [[fallthrough]]; | 184 | [[fallthrough]]; |
| 185 | case OpCode::Id::LD_S: { | 185 | case OpCode::Id::LD_S: { |
| 186 | const auto GetAddress = [&](s32 offset) { | 186 | const auto GetAddress = [&](s32 offset) { |
| @@ -224,7 +224,7 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) { | |||
| 224 | } | 224 | } |
| 225 | default: | 225 | default: |
| 226 | UNIMPLEMENTED_MSG("{} Unhandled type: {}", opcode->get().GetName(), | 226 | UNIMPLEMENTED_MSG("{} Unhandled type: {}", opcode->get().GetName(), |
| 227 | static_cast<u32>(instr.ldst_sl.type.Value())); | 227 | instr.ldst_sl.type.Value()); |
| 228 | } | 228 | } |
| 229 | break; | 229 | break; |
| 230 | } | 230 | } |
| @@ -306,8 +306,7 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) { | |||
| 306 | break; | 306 | break; |
| 307 | } | 307 | } |
| 308 | case OpCode::Id::ST_L: | 308 | case OpCode::Id::ST_L: |
| 309 | LOG_DEBUG(HW_GPU, "ST_L cache management mode: {}", | 309 | LOG_DEBUG(HW_GPU, "ST_L cache management mode: {}", instr.st_l.cache_management.Value()); |
| 310 | static_cast<u64>(instr.st_l.cache_management.Value())); | ||
| 311 | [[fallthrough]]; | 310 | [[fallthrough]]; |
| 312 | case OpCode::Id::ST_S: { | 311 | case OpCode::Id::ST_S: { |
| 313 | const auto GetAddress = [&](s32 offset) { | 312 | const auto GetAddress = [&](s32 offset) { |
| @@ -340,7 +339,7 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) { | |||
| 340 | } | 339 | } |
| 341 | default: | 340 | default: |
| 342 | UNIMPLEMENTED_MSG("{} unhandled type: {}", opcode->get().GetName(), | 341 | UNIMPLEMENTED_MSG("{} unhandled type: {}", opcode->get().GetName(), |
| 343 | static_cast<u32>(instr.ldst_sl.type.Value())); | 342 | instr.ldst_sl.type.Value()); |
| 344 | } | 343 | } |
| 345 | break; | 344 | break; |
| 346 | } | 345 | } |
| @@ -387,7 +386,7 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) { | |||
| 387 | } | 386 | } |
| 388 | case OpCode::Id::RED: { | 387 | case OpCode::Id::RED: { |
| 389 | UNIMPLEMENTED_IF_MSG(instr.red.type != GlobalAtomicType::U32, "type={}", | 388 | UNIMPLEMENTED_IF_MSG(instr.red.type != GlobalAtomicType::U32, "type={}", |
| 390 | static_cast<int>(instr.red.type.Value())); | 389 | instr.red.type.Value()); |
| 391 | const auto [real_address, base_address, descriptor] = | 390 | const auto [real_address, base_address, descriptor] = |
| 392 | TrackGlobalMemory(bb, instr, true, true); | 391 | TrackGlobalMemory(bb, instr, true, true); |
| 393 | if (!real_address || !base_address) { | 392 | if (!real_address || !base_address) { |
| @@ -403,12 +402,12 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) { | |||
| 403 | UNIMPLEMENTED_IF_MSG(instr.atom.operation == AtomicOp::Inc || | 402 | UNIMPLEMENTED_IF_MSG(instr.atom.operation == AtomicOp::Inc || |
| 404 | instr.atom.operation == AtomicOp::Dec || | 403 | instr.atom.operation == AtomicOp::Dec || |
| 405 | instr.atom.operation == AtomicOp::SafeAdd, | 404 | instr.atom.operation == AtomicOp::SafeAdd, |
| 406 | "operation={}", static_cast<int>(instr.atom.operation.Value())); | 405 | "operation={}", instr.atom.operation.Value()); |
| 407 | UNIMPLEMENTED_IF_MSG(instr.atom.type == GlobalAtomicType::S64 || | 406 | UNIMPLEMENTED_IF_MSG(instr.atom.type == GlobalAtomicType::S64 || |
| 408 | instr.atom.type == GlobalAtomicType::U64 || | 407 | instr.atom.type == GlobalAtomicType::U64 || |
| 409 | instr.atom.type == GlobalAtomicType::F16x2_FTZ_RN || | 408 | instr.atom.type == GlobalAtomicType::F16x2_FTZ_RN || |
| 410 | instr.atom.type == GlobalAtomicType::F32_FTZ_RN, | 409 | instr.atom.type == GlobalAtomicType::F32_FTZ_RN, |
| 411 | "type={}", static_cast<int>(instr.atom.type.Value())); | 410 | "type={}", instr.atom.type.Value()); |
| 412 | 411 | ||
| 413 | const auto [real_address, base_address, descriptor] = | 412 | const auto [real_address, base_address, descriptor] = |
| 414 | TrackGlobalMemory(bb, instr, true, true); | 413 | TrackGlobalMemory(bb, instr, true, true); |
| @@ -428,10 +427,10 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) { | |||
| 428 | case OpCode::Id::ATOMS: { | 427 | case OpCode::Id::ATOMS: { |
| 429 | UNIMPLEMENTED_IF_MSG(instr.atoms.operation == AtomicOp::Inc || | 428 | UNIMPLEMENTED_IF_MSG(instr.atoms.operation == AtomicOp::Inc || |
| 430 | instr.atoms.operation == AtomicOp::Dec, | 429 | instr.atoms.operation == AtomicOp::Dec, |
| 431 | "operation={}", static_cast<int>(instr.atoms.operation.Value())); | 430 | "operation={}", instr.atoms.operation.Value()); |
| 432 | UNIMPLEMENTED_IF_MSG(instr.atoms.type == AtomicType::S64 || | 431 | UNIMPLEMENTED_IF_MSG(instr.atoms.type == AtomicType::S64 || |
| 433 | instr.atoms.type == AtomicType::U64, | 432 | instr.atoms.type == AtomicType::U64, |
| 434 | "type={}", static_cast<int>(instr.atoms.type.Value())); | 433 | "type={}", instr.atoms.type.Value()); |
| 435 | const bool is_signed = | 434 | const bool is_signed = |
| 436 | instr.atoms.type == AtomicType::S32 || instr.atoms.type == AtomicType::S64; | 435 | instr.atoms.type == AtomicType::S32 || instr.atoms.type == AtomicType::S64; |
| 437 | const s32 offset = instr.atoms.GetImmediateOffset(); | 436 | const s32 offset = instr.atoms.GetImmediateOffset(); |
diff --git a/src/video_core/shader/decode/other.cpp b/src/video_core/shader/decode/other.cpp index 29a7cfbfe..d3ea07aac 100644 --- a/src/video_core/shader/decode/other.cpp +++ b/src/video_core/shader/decode/other.cpp | |||
| @@ -34,14 +34,13 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) { | |||
| 34 | break; | 34 | break; |
| 35 | } | 35 | } |
| 36 | case OpCode::Id::EXIT: { | 36 | case OpCode::Id::EXIT: { |
| 37 | const Tegra::Shader::ConditionCode cc = instr.flow_condition_code; | 37 | const ConditionCode cc = instr.flow_condition_code; |
| 38 | UNIMPLEMENTED_IF_MSG(cc != Tegra::Shader::ConditionCode::T, "EXIT condition code used: {}", | 38 | UNIMPLEMENTED_IF_MSG(cc != ConditionCode::T, "EXIT condition code used: {}", cc); |
| 39 | static_cast<u32>(cc)); | ||
| 40 | 39 | ||
| 41 | switch (instr.flow.cond) { | 40 | switch (instr.flow.cond) { |
| 42 | case Tegra::Shader::FlowCondition::Always: | 41 | case Tegra::Shader::FlowCondition::Always: |
| 43 | bb.push_back(Operation(OperationCode::Exit)); | 42 | bb.push_back(Operation(OperationCode::Exit)); |
| 44 | if (instr.pred.pred_index == static_cast<u64>(Tegra::Shader::Pred::UnusedIndex)) { | 43 | if (instr.pred.pred_index == static_cast<u64>(Pred::UnusedIndex)) { |
| 45 | // If this is an unconditional exit then just end processing here, | 44 | // If this is an unconditional exit then just end processing here, |
| 46 | // otherwise we have to account for the possibility of the condition | 45 | // otherwise we have to account for the possibility of the condition |
| 47 | // not being met, so continue processing the next instruction. | 46 | // not being met, so continue processing the next instruction. |
| @@ -56,17 +55,15 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) { | |||
| 56 | break; | 55 | break; |
| 57 | 56 | ||
| 58 | default: | 57 | default: |
| 59 | UNIMPLEMENTED_MSG("Unhandled flow condition: {}", | 58 | UNIMPLEMENTED_MSG("Unhandled flow condition: {}", instr.flow.cond.Value()); |
| 60 | static_cast<u32>(instr.flow.cond.Value())); | ||
| 61 | } | 59 | } |
| 62 | break; | 60 | break; |
| 63 | } | 61 | } |
| 64 | case OpCode::Id::KIL: { | 62 | case OpCode::Id::KIL: { |
| 65 | UNIMPLEMENTED_IF(instr.flow.cond != Tegra::Shader::FlowCondition::Always); | 63 | UNIMPLEMENTED_IF(instr.flow.cond != Tegra::Shader::FlowCondition::Always); |
| 66 | 64 | ||
| 67 | const Tegra::Shader::ConditionCode cc = instr.flow_condition_code; | 65 | const ConditionCode cc = instr.flow_condition_code; |
| 68 | UNIMPLEMENTED_IF_MSG(cc != Tegra::Shader::ConditionCode::T, "KIL condition code used: {}", | 66 | UNIMPLEMENTED_IF_MSG(cc != ConditionCode::T, "KIL condition code used: {}", cc); |
| 69 | static_cast<u32>(cc)); | ||
| 70 | 67 | ||
| 71 | bb.push_back(Operation(OperationCode::Discard)); | 68 | bb.push_back(Operation(OperationCode::Discard)); |
| 72 | break; | 69 | break; |
| @@ -90,11 +87,11 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) { | |||
| 90 | UNIMPLEMENTED_MSG("S2R WscaleFactorZ is not implemented"); | 87 | UNIMPLEMENTED_MSG("S2R WscaleFactorZ is not implemented"); |
| 91 | return Immediate(0U); | 88 | return Immediate(0U); |
| 92 | case SystemVariable::Tid: { | 89 | case SystemVariable::Tid: { |
| 93 | Node value = Immediate(0); | 90 | Node val = Immediate(0); |
| 94 | value = BitfieldInsert(value, Operation(OperationCode::LocalInvocationIdX), 0, 9); | 91 | val = BitfieldInsert(val, Operation(OperationCode::LocalInvocationIdX), 0, 9); |
| 95 | value = BitfieldInsert(value, Operation(OperationCode::LocalInvocationIdY), 16, 9); | 92 | val = BitfieldInsert(val, Operation(OperationCode::LocalInvocationIdY), 16, 9); |
| 96 | value = BitfieldInsert(value, Operation(OperationCode::LocalInvocationIdZ), 26, 5); | 93 | val = BitfieldInsert(val, Operation(OperationCode::LocalInvocationIdZ), 26, 5); |
| 97 | return value; | 94 | return val; |
| 98 | } | 95 | } |
| 99 | case SystemVariable::TidX: | 96 | case SystemVariable::TidX: |
| 100 | return Operation(OperationCode::LocalInvocationIdX); | 97 | return Operation(OperationCode::LocalInvocationIdX); |
| @@ -130,8 +127,7 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) { | |||
| 130 | return Immediate(0u); | 127 | return Immediate(0u); |
| 131 | } | 128 | } |
| 132 | default: | 129 | default: |
| 133 | UNIMPLEMENTED_MSG("Unhandled system move: {}", | 130 | UNIMPLEMENTED_MSG("Unhandled system move: {}", instr.sys20.Value()); |
| 134 | static_cast<u32>(instr.sys20.Value())); | ||
| 135 | return Immediate(0u); | 131 | return Immediate(0u); |
| 136 | } | 132 | } |
| 137 | }(); | 133 | }(); |
| @@ -181,8 +177,8 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) { | |||
| 181 | } | 177 | } |
| 182 | const Node branch = Operation(OperationCode::BranchIndirect, operand); | 178 | const Node branch = Operation(OperationCode::BranchIndirect, operand); |
| 183 | 179 | ||
| 184 | const Tegra::Shader::ConditionCode cc = instr.flow_condition_code; | 180 | const ConditionCode cc = instr.flow_condition_code; |
| 185 | if (cc != Tegra::Shader::ConditionCode::T) { | 181 | if (cc != ConditionCode::T) { |
| 186 | bb.push_back(Conditional(GetConditionCode(cc), {branch})); | 182 | bb.push_back(Conditional(GetConditionCode(cc), {branch})); |
| 187 | } else { | 183 | } else { |
| 188 | bb.push_back(branch); | 184 | bb.push_back(branch); |
| @@ -218,9 +214,8 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) { | |||
| 218 | break; | 214 | break; |
| 219 | } | 215 | } |
| 220 | case OpCode::Id::SYNC: { | 216 | case OpCode::Id::SYNC: { |
| 221 | const Tegra::Shader::ConditionCode cc = instr.flow_condition_code; | 217 | const ConditionCode cc = instr.flow_condition_code; |
| 222 | UNIMPLEMENTED_IF_MSG(cc != Tegra::Shader::ConditionCode::T, "SYNC condition code used: {}", | 218 | UNIMPLEMENTED_IF_MSG(cc != ConditionCode::T, "SYNC condition code used: {}", cc); |
| 223 | static_cast<u32>(cc)); | ||
| 224 | 219 | ||
| 225 | if (decompiled) { | 220 | if (decompiled) { |
| 226 | break; | 221 | break; |
| @@ -231,9 +226,8 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) { | |||
| 231 | break; | 226 | break; |
| 232 | } | 227 | } |
| 233 | case OpCode::Id::BRK: { | 228 | case OpCode::Id::BRK: { |
| 234 | const Tegra::Shader::ConditionCode cc = instr.flow_condition_code; | 229 | const ConditionCode cc = instr.flow_condition_code; |
| 235 | UNIMPLEMENTED_IF_MSG(cc != Tegra::Shader::ConditionCode::T, "BRK condition code used: {}", | 230 | UNIMPLEMENTED_IF_MSG(cc != ConditionCode::T, "BRK condition code used: {}", cc); |
| 236 | static_cast<u32>(cc)); | ||
| 237 | if (decompiled) { | 231 | if (decompiled) { |
| 238 | break; | 232 | break; |
| 239 | } | 233 | } |
| @@ -306,7 +300,7 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) { | |||
| 306 | case Tegra::Shader::MembarType::GL: | 300 | case Tegra::Shader::MembarType::GL: |
| 307 | return OperationCode::MemoryBarrierGlobal; | 301 | return OperationCode::MemoryBarrierGlobal; |
| 308 | default: | 302 | default: |
| 309 | UNIMPLEMENTED_MSG("MEMBAR type={}", static_cast<int>(instr.membar.type.Value())); | 303 | UNIMPLEMENTED_MSG("MEMBAR type={}", instr.membar.type.Value()); |
| 310 | return OperationCode::MemoryBarrierGlobal; | 304 | return OperationCode::MemoryBarrierGlobal; |
| 311 | } | 305 | } |
| 312 | }(); | 306 | }(); |
diff --git a/src/video_core/shader/decode/shift.cpp b/src/video_core/shader/decode/shift.cpp index d4ffa8014..a53819c15 100644 --- a/src/video_core/shader/decode/shift.cpp +++ b/src/video_core/shader/decode/shift.cpp | |||
| @@ -125,7 +125,7 @@ u32 ShaderIR::DecodeShift(NodeBlock& bb, u32 pc) { | |||
| 125 | case OpCode::Id::SHF_LEFT_IMM: { | 125 | case OpCode::Id::SHF_LEFT_IMM: { |
| 126 | UNIMPLEMENTED_IF(instr.generates_cc); | 126 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 127 | UNIMPLEMENTED_IF_MSG(instr.shf.xmode != ShfXmode::None, "xmode={}", | 127 | UNIMPLEMENTED_IF_MSG(instr.shf.xmode != ShfXmode::None, "xmode={}", |
| 128 | static_cast<int>(instr.shf.xmode.Value())); | 128 | instr.shf.xmode.Value()); |
| 129 | 129 | ||
| 130 | if (instr.is_b_imm) { | 130 | if (instr.is_b_imm) { |
| 131 | op_b = Immediate(static_cast<u32>(instr.shf.immediate)); | 131 | op_b = Immediate(static_cast<u32>(instr.shf.immediate)); |
diff --git a/src/video_core/shader/decode/texture.cpp b/src/video_core/shader/decode/texture.cpp index 02fdccd86..fb18f631f 100644 --- a/src/video_core/shader/decode/texture.cpp +++ b/src/video_core/shader/decode/texture.cpp | |||
| @@ -34,7 +34,7 @@ static std::size_t GetCoordCount(TextureType texture_type) { | |||
| 34 | case TextureType::TextureCube: | 34 | case TextureType::TextureCube: |
| 35 | return 3; | 35 | return 3; |
| 36 | default: | 36 | default: |
| 37 | UNIMPLEMENTED_MSG("Unhandled texture type: {}", static_cast<u32>(texture_type)); | 37 | UNIMPLEMENTED_MSG("Unhandled texture type: {}", texture_type); |
| 38 | return 0; | 38 | return 0; |
| 39 | } | 39 | } |
| 40 | } | 40 | } |
| @@ -255,8 +255,7 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) { | |||
| 255 | break; | 255 | break; |
| 256 | } | 256 | } |
| 257 | default: | 257 | default: |
| 258 | UNIMPLEMENTED_MSG("Unhandled texture query type: {}", | 258 | UNIMPLEMENTED_MSG("Unhandled texture query type: {}", instr.txq.query_type.Value()); |
| 259 | static_cast<u32>(instr.txq.query_type.Value())); | ||
| 260 | } | 259 | } |
| 261 | break; | 260 | break; |
| 262 | } | 261 | } |
| @@ -302,7 +301,7 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) { | |||
| 302 | case TextureType::TextureCube: | 301 | case TextureType::TextureCube: |
| 303 | return 3; | 302 | return 3; |
| 304 | default: | 303 | default: |
| 305 | UNIMPLEMENTED_MSG("Unhandled texture type {}", static_cast<int>(texture_type)); | 304 | UNIMPLEMENTED_MSG("Unhandled texture type {}", texture_type); |
| 306 | return 2; | 305 | return 2; |
| 307 | } | 306 | } |
| 308 | }(); | 307 | }(); |
| @@ -595,7 +594,7 @@ Node4 ShaderIR::GetTextureCode(Instruction instr, TextureType texture_type, | |||
| 595 | lod = GetRegister(instr.gpr20.Value() + bias_offset); | 594 | lod = GetRegister(instr.gpr20.Value() + bias_offset); |
| 596 | break; | 595 | break; |
| 597 | default: | 596 | default: |
| 598 | UNIMPLEMENTED_MSG("Unimplemented process mode={}", static_cast<u32>(process_mode)); | 597 | UNIMPLEMENTED_MSG("Unimplemented process mode={}", process_mode); |
| 599 | break; | 598 | break; |
| 600 | } | 599 | } |
| 601 | 600 | ||
diff --git a/src/video_core/shader/decode/warp.cpp b/src/video_core/shader/decode/warp.cpp index 11b77f795..37433d783 100644 --- a/src/video_core/shader/decode/warp.cpp +++ b/src/video_core/shader/decode/warp.cpp | |||
| @@ -27,7 +27,7 @@ OperationCode GetOperationCode(VoteOperation vote_op) { | |||
| 27 | case VoteOperation::Eq: | 27 | case VoteOperation::Eq: |
| 28 | return OperationCode::VoteEqual; | 28 | return OperationCode::VoteEqual; |
| 29 | default: | 29 | default: |
| 30 | UNREACHABLE_MSG("Invalid vote operation={}", static_cast<u64>(vote_op)); | 30 | UNREACHABLE_MSG("Invalid vote operation={}", vote_op); |
| 31 | return OperationCode::VoteAll; | 31 | return OperationCode::VoteAll; |
| 32 | } | 32 | } |
| 33 | } | 33 | } |
diff --git a/src/video_core/shader/expr.h b/src/video_core/shader/expr.h index 4e8264367..cda284c72 100644 --- a/src/video_core/shader/expr.h +++ b/src/video_core/shader/expr.h | |||
| @@ -76,7 +76,7 @@ public: | |||
| 76 | 76 | ||
| 77 | class ExprPredicate final { | 77 | class ExprPredicate final { |
| 78 | public: | 78 | public: |
| 79 | explicit ExprPredicate(u32 predicate) : predicate{predicate} {} | 79 | explicit ExprPredicate(u32 predicate_) : predicate{predicate_} {} |
| 80 | 80 | ||
| 81 | bool operator==(const ExprPredicate& b) const { | 81 | bool operator==(const ExprPredicate& b) const { |
| 82 | return predicate == b.predicate; | 82 | return predicate == b.predicate; |
| @@ -91,7 +91,7 @@ public: | |||
| 91 | 91 | ||
| 92 | class ExprCondCode final { | 92 | class ExprCondCode final { |
| 93 | public: | 93 | public: |
| 94 | explicit ExprCondCode(ConditionCode cc) : cc{cc} {} | 94 | explicit ExprCondCode(ConditionCode condition_code) : cc{condition_code} {} |
| 95 | 95 | ||
| 96 | bool operator==(const ExprCondCode& b) const { | 96 | bool operator==(const ExprCondCode& b) const { |
| 97 | return cc == b.cc; | 97 | return cc == b.cc; |
| @@ -121,7 +121,7 @@ public: | |||
| 121 | 121 | ||
| 122 | class ExprGprEqual final { | 122 | class ExprGprEqual final { |
| 123 | public: | 123 | public: |
| 124 | ExprGprEqual(u32 gpr, u32 value) : gpr{gpr}, value{value} {} | 124 | explicit ExprGprEqual(u32 gpr_, u32 value_) : gpr{gpr_}, value{value_} {} |
| 125 | 125 | ||
| 126 | bool operator==(const ExprGprEqual& b) const { | 126 | bool operator==(const ExprGprEqual& b) const { |
| 127 | return gpr == b.gpr && value == b.value; | 127 | return gpr == b.gpr && value == b.value; |
diff --git a/src/video_core/shader/node.h b/src/video_core/shader/node.h index a1e2c4d8e..8db9e1de7 100644 --- a/src/video_core/shader/node.h +++ b/src/video_core/shader/node.h | |||
| @@ -290,18 +290,18 @@ struct Sampler { | |||
| 290 | is_buffer{is_buffer_}, is_indexed{is_indexed_} {} | 290 | is_buffer{is_buffer_}, is_indexed{is_indexed_} {} |
| 291 | 291 | ||
| 292 | /// Separate sampler constructor | 292 | /// Separate sampler constructor |
| 293 | constexpr explicit Sampler(u32 index_, std::pair<u32, u32> offsets, std::pair<u32, u32> buffers, | 293 | constexpr explicit Sampler(u32 index_, std::pair<u32, u32> offsets_, |
| 294 | Tegra::Shader::TextureType type, bool is_array_, bool is_shadow_, | 294 | std::pair<u32, u32> buffers_, Tegra::Shader::TextureType type_, |
| 295 | bool is_buffer_) | 295 | bool is_array_, bool is_shadow_, bool is_buffer_) |
| 296 | : index{index_}, offset{offsets.first}, secondary_offset{offsets.second}, | 296 | : index{index_}, offset{offsets_.first}, secondary_offset{offsets_.second}, |
| 297 | buffer{buffers.first}, secondary_buffer{buffers.second}, type{type}, is_array{is_array_}, | 297 | buffer{buffers_.first}, secondary_buffer{buffers_.second}, type{type_}, |
| 298 | is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_separated{true} {} | 298 | is_array{is_array_}, is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_separated{true} {} |
| 299 | 299 | ||
| 300 | /// Bindless samplers constructor | 300 | /// Bindless samplers constructor |
| 301 | constexpr explicit Sampler(u32 index_, u32 offset_, u32 buffer_, | 301 | constexpr explicit Sampler(u32 index_, u32 offset_, u32 buffer_, |
| 302 | Tegra::Shader::TextureType type, bool is_array_, bool is_shadow_, | 302 | Tegra::Shader::TextureType type_, bool is_array_, bool is_shadow_, |
| 303 | bool is_buffer_, bool is_indexed_) | 303 | bool is_buffer_, bool is_indexed_) |
| 304 | : index{index_}, offset{offset_}, buffer{buffer_}, type{type}, is_array{is_array_}, | 304 | : index{index_}, offset{offset_}, buffer{buffer_}, type{type_}, is_array{is_array_}, |
| 305 | is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_bindless{true}, is_indexed{is_indexed_} { | 305 | is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_bindless{true}, is_indexed{is_indexed_} { |
| 306 | } | 306 | } |
| 307 | 307 | ||
diff --git a/src/video_core/shader/node_helper.cpp b/src/video_core/shader/node_helper.cpp index 7bf4ff387..6a5b6940d 100644 --- a/src/video_core/shader/node_helper.cpp +++ b/src/video_core/shader/node_helper.cpp | |||
| @@ -107,7 +107,7 @@ OperationCode SignedToUnsignedCode(OperationCode operation_code, bool is_signed) | |||
| 107 | UNREACHABLE_MSG("Can't apply absolute to an unsigned integer"); | 107 | UNREACHABLE_MSG("Can't apply absolute to an unsigned integer"); |
| 108 | return {}; | 108 | return {}; |
| 109 | default: | 109 | default: |
| 110 | UNREACHABLE_MSG("Unknown signed operation with code={}", static_cast<u32>(operation_code)); | 110 | UNREACHABLE_MSG("Unknown signed operation with code={}", operation_code); |
| 111 | return {}; | 111 | return {}; |
| 112 | } | 112 | } |
| 113 | } | 113 | } |
diff --git a/src/video_core/shader/shader_ir.cpp b/src/video_core/shader/shader_ir.cpp index 29d794b34..a4987ffc6 100644 --- a/src/video_core/shader/shader_ir.cpp +++ b/src/video_core/shader/shader_ir.cpp | |||
| @@ -25,9 +25,10 @@ using Tegra::Shader::PredCondition; | |||
| 25 | using Tegra::Shader::PredOperation; | 25 | using Tegra::Shader::PredOperation; |
| 26 | using Tegra::Shader::Register; | 26 | using Tegra::Shader::Register; |
| 27 | 27 | ||
| 28 | ShaderIR::ShaderIR(const ProgramCode& program_code, u32 main_offset, CompilerSettings settings, | 28 | ShaderIR::ShaderIR(const ProgramCode& program_code_, u32 main_offset_, CompilerSettings settings_, |
| 29 | Registry& registry) | 29 | Registry& registry_) |
| 30 | : program_code{program_code}, main_offset{main_offset}, settings{settings}, registry{registry} { | 30 | : program_code{program_code_}, main_offset{main_offset_}, settings{settings_}, registry{ |
| 31 | registry_} { | ||
| 31 | Decode(); | 32 | Decode(); |
| 32 | PostDecode(); | 33 | PostDecode(); |
| 33 | } | 34 | } |
| @@ -170,7 +171,7 @@ Node ShaderIR::ConvertIntegerSize(Node value, Register::Size size, bool is_signe | |||
| 170 | // Default - do nothing | 171 | // Default - do nothing |
| 171 | return value; | 172 | return value; |
| 172 | default: | 173 | default: |
| 173 | UNREACHABLE_MSG("Unimplemented conversion size: {}", static_cast<u32>(size)); | 174 | UNREACHABLE_MSG("Unimplemented conversion size: {}", size); |
| 174 | return value; | 175 | return value; |
| 175 | } | 176 | } |
| 176 | } | 177 | } |
| @@ -335,15 +336,15 @@ OperationCode ShaderIR::GetPredicateCombiner(PredOperation operation) { | |||
| 335 | return operation_table[index]; | 336 | return operation_table[index]; |
| 336 | } | 337 | } |
| 337 | 338 | ||
| 338 | Node ShaderIR::GetConditionCode(Tegra::Shader::ConditionCode cc) const { | 339 | Node ShaderIR::GetConditionCode(ConditionCode cc) const { |
| 339 | switch (cc) { | 340 | switch (cc) { |
| 340 | case Tegra::Shader::ConditionCode::NEU: | 341 | case ConditionCode::NEU: |
| 341 | return GetInternalFlag(InternalFlag::Zero, true); | 342 | return GetInternalFlag(InternalFlag::Zero, true); |
| 342 | case Tegra::Shader::ConditionCode::FCSM_TR: | 343 | case ConditionCode::FCSM_TR: |
| 343 | UNIMPLEMENTED_MSG("EXIT.FCSM_TR is not implemented"); | 344 | UNIMPLEMENTED_MSG("EXIT.FCSM_TR is not implemented"); |
| 344 | return MakeNode<PredicateNode>(Pred::NeverExecute, false); | 345 | return MakeNode<PredicateNode>(Pred::NeverExecute, false); |
| 345 | default: | 346 | default: |
| 346 | UNIMPLEMENTED_MSG("Unimplemented condition code: {}", static_cast<u32>(cc)); | 347 | UNIMPLEMENTED_MSG("Unimplemented condition code: {}", cc); |
| 347 | return MakeNode<PredicateNode>(Pred::NeverExecute, false); | 348 | return MakeNode<PredicateNode>(Pred::NeverExecute, false); |
| 348 | } | 349 | } |
| 349 | } | 350 | } |
| @@ -451,8 +452,8 @@ void ShaderIR::MarkAttributeUsage(Attribute::Index index, u64 element) { | |||
| 451 | } | 452 | } |
| 452 | 453 | ||
| 453 | std::size_t ShaderIR::DeclareAmend(Node new_amend) { | 454 | std::size_t ShaderIR::DeclareAmend(Node new_amend) { |
| 454 | const std::size_t id = amend_code.size(); | 455 | const auto id = amend_code.size(); |
| 455 | amend_code.push_back(new_amend); | 456 | amend_code.push_back(std::move(new_amend)); |
| 456 | return id; | 457 | return id; |
| 457 | } | 458 | } |
| 458 | 459 | ||
diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h index 3a98b2104..6aae14e34 100644 --- a/src/video_core/shader/shader_ir.h +++ b/src/video_core/shader/shader_ir.h | |||
| @@ -29,8 +29,8 @@ struct ShaderBlock; | |||
| 29 | constexpr u32 MAX_PROGRAM_LENGTH = 0x1000; | 29 | constexpr u32 MAX_PROGRAM_LENGTH = 0x1000; |
| 30 | 30 | ||
| 31 | struct ConstBuffer { | 31 | struct ConstBuffer { |
| 32 | constexpr explicit ConstBuffer(u32 max_offset, bool is_indirect) | 32 | constexpr explicit ConstBuffer(u32 max_offset_, bool is_indirect_) |
| 33 | : max_offset{max_offset}, is_indirect{is_indirect} {} | 33 | : max_offset{max_offset_}, is_indirect{is_indirect_} {} |
| 34 | 34 | ||
| 35 | constexpr ConstBuffer() = default; | 35 | constexpr ConstBuffer() = default; |
| 36 | 36 | ||
| @@ -66,8 +66,8 @@ struct GlobalMemoryUsage { | |||
| 66 | 66 | ||
| 67 | class ShaderIR final { | 67 | class ShaderIR final { |
| 68 | public: | 68 | public: |
| 69 | explicit ShaderIR(const ProgramCode& program_code, u32 main_offset, CompilerSettings settings, | 69 | explicit ShaderIR(const ProgramCode& program_code_, u32 main_offset_, |
| 70 | Registry& registry); | 70 | CompilerSettings settings_, Registry& registry_); |
| 71 | ~ShaderIR(); | 71 | ~ShaderIR(); |
| 72 | 72 | ||
| 73 | const std::map<u32, NodeBlock>& GetBasicBlocks() const { | 73 | const std::map<u32, NodeBlock>& GetBasicBlocks() const { |
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index 1688267bb..937e29d1e 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp | |||
| @@ -28,7 +28,7 @@ SurfaceTarget SurfaceTargetFromTextureType(Tegra::Texture::TextureType texture_t | |||
| 28 | case Tegra::Texture::TextureType::Texture2DArray: | 28 | case Tegra::Texture::TextureType::Texture2DArray: |
| 29 | return SurfaceTarget::Texture2DArray; | 29 | return SurfaceTarget::Texture2DArray; |
| 30 | default: | 30 | default: |
| 31 | LOG_CRITICAL(HW_GPU, "Unimplemented texture_type={}", static_cast<u32>(texture_type)); | 31 | LOG_CRITICAL(HW_GPU, "Unimplemented texture_type={}", texture_type); |
| 32 | UNREACHABLE(); | 32 | UNREACHABLE(); |
| 33 | return SurfaceTarget::Texture2D; | 33 | return SurfaceTarget::Texture2D; |
| 34 | } | 34 | } |
| @@ -47,7 +47,7 @@ bool SurfaceTargetIsLayered(SurfaceTarget target) { | |||
| 47 | case SurfaceTarget::TextureCubeArray: | 47 | case SurfaceTarget::TextureCubeArray: |
| 48 | return true; | 48 | return true; |
| 49 | default: | 49 | default: |
| 50 | LOG_CRITICAL(HW_GPU, "Unimplemented surface_target={}", static_cast<u32>(target)); | 50 | LOG_CRITICAL(HW_GPU, "Unimplemented surface_target={}", target); |
| 51 | UNREACHABLE(); | 51 | UNREACHABLE(); |
| 52 | return false; | 52 | return false; |
| 53 | } | 53 | } |
| @@ -66,7 +66,7 @@ bool SurfaceTargetIsArray(SurfaceTarget target) { | |||
| 66 | case SurfaceTarget::TextureCubeArray: | 66 | case SurfaceTarget::TextureCubeArray: |
| 67 | return true; | 67 | return true; |
| 68 | default: | 68 | default: |
| 69 | LOG_CRITICAL(HW_GPU, "Unimplemented surface_target={}", static_cast<u32>(target)); | 69 | LOG_CRITICAL(HW_GPU, "Unimplemented surface_target={}", target); |
| 70 | UNREACHABLE(); | 70 | UNREACHABLE(); |
| 71 | return false; | 71 | return false; |
| 72 | } | 72 | } |
| @@ -85,7 +85,7 @@ PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format) { | |||
| 85 | case Tegra::DepthFormat::D32_FLOAT_S8X24_UINT: | 85 | case Tegra::DepthFormat::D32_FLOAT_S8X24_UINT: |
| 86 | return PixelFormat::D32_FLOAT_S8_UINT; | 86 | return PixelFormat::D32_FLOAT_S8_UINT; |
| 87 | default: | 87 | default: |
| 88 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<u32>(format)); | 88 | UNIMPLEMENTED_MSG("Unimplemented format={}", format); |
| 89 | return PixelFormat::S8_UINT_D24_UNORM; | 89 | return PixelFormat::S8_UINT_D24_UNORM; |
| 90 | } | 90 | } |
| 91 | } | 91 | } |
| @@ -183,7 +183,7 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) | |||
| 183 | case Tegra::RenderTargetFormat::R8_UINT: | 183 | case Tegra::RenderTargetFormat::R8_UINT: |
| 184 | return PixelFormat::R8_UINT; | 184 | return PixelFormat::R8_UINT; |
| 185 | default: | 185 | default: |
| 186 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<int>(format)); | 186 | UNIMPLEMENTED_MSG("Unimplemented format={}", format); |
| 187 | return PixelFormat::A8B8G8R8_UNORM; | 187 | return PixelFormat::A8B8G8R8_UNORM; |
| 188 | } | 188 | } |
| 189 | } | 189 | } |
| @@ -197,7 +197,7 @@ PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat | |||
| 197 | case Tegra::FramebufferConfig::PixelFormat::B8G8R8A8_UNORM: | 197 | case Tegra::FramebufferConfig::PixelFormat::B8G8R8A8_UNORM: |
| 198 | return PixelFormat::B8G8R8A8_UNORM; | 198 | return PixelFormat::B8G8R8A8_UNORM; |
| 199 | default: | 199 | default: |
| 200 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<u32>(format)); | 200 | UNIMPLEMENTED_MSG("Unimplemented format={}", format); |
| 201 | return PixelFormat::A8B8G8R8_UNORM; | 201 | return PixelFormat::A8B8G8R8_UNORM; |
| 202 | } | 202 | } |
| 203 | } | 203 | } |
diff --git a/src/video_core/texture_cache/copy_params.h b/src/video_core/texture_cache/copy_params.h index 9c21a0649..5b475fe06 100644 --- a/src/video_core/texture_cache/copy_params.h +++ b/src/video_core/texture_cache/copy_params.h | |||
| @@ -9,16 +9,16 @@ | |||
| 9 | namespace VideoCommon { | 9 | namespace VideoCommon { |
| 10 | 10 | ||
| 11 | struct CopyParams { | 11 | struct CopyParams { |
| 12 | constexpr CopyParams(u32 source_x, u32 source_y, u32 source_z, u32 dest_x, u32 dest_y, | 12 | constexpr CopyParams(u32 source_x_, u32 source_y_, u32 source_z_, u32 dest_x_, u32 dest_y_, |
| 13 | u32 dest_z, u32 source_level, u32 dest_level, u32 width, u32 height, | 13 | u32 dest_z_, u32 source_level_, u32 dest_level_, u32 width_, u32 height_, |
| 14 | u32 depth) | 14 | u32 depth_) |
| 15 | : source_x{source_x}, source_y{source_y}, source_z{source_z}, dest_x{dest_x}, | 15 | : source_x{source_x_}, source_y{source_y_}, source_z{source_z_}, dest_x{dest_x_}, |
| 16 | dest_y{dest_y}, dest_z{dest_z}, source_level{source_level}, | 16 | dest_y{dest_y_}, dest_z{dest_z_}, source_level{source_level_}, |
| 17 | dest_level{dest_level}, width{width}, height{height}, depth{depth} {} | 17 | dest_level{dest_level_}, width{width_}, height{height_}, depth{depth_} {} |
| 18 | 18 | ||
| 19 | constexpr CopyParams(u32 width, u32 height, u32 depth, u32 level) | 19 | constexpr CopyParams(u32 width_, u32 height_, u32 depth_, u32 level_) |
| 20 | : source_x{}, source_y{}, source_z{}, dest_x{}, dest_y{}, dest_z{}, source_level{level}, | 20 | : source_x{}, source_y{}, source_z{}, dest_x{}, dest_y{}, dest_z{}, source_level{level_}, |
| 21 | dest_level{level}, width{width}, height{height}, depth{depth} {} | 21 | dest_level{level_}, width{width_}, height{height_}, depth{depth_} {} |
| 22 | 22 | ||
| 23 | u32 source_x; | 23 | u32 source_x; |
| 24 | u32 source_y; | 24 | u32 source_y; |
diff --git a/src/video_core/texture_cache/format_lookup_table.cpp b/src/video_core/texture_cache/format_lookup_table.cpp index 7d5a75648..7938d71eb 100644 --- a/src/video_core/texture_cache/format_lookup_table.cpp +++ b/src/video_core/texture_cache/format_lookup_table.cpp | |||
| @@ -24,12 +24,12 @@ constexpr bool C = false; // Normal color | |||
| 24 | constexpr bool S = true; // Srgb | 24 | constexpr bool S = true; // Srgb |
| 25 | 25 | ||
| 26 | struct Table { | 26 | struct Table { |
| 27 | constexpr Table(TextureFormat texture_format, bool is_srgb, ComponentType red_component, | 27 | constexpr Table(TextureFormat texture_format_, bool is_srgb_, ComponentType red_component_, |
| 28 | ComponentType green_component, ComponentType blue_component, | 28 | ComponentType green_component_, ComponentType blue_component_, |
| 29 | ComponentType alpha_component, PixelFormat pixel_format) | 29 | ComponentType alpha_component_, PixelFormat pixel_format_) |
| 30 | : texture_format{texture_format}, pixel_format{pixel_format}, red_component{red_component}, | 30 | : texture_format{texture_format_}, pixel_format{pixel_format_}, |
| 31 | green_component{green_component}, blue_component{blue_component}, | 31 | red_component{red_component_}, green_component{green_component_}, |
| 32 | alpha_component{alpha_component}, is_srgb{is_srgb} {} | 32 | blue_component{blue_component_}, alpha_component{alpha_component_}, is_srgb{is_srgb_} {} |
| 33 | 33 | ||
| 34 | TextureFormat texture_format; | 34 | TextureFormat texture_format; |
| 35 | PixelFormat pixel_format; | 35 | PixelFormat pixel_format; |
diff --git a/src/video_core/texture_cache/surface_base.cpp b/src/video_core/texture_cache/surface_base.cpp index b44c09d71..efbcf6723 100644 --- a/src/video_core/texture_cache/surface_base.cpp +++ b/src/video_core/texture_cache/surface_base.cpp | |||
| @@ -25,11 +25,11 @@ StagingCache::StagingCache() = default; | |||
| 25 | 25 | ||
| 26 | StagingCache::~StagingCache() = default; | 26 | StagingCache::~StagingCache() = default; |
| 27 | 27 | ||
| 28 | SurfaceBaseImpl::SurfaceBaseImpl(GPUVAddr gpu_addr, const SurfaceParams& params, | 28 | SurfaceBaseImpl::SurfaceBaseImpl(GPUVAddr gpu_addr_, const SurfaceParams& params_, |
| 29 | bool is_astc_supported) | 29 | bool is_astc_supported_) |
| 30 | : params{params}, gpu_addr{gpu_addr}, mipmap_sizes(params.num_levels), | 30 | : params{params_}, gpu_addr{gpu_addr_}, mipmap_sizes(params_.num_levels), |
| 31 | mipmap_offsets(params.num_levels) { | 31 | mipmap_offsets(params.num_levels) { |
| 32 | is_converted = IsPixelFormatASTC(params.pixel_format) && !is_astc_supported; | 32 | is_converted = IsPixelFormatASTC(params.pixel_format) && !is_astc_supported_; |
| 33 | host_memory_size = params.GetHostSizeInBytes(is_converted); | 33 | host_memory_size = params.GetHostSizeInBytes(is_converted); |
| 34 | 34 | ||
| 35 | std::size_t offset = 0; | 35 | std::size_t offset = 0; |
| @@ -167,27 +167,28 @@ std::vector<CopyParams> SurfaceBaseImpl::BreakDownNonLayered(const SurfaceParams | |||
| 167 | return result; | 167 | return result; |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | void SurfaceBaseImpl::SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& params, | 170 | void SurfaceBaseImpl::SwizzleFunc(MortonSwizzleMode mode, u8* memory, |
| 171 | u8* buffer, u32 level) { | 171 | const SurfaceParams& surface_params, u8* buffer, u32 level) { |
| 172 | const u32 width{params.GetMipWidth(level)}; | 172 | const u32 width{surface_params.GetMipWidth(level)}; |
| 173 | const u32 height{params.GetMipHeight(level)}; | 173 | const u32 height{surface_params.GetMipHeight(level)}; |
| 174 | const u32 block_height{params.GetMipBlockHeight(level)}; | 174 | const u32 block_height{surface_params.GetMipBlockHeight(level)}; |
| 175 | const u32 block_depth{params.GetMipBlockDepth(level)}; | 175 | const u32 block_depth{surface_params.GetMipBlockDepth(level)}; |
| 176 | 176 | ||
| 177 | std::size_t guest_offset{mipmap_offsets[level]}; | 177 | std::size_t guest_offset{mipmap_offsets[level]}; |
| 178 | if (params.is_layered) { | 178 | if (surface_params.is_layered) { |
| 179 | std::size_t host_offset = 0; | 179 | std::size_t host_offset = 0; |
| 180 | const std::size_t guest_stride = layer_size; | 180 | const std::size_t guest_stride = layer_size; |
| 181 | const std::size_t host_stride = params.GetHostLayerSize(level); | 181 | const std::size_t host_stride = surface_params.GetHostLayerSize(level); |
| 182 | for (u32 layer = 0; layer < params.depth; ++layer) { | 182 | for (u32 layer = 0; layer < surface_params.depth; ++layer) { |
| 183 | MortonSwizzle(mode, params.pixel_format, width, block_height, height, block_depth, 1, | 183 | MortonSwizzle(mode, surface_params.pixel_format, width, block_height, height, |
| 184 | params.tile_width_spacing, buffer + host_offset, memory + guest_offset); | 184 | block_depth, 1, surface_params.tile_width_spacing, buffer + host_offset, |
| 185 | memory + guest_offset); | ||
| 185 | guest_offset += guest_stride; | 186 | guest_offset += guest_stride; |
| 186 | host_offset += host_stride; | 187 | host_offset += host_stride; |
| 187 | } | 188 | } |
| 188 | } else { | 189 | } else { |
| 189 | MortonSwizzle(mode, params.pixel_format, width, block_height, height, block_depth, | 190 | MortonSwizzle(mode, surface_params.pixel_format, width, block_height, height, block_depth, |
| 190 | params.GetMipDepth(level), params.tile_width_spacing, buffer, | 191 | surface_params.GetMipDepth(level), surface_params.tile_width_spacing, buffer, |
| 191 | memory + guest_offset); | 192 | memory + guest_offset); |
| 192 | } | 193 | } |
| 193 | } | 194 | } |
diff --git a/src/video_core/texture_cache/surface_base.h b/src/video_core/texture_cache/surface_base.h index 173f2edba..b57135fe4 100644 --- a/src/video_core/texture_cache/surface_base.h +++ b/src/video_core/texture_cache/surface_base.h | |||
| @@ -148,8 +148,8 @@ public: | |||
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | protected: | 150 | protected: |
| 151 | explicit SurfaceBaseImpl(GPUVAddr gpu_addr, const SurfaceParams& params, | 151 | explicit SurfaceBaseImpl(GPUVAddr gpu_addr_, const SurfaceParams& params_, |
| 152 | bool is_astc_supported); | 152 | bool is_astc_supported_); |
| 153 | ~SurfaceBaseImpl() = default; | 153 | ~SurfaceBaseImpl() = default; |
| 154 | 154 | ||
| 155 | virtual void DecorateSurfaceName() = 0; | 155 | virtual void DecorateSurfaceName() = 0; |
| @@ -167,8 +167,8 @@ protected: | |||
| 167 | std::vector<std::size_t> mipmap_offsets; | 167 | std::vector<std::size_t> mipmap_offsets; |
| 168 | 168 | ||
| 169 | private: | 169 | private: |
| 170 | void SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& params, u8* buffer, | 170 | void SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& surface_params, |
| 171 | u32 level); | 171 | u8* buffer, u32 level); |
| 172 | 172 | ||
| 173 | std::vector<CopyParams> BreakDownLayered(const SurfaceParams& in_params) const; | 173 | std::vector<CopyParams> BreakDownLayered(const SurfaceParams& in_params) const; |
| 174 | 174 | ||
| @@ -297,9 +297,9 @@ public: | |||
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | protected: | 299 | protected: |
| 300 | explicit SurfaceBase(const GPUVAddr gpu_addr, const SurfaceParams& params, | 300 | explicit SurfaceBase(const GPUVAddr gpu_addr_, const SurfaceParams& params_, |
| 301 | bool is_astc_supported) | 301 | bool is_astc_supported_) |
| 302 | : SurfaceBaseImpl(gpu_addr, params, is_astc_supported) {} | 302 | : SurfaceBaseImpl{gpu_addr_, params_, is_astc_supported_} {} |
| 303 | 303 | ||
| 304 | ~SurfaceBase() = default; | 304 | ~SurfaceBase() = default; |
| 305 | 305 | ||
diff --git a/src/video_core/texture_cache/surface_params.cpp b/src/video_core/texture_cache/surface_params.cpp index 13dd16356..96f93246d 100644 --- a/src/video_core/texture_cache/surface_params.cpp +++ b/src/video_core/texture_cache/surface_params.cpp | |||
| @@ -356,18 +356,18 @@ std::size_t SurfaceParams::GetLayerSize(bool as_host_size, bool uncompressed) co | |||
| 356 | 356 | ||
| 357 | std::size_t SurfaceParams::GetInnerMipmapMemorySize(u32 level, bool as_host_size, | 357 | std::size_t SurfaceParams::GetInnerMipmapMemorySize(u32 level, bool as_host_size, |
| 358 | bool uncompressed) const { | 358 | bool uncompressed) const { |
| 359 | const u32 width{GetMipmapSize(uncompressed, GetMipWidth(level), GetDefaultBlockWidth())}; | 359 | const u32 mip_width{GetMipmapSize(uncompressed, GetMipWidth(level), GetDefaultBlockWidth())}; |
| 360 | const u32 height{GetMipmapSize(uncompressed, GetMipHeight(level), GetDefaultBlockHeight())}; | 360 | const u32 mip_height{GetMipmapSize(uncompressed, GetMipHeight(level), GetDefaultBlockHeight())}; |
| 361 | const u32 depth{is_layered ? 1U : GetMipDepth(level)}; | 361 | const u32 mip_depth{is_layered ? 1U : GetMipDepth(level)}; |
| 362 | if (is_tiled) { | 362 | if (is_tiled) { |
| 363 | return Tegra::Texture::CalculateSize(!as_host_size, GetBytesPerPixel(), width, height, | 363 | return Tegra::Texture::CalculateSize(!as_host_size, GetBytesPerPixel(), mip_width, |
| 364 | depth, GetMipBlockHeight(level), | 364 | mip_height, mip_depth, GetMipBlockHeight(level), |
| 365 | GetMipBlockDepth(level)); | 365 | GetMipBlockDepth(level)); |
| 366 | } else if (as_host_size || IsBuffer()) { | 366 | } else if (as_host_size || IsBuffer()) { |
| 367 | return GetBytesPerPixel() * width * height * depth; | 367 | return GetBytesPerPixel() * mip_width * mip_height * mip_depth; |
| 368 | } else { | 368 | } else { |
| 369 | // Linear Texture Case | 369 | // Linear Texture Case |
| 370 | return pitch * height * depth; | 370 | return pitch * mip_height * mip_depth; |
| 371 | } | 371 | } |
| 372 | } | 372 | } |
| 373 | 373 | ||
| @@ -398,9 +398,9 @@ std::string SurfaceParams::TargetName() const { | |||
| 398 | case SurfaceTarget::TextureCubeArray: | 398 | case SurfaceTarget::TextureCubeArray: |
| 399 | return "CubeArray"; | 399 | return "CubeArray"; |
| 400 | default: | 400 | default: |
| 401 | LOG_CRITICAL(HW_GPU, "Unimplemented surface_target={}", static_cast<u32>(target)); | 401 | LOG_CRITICAL(HW_GPU, "Unimplemented surface_target={}", target); |
| 402 | UNREACHABLE(); | 402 | UNREACHABLE(); |
| 403 | return fmt::format("TUK({})", static_cast<u32>(target)); | 403 | return fmt::format("TUK({})", target); |
| 404 | } | 404 | } |
| 405 | } | 405 | } |
| 406 | 406 | ||
diff --git a/src/video_core/texture_cache/surface_view.h b/src/video_core/texture_cache/surface_view.h index 90a8bb0ae..199f72732 100644 --- a/src/video_core/texture_cache/surface_view.h +++ b/src/video_core/texture_cache/surface_view.h | |||
| @@ -13,10 +13,10 @@ | |||
| 13 | namespace VideoCommon { | 13 | namespace VideoCommon { |
| 14 | 14 | ||
| 15 | struct ViewParams { | 15 | struct ViewParams { |
| 16 | constexpr explicit ViewParams(VideoCore::Surface::SurfaceTarget target, u32 base_layer, | 16 | constexpr explicit ViewParams(VideoCore::Surface::SurfaceTarget target_, u32 base_layer_, |
| 17 | u32 num_layers, u32 base_level, u32 num_levels) | 17 | u32 num_layers_, u32 base_level_, u32 num_levels_) |
| 18 | : target{target}, base_layer{base_layer}, num_layers{num_layers}, base_level{base_level}, | 18 | : target{target_}, base_layer{base_layer_}, num_layers{num_layers_}, |
| 19 | num_levels{num_levels} {} | 19 | base_level{base_level_}, num_levels{num_levels_} {} |
| 20 | 20 | ||
| 21 | std::size_t Hash() const; | 21 | std::size_t Hash() const; |
| 22 | 22 | ||
| @@ -44,7 +44,7 @@ struct ViewParams { | |||
| 44 | 44 | ||
| 45 | class ViewBase { | 45 | class ViewBase { |
| 46 | public: | 46 | public: |
| 47 | constexpr explicit ViewBase(const ViewParams& params) : params{params} {} | 47 | constexpr explicit ViewBase(const ViewParams& view_params) : params{view_params} {} |
| 48 | 48 | ||
| 49 | constexpr const ViewParams& GetViewParams() const { | 49 | constexpr const ViewParams& GetViewParams() const { |
| 50 | return params; | 50 | return params; |
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index ea835c59f..581d8dd5b 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -1191,9 +1191,8 @@ private: | |||
| 1191 | const SurfaceParams& src_params = src->GetSurfaceParams(); | 1191 | const SurfaceParams& src_params = src->GetSurfaceParams(); |
| 1192 | const SurfaceParams& dst_params = dst->GetSurfaceParams(); | 1192 | const SurfaceParams& dst_params = dst->GetSurfaceParams(); |
| 1193 | if (!format_compatibility.TestCopy(src_params.pixel_format, dst_params.pixel_format)) { | 1193 | if (!format_compatibility.TestCopy(src_params.pixel_format, dst_params.pixel_format)) { |
| 1194 | LOG_ERROR(HW_GPU, "Illegal copy between formats={{{}, {}}}", | 1194 | LOG_ERROR(HW_GPU, "Illegal copy between formats={{{}, {}}}", dst_params.pixel_format, |
| 1195 | static_cast<int>(dst_params.pixel_format), | 1195 | src_params.pixel_format); |
| 1196 | static_cast<int>(src_params.pixel_format)); | ||
| 1197 | return; | 1196 | return; |
| 1198 | } | 1197 | } |
| 1199 | ImageCopy(src, dst, copy); | 1198 | ImageCopy(src, dst, copy); |
diff --git a/src/video_core/textures/convert.cpp b/src/video_core/textures/convert.cpp index 962921483..bd1aebf02 100644 --- a/src/video_core/textures/convert.cpp +++ b/src/video_core/textures/convert.cpp | |||
| @@ -82,7 +82,7 @@ void ConvertFromHostToGuest(u8* data, PixelFormat pixel_format, u32 width, u32 h | |||
| 82 | bool convert_astc, bool convert_s8z24) { | 82 | bool convert_astc, bool convert_s8z24) { |
| 83 | if (convert_astc && IsPixelFormatASTC(pixel_format)) { | 83 | if (convert_astc && IsPixelFormatASTC(pixel_format)) { |
| 84 | LOG_CRITICAL(HW_GPU, "Conversion of format {} after texture flushing is not implemented", | 84 | LOG_CRITICAL(HW_GPU, "Conversion of format {} after texture flushing is not implemented", |
| 85 | static_cast<u32>(pixel_format)); | 85 | pixel_format); |
| 86 | UNREACHABLE(); | 86 | UNREACHABLE(); |
| 87 | 87 | ||
| 88 | } else if (convert_s8z24 && pixel_format == PixelFormat::S8_UINT_D24_UNORM) { | 88 | } else if (convert_s8z24 && pixel_format == PixelFormat::S8_UINT_D24_UNORM) { |
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h index 0574fef12..bbc7e3eaf 100644 --- a/src/video_core/textures/texture.h +++ b/src/video_core/textures/texture.h | |||
| @@ -146,7 +146,7 @@ enum class MsaaMode : u32 { | |||
| 146 | }; | 146 | }; |
| 147 | 147 | ||
| 148 | union TextureHandle { | 148 | union TextureHandle { |
| 149 | TextureHandle(u32 raw) : raw{raw} {} | 149 | /* implicit */ TextureHandle(u32 raw_) : raw{raw_} {} |
| 150 | 150 | ||
| 151 | u32 raw; | 151 | u32 raw; |
| 152 | BitField<0, 20, u32> tic_id; | 152 | BitField<0, 20, u32> tic_id; |
diff --git a/src/yuzu/applets/controller.cpp b/src/yuzu/applets/controller.cpp index 6944478f3..a15e8ca2a 100644 --- a/src/yuzu/applets/controller.cpp +++ b/src/yuzu/applets/controller.cpp | |||
| @@ -660,8 +660,8 @@ QtControllerSelector::QtControllerSelector(GMainWindow& parent) { | |||
| 660 | QtControllerSelector::~QtControllerSelector() = default; | 660 | QtControllerSelector::~QtControllerSelector() = default; |
| 661 | 661 | ||
| 662 | void QtControllerSelector::ReconfigureControllers( | 662 | void QtControllerSelector::ReconfigureControllers( |
| 663 | std::function<void()> callback, const Core::Frontend::ControllerParameters& parameters) const { | 663 | std::function<void()> callback_, const Core::Frontend::ControllerParameters& parameters) const { |
| 664 | this->callback = std::move(callback); | 664 | callback = std::move(callback_); |
| 665 | emit MainWindowReconfigureControllers(parameters); | 665 | emit MainWindowReconfigureControllers(parameters); |
| 666 | } | 666 | } |
| 667 | 667 | ||
diff --git a/src/yuzu/applets/controller.h b/src/yuzu/applets/controller.h index 7a421d856..3518eed56 100644 --- a/src/yuzu/applets/controller.h +++ b/src/yuzu/applets/controller.h | |||
| @@ -147,7 +147,7 @@ public: | |||
| 147 | ~QtControllerSelector() override; | 147 | ~QtControllerSelector() override; |
| 148 | 148 | ||
| 149 | void ReconfigureControllers( | 149 | void ReconfigureControllers( |
| 150 | std::function<void()> callback, | 150 | std::function<void()> callback_, |
| 151 | const Core::Frontend::ControllerParameters& parameters) const override; | 151 | const Core::Frontend::ControllerParameters& parameters) const override; |
| 152 | 152 | ||
| 153 | signals: | 153 | signals: |
diff --git a/src/yuzu/applets/error.cpp b/src/yuzu/applets/error.cpp index 08ed57355..53a993cf6 100644 --- a/src/yuzu/applets/error.cpp +++ b/src/yuzu/applets/error.cpp | |||
| @@ -17,7 +17,7 @@ QtErrorDisplay::QtErrorDisplay(GMainWindow& parent) { | |||
| 17 | QtErrorDisplay::~QtErrorDisplay() = default; | 17 | QtErrorDisplay::~QtErrorDisplay() = default; |
| 18 | 18 | ||
| 19 | void QtErrorDisplay::ShowError(ResultCode error, std::function<void()> finished) const { | 19 | void QtErrorDisplay::ShowError(ResultCode error, std::function<void()> finished) const { |
| 20 | this->callback = std::move(finished); | 20 | callback = std::move(finished); |
| 21 | emit MainWindowDisplayError( | 21 | emit MainWindowDisplayError( |
| 22 | tr("An error has occured.\nPlease try again or contact the developer of the " | 22 | tr("An error has occured.\nPlease try again or contact the developer of the " |
| 23 | "software.\n\nError Code: %1-%2 (0x%3)") | 23 | "software.\n\nError Code: %1-%2 (0x%3)") |
| @@ -28,7 +28,7 @@ void QtErrorDisplay::ShowError(ResultCode error, std::function<void()> finished) | |||
| 28 | 28 | ||
| 29 | void QtErrorDisplay::ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time, | 29 | void QtErrorDisplay::ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time, |
| 30 | std::function<void()> finished) const { | 30 | std::function<void()> finished) const { |
| 31 | this->callback = std::move(finished); | 31 | callback = std::move(finished); |
| 32 | 32 | ||
| 33 | const QDateTime date_time = QDateTime::fromSecsSinceEpoch(time.count()); | 33 | const QDateTime date_time = QDateTime::fromSecsSinceEpoch(time.count()); |
| 34 | emit MainWindowDisplayError( | 34 | emit MainWindowDisplayError( |
| @@ -44,7 +44,7 @@ void QtErrorDisplay::ShowErrorWithTimestamp(ResultCode error, std::chrono::secon | |||
| 44 | void QtErrorDisplay::ShowCustomErrorText(ResultCode error, std::string dialog_text, | 44 | void QtErrorDisplay::ShowCustomErrorText(ResultCode error, std::string dialog_text, |
| 45 | std::string fullscreen_text, | 45 | std::string fullscreen_text, |
| 46 | std::function<void()> finished) const { | 46 | std::function<void()> finished) const { |
| 47 | this->callback = std::move(finished); | 47 | callback = std::move(finished); |
| 48 | emit MainWindowDisplayError( | 48 | emit MainWindowDisplayError( |
| 49 | tr("An error has occured.\nError Code: %1-%2 (0x%3)\n\n%4\n\n%5") | 49 | tr("An error has occured.\nError Code: %1-%2 (0x%3)\n\n%4\n\n%5") |
| 50 | .arg(static_cast<u32>(error.module.Value()) + 2000, 4, 10, QChar::fromLatin1('0')) | 50 | .arg(static_cast<u32>(error.module.Value()) + 2000, 4, 10, QChar::fromLatin1('0')) |
diff --git a/src/yuzu/applets/profile_select.cpp b/src/yuzu/applets/profile_select.cpp index c9a2f8601..4bf2bfd40 100644 --- a/src/yuzu/applets/profile_select.cpp +++ b/src/yuzu/applets/profile_select.cpp | |||
| @@ -150,8 +150,8 @@ QtProfileSelector::QtProfileSelector(GMainWindow& parent) { | |||
| 150 | QtProfileSelector::~QtProfileSelector() = default; | 150 | QtProfileSelector::~QtProfileSelector() = default; |
| 151 | 151 | ||
| 152 | void QtProfileSelector::SelectProfile( | 152 | void QtProfileSelector::SelectProfile( |
| 153 | std::function<void(std::optional<Common::UUID>)> callback) const { | 153 | std::function<void(std::optional<Common::UUID>)> callback_) const { |
| 154 | this->callback = std::move(callback); | 154 | callback = std::move(callback_); |
| 155 | emit MainWindowSelectProfile(); | 155 | emit MainWindowSelectProfile(); |
| 156 | } | 156 | } |
| 157 | 157 | ||
diff --git a/src/yuzu/applets/profile_select.h b/src/yuzu/applets/profile_select.h index 29c33cca0..4e9037488 100644 --- a/src/yuzu/applets/profile_select.h +++ b/src/yuzu/applets/profile_select.h | |||
| @@ -60,7 +60,7 @@ public: | |||
| 60 | explicit QtProfileSelector(GMainWindow& parent); | 60 | explicit QtProfileSelector(GMainWindow& parent); |
| 61 | ~QtProfileSelector() override; | 61 | ~QtProfileSelector() override; |
| 62 | 62 | ||
| 63 | void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback) const override; | 63 | void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback_) const override; |
| 64 | 64 | ||
| 65 | signals: | 65 | signals: |
| 66 | void MainWindowSelectProfile() const; | 66 | void MainWindowSelectProfile() const; |
diff --git a/src/yuzu/applets/software_keyboard.cpp b/src/yuzu/applets/software_keyboard.cpp index af36f07c6..ab8cfd8ee 100644 --- a/src/yuzu/applets/software_keyboard.cpp +++ b/src/yuzu/applets/software_keyboard.cpp | |||
| @@ -135,8 +135,8 @@ void QtSoftwareKeyboard::RequestText(std::function<void(std::optional<std::u16st | |||
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | void QtSoftwareKeyboard::SendTextCheckDialog(std::u16string error_message, | 137 | void QtSoftwareKeyboard::SendTextCheckDialog(std::u16string error_message, |
| 138 | std::function<void()> finished_check) const { | 138 | std::function<void()> finished_check_) const { |
| 139 | this->finished_check = std::move(finished_check); | 139 | finished_check = std::move(finished_check_); |
| 140 | emit MainWindowTextCheckDialog(error_message); | 140 | emit MainWindowTextCheckDialog(error_message); |
| 141 | } | 141 | } |
| 142 | 142 | ||
diff --git a/src/yuzu/applets/software_keyboard.h b/src/yuzu/applets/software_keyboard.h index 44bcece75..9e1094cce 100644 --- a/src/yuzu/applets/software_keyboard.h +++ b/src/yuzu/applets/software_keyboard.h | |||
| @@ -61,7 +61,7 @@ public: | |||
| 61 | void RequestText(std::function<void(std::optional<std::u16string>)> out, | 61 | void RequestText(std::function<void(std::optional<std::u16string>)> out, |
| 62 | Core::Frontend::SoftwareKeyboardParameters parameters) const override; | 62 | Core::Frontend::SoftwareKeyboardParameters parameters) const override; |
| 63 | void SendTextCheckDialog(std::u16string error_message, | 63 | void SendTextCheckDialog(std::u16string error_message, |
| 64 | std::function<void()> finished_check) const override; | 64 | std::function<void()> finished_check_) const override; |
| 65 | 65 | ||
| 66 | signals: | 66 | signals: |
| 67 | void MainWindowGetText(Core::Frontend::SoftwareKeyboardParameters parameters) const; | 67 | void MainWindowGetText(Core::Frontend::SoftwareKeyboardParameters parameters) const; |
diff --git a/src/yuzu/applets/web_browser.cpp b/src/yuzu/applets/web_browser.cpp index 33f1c385d..9fd8d6326 100644 --- a/src/yuzu/applets/web_browser.cpp +++ b/src/yuzu/applets/web_browser.cpp | |||
| @@ -87,10 +87,10 @@ QtWebBrowser::QtWebBrowser(GMainWindow& main_window) { | |||
| 87 | 87 | ||
| 88 | QtWebBrowser::~QtWebBrowser() = default; | 88 | QtWebBrowser::~QtWebBrowser() = default; |
| 89 | 89 | ||
| 90 | void QtWebBrowser::OpenPageLocal(std::string_view url, std::function<void()> unpack_romfs_callback, | 90 | void QtWebBrowser::OpenPageLocal(std::string_view url, std::function<void()> unpack_romfs_callback_, |
| 91 | std::function<void()> finished_callback) { | 91 | std::function<void()> finished_callback_) { |
| 92 | this->unpack_romfs_callback = std::move(unpack_romfs_callback); | 92 | unpack_romfs_callback = std::move(unpack_romfs_callback_); |
| 93 | this->finished_callback = std::move(finished_callback); | 93 | finished_callback = std::move(finished_callback_); |
| 94 | 94 | ||
| 95 | const auto index = url.find('?'); | 95 | const auto index = url.find('?'); |
| 96 | if (index == std::string::npos) { | 96 | if (index == std::string::npos) { |
diff --git a/src/yuzu/applets/web_browser.h b/src/yuzu/applets/web_browser.h index b38437e46..f801846cf 100644 --- a/src/yuzu/applets/web_browser.h +++ b/src/yuzu/applets/web_browser.h | |||
| @@ -37,8 +37,8 @@ public: | |||
| 37 | explicit QtWebBrowser(GMainWindow& main_window); | 37 | explicit QtWebBrowser(GMainWindow& main_window); |
| 38 | ~QtWebBrowser() override; | 38 | ~QtWebBrowser() override; |
| 39 | 39 | ||
| 40 | void OpenPageLocal(std::string_view url, std::function<void()> unpack_romfs_callback, | 40 | void OpenPageLocal(std::string_view url, std::function<void()> unpack_romfs_callback_, |
| 41 | std::function<void()> finished_callback) override; | 41 | std::function<void()> finished_callback_) override; |
| 42 | 42 | ||
| 43 | signals: | 43 | signals: |
| 44 | void MainWindowOpenPage(std::string_view filename, std::string_view additional_args) const; | 44 | void MainWindowOpenPage(std::string_view filename, std::string_view additional_args) const; |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index fcc38b3af..0ec5b861a 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -511,6 +511,9 @@ void Config::ReadControlValues() { | |||
| 511 | ReadTouchscreenValues(); | 511 | ReadTouchscreenValues(); |
| 512 | ReadMotionTouchValues(); | 512 | ReadMotionTouchValues(); |
| 513 | 513 | ||
| 514 | Settings::values.emulate_analog_keyboard = | ||
| 515 | ReadSetting(QStringLiteral("emulate_analog_keyboard"), false).toBool(); | ||
| 516 | |||
| 514 | ReadSettingGlobal(Settings::values.use_docked_mode, QStringLiteral("use_docked_mode"), false); | 517 | ReadSettingGlobal(Settings::values.use_docked_mode, QStringLiteral("use_docked_mode"), false); |
| 515 | ReadSettingGlobal(Settings::values.vibration_enabled, QStringLiteral("vibration_enabled"), | 518 | ReadSettingGlobal(Settings::values.vibration_enabled, QStringLiteral("vibration_enabled"), |
| 516 | true); | 519 | true); |
| @@ -1186,6 +1189,8 @@ void Config::SaveControlValues() { | |||
| 1186 | QString::fromStdString(Settings::values.touch_device), | 1189 | QString::fromStdString(Settings::values.touch_device), |
| 1187 | QStringLiteral("engine:emu_window")); | 1190 | QStringLiteral("engine:emu_window")); |
| 1188 | WriteSetting(QStringLiteral("keyboard_enabled"), Settings::values.keyboard_enabled, false); | 1191 | WriteSetting(QStringLiteral("keyboard_enabled"), Settings::values.keyboard_enabled, false); |
| 1192 | WriteSetting(QStringLiteral("emulate_analog_keyboard"), | ||
| 1193 | Settings::values.emulate_analog_keyboard, false); | ||
| 1189 | 1194 | ||
| 1190 | qt_config->endGroup(); | 1195 | qt_config->endGroup(); |
| 1191 | } | 1196 | } |
diff --git a/src/yuzu/configuration/configure_input_advanced.cpp b/src/yuzu/configuration/configure_input_advanced.cpp index abaf03630..4e557bc6f 100644 --- a/src/yuzu/configuration/configure_input_advanced.cpp +++ b/src/yuzu/configuration/configure_input_advanced.cpp | |||
| @@ -121,6 +121,7 @@ void ConfigureInputAdvanced::ApplyConfiguration() { | |||
| 121 | Settings::values.debug_pad_enabled = ui->debug_enabled->isChecked(); | 121 | Settings::values.debug_pad_enabled = ui->debug_enabled->isChecked(); |
| 122 | Settings::values.mouse_enabled = ui->mouse_enabled->isChecked(); | 122 | Settings::values.mouse_enabled = ui->mouse_enabled->isChecked(); |
| 123 | Settings::values.keyboard_enabled = ui->keyboard_enabled->isChecked(); | 123 | Settings::values.keyboard_enabled = ui->keyboard_enabled->isChecked(); |
| 124 | Settings::values.emulate_analog_keyboard = ui->emulate_analog_keyboard->isChecked(); | ||
| 124 | Settings::values.touchscreen.enabled = ui->touchscreen_enabled->isChecked(); | 125 | Settings::values.touchscreen.enabled = ui->touchscreen_enabled->isChecked(); |
| 125 | } | 126 | } |
| 126 | 127 | ||
| @@ -147,6 +148,7 @@ void ConfigureInputAdvanced::LoadConfiguration() { | |||
| 147 | ui->debug_enabled->setChecked(Settings::values.debug_pad_enabled); | 148 | ui->debug_enabled->setChecked(Settings::values.debug_pad_enabled); |
| 148 | ui->mouse_enabled->setChecked(Settings::values.mouse_enabled); | 149 | ui->mouse_enabled->setChecked(Settings::values.mouse_enabled); |
| 149 | ui->keyboard_enabled->setChecked(Settings::values.keyboard_enabled); | 150 | ui->keyboard_enabled->setChecked(Settings::values.keyboard_enabled); |
| 151 | ui->emulate_analog_keyboard->setChecked(Settings::values.emulate_analog_keyboard); | ||
| 150 | ui->touchscreen_enabled->setChecked(Settings::values.touchscreen.enabled); | 152 | ui->touchscreen_enabled->setChecked(Settings::values.touchscreen.enabled); |
| 151 | 153 | ||
| 152 | UpdateUIEnabled(); | 154 | UpdateUIEnabled(); |
diff --git a/src/yuzu/configuration/configure_input_advanced.ui b/src/yuzu/configuration/configure_input_advanced.ui index a880a7c68..f207e5d3b 100644 --- a/src/yuzu/configuration/configure_input_advanced.ui +++ b/src/yuzu/configuration/configure_input_advanced.ui | |||
| @@ -2546,14 +2546,27 @@ | |||
| 2546 | </property> | 2546 | </property> |
| 2547 | </widget> | 2547 | </widget> |
| 2548 | </item> | 2548 | </item> |
| 2549 | <item row="4" column="2"> | 2549 | <item row="1" column="0"> |
| 2550 | <widget class="QCheckBox" name="emulate_analog_keyboard"> | ||
| 2551 | <property name="minimumSize"> | ||
| 2552 | <size> | ||
| 2553 | <width>0</width> | ||
| 2554 | <height>23</height> | ||
| 2555 | </size> | ||
| 2556 | </property> | ||
| 2557 | <property name="text"> | ||
| 2558 | <string>Emulate Analog with Keyboard Input</string> | ||
| 2559 | </property> | ||
| 2560 | </widget> | ||
| 2561 | </item> | ||
| 2562 | <item row="5" column="2"> | ||
| 2550 | <widget class="QPushButton" name="touchscreen_advanced"> | 2563 | <widget class="QPushButton" name="touchscreen_advanced"> |
| 2551 | <property name="text"> | 2564 | <property name="text"> |
| 2552 | <string>Advanced</string> | 2565 | <string>Advanced</string> |
| 2553 | </property> | 2566 | </property> |
| 2554 | </widget> | 2567 | </widget> |
| 2555 | </item> | 2568 | </item> |
| 2556 | <item row="1" column="1"> | 2569 | <item row="2" column="1"> |
| 2557 | <spacer name="horizontalSpacer_8"> | 2570 | <spacer name="horizontalSpacer_8"> |
| 2558 | <property name="orientation"> | 2571 | <property name="orientation"> |
| 2559 | <enum>Qt::Horizontal</enum> | 2572 | <enum>Qt::Horizontal</enum> |
| @@ -2569,21 +2582,21 @@ | |||
| 2569 | </property> | 2582 | </property> |
| 2570 | </spacer> | 2583 | </spacer> |
| 2571 | </item> | 2584 | </item> |
| 2572 | <item row="1" column="2"> | 2585 | <item row="2" column="2"> |
| 2573 | <widget class="QPushButton" name="mouse_advanced"> | 2586 | <widget class="QPushButton" name="mouse_advanced"> |
| 2574 | <property name="text"> | 2587 | <property name="text"> |
| 2575 | <string>Advanced</string> | 2588 | <string>Advanced</string> |
| 2576 | </property> | 2589 | </property> |
| 2577 | </widget> | 2590 | </widget> |
| 2578 | </item> | 2591 | </item> |
| 2579 | <item row="4" column="0"> | 2592 | <item row="5" column="0"> |
| 2580 | <widget class="QCheckBox" name="touchscreen_enabled"> | 2593 | <widget class="QCheckBox" name="touchscreen_enabled"> |
| 2581 | <property name="text"> | 2594 | <property name="text"> |
| 2582 | <string>Touchscreen</string> | 2595 | <string>Touchscreen</string> |
| 2583 | </property> | 2596 | </property> |
| 2584 | </widget> | 2597 | </widget> |
| 2585 | </item> | 2598 | </item> |
| 2586 | <item row="1" column="0"> | 2599 | <item row="2" column="0"> |
| 2587 | <widget class="QCheckBox" name="mouse_enabled"> | 2600 | <widget class="QCheckBox" name="mouse_enabled"> |
| 2588 | <property name="minimumSize"> | 2601 | <property name="minimumSize"> |
| 2589 | <size> | 2602 | <size> |
| @@ -2596,28 +2609,28 @@ | |||
| 2596 | </property> | 2609 | </property> |
| 2597 | </widget> | 2610 | </widget> |
| 2598 | </item> | 2611 | </item> |
| 2599 | <item row="6" column="0"> | 2612 | <item row="7" column="0"> |
| 2600 | <widget class="QLabel" name="motion_touch"> | 2613 | <widget class="QLabel" name="motion_touch"> |
| 2601 | <property name="text"> | 2614 | <property name="text"> |
| 2602 | <string>Motion / Touch</string> | 2615 | <string>Motion / Touch</string> |
| 2603 | </property> | 2616 | </property> |
| 2604 | </widget> | 2617 | </widget> |
| 2605 | </item> | 2618 | </item> |
| 2606 | <item row="6" column="2"> | 2619 | <item row="7" column="2"> |
| 2607 | <widget class="QPushButton" name="buttonMotionTouch"> | 2620 | <widget class="QPushButton" name="buttonMotionTouch"> |
| 2608 | <property name="text"> | 2621 | <property name="text"> |
| 2609 | <string>Configure</string> | 2622 | <string>Configure</string> |
| 2610 | </property> | 2623 | </property> |
| 2611 | </widget> | 2624 | </widget> |
| 2612 | </item> | 2625 | </item> |
| 2613 | <item row="5" column="0"> | 2626 | <item row="6" column="0"> |
| 2614 | <widget class="QCheckBox" name="debug_enabled"> | 2627 | <widget class="QCheckBox" name="debug_enabled"> |
| 2615 | <property name="text"> | 2628 | <property name="text"> |
| 2616 | <string>Debug Controller</string> | 2629 | <string>Debug Controller</string> |
| 2617 | </property> | 2630 | </property> |
| 2618 | </widget> | 2631 | </widget> |
| 2619 | </item> | 2632 | </item> |
| 2620 | <item row="5" column="2"> | 2633 | <item row="6" column="2"> |
| 2621 | <widget class="QPushButton" name="debug_configure"> | 2634 | <widget class="QPushButton" name="debug_configure"> |
| 2622 | <property name="text"> | 2635 | <property name="text"> |
| 2623 | <string>Configure</string> | 2636 | <string>Configure</string> |
diff --git a/src/yuzu/configuration/configure_motion_touch.cpp b/src/yuzu/configuration/configure_motion_touch.cpp index 2afac591a..c2a7113da 100644 --- a/src/yuzu/configuration/configure_motion_touch.cpp +++ b/src/yuzu/configuration/configure_motion_touch.cpp | |||
| @@ -183,8 +183,8 @@ void ConfigureMotionTouch::ConnectEvents() { | |||
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | void ConfigureMotionTouch::OnUDPAddServer() { | 185 | void ConfigureMotionTouch::OnUDPAddServer() { |
| 186 | QRegExp re(tr("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[" | 186 | QRegExp re(tr(R"re(^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4]" |
| 187 | "0-9][0-9]?)$")); // a valid ip address | 187 | "[0-9]|[01]?[0-9][0-9]?)$)re")); // a valid ip address |
| 188 | bool ok; | 188 | bool ok; |
| 189 | QString port_text = ui->udp_port->text(); | 189 | QString port_text = ui->udp_port->text(); |
| 190 | QString server_text = ui->udp_server->text(); | 190 | QString server_text = ui->udp_server->text(); |
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index 248855aff..df935022d 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h | |||
| @@ -174,7 +174,8 @@ public: | |||
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | bool operator<(const QStandardItem& other) const override { | 176 | bool operator<(const QStandardItem& other) const override { |
| 177 | return data(CompatNumberRole) < other.data(CompatNumberRole); | 177 | return data(CompatNumberRole).value<QString>() < |
| 178 | other.data(CompatNumberRole).value<QString>(); | ||
| 178 | } | 179 | } |
| 179 | }; | 180 | }; |
| 180 | 181 | ||
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 34c9673bc..b70f71a08 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp | |||
| @@ -345,7 +345,6 @@ void Config::ReadValues() { | |||
| 345 | // System | 345 | // System |
| 346 | Settings::values.use_docked_mode.SetValue( | 346 | Settings::values.use_docked_mode.SetValue( |
| 347 | sdl2_config->GetBoolean("System", "use_docked_mode", false)); | 347 | sdl2_config->GetBoolean("System", "use_docked_mode", false)); |
| 348 | const auto size = sdl2_config->GetInteger("System", "users_size", 0); | ||
| 349 | 348 | ||
| 350 | Settings::values.current_user = std::clamp<int>( | 349 | Settings::values.current_user = std::clamp<int>( |
| 351 | sdl2_config->GetInteger("System", "current_user", 0), 0, Service::Account::MAX_USERS - 1); | 350 | sdl2_config->GetInteger("System", "current_user", 0), 0, Service::Account::MAX_USERS - 1); |