mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
Set common name for system-specific framebuffer class
Implementation details are hidden as much as possible in platform-specific source files Reduced number of included header files
This commit is contained in:
parent
e50d09ceb2
commit
e6e2b11167
11 changed files with 162 additions and 205 deletions
|
@ -41,6 +41,10 @@
|
|||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/shaders/gl_present3dRowshader.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "hardware.h"
|
||||
#endif // _WIN32
|
||||
|
||||
EXTERN_CVAR(Float, vid_saturation)
|
||||
EXTERN_CVAR(Float, vid_brightness)
|
||||
EXTERN_CVAR(Float, vid_contrast)
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
#ifndef __GL_FRAMEBUFFER
|
||||
#define __GL_FRAMEBUFFER
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "hardware.h"
|
||||
#include "win32gliface.h"
|
||||
#endif
|
||||
#include "gl_sysfb.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -12,17 +9,9 @@ class FHardwareTexture;
|
|||
class FSimpleVertexBuffer;
|
||||
class FGLDebug;
|
||||
|
||||
#ifdef _WIN32
|
||||
class OpenGLFrameBuffer : public Win32GLFrameBuffer
|
||||
class OpenGLFrameBuffer : public SystemFrameBuffer
|
||||
{
|
||||
typedef Win32GLFrameBuffer Super;
|
||||
#else
|
||||
#include "sdlglvideo.h"
|
||||
class OpenGLFrameBuffer : public SDLGLFB
|
||||
{
|
||||
typedef SDLGLFB Super; //[C]commented, DECLARE_CLASS defines this in linux
|
||||
#endif
|
||||
|
||||
typedef SystemFrameBuffer Super;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -34,9 +34,6 @@
|
|||
#include "r_state.h"
|
||||
#include "actor.h"
|
||||
#include "cmdlib.h"
|
||||
#ifdef _WIN32
|
||||
#include "win32gliface.h"
|
||||
#endif
|
||||
#include "v_palette.h"
|
||||
#include "sc_man.h"
|
||||
#include "textures/skyboxtexture.h"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
** sdlglvideo.h
|
||||
** gl_sysfb.h
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2012-2014 Alexey Lysiuk
|
||||
** Copyright 2012-2018 Alexey Lysiuk
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
|
@ -31,29 +31,17 @@
|
|||
**
|
||||
*/
|
||||
|
||||
|
||||
// IMPORTANT NOTE!
|
||||
// This file was intentially named sdlglvideo.h but it has nothing with SDL
|
||||
// The name was selected to avoid spreding of changes over the project
|
||||
// The same applies to SDLGLFB class
|
||||
// See gl/system/gl_framebuffer.h for details about its usage
|
||||
|
||||
|
||||
#ifndef COCOA_SDLGLVIDEO_H_INCLUDED
|
||||
#define COCOA_SDLGLVIDEO_H_INCLUDED
|
||||
#ifndef COCOA_GL_SYSFB_H_INCLUDED
|
||||
#define COCOA_GL_SYSFB_H_INCLUDED
|
||||
|
||||
#include "v_video.h"
|
||||
|
||||
#include "gl/shaders/gl_shader.h"
|
||||
#include "gl/textures/gl_hwtexture.h"
|
||||
|
||||
|
||||
class SDLGLFB : public DFrameBuffer
|
||||
class SystemFrameBuffer : public DFrameBuffer
|
||||
{
|
||||
public:
|
||||
// This must have the same parameters as the Windows version, even if they are not used!
|
||||
SDLGLFB(void *hMonitor, int width, int height, int, int, bool fullscreen, bool bgra);
|
||||
~SDLGLFB();
|
||||
SystemFrameBuffer(void *hMonitor, int width, int height, int, int, bool fullscreen, bool bgra);
|
||||
~SystemFrameBuffer();
|
||||
|
||||
virtual bool IsFullscreen();
|
||||
virtual void SetVSync(bool vsync);
|
||||
|
@ -62,6 +50,7 @@ public:
|
|||
int GetClientHeight();
|
||||
|
||||
virtual int GetTrueHeight() { return GetClientHeight(); }
|
||||
|
||||
protected:
|
||||
bool UpdatePending;
|
||||
|
||||
|
@ -72,7 +61,7 @@ protected:
|
|||
bool m_supportsGamma;
|
||||
uint16_t m_originalGamma[GAMMA_TABLE_SIZE];
|
||||
|
||||
SDLGLFB();
|
||||
SystemFrameBuffer();
|
||||
|
||||
void InitializeState();
|
||||
|
||||
|
@ -83,4 +72,4 @@ protected:
|
|||
void ResetGammaTable();
|
||||
};
|
||||
|
||||
#endif // COCOA_SDLGLVIDEO_H_INCLUDED
|
||||
#endif // COCOA_GL_SYSFB_H_INCLUDED
|
|
@ -665,7 +665,7 @@ CocoaVideo* CocoaVideo::GetInstance()
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
SDLGLFB::SDLGLFB(void*, const int width, const int height, int, int, const bool fullscreen, bool bgra)
|
||||
SystemFrameBuffer::SystemFrameBuffer(void*, const int width, const int height, int, int, const bool fullscreen, bool bgra)
|
||||
: DFrameBuffer(width, height, bgra)
|
||||
, UpdatePending(false)
|
||||
{
|
||||
|
@ -685,20 +685,20 @@ SDLGLFB::SDLGLFB(void*, const int width, const int height, int, int, const bool
|
|||
}
|
||||
}
|
||||
|
||||
SDLGLFB::SDLGLFB()
|
||||
SystemFrameBuffer::SystemFrameBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
SDLGLFB::~SDLGLFB()
|
||||
SystemFrameBuffer::~SystemFrameBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
bool SDLGLFB::IsFullscreen()
|
||||
bool SystemFrameBuffer::IsFullscreen()
|
||||
{
|
||||
return CocoaVideo::IsFullscreen();
|
||||
}
|
||||
|
||||
void SDLGLFB::SetVSync(bool vsync)
|
||||
void SystemFrameBuffer::SetVSync(bool vsync)
|
||||
{
|
||||
const GLint value = vsync ? 1 : 0;
|
||||
|
||||
|
@ -707,21 +707,21 @@ void SDLGLFB::SetVSync(bool vsync)
|
|||
}
|
||||
|
||||
|
||||
void SDLGLFB::InitializeState()
|
||||
void SystemFrameBuffer::InitializeState()
|
||||
{
|
||||
}
|
||||
|
||||
bool SDLGLFB::CanUpdate()
|
||||
bool SystemFrameBuffer::CanUpdate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void SDLGLFB::SwapBuffers()
|
||||
void SystemFrameBuffer::SwapBuffers()
|
||||
{
|
||||
[[NSOpenGLContext currentContext] flushBuffer];
|
||||
}
|
||||
|
||||
void SDLGLFB::SetGammaTable(uint16_t* table)
|
||||
void SystemFrameBuffer::SetGammaTable(uint16_t* table)
|
||||
{
|
||||
if (m_supportsGamma)
|
||||
{
|
||||
|
@ -737,7 +737,7 @@ void SDLGLFB::SetGammaTable(uint16_t* table)
|
|||
}
|
||||
}
|
||||
|
||||
void SDLGLFB::ResetGammaTable()
|
||||
void SystemFrameBuffer::ResetGammaTable()
|
||||
{
|
||||
if (m_supportsGamma)
|
||||
{
|
||||
|
@ -745,7 +745,7 @@ void SDLGLFB::ResetGammaTable()
|
|||
}
|
||||
}
|
||||
|
||||
int SDLGLFB::GetClientWidth()
|
||||
int SystemFrameBuffer::GetClientWidth()
|
||||
{
|
||||
NSView *view = [[NSOpenGLContext currentContext] view];
|
||||
NSRect backingBounds = [view convertRectToBacking: [view bounds]];
|
||||
|
@ -753,7 +753,7 @@ int SDLGLFB::GetClientWidth()
|
|||
return clientWidth > 0 ? clientWidth : Width;
|
||||
}
|
||||
|
||||
int SDLGLFB::GetClientHeight()
|
||||
int SystemFrameBuffer::GetClientHeight()
|
||||
{
|
||||
NSView *view = [[NSOpenGLContext currentContext] view];
|
||||
NSRect backingBounds = [view convertRectToBacking: [view bounds]];
|
||||
|
|
55
src/posix/sdl/gl_sysfb.h
Normal file
55
src/posix/sdl/gl_sysfb.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
#ifndef __POSIX_SDL_GL_SYSFB_H__
|
||||
#define __POSIX_SDL_GL_SYSFB_H__
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "v_video.h"
|
||||
|
||||
class SystemFrameBuffer : 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, int width, int height, int, int, bool fullscreen, bool bgra);
|
||||
~SystemFrameBuffer ();
|
||||
|
||||
void ForceBuffering (bool force);
|
||||
|
||||
bool IsFullscreen ();
|
||||
|
||||
virtual void SetVSync( bool vsync );
|
||||
void SwapBuffers();
|
||||
|
||||
void NewRefreshRate ();
|
||||
|
||||
friend class SDLGLVideo;
|
||||
|
||||
int GetClientWidth();
|
||||
int GetClientHeight();
|
||||
|
||||
SDL_Window *GetSDLWindow() { return Screen; }
|
||||
|
||||
virtual int GetTrueHeight() { return GetClientHeight(); }
|
||||
|
||||
protected:
|
||||
bool CanUpdate();
|
||||
void SetGammaTable(uint16_t *tbl);
|
||||
void ResetGammaTable();
|
||||
void InitializeState();
|
||||
|
||||
SystemFrameBuffer () {}
|
||||
uint8_t GammaTable[3][256];
|
||||
bool UpdatePending;
|
||||
|
||||
SDL_Window *Screen;
|
||||
|
||||
SDL_GLContext GLContext;
|
||||
|
||||
void UpdateColors ();
|
||||
|
||||
Uint16 m_origGamma[3][256];
|
||||
bool m_supportsGamma;
|
||||
};
|
||||
|
||||
#endif // __POSIX_SDL_GL_SYSFB_H__
|
|
@ -46,7 +46,7 @@
|
|||
#include "v_text.h"
|
||||
#include "doomstat.h"
|
||||
#include "m_argv.h"
|
||||
#include "sdlglvideo.h"
|
||||
#include "gl_sysfb.h"
|
||||
#include "r_renderer.h"
|
||||
#include "swrenderer/r_swrenderer.h"
|
||||
|
||||
|
@ -89,8 +89,9 @@ void I_InitGraphics ()
|
|||
|
||||
val.Bool = !!Args->CheckParm ("-devparm");
|
||||
ticker.SetGenericRepDefault (val, CVAR_Bool);
|
||||
|
||||
Video = new SDLGLVideo(0);
|
||||
|
||||
extern IVideo *gl_CreateVideo();
|
||||
Video = gl_CreateVideo();
|
||||
|
||||
if (Video == NULL)
|
||||
I_FatalError ("Failed to initialize display");
|
||||
|
|
|
@ -46,7 +46,8 @@
|
|||
#include "c_console.h"
|
||||
|
||||
#include "videomodes.h"
|
||||
#include "sdlglvideo.h"
|
||||
#include "hardware.h"
|
||||
#include "gl_sysfb.h"
|
||||
#include "gl/system/gl_system.h"
|
||||
#include "r_defs.h"
|
||||
|
||||
|
@ -98,6 +99,28 @@ CVAR (Int, vid_adapter, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
|
||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||
|
||||
class SDLGLVideo : public IVideo
|
||||
{
|
||||
public:
|
||||
SDLGLVideo (int parm);
|
||||
~SDLGLVideo ();
|
||||
|
||||
EDisplayType GetDisplayType () { return DISPLAY_Both; }
|
||||
void SetWindowedScale (float scale);
|
||||
|
||||
DFrameBuffer *CreateFrameBuffer (int width, int height, bool bgra, bool fs, DFrameBuffer *old);
|
||||
|
||||
void StartModeIterator (int bits, bool fs);
|
||||
bool NextMode (int *width, int *height, bool *letterbox);
|
||||
bool SetResolution (int width, int height, int bits);
|
||||
|
||||
void SetupPixelFormat(bool allowsoftware, int multisample, const int *glver);
|
||||
|
||||
private:
|
||||
int IteratorMode;
|
||||
int IteratorBits;
|
||||
};
|
||||
|
||||
// CODE --------------------------------------------------------------------
|
||||
|
||||
SDLGLVideo::SDLGLVideo (int parm)
|
||||
|
@ -145,7 +168,7 @@ DFrameBuffer *SDLGLVideo::CreateFrameBuffer (int width, int height, bool bgra, b
|
|||
|
||||
if (old != NULL)
|
||||
{ // Reuse the old framebuffer if its attributes are the same
|
||||
SDLBaseFB *fb = static_cast<SDLBaseFB *> (old);
|
||||
SystemFrameBuffer *fb = static_cast<SystemFrameBuffer *> (old);
|
||||
if (fb->Width == width &&
|
||||
fb->Height == height)
|
||||
{
|
||||
|
@ -166,8 +189,7 @@ DFrameBuffer *SDLGLVideo::CreateFrameBuffer (int width, int height, bool bgra, b
|
|||
// flashAmount = 0;
|
||||
}
|
||||
|
||||
SDLBaseFB *fb;
|
||||
fb = new OpenGLFrameBuffer(0, width, height, 32, 60, fullscreen);
|
||||
SystemFrameBuffer *fb = new OpenGLFrameBuffer(0, width, height, 32, 60, fullscreen);
|
||||
|
||||
retry = 0;
|
||||
|
||||
|
@ -206,7 +228,7 @@ DFrameBuffer *SDLGLVideo::CreateFrameBuffer (int width, int height, bool bgra, b
|
|||
}
|
||||
|
||||
++retry;
|
||||
fb = static_cast<SDLBaseFB *>(CreateFrameBuffer (width, height, false, fullscreen, NULL));
|
||||
fb = static_cast<SystemFrameBuffer *>(CreateFrameBuffer (width, height, false, fullscreen, NULL));
|
||||
}
|
||||
|
||||
// fb->SetFlash (flashColor, flashAmount);
|
||||
|
@ -283,10 +305,16 @@ void SDLGLVideo::SetupPixelFormat(bool allowsoftware, int multisample, const int
|
|||
}
|
||||
|
||||
|
||||
IVideo *gl_CreateVideo()
|
||||
{
|
||||
return new SDLGLVideo(0);
|
||||
}
|
||||
|
||||
|
||||
// FrameBuffer implementation -----------------------------------------------
|
||||
|
||||
SDLGLFB::SDLGLFB (void *, int width, int height, int, int, bool fullscreen, bool bgra)
|
||||
: SDLBaseFB (width, height, bgra)
|
||||
SystemFrameBuffer::SystemFrameBuffer (void *, int width, int height, int, int, bool fullscreen, bool bgra)
|
||||
: DFrameBuffer (width, height, bgra)
|
||||
{
|
||||
// NOTE: Core profiles were added with GL 3.2, so there's no sense trying
|
||||
// to set core 3.1 or 3.0. We could try a forward-compatible context
|
||||
|
@ -349,7 +377,7 @@ SDLGLFB::SDLGLFB (void *, int width, int height, int, int, bool fullscreen, bool
|
|||
}
|
||||
}
|
||||
|
||||
SDLGLFB::~SDLGLFB ()
|
||||
SystemFrameBuffer::~SystemFrameBuffer ()
|
||||
{
|
||||
if (Screen)
|
||||
{
|
||||
|
@ -367,16 +395,16 @@ SDLGLFB::~SDLGLFB ()
|
|||
|
||||
|
||||
|
||||
void SDLGLFB::InitializeState()
|
||||
void SystemFrameBuffer::InitializeState()
|
||||
{
|
||||
}
|
||||
|
||||
bool SDLGLFB::CanUpdate ()
|
||||
bool SystemFrameBuffer::CanUpdate ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void SDLGLFB::SetGammaTable(uint16_t *tbl)
|
||||
void SystemFrameBuffer::SetGammaTable(uint16_t *tbl)
|
||||
{
|
||||
if (m_supportsGamma)
|
||||
{
|
||||
|
@ -384,7 +412,7 @@ void SDLGLFB::SetGammaTable(uint16_t *tbl)
|
|||
}
|
||||
}
|
||||
|
||||
void SDLGLFB::ResetGammaTable()
|
||||
void SystemFrameBuffer::ResetGammaTable()
|
||||
{
|
||||
if (m_supportsGamma)
|
||||
{
|
||||
|
@ -392,12 +420,12 @@ void SDLGLFB::ResetGammaTable()
|
|||
}
|
||||
}
|
||||
|
||||
bool SDLGLFB::IsFullscreen ()
|
||||
bool SystemFrameBuffer::IsFullscreen ()
|
||||
{
|
||||
return (SDL_GetWindowFlags (Screen) & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0;
|
||||
}
|
||||
|
||||
void SDLGLFB::SetVSync( bool vsync )
|
||||
void SystemFrameBuffer::SetVSync( bool vsync )
|
||||
{
|
||||
#if defined (__APPLE__)
|
||||
const GLint value = vsync ? 1 : 0;
|
||||
|
@ -415,11 +443,11 @@ void SDLGLFB::SetVSync( bool vsync )
|
|||
#endif
|
||||
}
|
||||
|
||||
void SDLGLFB::NewRefreshRate ()
|
||||
void SystemFrameBuffer::NewRefreshRate ()
|
||||
{
|
||||
}
|
||||
|
||||
void SDLGLFB::SwapBuffers()
|
||||
void SystemFrameBuffer::SwapBuffers()
|
||||
{
|
||||
#if !defined(__APPLE__) && !defined(__OpenBSD__)
|
||||
if (vid_maxfps && !cl_capfps)
|
||||
|
@ -431,14 +459,14 @@ void SDLGLFB::SwapBuffers()
|
|||
SDL_GL_SwapWindow (Screen);
|
||||
}
|
||||
|
||||
int SDLGLFB::GetClientWidth()
|
||||
int SystemFrameBuffer::GetClientWidth()
|
||||
{
|
||||
int width = 0;
|
||||
SDL_GL_GetDrawableSize(Screen, &width, nullptr);
|
||||
return width;
|
||||
}
|
||||
|
||||
int SDLGLFB::GetClientHeight()
|
||||
int SystemFrameBuffer::GetClientHeight()
|
||||
{
|
||||
int height = 0;
|
||||
SDL_GL_GetDrawableSize(Screen, nullptr, &height);
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
#ifndef __SDLGLVIDEO_H__
|
||||
#define __SDLGLVIDEO_H__
|
||||
|
||||
#include "hardware.h"
|
||||
#include "v_video.h"
|
||||
#include <SDL.h>
|
||||
#include "gl/system/gl_system.h"
|
||||
|
||||
EXTERN_CVAR (Float, dimamount)
|
||||
EXTERN_CVAR (Color, dimcolor)
|
||||
|
||||
class SDLGLVideo : public IVideo
|
||||
{
|
||||
public:
|
||||
SDLGLVideo (int parm);
|
||||
~SDLGLVideo ();
|
||||
|
||||
EDisplayType GetDisplayType () { return DISPLAY_Both; }
|
||||
void SetWindowedScale (float scale);
|
||||
|
||||
DFrameBuffer *CreateFrameBuffer (int width, int height, bool bgra, bool fs, DFrameBuffer *old);
|
||||
|
||||
void StartModeIterator (int bits, bool fs);
|
||||
bool NextMode (int *width, int *height, bool *letterbox);
|
||||
bool SetResolution (int width, int height, int bits);
|
||||
|
||||
void SetupPixelFormat(bool allowsoftware, int multisample, const int *glver);
|
||||
|
||||
private:
|
||||
int IteratorMode;
|
||||
int IteratorBits;
|
||||
};
|
||||
|
||||
class SDLBaseFB : public DFrameBuffer
|
||||
{
|
||||
typedef DFrameBuffer Super;
|
||||
public:
|
||||
using DFrameBuffer::DFrameBuffer;
|
||||
virtual SDL_Window *GetSDLWindow() = 0;
|
||||
|
||||
friend class SDLGLVideo;
|
||||
};
|
||||
|
||||
class SDLGLFB : public SDLBaseFB
|
||||
{
|
||||
typedef SDLBaseFB Super;
|
||||
public:
|
||||
// this must have the same parameters as the Windows version, even if they are not used!
|
||||
SDLGLFB (void *hMonitor, int width, int height, int, int, bool fullscreen, bool bgra);
|
||||
~SDLGLFB ();
|
||||
|
||||
void ForceBuffering (bool force);
|
||||
|
||||
bool IsFullscreen ();
|
||||
|
||||
virtual void SetVSync( bool vsync );
|
||||
void SwapBuffers();
|
||||
|
||||
void NewRefreshRate ();
|
||||
|
||||
friend class SDLGLVideo;
|
||||
|
||||
int GetClientWidth();
|
||||
int GetClientHeight();
|
||||
|
||||
SDL_Window *GetSDLWindow() override { return Screen; }
|
||||
|
||||
virtual int GetTrueHeight() { return GetClientHeight(); }
|
||||
protected:
|
||||
bool CanUpdate();
|
||||
void SetGammaTable(uint16_t *tbl);
|
||||
void ResetGammaTable();
|
||||
void InitializeState();
|
||||
|
||||
SDLGLFB () {}
|
||||
uint8_t GammaTable[3][256];
|
||||
bool UpdatePending;
|
||||
|
||||
SDL_Window *Screen;
|
||||
|
||||
SDL_GLContext GLContext;
|
||||
|
||||
void UpdateColors ();
|
||||
|
||||
Uint16 m_origGamma[3][256];
|
||||
bool m_supportsGamma;
|
||||
};
|
||||
#endif
|
|
@ -1,37 +1,18 @@
|
|||
#ifndef __WIN32GLIFACE_H__
|
||||
#define __WIN32GLIFACE_H__
|
||||
#ifndef __WIN32_GL_SYSFB_H__
|
||||
#define __WIN32_GL_SYSFB_H__
|
||||
|
||||
#include "hardware.h"
|
||||
#include "v_video.h"
|
||||
#include "tarray.h"
|
||||
|
||||
extern IVideo *Video;
|
||||
|
||||
|
||||
|
||||
EXTERN_CVAR (Float, dimamount)
|
||||
EXTERN_CVAR (Color, dimcolor)
|
||||
|
||||
EXTERN_CVAR(Int, vid_defwidth);
|
||||
EXTERN_CVAR(Int, vid_defheight);
|
||||
EXTERN_CVAR(Int, vid_adapter);
|
||||
|
||||
extern IVideo *Video;
|
||||
|
||||
struct FRenderer;
|
||||
|
||||
|
||||
|
||||
class Win32GLFrameBuffer : public DFrameBuffer
|
||||
class SystemFrameBuffer : public DFrameBuffer
|
||||
{
|
||||
typedef DFrameBuffer Super;
|
||||
|
||||
public:
|
||||
Win32GLFrameBuffer() {}
|
||||
SystemFrameBuffer() {}
|
||||
// Actually, hMonitor is a HMONITOR, but it's passed as a void * as there
|
||||
// look to be some cross-platform bits in the way.
|
||||
Win32GLFrameBuffer(void *hMonitor, int width, int height, int bits, int refreshHz, bool fullscreen, bool bgra);
|
||||
virtual ~Win32GLFrameBuffer();
|
||||
SystemFrameBuffer(void *hMonitor, int width, int height, int bits, int refreshHz, bool fullscreen, bool bgra);
|
||||
virtual ~SystemFrameBuffer();
|
||||
|
||||
void SetVSync (bool vsync);
|
||||
void SwapBuffers();
|
||||
|
@ -66,4 +47,4 @@ protected:
|
|||
|
||||
};
|
||||
|
||||
#endif //__WIN32GLIFACE_H__
|
||||
#endif // __WIN32_GL_SYSFB_H__
|
|
@ -32,14 +32,13 @@
|
|||
**
|
||||
*/
|
||||
|
||||
//#include "gl/system/gl_system.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include "wglext.h"
|
||||
|
||||
#include "win32gliface.h"
|
||||
#include "gl_sysfb.h"
|
||||
#include "hardware.h"
|
||||
#include "x86.h"
|
||||
#include "templates.h"
|
||||
#include "version.h"
|
||||
|
@ -51,7 +50,6 @@
|
|||
#include "v_text.h"
|
||||
#include "m_argv.h"
|
||||
#include "doomerrors.h"
|
||||
//#include "gl_defs.h"
|
||||
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
|
@ -81,6 +79,9 @@ CUSTOM_CVAR(Bool, gl_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINI
|
|||
|
||||
EXTERN_CVAR(Bool, vr_enable_quadbuffered)
|
||||
EXTERN_CVAR(Int, vid_refreshrate)
|
||||
EXTERN_CVAR(Int, vid_defwidth)
|
||||
EXTERN_CVAR(Int, vid_defheight)
|
||||
EXTERN_CVAR(Int, vid_adapter)
|
||||
|
||||
|
||||
//==========================================================================
|
||||
|
@ -451,7 +452,7 @@ bool Win32GLVideo::GoFullscreen(bool yes)
|
|||
|
||||
DFrameBuffer *Win32GLVideo::CreateFrameBuffer(int width, int height, bool bgra, bool fs, DFrameBuffer *old)
|
||||
{
|
||||
Win32GLFrameBuffer *fb;
|
||||
SystemFrameBuffer *fb;
|
||||
|
||||
if (fs)
|
||||
{
|
||||
|
@ -480,7 +481,7 @@ DFrameBuffer *Win32GLVideo::CreateFrameBuffer(int width, int height, bool bgra,
|
|||
|
||||
if (old != NULL)
|
||||
{ // Reuse the old framebuffer if its attributes are the same
|
||||
fb = static_cast<Win32GLFrameBuffer *> (old);
|
||||
fb = static_cast<SystemFrameBuffer *> (old);
|
||||
if (fb->m_Width == m_DisplayWidth &&
|
||||
fb->m_Height == m_DisplayHeight &&
|
||||
fb->m_Bits == m_DisplayBits &&
|
||||
|
@ -974,7 +975,7 @@ bool Win32GLVideo::SetFullscreen(const char *devicename, int w, int h, int bits,
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
Win32GLFrameBuffer::Win32GLFrameBuffer(void *hMonitor, int width, int height, int bits, int refreshHz, bool fullscreen, bool bgra) : DFrameBuffer(width, height, bgra)
|
||||
SystemFrameBuffer::SystemFrameBuffer(void *hMonitor, int width, int height, int bits, int refreshHz, bool fullscreen, bool bgra) : DFrameBuffer(width, height, bgra)
|
||||
{
|
||||
m_Width = width;
|
||||
m_Height = height;
|
||||
|
@ -1083,7 +1084,7 @@ Win32GLFrameBuffer::Win32GLFrameBuffer(void *hMonitor, int width, int height, in
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
Win32GLFrameBuffer::~Win32GLFrameBuffer()
|
||||
SystemFrameBuffer::~SystemFrameBuffer()
|
||||
{
|
||||
ResetGammaTable();
|
||||
I_SaveWindowedPos();
|
||||
|
@ -1106,7 +1107,7 @@ Win32GLFrameBuffer::~Win32GLFrameBuffer()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void Win32GLFrameBuffer::InitializeState()
|
||||
void SystemFrameBuffer::InitializeState()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1116,7 +1117,7 @@ void Win32GLFrameBuffer::InitializeState()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool Win32GLFrameBuffer::CanUpdate()
|
||||
bool SystemFrameBuffer::CanUpdate()
|
||||
{
|
||||
if (!AppActive && IsFullscreen()) return false;
|
||||
return true;
|
||||
|
@ -1128,7 +1129,7 @@ bool Win32GLFrameBuffer::CanUpdate()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void Win32GLFrameBuffer::ResetGammaTable()
|
||||
void SystemFrameBuffer::ResetGammaTable()
|
||||
{
|
||||
if (m_supportsGamma)
|
||||
{
|
||||
|
@ -1138,7 +1139,7 @@ void Win32GLFrameBuffer::ResetGammaTable()
|
|||
}
|
||||
}
|
||||
|
||||
void Win32GLFrameBuffer::SetGammaTable(uint16_t *tbl)
|
||||
void SystemFrameBuffer::SetGammaTable(uint16_t *tbl)
|
||||
{
|
||||
if (m_supportsGamma)
|
||||
{
|
||||
|
@ -1154,7 +1155,7 @@ void Win32GLFrameBuffer::SetGammaTable(uint16_t *tbl)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool Win32GLFrameBuffer::IsFullscreen()
|
||||
bool SystemFrameBuffer::IsFullscreen()
|
||||
{
|
||||
return m_Fullscreen;
|
||||
}
|
||||
|
@ -1165,12 +1166,12 @@ bool Win32GLFrameBuffer::IsFullscreen()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void Win32GLFrameBuffer::SetVSync (bool vsync)
|
||||
void SystemFrameBuffer::SetVSync (bool vsync)
|
||||
{
|
||||
if (myWglSwapIntervalExtProc != NULL) myWglSwapIntervalExtProc(vsync ? SwapInterval : 0);
|
||||
}
|
||||
|
||||
void Win32GLFrameBuffer::SwapBuffers()
|
||||
void SystemFrameBuffer::SwapBuffers()
|
||||
{
|
||||
// Limiting the frame rate is as simple as waiting for the timer to signal this event.
|
||||
I_FPSLimit();
|
||||
|
@ -1183,7 +1184,7 @@ void Win32GLFrameBuffer::SwapBuffers()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void Win32GLFrameBuffer::NewRefreshRate ()
|
||||
void SystemFrameBuffer::NewRefreshRate ()
|
||||
{
|
||||
if (m_Fullscreen)
|
||||
{
|
||||
|
@ -1194,21 +1195,21 @@ void Win32GLFrameBuffer::NewRefreshRate ()
|
|||
}
|
||||
}
|
||||
|
||||
int Win32GLFrameBuffer::GetClientWidth()
|
||||
int SystemFrameBuffer::GetClientWidth()
|
||||
{
|
||||
RECT rect = { 0 };
|
||||
GetClientRect(Window, &rect);
|
||||
return rect.right - rect.left;
|
||||
}
|
||||
|
||||
int Win32GLFrameBuffer::GetClientHeight()
|
||||
int SystemFrameBuffer::GetClientHeight()
|
||||
{
|
||||
RECT rect = { 0 };
|
||||
GetClientRect(Window, &rect);
|
||||
return rect.bottom - rect.top;
|
||||
}
|
||||
|
||||
int Win32GLFrameBuffer::GetTrueHeight()
|
||||
int SystemFrameBuffer::GetTrueHeight()
|
||||
{
|
||||
return static_cast<Win32GLVideo *>(Video)->GetTrueHeight();
|
||||
}
|
||||
|
@ -1216,4 +1217,4 @@ int Win32GLFrameBuffer::GetTrueHeight()
|
|||
IVideo *gl_CreateVideo()
|
||||
{
|
||||
return new Win32GLVideo(0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue