mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 20:15:27 +00:00
vulkan: Support APPLE
- Adds support for compilation on MAC with moltenVK. Note that vulkan does not work on MacOS yet. There are two main blockers:- 1) Texture component swizzles are not supported except for RGBA8_UNORM->BGRA8_UNORM. 2) There is a bug in their SPIR-V -> MSL generator. GLSL.std.450.xxxx functions are not implemented which breaks rpcs3 functionality. Trying to compile a vertex shader will throw because unpackHalf2x16 is missing.
This commit is contained in:
parent
d41b49d8b4
commit
2855869530
1 changed files with 14 additions and 4 deletions
|
@ -1679,6 +1679,7 @@ public:
|
|||
std::vector<const char *> extensions;
|
||||
std::vector<const char *> layers;
|
||||
|
||||
#ifndef __APPLE__
|
||||
extensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
|
||||
extensions.push_back(VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
|
||||
#ifdef _WIN32
|
||||
|
@ -1704,10 +1705,9 @@ public:
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!fast && g_cfg.video.debug_output)
|
||||
layers.push_back("VK_LAYER_LUNARG_standard_validation");
|
||||
|
||||
#endif
|
||||
VkInstanceCreateInfo instance_info = {};
|
||||
instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||
instance_info.pApplicationInfo = &app;
|
||||
|
@ -1791,6 +1791,10 @@ public:
|
|||
VkSurfaceKHR surface;
|
||||
CHECK_RESULT(vkCreateWin32SurfaceKHR(m_instance, &createInfo, NULL, &surface));
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
using swapchain_NATIVE = swapchain_X11;
|
||||
VkSurfaceKHR surface;
|
||||
|
||||
#else
|
||||
using swapchain_NATIVE = swapchain_X11;
|
||||
VkSurfaceKHR surface;
|
||||
|
@ -1818,14 +1822,15 @@ public:
|
|||
#endif
|
||||
|
||||
uint32_t device_queues = dev.get_queue_count();
|
||||
std::vector<VkBool32> supportsPresent(device_queues);
|
||||
std::vector<VkBool32> supportsPresent(device_queues, VK_FALSE);
|
||||
bool present_possible = false;
|
||||
|
||||
#ifndef __APPLE__
|
||||
for (u32 index = 0; index < device_queues; index++)
|
||||
{
|
||||
vkGetPhysicalDeviceSurfaceSupportKHR(dev, index, surface, &supportsPresent[index]);
|
||||
}
|
||||
|
||||
bool present_possible = false;
|
||||
for (const auto &value : supportsPresent)
|
||||
{
|
||||
if (value)
|
||||
|
@ -1839,6 +1844,7 @@ public:
|
|||
{
|
||||
LOG_ERROR(RSX, "It is not possible for the currently selected GPU to present to the window (Likely caused by NVIDIA driver running the current display)");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Search for a graphics and a present queue in the array of queue
|
||||
// families, try to find one that supports both
|
||||
|
@ -1897,6 +1903,10 @@ public:
|
|||
return swapchain;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
fmt::throw_exception("Unreachable" HERE);
|
||||
#endif
|
||||
|
||||
// Get the list of VkFormat's that are supported:
|
||||
uint32_t formatCount;
|
||||
CHECK_RESULT(vkGetPhysicalDeviceSurfaceFormatsKHR(dev, surface, &formatCount, nullptr));
|
||||
|
|
Loading…
Add table
Reference in a new issue