Skip to content

Commit

Permalink
- renamed SystemFrameBuffer to SystemGLFrameBuffer.
Browse files Browse the repository at this point in the history
... because with Vulkan there needs to be some hint what API this is for.
  • Loading branch information
coelckers committed Jun 24, 2018
1 parent 52102f3 commit e7365be
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 68 deletions.
4 changes: 2 additions & 2 deletions src/gl/system/gl_framebuffer.h
Expand Up @@ -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:

Expand Down
8 changes: 4 additions & 4 deletions src/posix/cocoa/gl_sysfb.h
Expand Up @@ -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);
Expand Down Expand Up @@ -78,7 +78,7 @@ class SystemFrameBuffer : public DFrameBuffer
bool m_supportsGamma;
uint16_t m_originalGamma[GAMMA_TABLE_SIZE];

SystemFrameBuffer() {}
SystemGLFrameBuffer() {}

void SetFullscreenMode();
void SetWindowedMode();
Expand Down
48 changes: 24 additions & 24 deletions src/posix/cocoa/i_video.mm
Expand Up @@ -319,7 +319,7 @@ - (void)setCursor:(NSCursor*)cursor
// ---------------------------------------------------------------------------


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)
Expand Down Expand Up @@ -386,7 +386,7 @@ - (void)setCursor:(NSCursor*)cursor
FConsoleWindow::GetInstance().Show(false);
}

SystemFrameBuffer::~SystemFrameBuffer()
SystemGLFrameBuffer::~SystemGLFrameBuffer()
{
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
[nc removeObserver:m_window
Expand All @@ -397,18 +397,18 @@ - (void)setCursor:(NSCursor*)cursor
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;

Expand All @@ -417,16 +417,16 @@ - (void)setCursor:(NSCursor*)cursor
}


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)
{
Expand All @@ -442,7 +442,7 @@ - (void)setCursor:(NSCursor*)cursor
}
}

void SystemFrameBuffer::ResetGammaTable()
void SystemGLFrameBuffer::ResetGammaTable()
{
if (m_supportsGamma)
{
Expand All @@ -451,20 +451,20 @@ - (void)setCursor:(NSCursor*)cursor
}


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)
{
Expand All @@ -478,7 +478,7 @@ - (void)setCursor:(NSCursor*)cursor
[m_window setFrame:screenFrame display:YES];
}

void SystemFrameBuffer::SetWindowedMode()
void SystemGLFrameBuffer::SetWindowedMode()
{
if (m_fullscreen)
{
Expand All @@ -498,7 +498,7 @@ - (void)setCursor:(NSCursor*)cursor
[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];
Expand Down Expand Up @@ -532,20 +532,20 @@ - (void)setCursor:(NSCursor*)cursor
}


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())
{
fb->SetMode(fb->m_fullscreen, hiDPI);
}
}

void SystemFrameBuffer::SetCursor(NSCursor* cursor)
void SystemGLFrameBuffer::SetCursor(NSCursor* cursor)
{
if (auto fb = GetSystemFrameBuffer())
{
Expand All @@ -557,7 +557,7 @@ - (void)setCursor:(NSCursor*)cursor
}
}

void SystemFrameBuffer::SetWindowVisible(bool visible)
void SystemGLFrameBuffer::SetWindowVisible(bool visible)
{
if (auto fb = GetSystemFrameBuffer())
{
Expand All @@ -574,7 +574,7 @@ - (void)setCursor:(NSCursor*)cursor
}
}

void SystemFrameBuffer::SetWindowTitle(const char* title)
void SystemGLFrameBuffer::SetWindowTitle(const char* title)
{
if (auto fb = GetSystemFrameBuffer())
{
Expand Down Expand Up @@ -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);
}


Expand Down Expand Up @@ -688,7 +688,7 @@ bool I_SetCursor(FTexture* cursorpic)
hotSpot:NSMakePoint(0.0f, 0.0f)];
}

SystemFrameBuffer::SetCursor(cursor);
SystemGLFrameBuffer::SetCursor(cursor);

[pool release];

Expand All @@ -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);
}
8 changes: 4 additions & 4 deletions src/posix/sdl/gl_sysfb.h
Expand Up @@ -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);

Expand All @@ -34,7 +34,7 @@ class SystemFrameBuffer : public DFrameBuffer
void ResetGammaTable();
void InitializeState();

SystemFrameBuffer () {}
SystemGLFrameBuffer () {}
uint8_t GammaTable[3][256];
bool UpdatePending;

Expand Down
26 changes: 13 additions & 13 deletions src/posix/sdl/sdlglvideo.cpp
Expand Up @@ -123,7 +123,7 @@ SDLGLVideo::~SDLGLVideo ()

DFrameBuffer *SDLGLVideo::CreateFrameBuffer ()
{
SystemFrameBuffer *fb = new OpenGLFrameBuffer(0, fullscreen);
SystemGLFrameBuffer *fb = new OpenGLFrameBuffer(0, fullscreen);

return fb;
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -257,7 +257,7 @@ SystemFrameBuffer::SystemFrameBuffer (void *, bool fullscreen)
}
}

SystemFrameBuffer::~SystemFrameBuffer ()
SystemGLFrameBuffer::~SystemGLFrameBuffer ()
{
if (Screen)
{
Expand All @@ -275,32 +275,32 @@ SystemFrameBuffer::~SystemFrameBuffer ()



void SystemFrameBuffer::InitializeState()
void SystemGLFrameBuffer::InitializeState()
{
}

void SystemFrameBuffer::SetGammaTable(uint16_t *tbl)
void SystemGLFrameBuffer::SetGammaTable(uint16_t *tbl)
{
if (m_supportsGamma)
{
SDL_SetWindowGammaRamp(Screen, &tbl[0], &tbl[256], &tbl[512]);
}
}

void SystemFrameBuffer::ResetGammaTable()
void SystemGLFrameBuffer::ResetGammaTable()
{
if (m_supportsGamma)
{
SDL_SetWindowGammaRamp(Screen, m_origGamma[0], m_origGamma[1], m_origGamma[2]);
}
}

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;
Expand All @@ -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)
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/win32/gl_sysfb.h
Expand Up @@ -3,19 +3,19 @@

#include "v_video.h"

class SystemFrameBuffer : public DFrameBuffer
class SystemGLFrameBuffer : public DFrameBuffer
{
typedef DFrameBuffer Super;

void SaveWindowedPos();
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();
Expand Down

0 comments on commit e7365be

Please sign in to comment.