VERY experimental Nintendo Switch 2 emulator
C++
fix ci and NEEDS_D24
crueter1037bff8aca0
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 9358f7d0fb..ce113e9ea9 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -12,7 +12,7 @@ on:jobs:source:if: ${{ !github.head_ref }}- runs-on: linux+ runs-on: sourcesteps:- uses: actions/checkout@v4with:diff --git a/.github/workflows/license-header.yml b/.github/workflows/license-header.ymlindex 2d359a5e76..416f0af881 100644--- a/.github/workflows/license-header.yml+++ b/.github/workflows/license-header.yml@@ -6,7 +6,7 @@ on:jobs:license-header:- runs-on: linux+ runs-on: sourcesteps:- uses: actions/checkout@v4with:@@ -15,6 +15,7 @@ jobs:- name: Fetchrun: git fetch origin+ # TODO: fix the script- name: Make script executablerun: chmod +x ./.ci/license-header.rbdiff --git a/.github/workflows/trigger_release.yml b/.github/workflows/trigger_release.ymlindex 716be389fc..46ec4d0134 100644--- a/.github/workflows/trigger_release.yml+++ b/.github/workflows/trigger_release.yml@@ -9,7 +9,7 @@ permissions:jobs:source:- runs-on: linux+ runs-on: sourcesteps:- uses: actions/checkout@v4with:diff --git a/src/android/app/src/main/res/values-uk/strings.xml b/src/android/app/src/main/res/values-uk/strings.xmlindex 25f5ae7f99..7dd5d5cec7 100644--- a/src/android/app/src/main/res/values-uk/strings.xml+++ b/src/android/app/src/main/res/values-uk/strings.xml@@ -38,8 +38,8 @@<string name="overlay_position_bottom_right">Внизу праворуч</string><string name="overlay_position_center_top">По центру вгорі</string><string name="overlay_position_center_bottom">По центру внизу</string>- <string name="overlay_background">Фон оверлею</string>- <string name="overlay_background_description">Додати фон для кращої читабельності</string>+ <string name="perf_overlay_background">Фон оверлею</string>+ <string name="perf_overlay_background_description">Додати фон для кращої читабельності</string><string name="show_shaders_building">Показати побудову шейдерів</string><string name="show_shaders_building_description">Показати поточну кількість шейдерів, які наразі компілюються</string>@@ -158,7 +158,6 @@<string name="multiplayer_join_room_success">Приєднано до кімнати</string><string name="multiplayer_create_room_failed">Помилка створення</string><string name="multiplayer_join_room_failed">Помилка приєднання</string>- <string name="multiplayer_input_invalid">Невірні дані</string><string name="multiplayer_address_invalid">Невірна адреса</string><string name="multiplayer_port_invalid">Невірний порт</string><string name="multiplayer_exit_room">Вийти</string>@@ -191,8 +190,6 @@<string name="multiplayer_kick_member">Вигнати</string><string name="multiplayer_chat_input_hint">Повідомлення...</string><string name="multiplayer_password">Пароль</string>- <string name="original_button_text">Приєднатися</string>- <string name="disabled_button_text">Приєднання...</string><string name="multiplayer_room_name">Назва кімнати</string><string name="multiplayer_room_name_invalid">Назва кімнати має містити від 3 до 20 символів</string><string name="multiplayer_max_players">Макс. гравців (16)</string>@@ -360,17 +357,6 @@<string name="contributors_description">Зроблено з \u2764 від команди Eden</string><string name="build">Збірка</string>- <!-- Early access upgrade strings -->- <string name="early_access">Ранній доступ</string>- <string name="early_access_benefits">Переваги раннього доступу</string>- <string name="cutting_edge_features">Новітні можливості</string>- <string name="early_access_updates">Ранній доступ до оновлень</string>- <string name="no_manual_installation">Без ручного встановлення</string>- <string name="prioritized_support">Пріоритетна підтримка</string>- <string name="helping_game_preservation">Допомога в презервації ігор</string>- <string name="our_eternal_gratitude">Наша нескінченна вдячність</string>- <string name="are_you_interested">Ви зацікавлені?</string>-<string name="frame_limit_enable">Обмеження швидкості</string><string name="frame_limit_enable_description">Обмежує швидкість емуляції у відсотках від нормальної.</string><string name="frame_limit_slider">Відсоток обмеження</string>diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cppindex d0cff37f61..3577342e4a 100644--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp@@ -952,28 +952,28 @@ void RasterizerVulkan::UpdateDynamicStates() {UpdateDepthBiasEnable(regs);}if (device.IsExtExtendedDynamicState3EnablesSupported()) {- using namespace Tegra::Engines;-- if (device.GetDriverID() == VkDriverIdKHR::VK_DRIVER_ID_AMD_OPEN_SOURCE- || device.GetDriverID() == VkDriverIdKHR::VK_DRIVER_ID_AMD_PROPRIETARY) {- struct In {- const Maxwell3D::Regs::VertexAttribute::Type d;- In(Maxwell3D::Regs::VertexAttribute::Type n) : d(n) {}- bool operator()(Maxwell3D::Regs::VertexAttribute n) const {- return n.type == d;- }- };-- auto has_float = std::any_of(- regs.vertex_attrib_format.begin(), regs.vertex_attrib_format.end(),- In(Maxwell3D::Regs::VertexAttribute::Type::Float));-- if (regs.logic_op.enable)- regs.logic_op.enable = static_cast<u32>(!has_float);-- UpdateLogicOpEnable(regs);- } else- UpdateLogicOpEnable(regs);+ using namespace Tegra::Engines;++ if (device.GetDriverID() == VkDriverIdKHR::VK_DRIVER_ID_AMD_OPEN_SOURCE+ || device.GetDriverID() == VkDriverIdKHR::VK_DRIVER_ID_AMD_PROPRIETARY) {+ struct In {+ const Maxwell3D::Regs::VertexAttribute::Type d;+ In(Maxwell3D::Regs::VertexAttribute::Type n) : d(n) {}+ bool operator()(Maxwell3D::Regs::VertexAttribute n) const {+ return n.type == d;+ }+ };++ auto has_float = std::any_of(+ regs.vertex_attrib_format.begin(), regs.vertex_attrib_format.end(),+ In(Maxwell3D::Regs::VertexAttribute::Type::Float));++ if (regs.logic_op.enable)+ regs.logic_op.enable = static_cast<u32>(!has_float);++ UpdateLogicOpEnable(regs);+ } else+ UpdateLogicOpEnable(regs);UpdateDepthClampEnable(regs);}}@@ -1103,15 +1103,23 @@ void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D::Regs& regs) {regs.zeta.format == Tegra::DepthFormat::X8Z24_UNORM ||regs.zeta.format == Tegra::DepthFormat::S8Z24_UNORM ||regs.zeta.format == Tegra::DepthFormat::V8Z24_UNORM;- if (is_d24 && !device.SupportsD24DepthBuffer() && program_id == 0x1006A800016E000ULL) {- // Only activate this in Super Smash Brothers Ultimate++ size_t length = sizeof(NEEDS_D24) / sizeof(u64);+ bool needs_convert = false;+ for (size_t i = 0; i < length; ++i) {+ if (NEEDS_D24[i] == program_id) {+ needs_convert = true;+ break;+ }+ }++ if (is_d24 && !device.SupportsD24DepthBuffer() && needs_convert) {// the base formulas can be obtained from here:// https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-output-merger-stage-depth-bias- const double rescale_factor =- static_cast<double>(1ULL << (32 - 24)) / (static_cast<double>(0x1.ep+127));+ const double rescale_factor = static_cast<double>(1ULL << (32 - 24))+ / (static_cast<double>(0x1.ep+127));units = static_cast<float>(static_cast<double>(units) * rescale_factor);- }- scheduler.Record([constant = units, clamp = regs.depth_bias_clamp,+ } scheduler.Record([constant = units, clamp = regs.depth_bias_clamp,factor = regs.slope_scale_depth_bias](vk::CommandBuffer cmdbuf) {cmdbuf.SetDepthBias(constant, clamp, factor);});diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.hindex 0617b37f05..70e889eb16 100644--- a/src/video_core/renderer_vulkan/vk_rasterizer.h+++ b/src/video_core/renderer_vulkan/vk_rasterizer.h@@ -139,6 +139,12 @@ public:u32 pixel_stride);private:+ static constexpr u64 NEEDS_D24[] = {+ 0x01006A800016E000ULL, // SSBU+ 0x0100E95004038000ULL, // XC2+ 0x0100A6301214E000ULL, // FE:Engage+ };+static constexpr size_t MAX_TEXTURES = 192;static constexpr size_t MAX_IMAGES = 48;static constexpr size_t MAX_IMAGE_VIEWS = MAX_TEXTURES + MAX_IMAGES;