Use VK_EXT_metal_surface on iOS
This commit is contained in:
parent
b39e539a37
commit
8b9e8c29ef
2 changed files with 15 additions and 2 deletions
|
@ -1917,7 +1917,10 @@ void GFXVulkan::createLogicalDevice(std::vector<const char*> extensions) {
|
||||||
|
|
||||||
VkPhysicalDeviceFeatures enabledFeatures = {};
|
VkPhysicalDeviceFeatures enabledFeatures = {};
|
||||||
//enabledFeatures.vertexPipelineStoresAndAtomics = true;
|
//enabledFeatures.vertexPipelineStoresAndAtomics = true;
|
||||||
|
// TODO: really not supported or are we not checking something?
|
||||||
|
#ifndef PLATFORM_IOS
|
||||||
enabledFeatures.fragmentStoresAndAtomics = true;
|
enabledFeatures.fragmentStoresAndAtomics = true;
|
||||||
|
#endif
|
||||||
enabledFeatures.samplerAnisotropy = true;
|
enabledFeatures.samplerAnisotropy = true;
|
||||||
enabledFeatures.fillModeNonSolid = true;
|
enabledFeatures.fillModeNonSolid = true;
|
||||||
enabledFeatures.imageCubeArray = true;
|
enabledFeatures.imageCubeArray = true;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include <MetalKit/MetalKit.h>
|
#include <MetalKit/MetalKit.h>
|
||||||
|
#define VK_USE_PLATFORM_METAL_EXT
|
||||||
#include <gfx_vulkan.hpp>
|
#include <gfx_vulkan.hpp>
|
||||||
#include <GameController/GameController.h>
|
#include <GameController/GameController.h>
|
||||||
|
|
||||||
|
@ -181,7 +182,16 @@ void platform::end_text_input() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void* platform::create_native_surface(platform::window_ptr index, void* instance) {
|
void* platform::create_native_surface(platform::window_ptr index, void* instance) {
|
||||||
return nullptr;
|
VkMetalSurfaceCreateInfoEXT surfaceInfo = {};
|
||||||
|
surfaceInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK;
|
||||||
|
surfaceInfo.pNext = 0;
|
||||||
|
surfaceInfo.flags = 0;
|
||||||
|
surfaceInfo.pLayer = (CAMetalLayer*)layer;
|
||||||
|
|
||||||
|
VkSurfaceKHR surface;
|
||||||
|
vkCreateMetalSurfaceEXT((VkInstance)instance, &surfaceInfo, nullptr, &surface);
|
||||||
|
|
||||||
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool platform::is_main_window(platform::window_ptr index) {
|
bool platform::is_main_window(platform::window_ptr index) {
|
||||||
|
@ -189,7 +199,7 @@ bool platform::is_main_window(platform::window_ptr index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<const char*> platform::get_native_surface_extension() {
|
std::vector<const char*> platform::get_native_surface_extension() {
|
||||||
return {};
|
return {VK_EXT_METAL_SURFACE_EXTENSION_NAME};
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform::show_window(const platform::window_ptr index) {
|
void platform::show_window(const platform::window_ptr index) {
|
||||||
|
|
Reference in a new issue