move win32 pixel format dumping code into LowLevelWindow_Win32
This commit is contained in:
@@ -689,72 +689,6 @@ void SetupExtensions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DumpOpenGLDebugInfo()
|
|
||||||
{
|
|
||||||
#if defined(WIN32)
|
|
||||||
/* Dump Windows pixel format data. */
|
|
||||||
int Actual = GetPixelFormat(wglGetCurrentDC());
|
|
||||||
|
|
||||||
PIXELFORMATDESCRIPTOR pfd;
|
|
||||||
memset(&pfd, 0, sizeof(pfd));
|
|
||||||
pfd.nSize=sizeof(pfd);
|
|
||||||
pfd.nVersion=1;
|
|
||||||
|
|
||||||
int pfcnt = DescribePixelFormat(GetDC(g_hWndMain),1,sizeof(pfd),&pfd);
|
|
||||||
for (int i=1; i <= pfcnt; i++)
|
|
||||||
{
|
|
||||||
memset(&pfd, 0, sizeof(pfd));
|
|
||||||
pfd.nSize=sizeof(pfd);
|
|
||||||
pfd.nVersion=1;
|
|
||||||
DescribePixelFormat(GetDC(g_hWndMain),i,sizeof(pfd),&pfd);
|
|
||||||
|
|
||||||
bool skip = false;
|
|
||||||
|
|
||||||
bool rgba = (pfd.iPixelType==PFD_TYPE_RGBA);
|
|
||||||
|
|
||||||
bool mcd = ((pfd.dwFlags & PFD_GENERIC_FORMAT) && (pfd.dwFlags & PFD_GENERIC_ACCELERATED));
|
|
||||||
bool soft = ((pfd.dwFlags & PFD_GENERIC_FORMAT) && !(pfd.dwFlags & PFD_GENERIC_ACCELERATED));
|
|
||||||
bool icd = !(pfd.dwFlags & PFD_GENERIC_FORMAT) && !(pfd.dwFlags & PFD_GENERIC_ACCELERATED);
|
|
||||||
bool opengl = !!(pfd.dwFlags & PFD_SUPPORT_OPENGL);
|
|
||||||
bool window = !!(pfd.dwFlags & PFD_DRAW_TO_WINDOW);
|
|
||||||
bool dbuff = !!(pfd.dwFlags & PFD_DOUBLEBUFFER);
|
|
||||||
|
|
||||||
if(!rgba || soft || !opengl || !window || !dbuff)
|
|
||||||
skip = true;
|
|
||||||
|
|
||||||
/* Skip the above, unless it happens to be the one we chose. */
|
|
||||||
if(skip && i != Actual)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
CString str = ssprintf("Mode %i: ", i);
|
|
||||||
if( i != Actual )
|
|
||||||
continue;
|
|
||||||
// if(i == Actual) str += "*** ";
|
|
||||||
if(skip) str += "(BOGUS) ";
|
|
||||||
if(soft) str += "software ";
|
|
||||||
if(icd) str += "ICD ";
|
|
||||||
if(mcd) str += "MCD ";
|
|
||||||
if(!rgba) str += "indexed ";
|
|
||||||
if(!opengl) str += "!OPENGL ";
|
|
||||||
if(!window) str += "!window ";
|
|
||||||
if(!dbuff) str += "!dbuff ";
|
|
||||||
|
|
||||||
str += ssprintf("%i (%i%i%i) ", pfd.cColorBits, pfd.cRedBits, pfd.cGreenBits, pfd.cBlueBits);
|
|
||||||
if(pfd.cAlphaBits) str += ssprintf("%i alpha ", pfd.cAlphaBits);
|
|
||||||
if(pfd.cDepthBits) str += ssprintf("%i depth ", pfd.cDepthBits);
|
|
||||||
if(pfd.cStencilBits) str += ssprintf("%i stencil ", pfd.cStencilBits);
|
|
||||||
if(pfd.cAccumBits) str += ssprintf("%i accum ", pfd.cAccumBits);
|
|
||||||
|
|
||||||
if(i == Actual && skip)
|
|
||||||
{
|
|
||||||
/* We chose a bogus format. */
|
|
||||||
LOG->Warn("%s", str.c_str());
|
|
||||||
} else
|
|
||||||
LOG->Info("%s", str.c_str());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void RageDisplay_OGL::ResolutionChanged()
|
void RageDisplay_OGL::ResolutionChanged()
|
||||||
{
|
{
|
||||||
SetViewport(0,0);
|
SetViewport(0,0);
|
||||||
@@ -787,7 +721,6 @@ CString RageDisplay_OGL::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut )
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->SetDefaultRenderStates();
|
this->SetDefaultRenderStates();
|
||||||
DumpOpenGLDebugInfo();
|
|
||||||
|
|
||||||
/* Now that we've initialized, we can search for extensions (some of which
|
/* Now that we've initialized, we can search for extensions (some of which
|
||||||
* we may need to set up the video mode). */
|
* we may need to set up the video mode). */
|
||||||
|
|||||||
@@ -71,6 +71,35 @@ void pump(const char *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DumpPixelFormat( const PIXELFORMATDESCRIPTOR &pfd )
|
||||||
|
{
|
||||||
|
CString str = ssprintf( "Mode: " );
|
||||||
|
bool bInvalidFormat = false;
|
||||||
|
|
||||||
|
if( pfd.dwFlags & PFD_GENERIC_FORMAT )
|
||||||
|
{
|
||||||
|
if( pfd.dwFlags & PFD_GENERIC_ACCELERATED ) str += "MCD ";
|
||||||
|
else { str += "software "; bInvalidFormat = true; }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
str += "ICD ";
|
||||||
|
|
||||||
|
if( pfd.iPixelType != PFD_TYPE_RGBA ) { str += "indexed "; bInvalidFormat = true; }
|
||||||
|
if( !(pfd.dwFlags & PFD_SUPPORT_OPENGL) ) { str += "!OPENGL "; bInvalidFormat = true; }
|
||||||
|
if( !(pfd.dwFlags & PFD_DRAW_TO_WINDOW) ) { str += "!window "; bInvalidFormat = true; }
|
||||||
|
if( !(pfd.dwFlags & PFD_DOUBLEBUFFER) ) { str += "!dbuff "; bInvalidFormat = true; }
|
||||||
|
|
||||||
|
str += ssprintf( "%i (%i%i%i) ", pfd.cColorBits, pfd.cRedBits, pfd.cGreenBits, pfd.cBlueBits );
|
||||||
|
if( pfd.cAlphaBits ) str += ssprintf( "%i alpha ", pfd.cAlphaBits );
|
||||||
|
if( pfd.cDepthBits ) str += ssprintf( "%i depth ", pfd.cDepthBits );
|
||||||
|
if( pfd.cStencilBits ) str += ssprintf( "%i stencil ", pfd.cStencilBits );
|
||||||
|
if( pfd.cAccumBits ) str += ssprintf( "%i accum ", pfd.cAccumBits );
|
||||||
|
|
||||||
|
if( bInvalidFormat )
|
||||||
|
LOG->Warn( "Invalid format: %s", str.c_str() );
|
||||||
|
else
|
||||||
|
LOG->Info( "%s", str.c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
/* This function does not reset the video mode if it fails, because we might be trying
|
/* This function does not reset the video mode if it fails, because we might be trying
|
||||||
* yet another video mode, so we'd just thrash the display. On fatal error,
|
* yet another video mode, so we'd just thrash the display. On fatal error,
|
||||||
@@ -171,10 +200,7 @@ CString LowLevelWindow_Win32::TryVideoMode( RageDisplay::VideoModeParams p, bool
|
|||||||
|
|
||||||
DescribePixelFormat( GraphicsWindow::GetHDC(), iPixelFormat, sizeof(g_CurrentPixelFormat), &g_CurrentPixelFormat );
|
DescribePixelFormat( GraphicsWindow::GetHDC(), iPixelFormat, sizeof(g_CurrentPixelFormat), &g_CurrentPixelFormat );
|
||||||
|
|
||||||
LOG->Info( "Got %i bpp (%i%i%i%i), %i depth",
|
DumpPixelFormat( g_CurrentPixelFormat );
|
||||||
g_CurrentPixelFormat.cColorBits, g_CurrentPixelFormat.cRedBits,
|
|
||||||
g_CurrentPixelFormat.cBlueBits, g_CurrentPixelFormat.cGreenBits,
|
|
||||||
g_CurrentPixelFormat.cAlphaBits, g_CurrentPixelFormat.cDepthBits );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( g_HGLRC == NULL )
|
if( g_HGLRC == NULL )
|
||||||
|
|||||||
Reference in New Issue
Block a user