early-access version 3880

This commit is contained in:
pineappleEA 2023-09-19 17:30:09 +02:00
parent eec36c827f
commit c1602b1bb8
17 changed files with 119 additions and 66 deletions

View File

@ -333,6 +333,7 @@ find_package(LLVM 17 MODULE COMPONENTS Demangle)
find_package(lz4 REQUIRED) find_package(lz4 REQUIRED)
find_package(nlohmann_json 3.8 REQUIRED) find_package(nlohmann_json 3.8 REQUIRED)
find_package(Opus 1.3 MODULE) find_package(Opus 1.3 MODULE)
find_package(RenderDoc MODULE)
find_package(VulkanMemoryAllocator CONFIG) find_package(VulkanMemoryAllocator CONFIG)
find_package(ZLIB 1.2 REQUIRED) find_package(ZLIB 1.2 REQUIRED)
find_package(zstd 1.5 REQUIRED) find_package(zstd 1.5 REQUIRED)

View File

@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: 2023 Alexandre Bouvier <contact@amb.tf>
#
# SPDX-License-Identifier: GPL-3.0-or-later
find_path(RenderDoc_INCLUDE_DIR renderdoc_app.h)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(RenderDoc
REQUIRED_VARS RenderDoc_INCLUDE_DIR
)
if (RenderDoc_FOUND AND NOT TARGET RenderDoc::API)
add_library(RenderDoc::API INTERFACE IMPORTED)
set_target_properties(RenderDoc::API PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${RenderDoc_INCLUDE_DIR}"
)
endif()
mark_as_advanced(RenderDoc_INCLUDE_DIR)

View File

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 3879. This is the source code for early-access 3880.
## Legal Notice ## Legal Notice

View File

@ -174,8 +174,11 @@ target_include_directories(stb PUBLIC ./stb)
add_library(bc_decoder bc_decoder/bc_decoder.cpp) add_library(bc_decoder bc_decoder/bc_decoder.cpp)
target_include_directories(bc_decoder PUBLIC ./bc_decoder) target_include_directories(bc_decoder PUBLIC ./bc_decoder)
add_library(renderdoc INTERFACE) if (NOT TARGET RenderDoc::API)
target_include_directories(renderdoc SYSTEM INTERFACE ./renderdoc) add_library(renderdoc INTERFACE)
target_include_directories(renderdoc SYSTEM INTERFACE ./renderdoc)
add_library(RenderDoc::API ALIAS renderdoc)
endif()
if (ANDROID) if (ANDROID)
if (ARCHITECTURE_arm64) if (ARCHITECTURE_arm64)

View File

@ -63,3 +63,6 @@ fastlane/Preview.html
fastlane/screenshots fastlane/screenshots
fastlane/test_output fastlane/test_output
fastlane/readme.md fastlane/readme.md
# Autogenerated library for vulkan validation layers
libVkLayer_khronos_validation.so

View File

@ -3,6 +3,7 @@
package org.yuzu.yuzu_emu.activities package org.yuzu.yuzu_emu.activities
import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.app.PendingIntent import android.app.PendingIntent
import android.app.PictureInPictureParams import android.app.PictureInPictureParams
@ -397,6 +398,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
} }
} }
@SuppressLint("UnspecifiedRegisterReceiverFlag")
override fun onPictureInPictureModeChanged( override fun onPictureInPictureModeChanged(
isInPictureInPictureMode: Boolean, isInPictureInPictureMode: Boolean,
newConfig: Configuration newConfig: Configuration
@ -409,8 +411,12 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
addAction(actionMute) addAction(actionMute)
addAction(actionUnmute) addAction(actionUnmute)
}.also { }.also {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
registerReceiver(pictureInPictureReceiver, it, RECEIVER_EXPORTED)
} else {
registerReceiver(pictureInPictureReceiver, it) registerReceiver(pictureInPictureReceiver, it)
} }
}
} else { } else {
try { try {
unregisterReceiver(pictureInPictureReceiver) unregisterReceiver(pictureInPictureReceiver)

View File

@ -15,7 +15,6 @@ import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.util.Rational
import android.view.* import android.view.*
import android.widget.TextView import android.widget.TextView
import androidx.activity.OnBackPressedCallback import androidx.activity.OnBackPressedCallback
@ -287,13 +286,14 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
override fun onConfigurationChanged(newConfig: Configuration) { override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig) super.onConfigurationChanged(newConfig)
updateScreenLayout()
if (emulationActivity?.isInPictureInPictureMode == true) { if (emulationActivity?.isInPictureInPictureMode == true) {
if (binding.drawerLayout.isOpen) { if (binding.drawerLayout.isOpen) {
binding.drawerLayout.close() binding.drawerLayout.close()
} }
if (EmulationMenuSettings.showOverlay) { if (EmulationMenuSettings.showOverlay) {
binding.surfaceInputOverlay.post { binding.surfaceInputOverlay.post {
binding.surfaceInputOverlay.visibility = View.VISIBLE binding.surfaceInputOverlay.visibility = View.INVISIBLE
} }
} }
} else { } else {
@ -328,7 +328,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
} }
override fun onPause() { override fun onPause() {
if (emulationState.isRunning) { if (emulationState.isRunning && emulationActivity?.isInPictureInPictureMode != true) {
emulationState.pause() emulationState.pause()
} }
super.onPause() super.onPause()
@ -394,16 +394,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
} }
private fun updateScreenLayout() { private fun updateScreenLayout() {
binding.surfaceEmulation.setAspectRatio( binding.surfaceEmulation.setAspectRatio(null)
when (IntSetting.RENDERER_ASPECT_RATIO.int) {
0 -> Rational(16, 9)
1 -> Rational(4, 3)
2 -> Rational(21, 9)
3 -> Rational(16, 10)
4 -> null // Stretch
else -> Rational(16, 9)
}
)
emulationActivity?.buildPictureInPictureParams() emulationActivity?.buildPictureInPictureParams()
updateOrientation() updateOrientation()
} }
@ -693,7 +684,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
private class EmulationState(private val gamePath: String) { private class EmulationState(private val gamePath: String) {
private var state: State private var state: State
private var surface: Surface? = null private var surface: Surface? = null
private var runWhenSurfaceIsValid = false
init { init {
// Starting state is stopped. // Starting state is stopped.
@ -751,8 +741,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
// If the surface is set, run now. Otherwise, wait for it to get set. // If the surface is set, run now. Otherwise, wait for it to get set.
if (surface != null) { if (surface != null) {
runWithValidSurface() runWithValidSurface()
} else {
runWhenSurfaceIsValid = true
} }
} }
@ -760,7 +748,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
@Synchronized @Synchronized
fun newSurface(surface: Surface?) { fun newSurface(surface: Surface?) {
this.surface = surface this.surface = surface
if (runWhenSurfaceIsValid) { if (this.surface != null) {
runWithValidSurface() runWithValidSurface()
} }
} }
@ -788,10 +776,9 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
} }
private fun runWithValidSurface() { private fun runWithValidSurface() {
runWhenSurfaceIsValid = false NativeLibrary.surfaceChanged(surface)
when (state) { when (state) {
State.STOPPED -> { State.STOPPED -> {
NativeLibrary.surfaceChanged(surface)
val emulationThread = Thread({ val emulationThread = Thread({
Log.debug("[EmulationFragment] Starting emulation thread.") Log.debug("[EmulationFragment] Starting emulation thread.")
NativeLibrary.run(gamePath) NativeLibrary.run(gamePath)
@ -801,7 +788,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
State.PAUSED -> { State.PAUSED -> {
Log.debug("[EmulationFragment] Resuming emulation.") Log.debug("[EmulationFragment] Resuming emulation.")
NativeLibrary.surfaceChanged(surface)
NativeLibrary.unpauseEmulation() NativeLibrary.unpauseEmulation()
} }

View File

@ -11,6 +11,12 @@
#include "jni/emu_window/emu_window.h" #include "jni/emu_window/emu_window.h"
void EmuWindow_Android::OnSurfaceChanged(ANativeWindow* surface) { void EmuWindow_Android::OnSurfaceChanged(ANativeWindow* surface) {
m_window_width = ANativeWindow_getWidth(surface);
m_window_height = ANativeWindow_getHeight(surface);
// Ensures that we emulate with the correct aspect ratio.
UpdateCurrentFramebufferLayout(m_window_width, m_window_height);
window_info.render_surface = reinterpret_cast<void*>(surface); window_info.render_surface = reinterpret_cast<void*>(surface);
} }
@ -62,14 +68,8 @@ EmuWindow_Android::EmuWindow_Android(InputCommon::InputSubsystem* input_subsyste
return; return;
} }
m_window_width = ANativeWindow_getWidth(surface); OnSurfaceChanged(surface);
m_window_height = ANativeWindow_getHeight(surface);
// Ensures that we emulate with the correct aspect ratio.
UpdateCurrentFramebufferLayout(m_window_width, m_window_height);
window_info.type = Core::Frontend::WindowSystemType::Android; window_info.type = Core::Frontend::WindowSystemType::Android;
window_info.render_surface = reinterpret_cast<void*>(surface);
m_input_subsystem->Initialize(); m_input_subsystem->Initialize();
} }

View File

@ -894,7 +894,7 @@ endif()
create_target_directory_groups(core) create_target_directory_groups(core)
target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core nx_tzdb) target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core nx_tzdb)
target_link_libraries(core PUBLIC Boost::headers PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls renderdoc) target_link_libraries(core PUBLIC Boost::headers PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls RenderDoc::API)
if (MINGW) if (MINGW)
target_link_libraries(core PRIVATE ${MSWSOCK_LIBRARY}) target_link_libraries(core PRIVATE ${MSWSOCK_LIBRARY})
endif() endif()

View File

@ -22,6 +22,8 @@
namespace Service::AOC { namespace Service::AOC {
constexpr Result ResultNoPurchasedProductInfoAvailable{ErrorModule::NIMShop, 400};
static bool CheckAOCTitleIDMatchesBase(u64 title_id, u64 base) { static bool CheckAOCTitleIDMatchesBase(u64 title_id, u64 base) {
return FileSys::GetBaseTitleID(title_id) == base; return FileSys::GetBaseTitleID(title_id) == base;
} }
@ -54,8 +56,8 @@ public:
{0, &IPurchaseEventManager::SetDefaultDeliveryTarget, "SetDefaultDeliveryTarget"}, {0, &IPurchaseEventManager::SetDefaultDeliveryTarget, "SetDefaultDeliveryTarget"},
{1, &IPurchaseEventManager::SetDeliveryTarget, "SetDeliveryTarget"}, {1, &IPurchaseEventManager::SetDeliveryTarget, "SetDeliveryTarget"},
{2, &IPurchaseEventManager::GetPurchasedEventReadableHandle, "GetPurchasedEventReadableHandle"}, {2, &IPurchaseEventManager::GetPurchasedEventReadableHandle, "GetPurchasedEventReadableHandle"},
{3, nullptr, "PopPurchasedProductInfo"}, {3, &IPurchaseEventManager::PopPurchasedProductInfo, "PopPurchasedProductInfo"},
{4, nullptr, "PopPurchasedProductInfoWithUid"}, {4, &IPurchaseEventManager::PopPurchasedProductInfoWithUid, "PopPurchasedProductInfoWithUid"},
}; };
// clang-format on // clang-format on
@ -101,6 +103,20 @@ private:
rb.PushCopyObjects(purchased_event->GetReadableEvent()); rb.PushCopyObjects(purchased_event->GetReadableEvent());
} }
void PopPurchasedProductInfo(HLERequestContext& ctx) {
LOG_DEBUG(Service_AOC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultNoPurchasedProductInfoAvailable);
}
void PopPurchasedProductInfoWithUid(HLERequestContext& ctx) {
LOG_DEBUG(Service_AOC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultNoPurchasedProductInfoAvailable);
}
KernelHelpers::ServiceContext service_context; KernelHelpers::ServiceContext service_context;
Kernel::KEvent* purchased_event; Kernel::KEvent* purchased_event;

View File

@ -546,7 +546,7 @@ private:
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
rb.PushIpcInterface<IDatabaseService>(system, is_system); rb.PushIpcInterface<IDatabaseService>(system, is_system);
LOG_CRITICAL(Service_Mii, "called"); LOG_DEBUG(Service_Mii, "called");
} }
bool is_system{}; bool is_system{};

View File

@ -15,6 +15,8 @@
#include "core/hle/service/mii/types/store_data.h" #include "core/hle/service/mii/types/store_data.h"
namespace Service::Mii { namespace Service::Mii {
const char* DbFileName = "MiiDatabase.dat";
DatabaseManager::DatabaseManager() {} DatabaseManager::DatabaseManager() {}
Result DatabaseManager::MountSaveData() { Result DatabaseManager::MountSaveData() {

View File

@ -53,7 +53,6 @@ private:
NintendoFigurineDatabase database{}; NintendoFigurineDatabase database{};
std::filesystem::path system_save_dir{}; std::filesystem::path system_save_dir{};
const std::string DbFileName = "MiiDatabase.dat";
}; };
}; // namespace Service::Mii }; // namespace Service::Mii

View File

@ -7,7 +7,7 @@
#include "common/dynamic_library.h" #include "common/dynamic_library.h"
#include "core/tools/renderdoc.h" #include "core/tools/renderdoc.h"
#ifdef WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#else #else
#include <dlfcn.h> #include <dlfcn.h>

View File

@ -1044,15 +1044,27 @@ void TextureCacheRuntime::BlitImage(Framebuffer* dst_framebuffer, ImageView& dst
dst_region, src_region, filter, operation); dst_region, src_region, filter, operation);
return; return;
} }
ASSERT(src.format == dst.format);
if (aspect_mask == (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) { if (aspect_mask == (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
if (!device.IsBlitDepthStencilSupported()) { const auto format = src.format;
const auto can_blit_depth_stencil = [this, format] {
switch (format) {
case VideoCore::Surface::PixelFormat::D24_UNORM_S8_UINT:
case VideoCore::Surface::PixelFormat::S8_UINT_D24_UNORM:
return device.IsBlitDepth24Stencil8Supported();
case VideoCore::Surface::PixelFormat::D32_FLOAT_S8_UINT:
return device.IsBlitDepth32Stencil8Supported();
default:
UNREACHABLE();
}
}();
if (!can_blit_depth_stencil) {
UNIMPLEMENTED_IF(is_src_msaa || is_dst_msaa); UNIMPLEMENTED_IF(is_src_msaa || is_dst_msaa);
blit_image_helper.BlitDepthStencil(dst_framebuffer, src.DepthView(), src.StencilView(), blit_image_helper.BlitDepthStencil(dst_framebuffer, src.DepthView(), src.StencilView(),
dst_region, src_region, filter, operation); dst_region, src_region, filter, operation);
return; return;
} }
} }
ASSERT(src.format == dst.format);
ASSERT(!(is_dst_msaa && !is_src_msaa)); ASSERT(!(is_dst_msaa && !is_src_msaa));
ASSERT(operation == Fermi2D::Operation::SrcCopy); ASSERT(operation == Fermi2D::Operation::SrcCopy);

View File

@ -420,7 +420,8 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
first_next = &diagnostics_nv; first_next = &diagnostics_nv;
} }
is_blit_depth_stencil_supported = TestDepthStencilBlits(); is_blit_depth24_stencil8_supported = TestDepthStencilBlits(VK_FORMAT_D24_UNORM_S8_UINT);
is_blit_depth32_stencil8_supported = TestDepthStencilBlits(VK_FORMAT_D32_SFLOAT_S8_UINT);
is_optimal_astc_supported = ComputeIsOptimalAstcSupported(); is_optimal_astc_supported = ComputeIsOptimalAstcSupported();
is_warp_potentially_bigger = !extensions.subgroup_size_control || is_warp_potentially_bigger = !extensions.subgroup_size_control ||
properties.subgroup_size_control.maxSubgroupSize > GuestWarpSize; properties.subgroup_size_control.maxSubgroupSize > GuestWarpSize;
@ -774,14 +775,13 @@ bool Device::ComputeIsOptimalAstcSupported() const {
return true; return true;
} }
bool Device::TestDepthStencilBlits() const { bool Device::TestDepthStencilBlits(VkFormat format) const {
static constexpr VkFormatFeatureFlags required_features = static constexpr VkFormatFeatureFlags required_features =
VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT; VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT;
const auto test_features = [](VkFormatProperties props) { const auto test_features = [](VkFormatProperties props) {
return (props.optimalTilingFeatures & required_features) == required_features; return (props.optimalTilingFeatures & required_features) == required_features;
}; };
return test_features(format_properties.at(VK_FORMAT_D32_SFLOAT_S8_UINT)) && return test_features(format_properties.at(format));
test_features(format_properties.at(VK_FORMAT_D24_UNORM_S8_UINT));
} }
bool Device::IsFormatSupported(VkFormat wanted_format, VkFormatFeatureFlags wanted_usage, bool Device::IsFormatSupported(VkFormat wanted_format, VkFormatFeatureFlags wanted_usage,

View File

@ -366,9 +366,14 @@ public:
return features.features.depthBounds; return features.features.depthBounds;
} }
/// Returns true when blitting from and to depth stencil images is supported. /// Returns true when blitting from and to D24S8 images is supported.
bool IsBlitDepthStencilSupported() const { bool IsBlitDepth24Stencil8Supported() const {
return is_blit_depth_stencil_supported; return is_blit_depth24_stencil8_supported;
}
/// Returns true when blitting from and to D32S8 images is supported.
bool IsBlitDepth32Stencil8Supported() const {
return is_blit_depth32_stencil8_supported;
} }
/// Returns true if the device supports VK_NV_viewport_swizzle. /// Returns true if the device supports VK_NV_viewport_swizzle.
@ -686,7 +691,7 @@ private:
bool ComputeIsOptimalAstcSupported() const; bool ComputeIsOptimalAstcSupported() const;
/// Returns true if the device natively supports blitting depth stencil images. /// Returns true if the device natively supports blitting depth stencil images.
bool TestDepthStencilBlits() const; bool TestDepthStencilBlits(VkFormat format) const;
private: private:
VkInstance instance; ///< Vulkan instance. VkInstance instance; ///< Vulkan instance.
@ -751,7 +756,8 @@ private:
// Misc features // Misc features
bool is_optimal_astc_supported{}; ///< Support for all guest ASTC formats. bool is_optimal_astc_supported{}; ///< Support for all guest ASTC formats.
bool is_blit_depth_stencil_supported{}; ///< Support for blitting from and to depth stencil. bool is_blit_depth24_stencil8_supported{}; ///< Support for blitting from and to D24S8.
bool is_blit_depth32_stencil8_supported{}; ///< Support for blitting from and to D32S8.
bool is_warp_potentially_bigger{}; ///< Host warp size can be bigger than guest. bool is_warp_potentially_bigger{}; ///< Host warp size can be bigger than guest.
bool is_integrated{}; ///< Is GPU an iGPU. bool is_integrated{}; ///< Is GPU an iGPU.
bool is_virtual{}; ///< Is GPU a virtual GPU. bool is_virtual{}; ///< Is GPU a virtual GPU.