- moved Win32GLVideo's definition into the .cpp file, because it isn't needed anywhere else.

This commit is contained in:
Christoph Oelckers 2017-03-09 13:09:38 +01:00
parent 05919a2926
commit 396c570a96
2 changed files with 80 additions and 66 deletions

View file

@ -26,6 +26,9 @@
#include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderer.h"
#include "gl/system/gl_framebuffer.h" #include "gl/system/gl_framebuffer.h"
extern HWND Window;
extern BOOL AppActive;
extern "C" { extern "C" {
_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
@ -50,6 +53,77 @@ CUSTOM_CVAR(Bool, gl_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINI
EXTERN_CVAR(Bool, vr_enable_quadbuffered) EXTERN_CVAR(Bool, vr_enable_quadbuffered)
EXTERN_CVAR(Int, vid_refreshrate) EXTERN_CVAR(Int, vid_refreshrate)
//==========================================================================
//
//
//
//==========================================================================
class Win32GLVideo : public IVideo
{
public:
Win32GLVideo(int parm);
virtual ~Win32GLVideo();
EDisplayType GetDisplayType() { return DISPLAY_Both; }
void SetWindowedScale(float scale);
void StartModeIterator(int bits, bool fs);
bool NextMode(int *width, int *height, bool *letterbox);
bool GoFullscreen(bool yes);
DFrameBuffer *CreateFrameBuffer(int width, int height, bool fs, DFrameBuffer *old);
virtual bool SetResolution(int width, int height, int bits);
void DumpAdapters();
bool InitHardware(HWND Window, int multisample);
void Shutdown();
bool SetFullscreen(const char *devicename, int w, int h, int bits, int hz);
HDC m_hDC;
protected:
struct ModeInfo
{
ModeInfo(int inX, int inY, int inBits, int inRealY, int inRefresh)
: next(NULL),
width(inX),
height(inY),
bits(inBits),
refreshHz(inRefresh),
realheight(inRealY)
{}
ModeInfo *next;
int width, height, bits, refreshHz, realheight;
} *m_Modes;
ModeInfo *m_IteratorMode;
int m_IteratorBits;
bool m_IteratorFS;
bool m_IsFullscreen;
int m_trueHeight;
int m_DisplayWidth, m_DisplayHeight, m_DisplayBits, m_DisplayHz;
HMODULE hmRender;
char m_DisplayDeviceBuffer[CCHDEVICENAME];
char *m_DisplayDeviceName;
HMONITOR m_hMonitor;
HWND m_Window;
HGLRC m_hRC;
HWND InitDummy();
void ShutdownDummy(HWND dummy);
bool SetPixelFormat();
bool SetupPixelFormat(int multisample);
void GetDisplayDeviceName();
void MakeModesList();
void AddMode(int x, int y, int bits, int baseHeight, int refreshHz);
void FreeModes();
public:
int GetTrueHeight() { return m_trueHeight; }
};
//========================================================================== //==========================================================================
// //
// //
@ -1161,6 +1235,11 @@ int Win32GLFrameBuffer::GetClientHeight()
return rect.bottom - rect.top; return rect.bottom - rect.top;
} }
int Win32GLFrameBuffer::GetTrueHeight()
{
return static_cast<Win32GLVideo *>(Video)->GetTrueHeight();
}
IVideo *gl_CreateVideo() IVideo *gl_CreateVideo()
{ {
return new Win32GLVideo(0); return new Win32GLVideo(0);

View file

@ -27,71 +27,6 @@ struct FRenderer;
FRenderer *gl_CreateInterface(); FRenderer *gl_CreateInterface();
class Win32GLVideo : public IVideo
{
public:
Win32GLVideo(int parm);
virtual ~Win32GLVideo();
EDisplayType GetDisplayType () { return DISPLAY_Both; }
void SetWindowedScale (float scale);
void StartModeIterator (int bits, bool fs);
bool NextMode (int *width, int *height, bool *letterbox);
bool GoFullscreen(bool yes);
DFrameBuffer *CreateFrameBuffer (int width, int height, bool fs, DFrameBuffer *old);
virtual bool SetResolution (int width, int height, int bits);
void DumpAdapters();
bool InitHardware (HWND Window, int multisample);
void Shutdown();
bool SetFullscreen(const char *devicename, int w, int h, int bits, int hz);
HDC m_hDC;
protected:
struct ModeInfo
{
ModeInfo (int inX, int inY, int inBits, int inRealY, int inRefresh)
: next (NULL),
width (inX),
height (inY),
bits (inBits),
refreshHz (inRefresh),
realheight (inRealY)
{}
ModeInfo *next;
int width, height, bits, refreshHz, realheight;
} *m_Modes;
ModeInfo *m_IteratorMode;
int m_IteratorBits;
bool m_IteratorFS;
bool m_IsFullscreen;
int m_trueHeight;
int m_DisplayWidth, m_DisplayHeight, m_DisplayBits, m_DisplayHz;
HMODULE hmRender;
char m_DisplayDeviceBuffer[CCHDEVICENAME];
char *m_DisplayDeviceName;
HMONITOR m_hMonitor;
HWND m_Window;
HGLRC m_hRC;
HWND InitDummy();
void ShutdownDummy(HWND dummy);
bool SetPixelFormat();
bool SetupPixelFormat(int multisample);
void GetDisplayDeviceName();
void MakeModesList();
void AddMode(int x, int y, int bits, int baseHeight, int refreshHz);
void FreeModes();
public:
int GetTrueHeight() { return m_trueHeight; }
};
class Win32GLFrameBuffer : public BaseWinFB class Win32GLFrameBuffer : public BaseWinFB
{ {
@ -120,7 +55,7 @@ public:
int GetClientWidth(); int GetClientWidth();
int GetClientHeight(); int GetClientHeight();
int GetTrueHeight() { return static_cast<Win32GLVideo *>(Video)->GetTrueHeight(); } int GetTrueHeight();
bool Lock(bool buffered); bool Lock(bool buffered);
bool Lock (); bool Lock ();