Add OpenGLRenderer (WIP)

This commit is contained in:
Lynix
2020-04-15 19:38:11 +02:00
parent ebb271a089
commit 68760209c1
118 changed files with 19236 additions and 414 deletions

View File

@@ -0,0 +1,68 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - OpenGL Renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/OpenGLRenderer/Wrapper/Fence.hpp>
#include <Nazara/OpenGLRenderer/Debug.hpp>
namespace Nz
{
namespace Vk
{
inline bool Fence::Create(Device& device, VkFenceCreateFlags flags, const VkAllocationCallbacks* allocator)
{
VkFenceCreateInfo createInfo =
{
VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
nullptr,
flags
};
return Create(device, createInfo, allocator);
}
inline bool Fence::Reset()
{
m_lastErrorCode = m_device->vkResetFences(*m_device, 1U, &m_handle);
if (m_lastErrorCode != VK_SUCCESS)
{
NazaraError("Failed to reset fence: " + TranslateOpenGLError(m_lastErrorCode));
return false;
}
return true;
}
inline bool Fence::Wait()
{
return Wait(std::numeric_limits<UInt64>::max());
}
inline bool Fence::Wait(UInt64 timeout, bool* didTimeout)
{
m_lastErrorCode = m_device->vkWaitForFences(*m_device, 1U, &m_handle, VK_TRUE, timeout);
if (m_lastErrorCode != VK_SUCCESS && m_lastErrorCode != VK_TIMEOUT)
{
NazaraError("Failed to wait for fence: " + TranslateOpenGLError(m_lastErrorCode));
return false;
}
if (didTimeout)
*didTimeout = (m_lastErrorCode == VK_TIMEOUT);
return true;
}
inline VkResult Fence::CreateHelper(Device& device, const VkFenceCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkFence* handle)
{
return device.vkCreateFence(device, createInfo, allocator, handle);
}
inline void Fence::DestroyHelper(Device& device, VkFence handle, const VkAllocationCallbacks* allocator)
{
return device.vkDestroyFence(device, handle, allocator);
}
}
}
#include <Nazara/OpenGLRenderer/DebugOff.hpp>