Try to run with OpenGL 4.5 core profile by default on Windows

This commit is contained in:
Robert Beckebans 2018-11-02 13:35:02 +01:00
parent 1e4b171b8a
commit 8cdc4aa99c
3 changed files with 23 additions and 11 deletions

View file

@ -481,6 +481,10 @@ void R_SetupProjectionMatrix( viewDef_t* viewDef )
viewDef->projectionMatrix[1 * 4 + 1] = -viewDef->projectionMatrix[1 * 4 + 1];
viewDef->projectionMatrix[1 * 4 + 3] = -viewDef->projectionMatrix[1 * 4 + 3];
}
#if defined(USE_VULKAN)
viewDef->projectionMatrix[1 * 4 + 1] *= -1.0F;
#endif
}
@ -540,6 +544,10 @@ void R_SetupProjectionMatrix2( const viewDef_t* viewDef, const float zNear, cons
projectionMatrix[1 * 4 + 1] = -viewDef->projectionMatrix[1 * 4 + 1];
projectionMatrix[1 * 4 + 3] = -viewDef->projectionMatrix[1 * 4 + 3];
}
#if defined(USE_VULKAN)
projectionMatrix[1 * 4 + 1] *= -1.0F;
#endif
}
/*

View file

@ -233,7 +233,6 @@ Creates a view that covers the screen and emit the surfaces
*/
void idGuiModel::EmitFullScreen()
{
if( surfaces[0].numIndexes == 0 )
{
return;
@ -286,6 +285,11 @@ void idGuiModel::EmitFullScreen()
viewDef->projectionMatrix[3 * 4 + 2] = -1.0f;
viewDef->projectionMatrix[3 * 4 + 3] = 1.0f;
#if defined(USE_VULKAN)
viewDef->projectionMatrix[1 * 4 + 1] *= -1.0F;
viewDef->projectionMatrix[3 * 4 + 1] *= -1.0F;
#endif
// make a tech5 renderMatrix for faster culling
idRenderMatrix::Transpose( *( idRenderMatrix* )viewDef->projectionMatrix, viewDef->projectionRenderMatrix );

View file

@ -51,7 +51,7 @@ If you have questions concerning this license or the applicable additional terms
idCVar r_useOpenGL32( "r_useOpenGL32", "1", CVAR_INTEGER, "0 = OpenGL 2.0, 1 = OpenGL 3.2 compatibility profile, 2 = OpenGL 3.2 core profile", 0, 2 );
idCVar r_useOpenGL45( "r_useOpenGL45", "2", CVAR_INTEGER, "0 = OpenGL 4.0, 1 = OpenGL 4.5 compatibility profile, 2 = OpenGL 4.5 core profile", 0, 2 );
@ -341,11 +341,11 @@ CreateOpenGLContextOnDC
#if !defined(USE_VULKAN)
static HGLRC CreateOpenGLContextOnDC( const HDC hdc, const bool debugContext )
{
int useOpenGL32 = r_useOpenGL32.GetInteger();
int useCoreProfile = r_useOpenGL45.GetInteger();
HGLRC m_hrc = NULL;
// RB: for GLintercept 1.2.0 or otherwise we can't diff the framebuffers using the XML log
if( !WGLEW_ARB_create_context || useOpenGL32 == 0 )
if( !WGLEW_ARB_create_context || useCoreProfile == 0 )
{
return wglCreateContext( hdc );
}
@ -353,11 +353,11 @@ static HGLRC CreateOpenGLContextOnDC( const HDC hdc, const bool debugContext )
for( int i = 0; i < 2; i++ )
{
const int glMajorVersion = ( useOpenGL32 != 0 ) ? 3 : 2;
const int glMinorVersion = ( useOpenGL32 != 0 ) ? 2 : 0;
const int glMajorVersion = ( useCoreProfile != 0 ) ? 4 : 5;
const int glMinorVersion = ( useCoreProfile != 0 ) ? 4 : 0;
const int glDebugFlag = debugContext ? WGL_CONTEXT_DEBUG_BIT_ARB : 0;
const int glProfileMask = ( useOpenGL32 != 0 ) ? WGL_CONTEXT_PROFILE_MASK_ARB : 0;
const int glProfile = ( useOpenGL32 == 1 ) ? WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB : ( ( useOpenGL32 == 2 ) ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : 0 );
const int glProfileMask = ( useCoreProfile != 0 ) ? WGL_CONTEXT_PROFILE_MASK_ARB : 0;
const int glProfile = ( useCoreProfile == 1 ) ? WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB : ( ( useCoreProfile == 2 ) ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : 0 );
const int attribs[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, glMajorVersion,
@ -372,11 +372,11 @@ static HGLRC CreateOpenGLContextOnDC( const HDC hdc, const bool debugContext )
{
idLib::Printf( "created OpenGL %d.%d context\n", glMajorVersion, glMinorVersion );
if( useOpenGL32 == 2 )
if( useCoreProfile == 2 )
{
glConfig.driverType = GLDRV_OPENGL32_CORE_PROFILE;
}
else if( useOpenGL32 == 1 )
else if( useCoreProfile == 1 )
{
glConfig.driverType = GLDRV_OPENGL32_COMPATIBILITY_PROFILE;
}
@ -389,7 +389,7 @@ static HGLRC CreateOpenGLContextOnDC( const HDC hdc, const bool debugContext )
}
idLib::Printf( "failed to create OpenGL %d.%d context\n", glMajorVersion, glMinorVersion );
useOpenGL32 = 0; // fall back to OpenGL 2.0
useCoreProfile = 0; // fall back to OpenGL 2.0
}
if( m_hrc == NULL )