Integrate C++11 branch into 5_1-new
This commit is contained in:
@@ -34,7 +34,7 @@ public:
|
||||
virtual const ActualVideoModeParams GetActualVideoModeParams() const = 0;
|
||||
|
||||
virtual bool SupportsRenderToTexture() const { return false; }
|
||||
virtual RenderTarget *CreateRenderTarget() { return NULL; }
|
||||
virtual RenderTarget *CreateRenderTarget() { return nullptr; }
|
||||
|
||||
virtual bool SupportsFullscreenBorderlessWindow() const { return false; };
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ void RenderTarget_MacOSX::Create( const RenderTargetParam ¶m, int &iTextureW
|
||||
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, param.bWithAlpha? GL_RGBA8:GL_RGB8,
|
||||
iTextureWidth, iTextureHeight, 0, param.bWithAlpha? GL_RGBA:GL_RGB,
|
||||
GL_UNSIGNED_BYTE, NULL );
|
||||
GL_UNSIGNED_BYTE, nil);
|
||||
GLenum error = glGetError();
|
||||
ASSERT_M(error == GL_NO_ERROR, RageDisplay_Legacy_Helpers::GLToString(error));
|
||||
|
||||
@@ -293,7 +293,7 @@ void RenderTarget_MacOSX::FinishRenderingTo()
|
||||
}
|
||||
|
||||
|
||||
LowLevelWindow_MacOSX::LowLevelWindow_MacOSX() : m_Context(nil), m_BGContext(nil), m_CurrentDisplayMode(NULL), m_DisplayID(0)
|
||||
LowLevelWindow_MacOSX::LowLevelWindow_MacOSX() : m_Context(nil), m_BGContext(nil), m_CurrentDisplayMode(nil), m_DisplayID(0)
|
||||
{
|
||||
POOL;
|
||||
m_WindowDelegate = [[SMWindowDelegate alloc] init];
|
||||
@@ -323,12 +323,12 @@ void *LowLevelWindow_MacOSX::GetProcAddress( RString s )
|
||||
// Both functions mentioned in there are deprecated in 10.4.
|
||||
const RString& symbolName( '_' + s );
|
||||
const uint32_t count = _dyld_image_count();
|
||||
NSSymbol symbol = NULL;
|
||||
NSSymbol symbol = nil;
|
||||
const uint32_t options = NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR;
|
||||
|
||||
for( uint32_t i = 0; i < count && !symbol; ++i )
|
||||
symbol = NSLookupSymbolInImage( _dyld_get_image_header(i), symbolName, options );
|
||||
return symbol ? NSAddressOfSymbol( symbol ) : NULL;
|
||||
return symbol ? NSAddressOfSymbol( symbol ) : nil;
|
||||
}
|
||||
|
||||
RString LowLevelWindow_MacOSX::TryVideoMode( const VideoModeParams& p, bool& newDeviceOut )
|
||||
@@ -462,13 +462,13 @@ void LowLevelWindow_MacOSX::ShutDownFullScreen()
|
||||
ASSERT( err == kCGErrorSuccess );
|
||||
SetActualParamsFromMode( m_CurrentDisplayMode );
|
||||
// We don't own this so we cannot release it.
|
||||
m_CurrentDisplayMode = NULL;
|
||||
m_CurrentDisplayMode = nil;
|
||||
m_CurrentParams.windowed = true;
|
||||
}
|
||||
|
||||
int LowLevelWindow_MacOSX::ChangeDisplayMode( const VideoModeParams& p )
|
||||
{
|
||||
CFDictionaryRef mode = NULL;
|
||||
CFDictionaryRef mode = nil;
|
||||
CFDictionaryRef newMode;
|
||||
CGDisplayErr err;
|
||||
|
||||
@@ -483,10 +483,10 @@ int LowLevelWindow_MacOSX::ChangeDisplayMode( const VideoModeParams& p )
|
||||
}
|
||||
|
||||
if( p.rate == REFRESH_DEFAULT )
|
||||
newMode = CGDisplayBestModeForParameters( kCGDirectMainDisplay, p.bpp, p.width, p.height, NULL );
|
||||
newMode = CGDisplayBestModeForParameters( kCGDirectMainDisplay, p.bpp, p.width, p.height, nil);
|
||||
else
|
||||
newMode = CGDisplayBestModeForParametersAndRefreshRate( kCGDirectMainDisplay, p.bpp,
|
||||
p.width, p.height, p.rate, NULL );
|
||||
p.width, p.height, p.rate, nil);
|
||||
|
||||
|
||||
err = CGDisplaySwitchToMode( kCGDirectMainDisplay, newMode );
|
||||
|
||||
@@ -14,29 +14,23 @@
|
||||
#include <GL/glew.h>
|
||||
|
||||
static PIXELFORMATDESCRIPTOR g_CurrentPixelFormat;
|
||||
static HGLRC g_HGLRC = NULL;
|
||||
static HGLRC g_HGLRC_Background = NULL;
|
||||
static HMODULE g_HGL_Module = NULL;
|
||||
static HGLRC g_HGLRC = nullptr;
|
||||
static HGLRC g_HGLRC_Background = nullptr;
|
||||
static HMODULE g_HGL_Module = nullptr;
|
||||
|
||||
static void DestroyGraphicsWindowAndOpenGLContext()
|
||||
{
|
||||
if( g_HGLRC != NULL )
|
||||
if( g_HGLRC != nullptr )
|
||||
{
|
||||
wglMakeCurrent( NULL, NULL );
|
||||
wglMakeCurrent( nullptr, nullptr );
|
||||
wglDeleteContext( g_HGLRC );
|
||||
g_HGLRC = NULL;
|
||||
g_HGLRC = nullptr;
|
||||
}
|
||||
|
||||
if( g_HGLRC_Background != NULL )
|
||||
if( g_HGLRC_Background != nullptr )
|
||||
{
|
||||
wglDeleteContext( g_HGLRC_Background );
|
||||
g_HGLRC_Background = NULL;
|
||||
}
|
||||
|
||||
if( g_HGL_Module != NULL )
|
||||
{
|
||||
FreeLibrary(g_HGL_Module);
|
||||
g_HGL_Module = NULL;
|
||||
g_HGLRC_Background = nullptr;
|
||||
}
|
||||
|
||||
ZERO( g_CurrentPixelFormat );
|
||||
@@ -47,25 +41,25 @@ static void DestroyGraphicsWindowAndOpenGLContext()
|
||||
void *LowLevelWindow_Win32::GetProcAddress( RString s )
|
||||
{
|
||||
void *pRet = (void*) wglGetProcAddress( s );
|
||||
if( pRet != NULL )
|
||||
if( pRet != nullptr )
|
||||
return pRet;
|
||||
|
||||
if (g_HGL_Module != NULL)
|
||||
if (g_HGL_Module != nullptr)
|
||||
{
|
||||
pRet = (void *) ::GetProcAddress( g_HGL_Module, s );
|
||||
|
||||
if (pRet != NULL)
|
||||
if (pRet != nullptr)
|
||||
return pRet;
|
||||
}
|
||||
|
||||
return (void*) ::GetProcAddress( GetModuleHandle(NULL), s );
|
||||
return (void*) ::GetProcAddress( GetModuleHandle(nullptr), s );
|
||||
}
|
||||
|
||||
LowLevelWindow_Win32::LowLevelWindow_Win32()
|
||||
{
|
||||
ASSERT( g_HGLRC == NULL );
|
||||
ASSERT( g_HGLRC_Background == NULL );
|
||||
ASSERT( g_HGL_Module == NULL );
|
||||
ASSERT( g_HGLRC == nullptr );
|
||||
ASSERT( g_HGLRC_Background == nullptr );
|
||||
ASSERT( g_HGL_Module == nullptr );
|
||||
|
||||
GraphicsWindow::Initialize( false );
|
||||
}
|
||||
@@ -83,8 +77,8 @@ void LowLevelWindow_Win32::GetDisplaySpecs( DisplaySpecs &out ) const
|
||||
|
||||
int ChooseWindowPixelFormat( const VideoModeParams &p, PIXELFORMATDESCRIPTOR *pixfmt )
|
||||
{
|
||||
ASSERT( GraphicsWindow::GetHwnd() != NULL );
|
||||
ASSERT( GraphicsWindow::GetHDC() != NULL );
|
||||
ASSERT( GraphicsWindow::GetHwnd() != nullptr );
|
||||
ASSERT( GraphicsWindow::GetHDC() != nullptr );
|
||||
|
||||
ZERO( *pixfmt );
|
||||
pixfmt->nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
||||
@@ -144,7 +138,7 @@ RString LowLevelWindow_Win32::TryVideoMode( const VideoModeParams &p, bool &bNew
|
||||
bool bCanSetPixelFormat = true;
|
||||
|
||||
/* Do we have an old window? */
|
||||
if( GraphicsWindow::GetHwnd() == NULL )
|
||||
if( GraphicsWindow::GetHwnd() == nullptr )
|
||||
{
|
||||
/* No. Always create and show the window before changing the video mode.
|
||||
* Otherwise, some other window may have focus, and changing the video mode will
|
||||
@@ -157,7 +151,7 @@ RString LowLevelWindow_Win32::TryVideoMode( const VideoModeParams &p, bool &bNew
|
||||
bCanSetPixelFormat = false;
|
||||
}
|
||||
|
||||
ASSERT( GraphicsWindow::GetHwnd() != NULL );
|
||||
ASSERT( GraphicsWindow::GetHwnd() != nullptr );
|
||||
|
||||
/* Set the display mode: switch to a fullscreen mode or revert to windowed mode. */
|
||||
LOG->Trace("SetScreenMode ...");
|
||||
@@ -199,13 +193,13 @@ RString LowLevelWindow_Win32::TryVideoMode( const VideoModeParams &p, bool &bNew
|
||||
* We have to create the new window first.
|
||||
*/
|
||||
LOG->Trace( "Mode requires new pixel format, and we've already set one; resetting OpenGL context" );
|
||||
if( g_HGLRC != NULL )
|
||||
if( g_HGLRC != nullptr )
|
||||
{
|
||||
wglMakeCurrent( NULL, NULL );
|
||||
wglMakeCurrent( nullptr, nullptr );
|
||||
wglDeleteContext( g_HGLRC );
|
||||
g_HGLRC = NULL;
|
||||
g_HGLRC = nullptr;
|
||||
wglDeleteContext( g_HGLRC_Background );
|
||||
g_HGLRC_Background = NULL;
|
||||
g_HGLRC_Background = nullptr;
|
||||
}
|
||||
|
||||
bNewDeviceOut = true;
|
||||
@@ -231,19 +225,19 @@ RString LowLevelWindow_Win32::TryVideoMode( const VideoModeParams &p, bool &bNew
|
||||
DumpPixelFormat( g_CurrentPixelFormat );
|
||||
}
|
||||
|
||||
if( g_HGLRC == NULL )
|
||||
if( g_HGLRC == nullptr )
|
||||
{
|
||||
g_HGL_Module = LoadLibraryA("opengl32.dll");
|
||||
|
||||
g_HGLRC = wglCreateContext( GraphicsWindow::GetHDC() );
|
||||
if ( g_HGLRC == NULL )
|
||||
if ( g_HGLRC == nullptr )
|
||||
{
|
||||
DestroyGraphicsWindowAndOpenGLContext();
|
||||
return hr_ssprintf( GetLastError(), "wglCreateContext" );
|
||||
}
|
||||
|
||||
g_HGLRC_Background = wglCreateContext( GraphicsWindow::GetHDC() );
|
||||
if( g_HGLRC_Background == NULL )
|
||||
if( g_HGLRC_Background == nullptr )
|
||||
{
|
||||
DestroyGraphicsWindowAndOpenGLContext();
|
||||
return hr_ssprintf( GetLastError(), "wglCreateContext" );
|
||||
@@ -253,7 +247,7 @@ RString LowLevelWindow_Win32::TryVideoMode( const VideoModeParams &p, bool &bNew
|
||||
{
|
||||
LOG->Warn( werr_ssprintf(GetLastError(), "wglShareLists failed") );
|
||||
wglDeleteContext( g_HGLRC_Background );
|
||||
g_HGLRC_Background = NULL;
|
||||
g_HGLRC_Background = nullptr;
|
||||
}
|
||||
|
||||
if( !wglMakeCurrent( GraphicsWindow::GetHDC(), g_HGLRC ) )
|
||||
@@ -267,7 +261,7 @@ RString LowLevelWindow_Win32::TryVideoMode( const VideoModeParams &p, bool &bNew
|
||||
|
||||
bool LowLevelWindow_Win32::SupportsThreadedRendering()
|
||||
{
|
||||
return g_HGLRC_Background != NULL;
|
||||
return g_HGLRC_Background != nullptr;
|
||||
}
|
||||
|
||||
void LowLevelWindow_Win32::BeginConcurrentRendering()
|
||||
@@ -281,7 +275,7 @@ void LowLevelWindow_Win32::BeginConcurrentRendering()
|
||||
|
||||
void LowLevelWindow_Win32::EndConcurrentRendering()
|
||||
{
|
||||
wglMakeCurrent( NULL, NULL );
|
||||
wglMakeCurrent( nullptr, nullptr );
|
||||
}
|
||||
|
||||
static LocalizedString OPENGL_NOT_AVAILABLE( "LowLevelWindow_Win32", "OpenGL hardware acceleration is not available." );
|
||||
@@ -343,8 +337,8 @@ RenderTarget_Win32::RenderTarget_Win32(LowLevelWindow_Win32 *pWind)
|
||||
{
|
||||
m_pWind = pWind;
|
||||
m_texHandle = 0;
|
||||
m_hOldDeviceContext = NULL;
|
||||
m_hOldRenderContext = NULL;
|
||||
m_hOldDeviceContext = nullptr;
|
||||
m_hOldRenderContext = nullptr;
|
||||
}
|
||||
|
||||
RenderTarget_Win32::~RenderTarget_Win32()
|
||||
@@ -377,7 +371,7 @@ void RenderTarget_Win32::Create(const RenderTargetParam ¶m, int &iTextureWid
|
||||
internalformat = param.bWithAlpha? GL_RGBA8:GL_RGB8;
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internalformat, iTextureWidth,
|
||||
iTextureHeight, 0, type, GL_UNSIGNED_BYTE, NULL);
|
||||
iTextureHeight, 0, type, GL_UNSIGNED_BYTE, nullptr);
|
||||
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
|
||||
@@ -31,8 +31,8 @@ using namespace X11Helper;
|
||||
// Display ID for treating the entire X screen as the display
|
||||
const std::string ID_XSCREEN = "XSCREEN_RANDR";
|
||||
|
||||
static GLXContext g_pContext = NULL;
|
||||
static GLXContext g_pBackgroundContext = NULL;
|
||||
static GLXContext g_pContext = nullptr;
|
||||
static GLXContext g_pBackgroundContext = nullptr;
|
||||
static Window g_AltWindow = None;
|
||||
static bool g_bChangedScreenSize = false;
|
||||
static SizeID g_iOldSize = None;
|
||||
@@ -98,12 +98,12 @@ LowLevelWindow_X11::~LowLevelWindow_X11()
|
||||
if( g_pContext )
|
||||
{
|
||||
glXDestroyContext( Dpy, g_pContext );
|
||||
g_pContext = NULL;
|
||||
g_pContext = nullptr;
|
||||
}
|
||||
if( g_pBackgroundContext )
|
||||
{
|
||||
glXDestroyContext( Dpy, g_pBackgroundContext );
|
||||
g_pBackgroundContext = NULL;
|
||||
g_pBackgroundContext = nullptr;
|
||||
}
|
||||
XDestroyWindow( Dpy, Win );
|
||||
Win = None;
|
||||
@@ -138,7 +138,7 @@ void LowLevelWindow_X11::RestoreOutputConfig() {
|
||||
void *LowLevelWindow_X11::GetProcAddress( RString s )
|
||||
{
|
||||
// XXX: We should check whether glXGetProcAddress or
|
||||
// glXGetProcAddressARB is available/not NULL, and go by that,
|
||||
// glXGetProcAddressARB is available/not nullptr, and go by that,
|
||||
// instead of assuming like this.
|
||||
return (void*) glXGetProcAddressARB( (const GLubyte*) s.c_str() );
|
||||
}
|
||||
@@ -156,9 +156,9 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
|
||||
int windowHeight = p.height;
|
||||
bool renderOffscreen = false;
|
||||
|
||||
if( g_pContext == NULL || p.bpp != CurrentParams.bpp || m_bWasWindowed != p.windowed )
|
||||
if( g_pContext == nullptr || p.bpp != CurrentParams.bpp || m_bWasWindowed != p.windowed )
|
||||
{
|
||||
bool bFirstRun = g_pContext == NULL;
|
||||
bool bFirstRun = g_pContext == nullptr;
|
||||
// Different depth, or we didn't make a window before. New context.
|
||||
bNewDeviceOut = true;
|
||||
|
||||
@@ -186,7 +186,7 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
|
||||
visAttribs[i++] = None;
|
||||
|
||||
XVisualInfo *xvi = glXChooseVisual( Dpy, DefaultScreen(Dpy), visAttribs );
|
||||
if( xvi == NULL )
|
||||
if( xvi == nullptr )
|
||||
return "No visual available for that depth.";
|
||||
|
||||
// I get strange behavior if I add override redirect after creating the window.
|
||||
@@ -205,7 +205,7 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
|
||||
glXDestroyContext( Dpy, g_pContext );
|
||||
if( g_pBackgroundContext )
|
||||
glXDestroyContext( Dpy, g_pBackgroundContext );
|
||||
g_pContext = glXCreateContext( Dpy, xvi, NULL, True );
|
||||
g_pContext = glXCreateContext( Dpy, xvi, nullptr, True );
|
||||
g_pBackgroundContext = glXCreateContext( Dpy, xvi, g_pContext, True );
|
||||
|
||||
glXMakeCurrent( Dpy, Win, g_pContext );
|
||||
@@ -307,7 +307,7 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
|
||||
LOG->Info("LowLevelWindow_X11: Using XRandR");
|
||||
|
||||
XRRScreenResources *scrRes = XRRGetScreenResources(Dpy, Win);
|
||||
ASSERT(scrRes != NULL);
|
||||
ASSERT(scrRes != nullptr);
|
||||
ASSERT(scrRes->ncrtc > 0);
|
||||
ASSERT(scrRes->noutput > 0);
|
||||
ASSERT(scrRes->nmode > 0);
|
||||
@@ -353,7 +353,7 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
|
||||
// if the target output is not currently being driven by a crtc,
|
||||
// find an unused crtc that can be connected to it
|
||||
XRROutputInfo *tgtOutInfo = XRRGetOutputInfo( Dpy, scrRes, targetOut );
|
||||
if (tgtOutInfo == NULL)
|
||||
if (tgtOutInfo == nullptr)
|
||||
{
|
||||
XRRFreeScreenResources(scrRes);
|
||||
return "Failed to find XRROutput";
|
||||
@@ -748,7 +748,7 @@ void LowLevelWindow_X11::GetDisplaySpecs(DisplaySpecs &out) const {
|
||||
|
||||
bool LowLevelWindow_X11::SupportsThreadedRendering()
|
||||
{
|
||||
return g_pBackgroundContext != NULL;
|
||||
return g_pBackgroundContext != nullptr;
|
||||
}
|
||||
|
||||
class RenderTarget_X11: public RenderTarget
|
||||
@@ -780,9 +780,9 @@ RenderTarget_X11::RenderTarget_X11( LowLevelWindow_X11 *pWind )
|
||||
{
|
||||
m_pWind = pWind;
|
||||
m_iPbuffer = 0;
|
||||
m_pPbufferContext = NULL;
|
||||
m_pPbufferContext = nullptr;
|
||||
m_iTexHandle = 0;
|
||||
m_pOldContext = NULL;
|
||||
m_pOldContext = nullptr;
|
||||
m_pOldDrawable = 0;
|
||||
}
|
||||
|
||||
@@ -860,7 +860,7 @@ void RenderTarget_X11::Create( const RenderTargetParam ¶m, int &iTextureWidt
|
||||
iTextureHeightOut = iTextureHeight;
|
||||
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, param.bWithAlpha? GL_RGBA8:GL_RGB8,
|
||||
iTextureWidth, iTextureHeight, 0, param.bWithAlpha? GL_RGBA:GL_RGB, GL_UNSIGNED_BYTE, NULL );
|
||||
iTextureWidth, iTextureHeight, 0, param.bWithAlpha? GL_RGBA:GL_RGB, GL_UNSIGNED_BYTE, nullptr );
|
||||
GLenum error = glGetError();
|
||||
ASSERT_M( error == GL_NO_ERROR, GLToString(error) );
|
||||
|
||||
@@ -897,7 +897,7 @@ void RenderTarget_X11::FinishRenderingTo()
|
||||
glBindTexture( GL_TEXTURE_2D, 0 );
|
||||
|
||||
glXMakeCurrent( Dpy, m_pOldDrawable, m_pOldContext );
|
||||
m_pOldContext = NULL;
|
||||
m_pOldContext = nullptr;
|
||||
m_pOldDrawable = 0;
|
||||
|
||||
}
|
||||
@@ -906,7 +906,7 @@ bool LowLevelWindow_X11::SupportsRenderToTexture() const
|
||||
{
|
||||
// Server must support pbuffers:
|
||||
const int iScreen = DefaultScreen( Dpy );
|
||||
float fVersion = strtof( glXQueryServerString(Dpy, iScreen, GLX_VERSION), NULL );
|
||||
float fVersion = strtof( glXQueryServerString(Dpy, iScreen, GLX_VERSION), nullptr );
|
||||
if( fVersion < 1.3f )
|
||||
return false;
|
||||
|
||||
@@ -969,7 +969,7 @@ void LowLevelWindow_X11::BeginConcurrentRendering()
|
||||
|
||||
void LowLevelWindow_X11::EndConcurrentRendering()
|
||||
{
|
||||
bool b = glXMakeCurrent( Dpy, None, NULL );
|
||||
bool b = glXMakeCurrent( Dpy, None, nullptr );
|
||||
ASSERT(b);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user