OpenGLRenderer: Minor fixes
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_OPENGLRENDERER_OPENGLWINDOWFRAMEBUFFER_HPP
|
||||
#define NAZARA_OPENGLRENDERER_OPENGLWINDOWFRAMEBUFFER_HPP
|
||||
#ifndef NAZARA_OPENGLRENDERER_OPENGLFBOFRAMEBUFFER_HPP
|
||||
#define NAZARA_OPENGLRENDERER_OPENGLFBOFRAMEBUFFER_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/OpenGLRenderer/OpenGLFramebuffer.hpp>
|
||||
@@ -42,4 +42,4 @@ namespace Nz
|
||||
|
||||
#include <Nazara/OpenGLRenderer/OpenGLFboFramebuffer.hpp>
|
||||
|
||||
#endif // NAZARA_OPENGLRENDERER_OpenGLWindowFramebuffer_HPP
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Framebuffer.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Loader.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Program.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/RenderBuffer.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Sampler.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Shader.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Texture.hpp>
|
||||
|
||||
@@ -34,6 +34,7 @@ typedef void (GL_APIENTRYP PFNGLSPECIALIZESHADERARBPROC) (GLuint shader, const G
|
||||
cb(glBlitFramebuffer, PFNGLBLITFRAMEBUFFERPROC) \
|
||||
cb(glBufferData, PFNGLBUFFERDATAPROC) \
|
||||
cb(glBufferSubData, PFNGLBUFFERSUBDATAPROC) \
|
||||
cb(glCheckFramebufferStatus, PFNGLCHECKFRAMEBUFFERSTATUSPROC) \
|
||||
cb(glClear, PFNGLCLEARPROC) \
|
||||
cb(glClearBufferfi, PFNGLCLEARBUFFERFIPROC) \
|
||||
cb(glClearBufferfv, PFNGLCLEARBUFFERFVPROC) \
|
||||
@@ -41,15 +42,14 @@ typedef void (GL_APIENTRYP PFNGLSPECIALIZESHADERARBPROC) (GLuint shader, const G
|
||||
cb(glClearColor, PFNGLCLEARCOLORPROC) \
|
||||
cb(glClearDepthf, PFNGLCLEARDEPTHFPROC) \
|
||||
cb(glClearStencil, PFNGLCLEARSTENCILPROC) \
|
||||
cb(glCreateProgram, PFNGLCREATEPROGRAMPROC) \
|
||||
cb(glCreateShader, PFNGLCREATESHADERPROC) \
|
||||
cb(glCheckFramebufferStatus, PFNGLCHECKFRAMEBUFFERSTATUSPROC) \
|
||||
cb(glColorMask, PFNGLCOLORMASKPROC) \
|
||||
cb(glCompileShader, PFNGLCOMPILESHADERPROC) \
|
||||
cb(glCompressedTexSubImage2D, PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) \
|
||||
cb(glCompressedTexSubImage3D, PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) \
|
||||
cb(glCompileShader, PFNGLCOMPILESHADERPROC) \
|
||||
cb(glCopyBufferSubData, PFNGLCOPYBUFFERSUBDATAPROC) \
|
||||
cb(glCopyTexSubImage2D, PFNGLCOPYTEXSUBIMAGE2DPROC) \
|
||||
cb(glCreateProgram, PFNGLCREATEPROGRAMPROC) \
|
||||
cb(glCreateShader, PFNGLCREATESHADERPROC) \
|
||||
cb(glCullFace, PFNGLCULLFACEPROC) \
|
||||
cb(glDeleteBuffers, PFNGLDELETEBUFFERSPROC) \
|
||||
cb(glDeleteFramebuffers, PFNGLDELETEFRAMEBUFFERSPROC) \
|
||||
@@ -76,14 +76,14 @@ typedef void (GL_APIENTRYP PFNGLSPECIALIZESHADERARBPROC) (GLuint shader, const G
|
||||
cb(glFramebufferRenderbuffer, PFNGLFRAMEBUFFERRENDERBUFFERPROC) \
|
||||
cb(glFramebufferTexture2D, PFNGLFRAMEBUFFERTEXTURE2DPROC) \
|
||||
cb(glFramebufferTextureLayer, PFNGLFRAMEBUFFERTEXTURELAYERPROC) \
|
||||
cb(glGenerateMipmap, PFNGLGENERATEMIPMAPPROC) \
|
||||
cb(glGenBuffers, PFNGLGENBUFFERSPROC) \
|
||||
cb(glGenFramebuffers, PFNGLGENFRAMEBUFFERSPROC) \
|
||||
cb(glGenRenderbuffers, PFNGLGENRENDERBUFFERSPROC) \
|
||||
cb(glGenQueries, PFNGLGENQUERIESPROC) \
|
||||
cb(glGenRenderbuffers, PFNGLGENRENDERBUFFERSPROC) \
|
||||
cb(glGenSamplers, PFNGLGENSAMPLERSPROC) \
|
||||
cb(glGenTextures, PFNGLGENTEXTURESPROC) \
|
||||
cb(glGenVertexArrays, PFNGLGENVERTEXARRAYSPROC) \
|
||||
cb(glGenerateMipmap, PFNGLGENERATEMIPMAPPROC) \
|
||||
cb(glGetActiveUniform, PFNGLGETACTIVEUNIFORMPROC) \
|
||||
cb(glGetBooleanv, PFNGLGETBOOLEANVPROC) \
|
||||
cb(glGetBufferParameteriv, PFNGLGETBUFFERPARAMETERIVPROC) \
|
||||
@@ -91,20 +91,20 @@ typedef void (GL_APIENTRYP PFNGLSPECIALIZESHADERARBPROC) (GLuint shader, const G
|
||||
cb(glGetFloatv, PFNGLGETFLOATVPROC) \
|
||||
cb(glGetIntegerv, PFNGLGETINTEGERVPROC) \
|
||||
cb(glGetProgramBinary, PFNGLGETPROGRAMBINARYPROC) \
|
||||
cb(glGetProgramiv, PFNGLGETPROGRAMIVPROC) \
|
||||
cb(glGetProgramInfoLog, PFNGLGETPROGRAMINFOLOGPROC) \
|
||||
cb(glGetQueryiv, PFNGLGETQUERYIVPROC) \
|
||||
cb(glGetProgramiv, PFNGLGETPROGRAMIVPROC) \
|
||||
cb(glGetQueryObjectuiv, PFNGLGETQUERYOBJECTUIVPROC) \
|
||||
cb(glGetQueryiv, PFNGLGETQUERYIVPROC) \
|
||||
cb(glGetShaderInfoLog, PFNGLGETSHADERINFOLOGPROC) \
|
||||
cb(glGetShaderiv, PFNGLGETSHADERIVPROC) \
|
||||
cb(glGetShaderSource, PFNGLGETSHADERSOURCEPROC) \
|
||||
cb(glGetShaderiv, PFNGLGETSHADERIVPROC) \
|
||||
cb(glGetString, PFNGLGETSTRINGPROC) \
|
||||
cb(glGetStringi, PFNGLGETSTRINGIPROC) \
|
||||
cb(glGetTexParameterfv, PFNGLGETTEXPARAMETERFVPROC) \
|
||||
cb(glGetTexParameteriv, PFNGLGETTEXPARAMETERIVPROC) \
|
||||
cb(glGetUniformLocation, PFNGLGETUNIFORMLOCATIONPROC) \
|
||||
cb(glGetUniformfv, PFNGLGETUNIFORMFVPROC) \
|
||||
cb(glGetUniformiv, PFNGLGETUNIFORMIVPROC) \
|
||||
cb(glGetUniformLocation, PFNGLGETUNIFORMLOCATIONPROC) \
|
||||
cb(glIsEnabled, PFNGLISENABLEDPROC) \
|
||||
cb(glLineWidth, PFNGLLINEWIDTHPROC) \
|
||||
cb(glLinkProgram, PFNGLLINKPROGRAMPROC) \
|
||||
@@ -136,8 +136,8 @@ typedef void (GL_APIENTRYP PFNGLSPECIALIZESHADERARBPROC) (GLuint shader, const G
|
||||
cb(glTexSubImage2D, PFNGLTEXSUBIMAGE2DPROC) \
|
||||
cb(glTexSubImage3D, PFNGLTEXSUBIMAGE3DPROC) \
|
||||
cb(glUniform1f, PFNGLUNIFORM1FPROC) \
|
||||
cb(glUniform1i, PFNGLUNIFORM1IPROC) \
|
||||
cb(glUniform1fv, PFNGLUNIFORM1FVPROC) \
|
||||
cb(glUniform1i, PFNGLUNIFORM1IPROC) \
|
||||
cb(glUniform1iv, PFNGLUNIFORM1IVPROC) \
|
||||
cb(glUniform2fv, PFNGLUNIFORM2FVPROC) \
|
||||
cb(glUniform2iv, PFNGLUNIFORM2IVPROC) \
|
||||
@@ -151,8 +151,8 @@ typedef void (GL_APIENTRYP PFNGLSPECIALIZESHADERARBPROC) (GLuint shader, const G
|
||||
cb(glValidateProgram, PFNGLVALIDATEPROGRAMPROC) \
|
||||
cb(glVertexAttrib4f, PFNGLVERTEXATTRIB4FPROC) \
|
||||
cb(glVertexAttribDivisor, PFNGLVERTEXATTRIBDIVISORPROC) \
|
||||
cb(glVertexAttribPointer, PFNGLVERTEXATTRIBPOINTERPROC) \
|
||||
cb(glVertexAttribIPointer, PFNGLVERTEXATTRIBIPOINTERPROC) \
|
||||
cb(glVertexAttribPointer, PFNGLVERTEXATTRIBPOINTERPROC) \
|
||||
cb(glViewport, PFNGLVIEWPORTPROC) \
|
||||
\
|
||||
extCb(glDebugMessageCallback, PFNGLDEBUGMESSAGECALLBACKPROC) \
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_OPENGLRENDERER_VKFENCE_HPP
|
||||
#define NAZARA_OPENGLRENDERER_VKFENCE_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/DeviceObject.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
namespace Vk
|
||||
{
|
||||
class Fence : public DeviceObject<Fence, VkFence, VkFenceCreateInfo, VK_OBJECT_TYPE_FENCE>
|
||||
{
|
||||
friend DeviceObject;
|
||||
|
||||
public:
|
||||
Fence() = default;
|
||||
Fence(const Fence&) = delete;
|
||||
Fence(Fence&&) = default;
|
||||
~Fence() = default;
|
||||
|
||||
using DeviceObject::Create;
|
||||
inline bool Create(Device& device, VkFenceCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
||||
|
||||
inline bool Reset();
|
||||
|
||||
inline bool Wait();
|
||||
inline bool Wait(UInt64 timeout, bool* didTimeout = nullptr);
|
||||
|
||||
Fence& operator=(const Fence&) = delete;
|
||||
Fence& operator=(Fence&&) = delete;
|
||||
|
||||
private:
|
||||
static inline VkResult CreateHelper(Device& device, const VkFenceCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkFence* handle);
|
||||
static inline void DestroyHelper(Device& device, VkFence handle, const VkAllocationCallbacks* allocator);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Fence.inl>
|
||||
|
||||
#endif // NAZARA_OPENGLRENDERER_VKFENCE_HPP
|
||||
@@ -1,68 +0,0 @@
|
||||
// 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>
|
||||
Reference in New Issue
Block a user