better workaround for Intel GPU crash for glDrawBuffer on Linux
fix a linux build issue
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
#define RAGDOLL_DEMO_H
|
#define RAGDOLL_DEMO_H
|
||||||
|
|
||||||
|
|
||||||
#include "../../Demos/CommonRigidBodySetup.h"
|
#include "../../../Demos/CommonRigidBodySetup.h"
|
||||||
#include "../BasicDemo/BasicDemo.h"
|
#include "../BasicDemo/BasicDemo.h"
|
||||||
|
|
||||||
struct BulletDemoInterface;
|
struct BulletDemoInterface;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
///See http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/
|
///See http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/
|
||||||
|
|
||||||
|
bool gIntelLinuxglDrawBufferWorkaround=false;
|
||||||
|
|
||||||
#include "GLRenderToTexture.h"
|
#include "GLRenderToTexture.h"
|
||||||
#include "Bullet3Common/b3Scalar.h" // for b3Assert
|
#include "Bullet3Common/b3Scalar.h" // for b3Assert
|
||||||
GLRenderToTexture::GLRenderToTexture()
|
GLRenderToTexture::GLRenderToTexture()
|
||||||
@@ -66,9 +68,16 @@ bool GLRenderToTexture::enable()
|
|||||||
}
|
}
|
||||||
case RENDERTEXTURE_DEPTH:
|
case RENDERTEXTURE_DEPTH:
|
||||||
{
|
{
|
||||||
GLenum drawBuffers[2] = { GL_COLOR_ATTACHMENT0, 0 };// GL_DEPTH_ATTACHMENT, 0};
|
//Intel OpenGL driver crashes when using GL_NONE for glDrawBuffer on Linux, so use a workaround
|
||||||
|
if (gIntelLinuxglDrawBufferWorkaround)
|
||||||
|
{
|
||||||
|
GLenum drawBuffers[2] = { GL_DEPTH_ATTACHMENT,0};
|
||||||
glDrawBuffers(1, drawBuffers);
|
glDrawBuffers(1, drawBuffers);
|
||||||
// glDrawBuffer(GL_NONE);
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
glDrawBuffer(GL_NONE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
extern bool gIntelLinuxglDrawBufferWorkaround;
|
||||||
|
|
||||||
GLint att[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER, None };
|
GLint att[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER, None };
|
||||||
static bool forceOpenGL3 = true;
|
static bool forceOpenGL3 = true;
|
||||||
@@ -233,6 +234,12 @@ void X11OpenGLWindow::enableOpenGL()
|
|||||||
}
|
}
|
||||||
const GLubyte* ven = glGetString(GL_VENDOR);
|
const GLubyte* ven = glGetString(GL_VENDOR);
|
||||||
printf("GL_VENDOR=%s\n", ven);
|
printf("GL_VENDOR=%s\n", ven);
|
||||||
|
|
||||||
|
if (strncmp((const char*)ven,"Intel",5)==0)
|
||||||
|
{
|
||||||
|
printf("Workaround for some crash in the Intel OpenGL driver on Linux/Ubuntu\n");
|
||||||
|
gIntelLinuxglDrawBufferWorkaround=true;
|
||||||
|
}
|
||||||
const GLubyte* ren = glGetString(GL_RENDERER);
|
const GLubyte* ren = glGetString(GL_RENDERER);
|
||||||
printf("GL_RENDERER=%s\n",ren);
|
printf("GL_RENDERER=%s\n",ren);
|
||||||
const GLubyte* ver = glGetString(GL_VERSION);
|
const GLubyte* ver = glGetString(GL_VERSION);
|
||||||
|
|||||||
Reference in New Issue
Block a user