Remove ContextGL since as an abstraction it's unused.

This commit is contained in:
Sebastian Hartte 2019-03-14 21:40:30 +01:00
parent cc3e660d7e
commit 3a8c6db513
8 changed files with 40 additions and 168 deletions

View file

@ -1,55 +0,0 @@
/*************************************************************************/
/* context_gl.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "context_gl.h"
#if defined(OPENGL_ENABLED) || defined(GLES_ENABLED)
ContextGL *ContextGL::singleton = NULL;
ContextGL *ContextGL::get_singleton() {
return singleton;
}
ContextGL::ContextGL() {
ERR_FAIL_COND(singleton);
singleton = this;
}
ContextGL::~ContextGL() {
if (singleton == this)
singleton = NULL;
}
#endif

View file

@ -1,66 +0,0 @@
/*************************************************************************/
/* context_gl.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef CONTEXT_GL_H
#define CONTEXT_GL_H
#if defined(OPENGL_ENABLED) || defined(GLES_ENABLED)
#include "core/typedefs.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
class ContextGL {
static ContextGL *singleton;
public:
static ContextGL *get_singleton();
virtual void release_current() = 0;
virtual void make_current() = 0;
virtual void swap_buffers() = 0;
virtual Error initialize() = 0;
virtual void set_use_vsync(bool p_use) = 0;
virtual bool is_using_vsync() const = 0;
ContextGL();
virtual ~ContextGL();
};
#endif
#endif

View file

@ -32,7 +32,6 @@
#include "core/os/os.h" #include "core/os/os.h"
#include "core/project_settings.h" #include "core/project_settings.h"
#include "drivers/gl_context/context_gl.h"
#define _EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 #define _EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
#define _EXT_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 #define _EXT_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243

View file

@ -32,7 +32,6 @@
#include "core/os/os.h" #include "core/os/os.h"
#include "core/project_settings.h" #include "core/project_settings.h"
#include "drivers/gl_context/context_gl.h"
RasterizerStorage *RasterizerGLES3::get_storage() { RasterizerStorage *RasterizerGLES3::get_storage() {

View file

@ -33,12 +33,10 @@
#if defined(OPENGL_ENABLED) #if defined(OPENGL_ENABLED)
#include "drivers/gl_context/context_gl.h"
#include "haiku_direct_window.h" #include "haiku_direct_window.h"
#include "haiku_gl_view.h" #include "haiku_gl_view.h"
class ContextGL_Haiku : public ContextGL { class ContextGL_Haiku {
private: private:
HaikuGLView *view; HaikuGLView *view;
HaikuDirectWindow *window; HaikuDirectWindow *window;
@ -46,18 +44,18 @@ private:
bool use_vsync; bool use_vsync;
public: public:
virtual Error initialize(); Error initialize();
virtual void release_current(); void release_current();
virtual void make_current(); void make_current();
virtual void swap_buffers(); void swap_buffers();
virtual int get_window_width(); int get_window_width();
virtual int get_window_height(); int get_window_height();
virtual void set_use_vsync(bool p_use); void set_use_vsync(bool p_use);
virtual bool is_using_vsync() const; bool is_using_vsync() const;
ContextGL_Haiku(HaikuDirectWindow *p_window); ContextGL_Haiku(HaikuDirectWindow *p_window);
virtual ~ContextGL_Haiku(); ~ContextGL_Haiku();
}; };
#endif #endif

View file

@ -37,11 +37,10 @@
#include "core/error_list.h" #include "core/error_list.h"
#include "core/os/os.h" #include "core/os/os.h"
#include "drivers/gl_context/context_gl.h"
using namespace Windows::UI::Core; using namespace Windows::UI::Core;
class ContextEGL_UWP : public ContextGL { class ContextEGL_UWP {
public: public:
enum Driver { enum Driver {
@ -64,24 +63,24 @@ private:
Driver driver; Driver driver;
public: public:
virtual void release_current(); void release_current();
virtual void make_current(); void make_current();
virtual int get_window_width(); int get_window_width();
virtual int get_window_height(); int get_window_height();
virtual void swap_buffers(); void swap_buffers();
virtual void set_use_vsync(bool use) { vsync = use; } void set_use_vsync(bool use) { vsync = use; }
virtual bool is_using_vsync() const { return vsync; } bool is_using_vsync() const { return vsync; }
virtual Error initialize(); Error initialize();
void reset(); void reset();
void cleanup(); void cleanup();
ContextEGL_UWP(CoreWindow ^ p_window, Driver p_driver); ContextEGL_UWP(CoreWindow ^ p_window, Driver p_driver);
virtual ~ContextEGL_UWP(); ~ContextEGL_UWP();
}; };
#endif // CONTEXT_EGL_UWP_H #endif // CONTEXT_EGL_UWP_H

View file

@ -37,13 +37,12 @@
#include "core/error_list.h" #include "core/error_list.h"
#include "core/os/os.h" #include "core/os/os.h"
#include "drivers/gl_context/context_gl.h"
#include <windows.h> #include <windows.h>
typedef bool(APIENTRY *PFNWGLSWAPINTERVALEXTPROC)(int interval); typedef bool(APIENTRY *PFNWGLSWAPINTERVALEXTPROC)(int interval);
class ContextGL_Windows : public ContextGL { class ContextGL_Windows {
HDC hDC; HDC hDC;
HGLRC hRC; HGLRC hRC;
@ -55,21 +54,21 @@ class ContextGL_Windows : public ContextGL {
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT; PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
public: public:
virtual void release_current(); void release_current();
virtual void make_current(); void make_current();
virtual int get_window_width(); int get_window_width();
virtual int get_window_height(); int get_window_height();
virtual void swap_buffers(); void swap_buffers();
virtual Error initialize(); Error initialize();
virtual void set_use_vsync(bool p_use); void set_use_vsync(bool p_use);
virtual bool is_using_vsync() const; bool is_using_vsync() const;
ContextGL_Windows(HWND hwnd, bool p_opengl_3_context); ContextGL_Windows(HWND hwnd, bool p_opengl_3_context);
virtual ~ContextGL_Windows(); ~ContextGL_Windows();
}; };
#endif #endif

View file

@ -39,13 +39,12 @@
#if defined(OPENGL_ENABLED) #if defined(OPENGL_ENABLED)
#include "core/os/os.h" #include "core/os/os.h"
#include "drivers/gl_context/context_gl.h"
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/extensions/Xrender.h> #include <X11/extensions/Xrender.h>
struct ContextGL_X11_Private; struct ContextGL_X11_Private;
class ContextGL_X11 : public ContextGL { class ContextGL_X11 {
public: public:
enum ContextType { enum ContextType {
@ -67,19 +66,19 @@ private:
ContextType context_type; ContextType context_type;
public: public:
virtual void release_current(); void release_current();
virtual void make_current(); void make_current();
virtual void swap_buffers(); void swap_buffers();
virtual int get_window_width(); int get_window_width();
virtual int get_window_height(); int get_window_height();
virtual Error initialize(); Error initialize();
virtual void set_use_vsync(bool p_use); void set_use_vsync(bool p_use);
virtual bool is_using_vsync() const; bool is_using_vsync() const;
ContextGL_X11(::Display *p_x11_display, ::Window &p_x11_window, const OS::VideoMode &p_default_video_mode, ContextType p_context_type); ContextGL_X11(::Display *p_x11_display, ::Window &p_x11_window, const OS::VideoMode &p_default_video_mode, ContextType p_context_type);
virtual ~ContextGL_X11(); ~ContextGL_X11();
}; };
#endif #endif