mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 07:11:54 +00:00
Re-enable intel HD GL workaround, still needed .. see issue #512
This commit is contained in:
parent
222adc1c87
commit
db467908ad
3 changed files with 198 additions and 17 deletions
|
@ -97,6 +97,10 @@ void CamWnd::OnCreate(){
|
|||
|
||||
g_PrefsDlg.UpdateTextureCompression();
|
||||
|
||||
#ifdef ATIHACK_812
|
||||
g_PrefsDlg.UpdateATIHack();
|
||||
#endif
|
||||
|
||||
g_qeglobals_gui.d_camera = m_pWidget;
|
||||
}
|
||||
|
||||
|
@ -1467,26 +1471,26 @@ void CamWnd::Cam_Draw(){
|
|||
|
||||
// edge / vertex flags
|
||||
if ( g_qeglobals.d_select_mode == sel_vertex ) {
|
||||
// brush verts
|
||||
qglPointSize( 4 );
|
||||
qglColor3f( 0,1,0 );
|
||||
qglBegin( GL_POINTS );
|
||||
for ( i = 0 ; i < g_qeglobals.d_numpoints ; i++ )
|
||||
qglVertex3fv( g_qeglobals.d_points[i] );
|
||||
qglEnd();
|
||||
|
||||
if ( g_qeglobals.d_num_move_points ) {
|
||||
// selected brush verts
|
||||
qglPointSize( 5 );
|
||||
qglColor3f( 0,0,1 );
|
||||
// brush verts
|
||||
qglPointSize( 4 );
|
||||
qglColor3f( 0,1,0 );
|
||||
qglBegin( GL_POINTS );
|
||||
for ( i = 0; i < g_qeglobals.d_num_move_points; i++ )
|
||||
qglVertex3fv( g_qeglobals.d_move_points[i] );
|
||||
for ( i = 0 ; i < g_qeglobals.d_numpoints ; i++ )
|
||||
qglVertex3fv( g_qeglobals.d_points[i] );
|
||||
qglEnd();
|
||||
}
|
||||
|
||||
qglPointSize( 1 );
|
||||
}
|
||||
if ( g_qeglobals.d_num_move_points ) {
|
||||
// selected brush verts
|
||||
qglPointSize( 5 );
|
||||
qglColor3f( 0,0,1 );
|
||||
qglBegin( GL_POINTS );
|
||||
for ( i = 0; i < g_qeglobals.d_num_move_points; i++ )
|
||||
qglVertex3fv( g_qeglobals.d_move_points[i] );
|
||||
qglEnd();
|
||||
}
|
||||
|
||||
qglPointSize( 1 );
|
||||
}
|
||||
else if ( g_qeglobals.d_select_mode == sel_edge ) {
|
||||
float *v1, *v2;
|
||||
qglPointSize( 4 );
|
||||
|
|
|
@ -157,6 +157,10 @@
|
|||
#define Q3MAP2TEX_KEY "Q3Map2Tex"
|
||||
#define X64Q3MAP2_KEY "x64Q3Map2"
|
||||
|
||||
#ifdef ATIHACK_812
|
||||
#define ATIHACK_KEY "ATIHack"
|
||||
#endif
|
||||
|
||||
// window stuff
|
||||
#define ENTITYSPLIT1_KEY "EntitySplit1"
|
||||
#define ENTITYSPLIT2_KEY "EntitySplit2"
|
||||
|
@ -671,6 +675,9 @@ PrefsDlg::PrefsDlg (){
|
|||
#ifdef _WIN32
|
||||
m_bx64q3map2 = TRUE;
|
||||
#endif
|
||||
#ifdef ATIHACK_812
|
||||
m_bGlATIHack = FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1787,6 +1794,14 @@ void PrefsDlg::BuildDialog(){
|
|||
gtk_widget_show( check );
|
||||
AddDialogData( check, &m_bSizePaint, DLG_CHECK_BOOL );
|
||||
|
||||
#ifdef ATIHACK_812
|
||||
// ATI bugs
|
||||
check = gtk_check_button_new_with_label( _( "ATI and Intel cards w/ buggy drivers (disappearing polygons)" ) );
|
||||
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
|
||||
gtk_widget_show( check );
|
||||
AddDialogData( check, &m_bGlATIHack, DLG_CHECK_BOOL );
|
||||
#endif
|
||||
|
||||
// Add the page to the notebook
|
||||
page_index = gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), pageframe, preflabel );
|
||||
assert( page_index == PTAB_2D );
|
||||
|
@ -2893,6 +2908,31 @@ void PrefsDlg::UpdateTextureCompression(){
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ATIHACK_812
|
||||
void PrefsDlg::UpdateATIHack() {
|
||||
// if OpenGL is not ready yet, don't do anything
|
||||
if ( !g_qeglobals.m_bOpenGLReady ) {
|
||||
Sys_Printf( "OpenGL not ready - postpone ATI bug workaround setup\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_bGlATIHack ) {
|
||||
qglCullFace = &qglCullFace_ATIHack;
|
||||
qglDisable = &qglDisable_ATIHack;
|
||||
qglEnable = &qglEnable_ATIHack;
|
||||
qglPolygonMode = &qglPolygonMode_ATIHack;
|
||||
Sys_Printf( "ATI bug workaround enabled\n" );
|
||||
}
|
||||
else {
|
||||
qglCullFace = qglCullFace_real;
|
||||
qglDisable = qglDisable_real;
|
||||
qglEnable = qglEnable_real;
|
||||
qglPolygonMode = qglPolygonMode_real;
|
||||
Sys_Printf( "ATI bug workaround disabled\n" );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// TTimo: m_strEnginePath has a special status, if not found in registry we need to
|
||||
// initiliaze it for sure. It is not totally failsafe but we can use the same
|
||||
// code than in q3map, expecting to find some "quake" above us. If not, we prompt
|
||||
|
@ -3161,10 +3201,18 @@ void PrefsDlg::LoadPrefs(){
|
|||
mLocalPrefs.GetPref( X64Q3MAP2_KEY, &m_bx64q3map2, TRUE );
|
||||
#endif
|
||||
|
||||
#ifdef ATIHACK_812
|
||||
mLocalPrefs.GetPref( ATIHACK_KEY, &m_bGlATIHack, FALSE );
|
||||
#endif
|
||||
|
||||
Undo_SetMaxSize( m_nUndoLevels ); // set it internally as well / FIXME: why not just have one global value?
|
||||
|
||||
UpdateTextureCompression();
|
||||
|
||||
#ifdef ATIHACK_812
|
||||
UpdateATIHack();
|
||||
#endif
|
||||
|
||||
if ( mLocalPrefs.mbEmpty ) {
|
||||
mLocalPrefs.mbEmpty = false;
|
||||
Sys_Printf( "Saving local.pref with default pref values\n" );
|
||||
|
@ -3208,6 +3256,9 @@ void PrefsDlg::PostModal( int code ){
|
|||
SavePrefs();
|
||||
// make sure the logfile is ok
|
||||
Sys_LogFile();
|
||||
#ifdef ATIHACK_812
|
||||
UpdateATIHack();
|
||||
#endif
|
||||
if ( g_pParentWnd ) {
|
||||
g_pParentWnd->SetGridStatus();
|
||||
}
|
||||
|
|
126
radiant/qgl.c
126
radiant/qgl.c
|
@ -505,6 +505,13 @@ void ( APIENTRY * qgluLookAt )(
|
|||
GLdouble upz );
|
||||
const GLubyte* ( APIENTRY * qgluErrorString )(GLenum errCode );
|
||||
|
||||
#ifdef ATIHACK_812
|
||||
void ( APIENTRY * qglCullFace_real )( GLenum mode );
|
||||
void ( APIENTRY * qglDisable_real )( GLenum cap );
|
||||
void ( APIENTRY * qglEnable_real )( GLenum cap );
|
||||
void ( APIENTRY * qglPolygonMode_real )( GLenum face, GLenum mode );
|
||||
#endif
|
||||
|
||||
/*
|
||||
** QGL_Shutdown
|
||||
**
|
||||
|
@ -953,6 +960,13 @@ void QGL_Shutdown(){
|
|||
qgluPerspective = NULL;
|
||||
qgluErrorString = NULL;
|
||||
qgluLookAt = NULL;
|
||||
|
||||
#ifdef ATIHACK_812
|
||||
qglCullFace_real = NULL;
|
||||
qglDisable_real = NULL;
|
||||
qglEnable_real = NULL;
|
||||
qglPolygonMode_real = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1070,6 +1084,91 @@ const GLubyte* WINAPI gluErrorString( GLenum errCode ){
|
|||
return (GLubyte *) "Unknown error";
|
||||
}
|
||||
|
||||
#ifdef ATIHACK_812
|
||||
int ATIhack_culling;
|
||||
GLenum ATIhack_cullmode;
|
||||
GLenum ATIhack_backmode;
|
||||
GLenum ATIhack_frontmode;
|
||||
|
||||
static void ATIhack_update( void ){
|
||||
if ( !ATIhack_culling || ( GL_FRONT_AND_BACK == ATIhack_cullmode ) ) {
|
||||
qglPolygonMode_real( GL_FRONT, ATIhack_frontmode );
|
||||
qglPolygonMode_real( GL_BACK, ATIhack_backmode );
|
||||
}
|
||||
else{
|
||||
switch ( ATIhack_cullmode )
|
||||
{
|
||||
case GL_FRONT:
|
||||
qglPolygonMode_real( GL_FRONT_AND_BACK, ATIhack_backmode );
|
||||
break;
|
||||
case GL_BACK:
|
||||
qglPolygonMode_real( GL_FRONT_AND_BACK, ATIhack_frontmode );
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void APIENTRY qglEnable_ATIHack( GLenum cap ){
|
||||
qglEnable_real( cap );
|
||||
if ( GL_CULL_FACE != cap ) {
|
||||
return;
|
||||
}
|
||||
if ( ATIhack_culling ) {
|
||||
return;
|
||||
}
|
||||
ATIhack_culling = 1;
|
||||
ATIhack_update();
|
||||
}
|
||||
|
||||
void APIENTRY qglDisable_ATIHack( GLenum cap ){
|
||||
qglDisable_real( cap );
|
||||
if ( GL_CULL_FACE != cap ) {
|
||||
return;
|
||||
}
|
||||
if ( !ATIhack_culling ) {
|
||||
return;
|
||||
}
|
||||
ATIhack_culling = 0;
|
||||
ATIhack_update();
|
||||
}
|
||||
|
||||
void APIENTRY qglCullFace_ATIHack( GLenum mode ){
|
||||
if ( ATIhack_cullmode == mode ) {
|
||||
return;
|
||||
}
|
||||
qglCullFace_real( mode );
|
||||
ATIhack_cullmode = mode;
|
||||
ATIhack_update();
|
||||
}
|
||||
|
||||
void APIENTRY qglPolygonMode_ATIHack( GLenum face, GLenum mode ){
|
||||
switch ( face )
|
||||
{
|
||||
case GL_FRONT:
|
||||
if ( ATIhack_frontmode == mode ) {
|
||||
return;
|
||||
}
|
||||
ATIhack_frontmode = mode;
|
||||
break;
|
||||
case GL_BACK:
|
||||
if ( ATIhack_backmode == mode ) {
|
||||
return;
|
||||
}
|
||||
ATIhack_backmode = mode;
|
||||
break;
|
||||
case GL_FRONT_AND_BACK:
|
||||
if ( ( ATIhack_frontmode == mode ) && ( ATIhack_backmode == mode ) ) {
|
||||
return;
|
||||
}
|
||||
ATIhack_frontmode = ATIhack_backmode = mode;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ATIhack_update();
|
||||
}
|
||||
#endif
|
||||
|
||||
int QGL_Init( const char *dllname, const char* gluname ){
|
||||
#ifdef _WIN32
|
||||
g_hGLDLL = LoadLibrary( dllname );
|
||||
|
@ -1156,13 +1255,23 @@ int QGL_Init( const char *dllname, const char* gluname ){
|
|||
qglCopyTexImage2D = safe_dlsym( g_hGLDLL, "glCopyTexImage2D" );
|
||||
qglCopyTexSubImage1D = safe_dlsym( g_hGLDLL, "glCopyTexSubImage1D" );
|
||||
qglCopyTexSubImage2D = safe_dlsym( g_hGLDLL, "glCopyTexSubImage2D" );
|
||||
#ifdef ATIHACK_812
|
||||
qglCullFace_real = safe_dlsym( g_hGLDLL, "glCullFace" );
|
||||
qglCullFace = qglCullFace_real;
|
||||
#else
|
||||
qglCullFace = safe_dlsym( g_hGLDLL, "glCullFace" );
|
||||
#endif
|
||||
qglDeleteLists = safe_dlsym( g_hGLDLL, "glDeleteLists" );
|
||||
qglDeleteTextures = safe_dlsym( g_hGLDLL, "glDeleteTextures" );
|
||||
qglDepthFunc = safe_dlsym( g_hGLDLL, "glDepthFunc" );
|
||||
qglDepthMask = safe_dlsym( g_hGLDLL, "glDepthMask" );
|
||||
qglDepthRange = safe_dlsym( g_hGLDLL, "glDepthRange" );
|
||||
#ifdef ATIHACK_812
|
||||
qglDisable_real = safe_dlsym( g_hGLDLL, "glDisable" );
|
||||
qglDisable = qglDisable_real;
|
||||
#else
|
||||
qglDisable = safe_dlsym( g_hGLDLL, "glDisable" );
|
||||
#endif
|
||||
qglDisableClientState = safe_dlsym( g_hGLDLL, "glDisableClientState" );
|
||||
qglDrawArrays = safe_dlsym( g_hGLDLL, "glDrawArrays" );
|
||||
qglDrawBuffer = safe_dlsym( g_hGLDLL, "glDrawBuffer" );
|
||||
|
@ -1171,7 +1280,12 @@ int QGL_Init( const char *dllname, const char* gluname ){
|
|||
qglEdgeFlag = safe_dlsym( g_hGLDLL, "glEdgeFlag" );
|
||||
qglEdgeFlagPointer = safe_dlsym( g_hGLDLL, "glEdgeFlagPointer" );
|
||||
qglEdgeFlagv = safe_dlsym( g_hGLDLL, "glEdgeFlagv" );
|
||||
#ifdef ATIHACK_812
|
||||
qglEnable_real = safe_dlsym( g_hGLDLL, "glEnable" );
|
||||
qglEnable = qglEnable_real;
|
||||
#else
|
||||
qglEnable = safe_dlsym( g_hGLDLL, "glEnable" );
|
||||
#endif
|
||||
qglEnableClientState = safe_dlsym( g_hGLDLL, "glEnableClientState" );
|
||||
qglEnd = safe_dlsym( g_hGLDLL, "glEnd" );
|
||||
qglEndList = safe_dlsym( g_hGLDLL, "glEndList" );
|
||||
|
@ -1299,7 +1413,12 @@ int QGL_Init( const char *dllname, const char* gluname ){
|
|||
qglPixelTransferi = safe_dlsym( g_hGLDLL, "glPixelTransferi" );
|
||||
qglPixelZoom = safe_dlsym( g_hGLDLL, "glPixelZoom" );
|
||||
qglPointSize = safe_dlsym( g_hGLDLL, "glPointSize" );
|
||||
#ifdef ATIHACK_812
|
||||
qglPolygonMode_real = safe_dlsym( g_hGLDLL, "glPolygonMode" );
|
||||
qglPolygonMode = qglPolygonMode_real;
|
||||
#else
|
||||
qglPolygonMode = safe_dlsym( g_hGLDLL, "glPolygonMode" );
|
||||
#endif
|
||||
qglPolygonOffset = safe_dlsym( g_hGLDLL, "glPolygonOffset" );
|
||||
qglPolygonStipple = safe_dlsym( g_hGLDLL, "glPolygonStipple" );
|
||||
qglPopAttrib = safe_dlsym( g_hGLDLL, "glPopAttrib" );
|
||||
|
@ -1532,6 +1651,13 @@ int QGL_Init( const char *dllname, const char* gluname ){
|
|||
|
||||
Sys_Printf( "Done.\n" );
|
||||
|
||||
#ifdef ATIHACK_812
|
||||
ATIhack_culling = 0;
|
||||
ATIhack_cullmode = GL_BACK;
|
||||
ATIhack_backmode = GL_FILL;
|
||||
ATIhack_frontmode = GL_FILL;
|
||||
#endif
|
||||
|
||||
if ( init_error == 1 ) {
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue