Commit WIP about RenderSurface
This commit is contained in:
45
src/Nazara/VulkanRenderer/VulkanSurface.cpp
Normal file
45
src/Nazara/VulkanRenderer/VulkanSurface.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
// Copyright (C) 2016 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Vulkan Renderer"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/VulkanRenderer/VulkanSurface.hpp>
|
||||
#include <Nazara/VulkanRenderer/Vulkan.hpp>
|
||||
#include <Nazara/VulkanRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
VulkanSurface::VulkanSurface() :
|
||||
m_surface(Vulkan::GetInstance())
|
||||
{
|
||||
}
|
||||
|
||||
VulkanSurface::~VulkanSurface() = default;
|
||||
|
||||
bool VulkanSurface::Create(WindowHandle handle)
|
||||
{
|
||||
bool success = false;
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
{
|
||||
HWND winHandle = reinterpret_cast<HWND>(handle);
|
||||
HINSTANCE instance = reinterpret_cast<HINSTANCE>(GetWindowLongPtrW(winHandle, GWLP_HINSTANCE));
|
||||
|
||||
success = m_surface.Create(instance, winHandle);
|
||||
}
|
||||
#else
|
||||
#error This OS is not supported by Vulkan
|
||||
#endif
|
||||
|
||||
if (!success)
|
||||
{
|
||||
NazaraError("Failed to create Vulkan surface: " + TranslateVulkanError(m_surface.GetLastErrorCode()));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void VulkanSurface::Destroy()
|
||||
{
|
||||
m_surface.Destroy();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user