2021-06-22 14:58:24 -04:00
|
|
|
#include <cassert>
|
|
|
|
#include "GSH_VulkaniOS.h"
|
|
|
|
#include "vulkan/Loader.h"
|
|
|
|
|
|
|
|
CGSH_VulkaniOS::CGSH_VulkaniOS(CAMetalLayer* layer)
|
2021-06-29 08:14:27 -04:00
|
|
|
: m_layer(layer)
|
2021-06-22 14:58:24 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CGSHandler::FactoryFunction CGSH_VulkaniOS::GetFactoryFunction(CAMetalLayer* layer)
|
|
|
|
{
|
|
|
|
return [layer]() { return new CGSH_VulkaniOS(layer); };
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGSH_VulkaniOS::InitializeImpl()
|
|
|
|
{
|
2021-06-28 18:36:29 -04:00
|
|
|
m_instance = CreateInstance(true);
|
2021-06-29 08:14:27 -04:00
|
|
|
|
2021-06-22 14:58:24 -04:00
|
|
|
VkIOSSurfaceCreateInfoMVK surfaceCreateInfo = {};
|
|
|
|
surfaceCreateInfo.pView = (__bridge void*)m_layer;
|
|
|
|
auto result = m_instance.vkCreateIOSSurfaceMVK(m_instance, &surfaceCreateInfo, nullptr, &m_context->surface);
|
|
|
|
CHECKVULKANERROR(result);
|
|
|
|
|
|
|
|
CGSH_Vulkan::InitializeImpl();
|
2021-06-29 08:14:27 -04:00
|
|
|
|
2021-06-22 14:58:24 -04:00
|
|
|
{
|
|
|
|
CGSize drawableSize = m_layer.drawableSize;
|
|
|
|
|
|
|
|
PRESENTATION_PARAMS presentationParams;
|
|
|
|
presentationParams.mode = PRESENTATION_MODE_FIT;
|
|
|
|
presentationParams.windowWidth = drawableSize.width;
|
|
|
|
presentationParams.windowHeight = drawableSize.height;
|
|
|
|
|
|
|
|
SetPresentationParams(presentationParams);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGSH_VulkaniOS::PresentBackbuffer()
|
|
|
|
{
|
|
|
|
}
|