Rename WGL folder from Win32 to WGL
This commit is contained in:
@@ -1,85 +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_WGLCONTEXT_HPP
|
||||
#define NAZARA_OPENGLRENDERER_WGLCONTEXT_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/DynLib.hpp>
|
||||
#include <Nazara/Platform/WindowHandle.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Win32/Win32Helper.hpp>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <unordered_set>
|
||||
|
||||
#undef WIN32_LEAN_AND_MEAN //< Redefined by OpenGL header (ty Khronos)
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Win32/WGLFunctions.hpp>
|
||||
|
||||
namespace Nz::GL
|
||||
{
|
||||
class WGLLoader;
|
||||
|
||||
class WGLContext : public Context
|
||||
{
|
||||
public:
|
||||
inline WGLContext(const OpenGLDevice* device, const WGLLoader& loader);
|
||||
WGLContext(const WGLContext&) = delete;
|
||||
WGLContext(WGLContext&&) = delete;
|
||||
~WGLContext();
|
||||
|
||||
bool Create(const WGLContext* baseContext, const ContextParams& params, const WGLContext* shareContext = nullptr);
|
||||
bool Create(const WGLContext* baseContext, const ContextParams& params, WindowHandle window, const WGLContext* shareContext = nullptr);
|
||||
void Destroy();
|
||||
|
||||
void EnableVerticalSync(bool enabled) override;
|
||||
|
||||
inline bool HasPlatformExtension(const std::string& str) const;
|
||||
|
||||
void SwapBuffers() override;
|
||||
|
||||
WGLContext& operator=(const WGLContext&) = delete;
|
||||
WGLContext& operator=(WGLContext&&) = delete;
|
||||
|
||||
private:
|
||||
bool CreateInternal(const WGLContext* baseContext, const ContextParams& params, const WGLContext* shareContext = nullptr);
|
||||
bool ImplementFallback(const std::string_view& function) override;
|
||||
|
||||
bool Activate() const override;
|
||||
void Desactivate() const override;
|
||||
const Loader& GetLoader() override;
|
||||
bool LoadWGLExt();
|
||||
bool SetPixelFormat();
|
||||
|
||||
#define NAZARA_OPENGLRENDERER_FUNC(name, sig)
|
||||
#define NAZARA_OPENGLRENDERER_EXT_BEGIN(ext)
|
||||
#define NAZARA_OPENGLRENDERER_EXT_END()
|
||||
#define NAZARA_OPENGLRENDERER_EXT_FUNC(name, sig) sig name = nullptr;
|
||||
NAZARA_OPENGLRENDERER_FOREACH_WGL_FUNC(NAZARA_OPENGLRENDERER_FUNC, NAZARA_OPENGLRENDERER_EXT_BEGIN, NAZARA_OPENGLRENDERER_EXT_END, NAZARA_OPENGLRENDERER_EXT_FUNC)
|
||||
#undef NAZARA_OPENGLRENDERER_EXT_BEGIN
|
||||
#undef NAZARA_OPENGLRENDERER_EXT_END
|
||||
#undef NAZARA_OPENGLRENDERER_EXT_FUNC
|
||||
#undef NAZARA_OPENGLRENDERER_FUNC
|
||||
|
||||
struct Fallback
|
||||
{
|
||||
using glClearDepthProc = void(*)(double depth);
|
||||
|
||||
glClearDepthProc glClearDepth;
|
||||
};
|
||||
Fallback fallbacks; //< m_ omitted
|
||||
|
||||
std::unordered_set<std::string> m_supportedPlatformExtensions;
|
||||
const WGLLoader& m_loader;
|
||||
HDC m_deviceContext;
|
||||
HGLRC m_handle;
|
||||
HWNDHandle m_window;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Win32/WGLContext.inl>
|
||||
|
||||
#endif
|
||||
@@ -1,22 +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/Win32/WGLContext.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz::GL
|
||||
{
|
||||
inline GL::WGLContext::WGLContext(const OpenGLDevice* device, const WGLLoader& loader) :
|
||||
Context(device),
|
||||
m_loader(loader)
|
||||
{
|
||||
}
|
||||
|
||||
inline bool WGLContext::HasPlatformExtension(const std::string& str) const
|
||||
{
|
||||
return m_supportedPlatformExtensions.find(str) != m_supportedPlatformExtensions.end();
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/OpenGLRenderer/DebugOff.hpp>
|
||||
@@ -1,52 +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_WGLFUNCTIONS_HPP
|
||||
#define NAZARA_OPENGLRENDERER_WGLFUNCTIONS_HPP
|
||||
|
||||
#include <GLES3/gl3.h>
|
||||
#include <GL/wgl.h>
|
||||
#include <GL/wglext.h>
|
||||
|
||||
#define NAZARA_OPENGLRENDERER_FOREACH_WGL_FUNC(func, extBegin, extEnd, extFunc) \
|
||||
func(wglCreateContext, PFNWGLCREATECONTEXTPROC) \
|
||||
func(wglDeleteContext, PFNWGLDELETECONTEXTPROC) \
|
||||
func(wglGetCurrentContext, PFNWGLGETCURRENTCONTEXTPROC) \
|
||||
func(wglGetProcAddress, PFNWGLGETPROCADDRESSPROC) \
|
||||
func(wglMakeCurrent, PFNWGLMAKECURRENTPROC) \
|
||||
func(wglShareLists, PFNWGLSHARELISTSPROC) \
|
||||
\
|
||||
extBegin(WGL_ARB_create_context) \
|
||||
extFunc(wglCreateContextAttribsARB, PFNWGLCREATECONTEXTATTRIBSARBPROC) \
|
||||
extEnd() \
|
||||
\
|
||||
extBegin(WGL_ARB_pixel_format) \
|
||||
extFunc(wglChoosePixelFormatARB, PFNWGLCHOOSEPIXELFORMATARBPROC) \
|
||||
extEnd() \
|
||||
\
|
||||
extBegin(WGL_EXT_pixel_format) \
|
||||
extFunc(wglChoosePixelFormatEXT, PFNWGLCHOOSEPIXELFORMATEXTPROC) \
|
||||
extEnd() \
|
||||
\
|
||||
extBegin(WGL_ARB_extensions_string) \
|
||||
extFunc(wglGetExtensionsStringARB, PFNWGLGETEXTENSIONSSTRINGARBPROC) \
|
||||
extEnd() \
|
||||
\
|
||||
extBegin(WGL_EXT_extensions_string) \
|
||||
extFunc(wglGetExtensionsStringEXT, PFNWGLGETEXTENSIONSSTRINGEXTPROC) \
|
||||
extEnd() \
|
||||
\
|
||||
extBegin(WGL_EXT_swap_control) \
|
||||
extFunc(wglSwapIntervalEXT, PFNWGLSWAPINTERVALEXTPROC) \
|
||||
extEnd()
|
||||
|
||||
#define NAZARA_OPENGLRENDERER_FOREACH_GDI32_FUNC(func) \
|
||||
func(ChoosePixelFormat, PFNCHOOSEPIXELFORMATPROC) \
|
||||
func(DescribePixelFormat, PFNDESCRIBEPIXELFORMATPROC) \
|
||||
func(SetPixelFormat, PFNSETPIXELFORMATPROC) \
|
||||
func(SwapBuffers, PFNSWAPBUFFERSPROC) \
|
||||
|
||||
#endif
|
||||
@@ -1,52 +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_WGLLOADER_HPP
|
||||
#define NAZARA_OPENGLRENDERER_WGLLOADER_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/DynLib.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Loader.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Win32/WGLContext.hpp>
|
||||
#include <string>
|
||||
|
||||
#undef WIN32_LEAN_AND_MEAN //< Redefined by OpenGL header (ty Khronos)
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Win32/WGLFunctions.hpp>
|
||||
|
||||
namespace Nz::GL
|
||||
{
|
||||
class WGLLoader : public Loader
|
||||
{
|
||||
public:
|
||||
WGLLoader(DynLib& openglLib);
|
||||
~WGLLoader() = default;
|
||||
|
||||
std::unique_ptr<Context> CreateContext(const OpenGLDevice* device, const ContextParams& params, Context* shareContext) const override;
|
||||
std::unique_ptr<Context> CreateContext(const OpenGLDevice* device, const ContextParams& params, WindowHandle handle, Context* shareContext) const override;
|
||||
|
||||
GLFunction LoadFunction(const char* name) const override;
|
||||
|
||||
#define NAZARA_OPENGLRENDERER_FUNC(name, sig) sig name = nullptr;
|
||||
#define NAZARA_OPENGLRENDERER_EXT_BEGIN(ext)
|
||||
#define NAZARA_OPENGLRENDERER_EXT_END()
|
||||
#define NAZARA_OPENGLRENDERER_EXT_FUNC(name, sig)
|
||||
NAZARA_OPENGLRENDERER_FOREACH_GDI32_FUNC(NAZARA_OPENGLRENDERER_FUNC)
|
||||
NAZARA_OPENGLRENDERER_FOREACH_WGL_FUNC(NAZARA_OPENGLRENDERER_FUNC, NAZARA_OPENGLRENDERER_EXT_BEGIN, NAZARA_OPENGLRENDERER_EXT_END, NAZARA_OPENGLRENDERER_EXT_FUNC)
|
||||
#undef NAZARA_OPENGLRENDERER_EXT_BEGIN
|
||||
#undef NAZARA_OPENGLRENDERER_EXT_END
|
||||
#undef NAZARA_OPENGLRENDERER_EXT_FUNC
|
||||
#undef NAZARA_OPENGLRENDERER_FUNC
|
||||
|
||||
private:
|
||||
DynLib m_gdi32Lib;
|
||||
DynLib& m_opengl32Lib;
|
||||
WGLContext m_baseContext;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Win32/WGLLoader.inl>
|
||||
|
||||
#endif
|
||||
@@ -1,12 +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/Win32/WGLLoader.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz::Vk
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/OpenGLRenderer/DebugOff.hpp>
|
||||
@@ -1,26 +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_WIN32HELPER_HPP
|
||||
#define NAZARA_OPENGLRENDERER_WIN32HELPER_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <windows.h>
|
||||
|
||||
namespace Nz::GL
|
||||
{
|
||||
struct WindowDeleter
|
||||
{
|
||||
void operator()(HWND handle) const
|
||||
{
|
||||
DestroyWindow(handle);
|
||||
}
|
||||
};
|
||||
|
||||
using HWNDHandle = std::unique_ptr<std::remove_pointer_t<HWND>, WindowDeleter>;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user