1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

macOS moltenVK support and SIGBUS handling (#11252)

This commit is contained in:
nastys 2021-12-12 21:35:56 +01:00 committed by GitHub
parent 2f93df480b
commit 08333e0876
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 5 deletions

View File

@ -1826,6 +1826,14 @@ const bool s_exception_handler_set = []() -> bool
std::abort();
}
#ifdef __APPLE__
if (::sigaction(SIGBUS, &sa, NULL) == -1)
{
std::fprintf(stderr, "sigaction(SIGBUS) failed (%d).\n", errno);
std::abort();
}
#endif
sa.sa_handler = sigpipe_signaling_handler;
if (::sigaction(SIGPIPE, &sa, NULL) == -1)
{

View File

@ -81,7 +81,9 @@ else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
endif()
elseif(APPLE)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-stdlib=libc++)
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-image_base,0x10000 -Wl,-pagezero_size,0x10000")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_pie")
elseif(WIN32)

View File

@ -681,8 +681,8 @@ namespace glsl
"{\n"
" vec4 low = cl * 12.92;\n"
" vec4 high = 1.055 * pow(cl, vec4(1. / 2.4)) - 0.055;\n"
" bvec4 select = lessThan(cl, vec4(0.0031308));\n"
" return clamp(mix(high, low, select), 0., 1.);\n"
" bvec4 selection = lessThan(cl, vec4(0.0031308));\n"
" return clamp(mix(high, low, selection), 0., 1.);\n"
"}\n\n";
}

View File

@ -29,7 +29,9 @@ namespace vk
case rsx::primitive_type::quad_strip:
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
case rsx::primitive_type::triangle_fan:
#ifndef __APPLE__
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN;
#endif
case rsx::primitive_type::quads:
case rsx::primitive_type::polygon:
requires_modification = true;

View File

@ -495,6 +495,14 @@ namespace vk
enabled_features.occlusionQueryPrecise = VK_FALSE;
}
#ifdef __APPLE__
if (!pgpu->features.logicOp)
{
rsx_log.error("Your GPU does not support framebuffer logical operations. Graphics may not render correctly.");
enabled_features.logicOp = VK_FALSE;
}
#endif
VkDeviceCreateInfo device = {};
device.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
device.pNext = nullptr;

View File

@ -49,7 +49,7 @@ DYNAMIC_IMPORT("ntdll.dll", NtSetTimerResolution, NTSTATUS(ULONG DesiredResoluti
#include <sys/resource.h>
#endif
#ifdef __APPLE__
#if defined(__APPLE__) && defined(BLOCKS) // BLOCKS is required for dispatch_sync, but GCC-11 does not support it
#include <dispatch/dispatch.h>
#endif
@ -130,8 +130,9 @@ LOG_CHANNEL(q_debug, "QDEBUG");
dlg.exec();
};
#ifdef __APPLE__
#if defined(__APPLE__) && defined(BLOCKS) // BLOCKS is required for dispatch_sync, but GCC-11 does not support it
// Cocoa access is not allowed outside of the main thread
// Prevents crash dialogs from freezing the program
if (!pthread_main_np())
{
dispatch_sync(dispatch_get_main_queue(), ^ { show_report(text); });