Common: Formatting

This commit is contained in:
TellowKrinkle 2022-01-09 23:57:13 -06:00 committed by tellowkrinkle
parent de60209e2b
commit a2c3050c51
1 changed files with 49 additions and 49 deletions

View File

@ -23,64 +23,64 @@
#include <vector> #include <vector>
namespace GL { namespace GL {
class Context class Context
{ {
public: public:
Context(const WindowInfo& wi); Context(const WindowInfo& wi);
virtual ~Context(); virtual ~Context();
enum class Profile enum class Profile
{ {
NoProfile, NoProfile,
Core, Core,
ES ES
}; };
struct Version struct Version
{ {
Profile profile; Profile profile;
int major_version; int major_version;
int minor_version; int minor_version;
}; };
struct FullscreenModeInfo struct FullscreenModeInfo
{ {
u32 width; u32 width;
u32 height; u32 height;
float refresh_rate; float refresh_rate;
}; };
__fi const WindowInfo& GetWindowInfo() const { return m_wi; } __fi const WindowInfo& GetWindowInfo() const { return m_wi; }
__fi bool IsGLES() const { return (m_version.profile == Profile::ES); } __fi bool IsGLES() const { return (m_version.profile == Profile::ES); }
__fi u32 GetSurfaceWidth() const { return m_wi.surface_width; } __fi u32 GetSurfaceWidth() const { return m_wi.surface_width; }
__fi u32 GetSurfaceHeight() const { return m_wi.surface_height; } __fi u32 GetSurfaceHeight() const { return m_wi.surface_height; }
virtual void* GetProcAddress(const char* name) = 0; virtual void* GetProcAddress(const char* name) = 0;
virtual bool ChangeSurface(const WindowInfo& new_wi) = 0; virtual bool ChangeSurface(const WindowInfo& new_wi) = 0;
virtual void ResizeSurface(u32 new_surface_width = 0, u32 new_surface_height = 0) = 0; virtual void ResizeSurface(u32 new_surface_width = 0, u32 new_surface_height = 0) = 0;
virtual bool SwapBuffers() = 0; virtual bool SwapBuffers() = 0;
virtual bool MakeCurrent() = 0; virtual bool MakeCurrent() = 0;
virtual bool DoneCurrent() = 0; virtual bool DoneCurrent() = 0;
virtual bool SetSwapInterval(s32 interval) = 0; virtual bool SetSwapInterval(s32 interval) = 0;
virtual std::unique_ptr<Context> CreateSharedContext(const WindowInfo& wi) = 0; virtual std::unique_ptr<Context> CreateSharedContext(const WindowInfo& wi) = 0;
virtual std::vector<FullscreenModeInfo> EnumerateFullscreenModes(); virtual std::vector<FullscreenModeInfo> EnumerateFullscreenModes();
static std::unique_ptr<Context> Create(const WindowInfo& wi, const Version* versions_to_try, static std::unique_ptr<Context> Create(const WindowInfo& wi, const Version* versions_to_try,
size_t num_versions_to_try); size_t num_versions_to_try);
template<size_t N> template<size_t N>
static std::unique_ptr<Context> Create(const WindowInfo& wi, const std::array<Version, N>& versions_to_try) static std::unique_ptr<Context> Create(const WindowInfo& wi, const std::array<Version, N>& versions_to_try)
{ {
return Create(wi, versions_to_try.data(), versions_to_try.size()); return Create(wi, versions_to_try.data(), versions_to_try.size());
} }
static std::unique_ptr<Context> Create(const WindowInfo& wi) { return Create(wi, GetAllVersionsList()); } static std::unique_ptr<Context> Create(const WindowInfo& wi) { return Create(wi, GetAllVersionsList()); }
static const std::array<Version, 16>& GetAllVersionsList(); static const std::array<Version, 16>& GetAllVersionsList();
protected: protected:
WindowInfo m_wi; WindowInfo m_wi;
Version m_version = {}; Version m_version = {};
}; };
} // namespace GL } // namespace GL