early-access version 3732

This commit is contained in:
pineappleEA 2023-07-02 06:11:04 +02:00
parent 39ae6f96a6
commit 158e270fe0
7 changed files with 25 additions and 19 deletions

View file

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

View file

@ -591,7 +591,7 @@ void BufferCacheRuntime::ReserveNullBuffer() {
.flags = 0, .flags = 0,
.size = 4, .size = 4,
.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT | .usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT |
VK_BUFFER_USAGE_TRANSFER_DST_BIT, VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE, .sharingMode = VK_SHARING_MODE_EXCLUSIVE,
.queueFamilyIndexCount = 0, .queueFamilyIndexCount = 0,
.pQueueFamilyIndices = nullptr, .pQueueFamilyIndices = nullptr,
@ -599,7 +599,6 @@ void BufferCacheRuntime::ReserveNullBuffer() {
if (device.IsExtTransformFeedbackSupported()) { if (device.IsExtTransformFeedbackSupported()) {
create_info.usage |= VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT; create_info.usage |= VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT;
} }
create_info.usage |= VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT;
null_buffer = memory_allocator.CreateBuffer(create_info, MemoryUsage::DeviceLocal); null_buffer = memory_allocator.CreateBuffer(create_info, MemoryUsage::DeviceLocal);
if (device.HasDebuggingToolAttached()) { if (device.HasDebuggingToolAttached()) {
null_buffer.SetObjectNameEXT("Null buffer"); null_buffer.SetObjectNameEXT("Null buffer");

View file

@ -19,11 +19,9 @@
#include <windows.h> #include <windows.h>
// ensure include order // ensure include order
#include <vulkan/vulkan_win32.h> #include <vulkan/vulkan_win32.h>
#elif defined(__APPLE__)
#include <vulkan/vulkan_macos.h>
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
#include <vulkan/vulkan_android.h> #include <vulkan/vulkan_android.h>
#else #elif !defined(__APPLE__)
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <vulkan/vulkan_wayland.h> #include <vulkan/vulkan_wayland.h>
#include <vulkan/vulkan_xlib.h> #include <vulkan/vulkan_xlib.h>
@ -68,7 +66,7 @@ namespace {
break; break;
#elif defined(__APPLE__) #elif defined(__APPLE__)
case Core::Frontend::WindowSystemType::Cocoa: case Core::Frontend::WindowSystemType::Cocoa:
extensions.push_back(VK_MVK_MACOS_SURFACE_EXTENSION_NAME); extensions.push_back(VK_EXT_METAL_SURFACE_EXTENSION_NAME);
break; break;
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
case Core::Frontend::WindowSystemType::Android: case Core::Frontend::WindowSystemType::Android:

View file

@ -11,11 +11,9 @@
#include <windows.h> #include <windows.h>
// ensure include order // ensure include order
#include <vulkan/vulkan_win32.h> #include <vulkan/vulkan_win32.h>
#elif defined(__APPLE__)
#include <vulkan/vulkan_macos.h>
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
#include <vulkan/vulkan_android.h> #include <vulkan/vulkan_android.h>
#else #elif !defined(__APPLE__)
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <vulkan/vulkan_wayland.h> #include <vulkan/vulkan_wayland.h>
#include <vulkan/vulkan_xlib.h> #include <vulkan/vulkan_xlib.h>
@ -44,12 +42,13 @@ vk::SurfaceKHR CreateSurface(
} }
#elif defined(__APPLE__) #elif defined(__APPLE__)
if (window_info.type == Core::Frontend::WindowSystemType::Cocoa) { if (window_info.type == Core::Frontend::WindowSystemType::Cocoa) {
const VkMacOSSurfaceCreateInfoMVK mvk_ci{VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK, const VkMetalSurfaceCreateInfoEXT macos_ci = {
nullptr, 0, window_info.render_surface}; .pLayer = static_cast<const CAMetalLayer*>(window_info.render_surface),
const auto vkCreateMacOSSurfaceMVK = reinterpret_cast<PFN_vkCreateMacOSSurfaceMVK>( };
dld.vkGetInstanceProcAddr(*instance, "vkCreateMacOSSurfaceMVK")); const auto vkCreateMetalSurfaceEXT = reinterpret_cast<PFN_vkCreateMetalSurfaceEXT>(
if (!vkCreateMacOSSurfaceMVK || dld.vkGetInstanceProcAddr(*instance, "vkCreateMetalSurfaceEXT"));
vkCreateMacOSSurfaceMVK(*instance, &mvk_ci, nullptr, &unsafe_surface) != VK_SUCCESS) { if (!vkCreateMetalSurfaceEXT ||
vkCreateMetalSurfaceEXT(*instance, &macos_ci, nullptr, &unsafe_surface) != VK_SUCCESS) {
LOG_ERROR(Render_Vulkan, "Failed to initialize Metal surface"); LOG_ERROR(Render_Vulkan, "Failed to initialize Metal surface");
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED); throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
} }

View file

@ -15,6 +15,8 @@
#define VK_NO_PROTOTYPES #define VK_NO_PROTOTYPES
#ifdef _WIN32 #ifdef _WIN32
#define VK_USE_PLATFORM_WIN32_KHR #define VK_USE_PLATFORM_WIN32_KHR
#elif defined(__APPLE__)
#define VK_USE_PLATFORM_METAL_EXT
#endif #endif
#include <vulkan/vulkan.h> #include <vulkan/vulkan.h>

View file

@ -10,6 +10,8 @@
#if !defined(WIN32) && !defined(__APPLE__) #if !defined(WIN32) && !defined(__APPLE__)
#include <qpa/qplatformnativeinterface.h> #include <qpa/qplatformnativeinterface.h>
#elif defined(__APPLE__)
#include <objc/message.h>
#endif #endif
namespace QtCommon { namespace QtCommon {
@ -37,9 +39,12 @@ Core::Frontend::EmuWindow::WindowSystemInfo GetWindowSystemInfo(QWindow* window)
Core::Frontend::EmuWindow::WindowSystemInfo wsi; Core::Frontend::EmuWindow::WindowSystemInfo wsi;
wsi.type = GetWindowSystemType(); wsi.type = GetWindowSystemType();
#if defined(WIN32)
// Our Win32 Qt external doesn't have the private API. // Our Win32 Qt external doesn't have the private API.
#if defined(WIN32) || defined(__APPLE__) wsi.render_surface = reinterpret_cast<void*>(window->winId());
wsi.render_surface = window ? reinterpret_cast<void*>(window->winId()) : nullptr; #elif defined(__APPLE__)
wsi.render_surface = reinterpret_cast<void* (*)(id, SEL)>(objc_msgSend)(
reinterpret_cast<id>(window->winId()), sel_registerName("layer"));
#else #else
QPlatformNativeInterface* pni = QGuiApplication::platformNativeInterface(); QPlatformNativeInterface* pni = QGuiApplication::platformNativeInterface();
wsi.display_connection = pni->nativeResourceForWindow("display", window); wsi.display_connection = pni->nativeResourceForWindow("display", window);

View file

@ -26,7 +26,10 @@ Record::~Record() = default;
void PopulateRecords(std::vector<Record>& records, QWindow* window) try { void PopulateRecords(std::vector<Record>& records, QWindow* window) try {
using namespace Vulkan; using namespace Vulkan;
auto wsi = QtCommon::GetWindowSystemInfo(window); // Create a test window with a Vulkan surface type for checking present modes.
QWindow test_window(window);
test_window.setSurfaceType(QWindow::VulkanSurface);
auto wsi = QtCommon::GetWindowSystemInfo(&test_window);
vk::InstanceDispatch dld; vk::InstanceDispatch dld;
const auto library = OpenLibrary(); const auto library = OpenLibrary();