- renamed SystemFrameBuffer to SystemGLFrameBuffer.

... because with Vulkan there needs to be some hint what API this is for.
This commit is contained in:
Christoph Oelckers 2018-06-24 20:16:30 +02:00
parent 52102f3d4a
commit e7365be0d1
8 changed files with 68 additions and 68 deletions

View file

@ -9,9 +9,9 @@ class FHardwareTexture;
class FSimpleVertexBuffer;
class FGLDebug;
class OpenGLFrameBuffer : public SystemFrameBuffer
class OpenGLFrameBuffer : public SystemGLFrameBuffer
{
typedef SystemFrameBuffer Super;
typedef SystemGLFrameBuffer Super;
public:

View file

@ -44,12 +44,12 @@ typedef struct objc_object NSCursor;
typedef struct objc_object CocoaWindow;
#endif
class SystemFrameBuffer : public DFrameBuffer
class SystemGLFrameBuffer : public DFrameBuffer
{
public:
// This must have the same parameters as the Windows version, even if they are not used!
SystemFrameBuffer(void *hMonitor, bool fullscreen);
~SystemFrameBuffer();
SystemGLFrameBuffer(void *hMonitor, bool fullscreen);
~SystemGLFrameBuffer();
virtual bool IsFullscreen();
virtual void SetVSync(bool vsync);
@ -78,7 +78,7 @@ protected:
bool m_supportsGamma;
uint16_t m_originalGamma[GAMMA_TABLE_SIZE];
SystemFrameBuffer() {}
SystemGLFrameBuffer() {}
void SetFullscreenMode();
void SetWindowedMode();

View file

@ -319,7 +319,7 @@ NSOpenGLPixelFormat* CreatePixelFormat(const NSOpenGLPixelFormatAttribute profil
// ---------------------------------------------------------------------------
SystemFrameBuffer::SystemFrameBuffer(void*, const bool fullscreen)
SystemGLFrameBuffer::SystemGLFrameBuffer(void*, const bool fullscreen)
: DFrameBuffer(vid_defwidth, vid_defheight)
, m_window(CreateWindow(STYLE_MASK_WINDOWED))
, m_fullscreen(false)
@ -386,7 +386,7 @@ SystemFrameBuffer::SystemFrameBuffer(void*, const bool fullscreen)
FConsoleWindow::GetInstance().Show(false);
}
SystemFrameBuffer::~SystemFrameBuffer()
SystemGLFrameBuffer::~SystemGLFrameBuffer()
{
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
[nc removeObserver:m_window
@ -397,18 +397,18 @@ SystemFrameBuffer::~SystemFrameBuffer()
object:nil];
}
bool SystemFrameBuffer::IsFullscreen()
bool SystemGLFrameBuffer::IsFullscreen()
{
return m_fullscreen;
}
void SystemFrameBuffer::ToggleFullscreen(bool yes)
void SystemGLFrameBuffer::ToggleFullscreen(bool yes)
{
SetMode(yes, m_hiDPI);
}
void SystemFrameBuffer::SetVSync(bool vsync)
void SystemGLFrameBuffer::SetVSync(bool vsync)
{
const GLint value = vsync ? 1 : 0;
@ -417,16 +417,16 @@ void SystemFrameBuffer::SetVSync(bool vsync)
}
void SystemFrameBuffer::InitializeState()
void SystemGLFrameBuffer::InitializeState()
{
}
void SystemFrameBuffer::SwapBuffers()
void SystemGLFrameBuffer::SwapBuffers()
{
[[NSOpenGLContext currentContext] flushBuffer];
}
void SystemFrameBuffer::SetGammaTable(uint16_t* table)
void SystemGLFrameBuffer::SetGammaTable(uint16_t* table)
{
if (m_supportsGamma)
{
@ -442,7 +442,7 @@ void SystemFrameBuffer::SetGammaTable(uint16_t* table)
}
}
void SystemFrameBuffer::ResetGammaTable()
void SystemGLFrameBuffer::ResetGammaTable()
{
if (m_supportsGamma)
{
@ -451,20 +451,20 @@ void SystemFrameBuffer::ResetGammaTable()
}
int SystemFrameBuffer::GetClientWidth()
int SystemGLFrameBuffer::GetClientWidth()
{
const int clientWidth = I_GetContentViewSize(m_window).width;
return clientWidth > 0 ? clientWidth : GetWidth();
}
int SystemFrameBuffer::GetClientHeight()
int SystemGLFrameBuffer::GetClientHeight()
{
const int clientHeight = I_GetContentViewSize(m_window).height;
return clientHeight > 0 ? clientHeight : GetHeight();
}
void SystemFrameBuffer::SetFullscreenMode()
void SystemGLFrameBuffer::SetFullscreenMode()
{
if (!m_fullscreen)
{
@ -478,7 +478,7 @@ void SystemFrameBuffer::SetFullscreenMode()
[m_window setFrame:screenFrame display:YES];
}
void SystemFrameBuffer::SetWindowedMode()
void SystemGLFrameBuffer::SetWindowedMode()
{
if (m_fullscreen)
{
@ -498,7 +498,7 @@ void SystemFrameBuffer::SetWindowedMode()
[m_window exitAppOnClose];
}
void SystemFrameBuffer::SetMode(const bool fullscreen, const bool hiDPI)
void SystemGLFrameBuffer::SetMode(const bool fullscreen, const bool hiDPI)
{
NSOpenGLView* const glView = [m_window contentView];
[glView setWantsBestResolutionOpenGLSurface:hiDPI];
@ -532,12 +532,12 @@ void SystemFrameBuffer::SetMode(const bool fullscreen, const bool hiDPI)
}
static SystemFrameBuffer* GetSystemFrameBuffer()
static SystemGLFrameBuffer* GetSystemFrameBuffer()
{
return static_cast<SystemFrameBuffer*>(screen);
return static_cast<SystemGLFrameBuffer*>(screen);
}
void SystemFrameBuffer::UseHiDPI(const bool hiDPI)
void SystemGLFrameBuffer::UseHiDPI(const bool hiDPI)
{
if (auto fb = GetSystemFrameBuffer())
{
@ -545,7 +545,7 @@ void SystemFrameBuffer::UseHiDPI(const bool hiDPI)
}
}
void SystemFrameBuffer::SetCursor(NSCursor* cursor)
void SystemGLFrameBuffer::SetCursor(NSCursor* cursor)
{
if (auto fb = GetSystemFrameBuffer())
{
@ -557,7 +557,7 @@ void SystemFrameBuffer::SetCursor(NSCursor* cursor)
}
}
void SystemFrameBuffer::SetWindowVisible(bool visible)
void SystemGLFrameBuffer::SetWindowVisible(bool visible)
{
if (auto fb = GetSystemFrameBuffer())
{
@ -574,7 +574,7 @@ void SystemFrameBuffer::SetWindowVisible(bool visible)
}
}
void SystemFrameBuffer::SetWindowTitle(const char* title)
void SystemGLFrameBuffer::SetWindowTitle(const char* title)
{
if (auto fb = GetSystemFrameBuffer())
{
@ -627,7 +627,7 @@ void I_SetFPSLimit(int limit)
CUSTOM_CVAR(Bool, vid_hidpi, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
SystemFrameBuffer::UseHiDPI(self);
SystemGLFrameBuffer::UseHiDPI(self);
}
@ -688,7 +688,7 @@ bool I_SetCursor(FTexture* cursorpic)
hotSpot:NSMakePoint(0.0f, 0.0f)];
}
SystemFrameBuffer::SetCursor(cursor);
SystemGLFrameBuffer::SetCursor(cursor);
[pool release];
@ -708,11 +708,11 @@ NSSize I_GetContentViewSize(const NSWindow* const window)
void I_SetMainWindowVisible(bool visible)
{
SystemFrameBuffer::SetWindowVisible(visible);
SystemGLFrameBuffer::SetWindowVisible(visible);
}
// each platform has its own specific version of this function.
void I_SetWindowTitle(const char* title)
{
SystemFrameBuffer::SetWindowTitle(title);
SystemGLFrameBuffer::SetWindowTitle(title);
}

View file

@ -5,14 +5,14 @@
#include "v_video.h"
class SystemFrameBuffer : public DFrameBuffer
class SystemGLFrameBuffer : public DFrameBuffer
{
typedef DFrameBuffer Super;
public:
// this must have the same parameters as the Windows version, even if they are not used!
SystemFrameBuffer (void *hMonitor, bool fullscreen);
~SystemFrameBuffer ();
SystemGLFrameBuffer (void *hMonitor, bool fullscreen);
~SystemGLFrameBuffer ();
void ForceBuffering (bool force);
@ -34,7 +34,7 @@ protected:
void ResetGammaTable();
void InitializeState();
SystemFrameBuffer () {}
SystemGLFrameBuffer () {}
uint8_t GammaTable[3][256];
bool UpdatePending;

View file

@ -123,7 +123,7 @@ SDLGLVideo::~SDLGLVideo ()
DFrameBuffer *SDLGLVideo::CreateFrameBuffer ()
{
SystemFrameBuffer *fb = new OpenGLFrameBuffer(0, fullscreen);
SystemGLFrameBuffer *fb = new OpenGLFrameBuffer(0, fullscreen);
return fb;
}
@ -179,7 +179,7 @@ IVideo *gl_CreateVideo()
// FrameBuffer implementation -----------------------------------------------
SystemFrameBuffer::SystemFrameBuffer (void *, bool fullscreen)
SystemGLFrameBuffer::SystemGLFrameBuffer (void *, bool fullscreen)
: DFrameBuffer (vid_defwidth, vid_defheight)
{
// NOTE: Core profiles were added with GL 3.2, so there's no sense trying
@ -257,7 +257,7 @@ SystemFrameBuffer::SystemFrameBuffer (void *, bool fullscreen)
}
}
SystemFrameBuffer::~SystemFrameBuffer ()
SystemGLFrameBuffer::~SystemGLFrameBuffer ()
{
if (Screen)
{
@ -275,11 +275,11 @@ SystemFrameBuffer::~SystemFrameBuffer ()
void SystemFrameBuffer::InitializeState()
void SystemGLFrameBuffer::InitializeState()
{
}
void SystemFrameBuffer::SetGammaTable(uint16_t *tbl)
void SystemGLFrameBuffer::SetGammaTable(uint16_t *tbl)
{
if (m_supportsGamma)
{
@ -287,7 +287,7 @@ void SystemFrameBuffer::SetGammaTable(uint16_t *tbl)
}
}
void SystemFrameBuffer::ResetGammaTable()
void SystemGLFrameBuffer::ResetGammaTable()
{
if (m_supportsGamma)
{
@ -295,12 +295,12 @@ void SystemFrameBuffer::ResetGammaTable()
}
}
bool SystemFrameBuffer::IsFullscreen ()
bool SystemGLFrameBuffer::IsFullscreen ()
{
return (SDL_GetWindowFlags (Screen) & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0;
}
void SystemFrameBuffer::SetVSync( bool vsync )
void SystemGLFrameBuffer::SetVSync( bool vsync )
{
#if defined (__APPLE__)
const GLint value = vsync ? 1 : 0;
@ -318,7 +318,7 @@ void SystemFrameBuffer::SetVSync( bool vsync )
#endif
}
void SystemFrameBuffer::SwapBuffers()
void SystemGLFrameBuffer::SwapBuffers()
{
#if !defined(__APPLE__) && !defined(__OpenBSD__)
if (vid_maxfps && !cl_capfps)
@ -330,19 +330,19 @@ void SystemFrameBuffer::SwapBuffers()
SDL_GL_SwapWindow (Screen);
}
void SystemFrameBuffer::ToggleFullscreen(bool yes)
void SystemGLFrameBuffer::ToggleFullscreen(bool yes)
{
SDL_SetWindowFullscreen(Screen, yes ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
}
int SystemFrameBuffer::GetClientWidth()
int SystemGLFrameBuffer::GetClientWidth()
{
int width = 0;
SDL_GL_GetDrawableSize(Screen, &width, nullptr);
return width;
}
int SystemFrameBuffer::GetClientHeight()
int SystemGLFrameBuffer::GetClientHeight()
{
int height = 0;
SDL_GL_GetDrawableSize(Screen, nullptr, &height);
@ -388,7 +388,7 @@ void ProcessSDLWindowEvent(const SDL_WindowEvent &event)
// each platform has its own specific version of this function.
void I_SetWindowTitle(const char* caption)
{
auto window = static_cast<SystemFrameBuffer *>(screen)->GetSDLWindow();
auto window = static_cast<SystemGLFrameBuffer *>(screen)->GetSDLWindow();
if (caption)
SDL_SetWindowTitle(window, caption);
else

View file

@ -3,7 +3,7 @@
#include "v_video.h"
class SystemFrameBuffer : public DFrameBuffer
class SystemGLFrameBuffer : public DFrameBuffer
{
typedef DFrameBuffer Super;
@ -11,11 +11,11 @@ class SystemFrameBuffer : public DFrameBuffer
void RestoreWindowedPos();
public:
SystemFrameBuffer() {}
SystemGLFrameBuffer() {}
// Actually, hMonitor is a HMONITOR, but it's passed as a void * as there
// look to be some cross-platform bits in the way.
SystemFrameBuffer(void *hMonitor, bool fullscreen);
virtual ~SystemFrameBuffer();
SystemGLFrameBuffer(void *hMonitor, bool fullscreen);
virtual ~SystemGLFrameBuffer();
void SetVSync (bool vsync);
void SwapBuffers();

View file

@ -97,7 +97,7 @@ EXTERN_CVAR(Int, vid_defheight)
//
//==========================================================================
static void GetCenteredPos(int in_w, int in_h, int &winx, int &winy, int &winw, int &winh, int &scrwidth, int &scrheight)
void SystemGLFrameBuffer::GetCenteredPos(int in_w, int in_h, int &winx, int &winy, int &winw, int &winh, int &scrwidth, int &scrheight)
{
DEVMODE displaysettings;
RECT rect;
@ -125,7 +125,7 @@ static void GetCenteredPos(int in_w, int in_h, int &winx, int &winy, int &winw,
//
//==========================================================================
static void KeepWindowOnScreen(int &winx, int &winy, int winw, int winh, int scrwidth, int scrheight)
void SystemGLFrameBuffer::KeepWindowOnScreen(int &winx, int &winy, int winw, int winh, int scrwidth, int scrheight)
{
// If the window is too large to fit entirely on the screen, at least
// keep its upperleft corner visible.
@ -153,7 +153,7 @@ static void KeepWindowOnScreen(int &winx, int &winy, int winw, int winh, int scr
//
//==========================================================================
void SystemFrameBuffer::SaveWindowedPos()
void SystemGLFrameBuffer::SaveWindowedPos()
{
// Don't save if we were run with the -0 option.
if (Args->CheckParm("-0"))
@ -204,7 +204,7 @@ void SystemFrameBuffer::SaveWindowedPos()
//
//==========================================================================
void SystemFrameBuffer::RestoreWindowedPos()
void SystemGLFrameBuffer::RestoreWindowedPos()
{
int winx, winy, winw, winh, scrwidth, scrheight;
@ -239,7 +239,7 @@ void SystemFrameBuffer::RestoreWindowedPos()
//
//==========================================================================
void SystemFrameBuffer::PositionWindow(bool fullscreen)
void SystemGLFrameBuffer::PositionWindow(bool fullscreen)
{
RECT r;
LONG style, exStyle;
@ -298,7 +298,7 @@ void SystemFrameBuffer::PositionWindow(bool fullscreen)
//
//==========================================================================
SystemFrameBuffer::SystemFrameBuffer(void *hMonitor, bool fullscreen) : DFrameBuffer(vid_defwidth, vid_defheight)
SystemGLFrameBuffer::SystemGLFrameBuffer(void *hMonitor, bool fullscreen) : DFrameBuffer(vid_defwidth, vid_defheight)
{
m_Monitor = hMonitor;
m_displayDeviceName = 0;
@ -346,7 +346,7 @@ SystemFrameBuffer::SystemFrameBuffer(void *hMonitor, bool fullscreen) : DFrameBu
//
//==========================================================================
SystemFrameBuffer::~SystemFrameBuffer()
SystemGLFrameBuffer::~SystemGLFrameBuffer()
{
ResetGammaTable();
SaveWindowedPos();
@ -367,7 +367,7 @@ SystemFrameBuffer::~SystemFrameBuffer()
//
//==========================================================================
void SystemFrameBuffer::InitializeState()
void SystemGLFrameBuffer::InitializeState()
{
}
@ -377,7 +377,7 @@ void SystemFrameBuffer::InitializeState()
//
//==========================================================================
void SystemFrameBuffer::ResetGammaTable()
void SystemGLFrameBuffer::ResetGammaTable()
{
if (m_supportsGamma)
{
@ -387,7 +387,7 @@ void SystemFrameBuffer::ResetGammaTable()
}
}
void SystemFrameBuffer::SetGammaTable(uint16_t *tbl)
void SystemGLFrameBuffer::SetGammaTable(uint16_t *tbl)
{
if (m_supportsGamma)
{
@ -403,7 +403,7 @@ void SystemFrameBuffer::SetGammaTable(uint16_t *tbl)
//
//==========================================================================
bool SystemFrameBuffer::IsFullscreen()
bool SystemGLFrameBuffer::IsFullscreen()
{
return m_Fullscreen;
}
@ -414,7 +414,7 @@ bool SystemFrameBuffer::IsFullscreen()
//
//==========================================================================
void SystemFrameBuffer::ToggleFullscreen(bool yes)
void SystemGLFrameBuffer::ToggleFullscreen(bool yes)
{
PositionWindow(yes);
}
@ -430,12 +430,12 @@ CUSTOM_CVAR(Bool, gl_control_tear, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
vid_vsync.Callback();
}
void SystemFrameBuffer::SetVSync (bool vsync)
void SystemGLFrameBuffer::SetVSync (bool vsync)
{
if (myWglSwapIntervalExtProc != NULL) myWglSwapIntervalExtProc(vsync ? (gl_control_tear? SwapInterval : 1) : 0);
}
void SystemFrameBuffer::SwapBuffers()
void SystemGLFrameBuffer::SwapBuffers()
{
// Limiting the frame rate is as simple as waiting for the timer to signal this event.
I_FPSLimit();
@ -448,14 +448,14 @@ void SystemFrameBuffer::SwapBuffers()
//
//==========================================================================
int SystemFrameBuffer::GetClientWidth()
int SystemGLFrameBuffer::GetClientWidth()
{
RECT rect = { 0 };
GetClientRect(Window, &rect);
return rect.right - rect.left;
}
int SystemFrameBuffer::GetClientHeight()
int SystemGLFrameBuffer::GetClientHeight()
{
RECT rect = { 0 };
GetClientRect(Window, &rect);

View file

@ -173,7 +173,7 @@ void Win32GLVideo::GetDisplayDeviceName()
DFrameBuffer *Win32GLVideo::CreateFrameBuffer()
{
SystemFrameBuffer *fb;
SystemGLFrameBuffer *fb;
fb = new OpenGLFrameBuffer(m_hMonitor, fullscreen);
return fb;