Merge pull request #87999 from bruvzg/metal_layer
[macOS / iOS] Switch Vulkan init to `VK_EXT_metal_surface` extension.
This commit is contained in:
commit
b50001ecfe
6 changed files with 18 additions and 18 deletions
|
@ -80,7 +80,7 @@ DisplayServerIOS::DisplayServerIOS(const String &p_rendering_driver, WindowMode
|
|||
if (!layer) {
|
||||
ERR_FAIL_MSG("Failed to create iOS Vulkan rendering layer.");
|
||||
}
|
||||
wpd.vulkan.layer_ptr = &layer;
|
||||
wpd.vulkan.layer_ptr = (CAMetalLayer *const *)&layer;
|
||||
rendering_context = memnew(RenderingContextDriverVulkanIOS);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include "drivers/vulkan/rendering_context_driver_vulkan.h"
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <QuartzCore/CAMetalLayer.h>
|
||||
|
||||
class RenderingContextDriverVulkanIOS : public RenderingContextDriverVulkan {
|
||||
private:
|
||||
|
@ -46,7 +46,7 @@ protected:
|
|||
|
||||
public:
|
||||
struct WindowPlatformData {
|
||||
CALayer *const *layer_ptr;
|
||||
CAMetalLayer *const *layer_ptr;
|
||||
};
|
||||
|
||||
RenderingContextDriverVulkanIOS();
|
||||
|
|
|
@ -35,22 +35,22 @@
|
|||
#ifdef USE_VOLK
|
||||
#include <volk.h>
|
||||
#else
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <vulkan/vulkan_metal.h>
|
||||
#endif
|
||||
|
||||
const char *RenderingContextDriverVulkanIOS::_get_platform_surface_extension() const {
|
||||
return VK_MVK_IOS_SURFACE_EXTENSION_NAME;
|
||||
return VK_EXT_METAL_SURFACE_EXTENSION_NAME;
|
||||
}
|
||||
|
||||
RenderingContextDriver::SurfaceID RenderingContextDriverVulkanIOS::surface_create(const void *p_platform_data) {
|
||||
const WindowPlatformData *wpd = (const WindowPlatformData *)(p_platform_data);
|
||||
|
||||
VkIOSSurfaceCreateInfoMVK create_info = {};
|
||||
create_info.sType = VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK;
|
||||
create_info.pView = (__bridge const void *)(*wpd->layer_ptr);
|
||||
VkMetalSurfaceCreateInfoEXT create_info = {};
|
||||
create_info.sType = VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT;
|
||||
create_info.pLayer = *wpd->layer_ptr;
|
||||
|
||||
VkSurfaceKHR vk_surface = VK_NULL_HANDLE;
|
||||
VkResult err = vkCreateIOSSurfaceMVK(instance_get(), &create_info, nullptr, &vk_surface);
|
||||
VkResult err = vkCreateMetalSurfaceEXT(instance_get(), &create_info, nullptr, &vk_surface);
|
||||
ERR_FAIL_COND_V(err != VK_SUCCESS, SurfaceID());
|
||||
|
||||
Surface *surface = memnew(Surface);
|
||||
|
|
|
@ -204,7 +204,7 @@ DisplayServerMacOS::WindowID DisplayServerMacOS::_create_window(WindowMode p_mod
|
|||
} wpd;
|
||||
#ifdef VULKAN_ENABLED
|
||||
if (rendering_driver == "vulkan") {
|
||||
wpd.vulkan.view_ptr = &wd.window_view;
|
||||
wpd.vulkan.layer_ptr = (CAMetalLayer *const *)&layer;
|
||||
}
|
||||
#endif
|
||||
Error err = rendering_context->window_create(window_id_counter, &wpd);
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include "drivers/vulkan/rendering_context_driver_vulkan.h"
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <QuartzCore/CAMetalLayer.h>
|
||||
|
||||
class RenderingContextDriverVulkanMacOS : public RenderingContextDriverVulkan {
|
||||
private:
|
||||
|
@ -46,7 +46,7 @@ protected:
|
|||
|
||||
public:
|
||||
struct WindowPlatformData {
|
||||
const id *view_ptr;
|
||||
CAMetalLayer *const *layer_ptr;
|
||||
};
|
||||
|
||||
RenderingContextDriverVulkanMacOS();
|
||||
|
|
|
@ -35,22 +35,22 @@
|
|||
#ifdef USE_VOLK
|
||||
#include <volk.h>
|
||||
#else
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <vulkan/vulkan_metal.h>
|
||||
#endif
|
||||
|
||||
const char *RenderingContextDriverVulkanMacOS::_get_platform_surface_extension() const {
|
||||
return VK_MVK_MACOS_SURFACE_EXTENSION_NAME;
|
||||
return VK_EXT_METAL_SURFACE_EXTENSION_NAME;
|
||||
}
|
||||
|
||||
RenderingContextDriver::SurfaceID RenderingContextDriverVulkanMacOS::surface_create(const void *p_platform_data) {
|
||||
const WindowPlatformData *wpd = (const WindowPlatformData *)(p_platform_data);
|
||||
|
||||
VkMacOSSurfaceCreateInfoMVK create_info = {};
|
||||
create_info.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK;
|
||||
create_info.pView = (__bridge const void *)(*wpd->view_ptr);
|
||||
VkMetalSurfaceCreateInfoEXT create_info = {};
|
||||
create_info.sType = VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT;
|
||||
create_info.pLayer = *wpd->layer_ptr;
|
||||
|
||||
VkSurfaceKHR vk_surface = VK_NULL_HANDLE;
|
||||
VkResult err = vkCreateMacOSSurfaceMVK(instance_get(), &create_info, nullptr, &vk_surface);
|
||||
VkResult err = vkCreateMetalSurfaceEXT(instance_get(), &create_info, nullptr, &vk_surface);
|
||||
ERR_FAIL_COND_V(err != VK_SUCCESS, SurfaceID());
|
||||
|
||||
Surface *surface = memnew(Surface);
|
||||
|
|
Loading…
Reference in a new issue