mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
Merge pull request #1083 from BeamNG/opengl_intel_WIP
Fix/walkaround for OpenGL on Intel
This commit is contained in:
commit
9eb05b2bdc
|
|
@ -98,6 +98,27 @@ void STDCALL glAmdDebugCallback(GLuint id, GLenum category, GLenum severity, GLs
|
|||
Con::errorf("OPENGL: %s",message);
|
||||
}
|
||||
|
||||
|
||||
// >>>> OPENGL INTEL WORKAROUND @todo OPENGL INTEL remove
|
||||
PFNGLBINDFRAMEBUFFERPROC __openglBindFramebuffer = NULL;
|
||||
|
||||
void STDCALL _t3d_glBindFramebuffer(GLenum target, GLuint framebuffer)
|
||||
{
|
||||
if( target == GL_FRAMEBUFFER )
|
||||
{
|
||||
if( GFXGL->getOpenglCache()->getCacheBinded( GL_DRAW_FRAMEBUFFER ) == framebuffer
|
||||
&& GFXGL->getOpenglCache()->getCacheBinded( GL_READ_FRAMEBUFFER ) == framebuffer )
|
||||
return;
|
||||
}
|
||||
else if( GFXGL->getOpenglCache()->getCacheBinded( target ) == framebuffer )
|
||||
return;
|
||||
|
||||
__openglBindFramebuffer(target, framebuffer);
|
||||
GFXGL->getOpenglCache()->setCacheBinded( target, framebuffer);
|
||||
}
|
||||
// <<<< OPENGL INTEL WORKAROUND
|
||||
|
||||
|
||||
void GFXGLDevice::initGLState()
|
||||
{
|
||||
// We don't currently need to sync device state with a known good place because we are
|
||||
|
|
@ -120,9 +141,17 @@ void GFXGLDevice::initGLState()
|
|||
mSupportsAnisotropic = mCardProfiler->queryProfile( "GL::suppAnisotropic" );
|
||||
|
||||
String vendorStr = (const char*)glGetString( GL_VENDOR );
|
||||
if( vendorStr.find("NVIDIA") != String::NPos)
|
||||
if( vendorStr.find("NVIDIA", 0, String::NoCase | String::Left) != String::NPos)
|
||||
mUseGlMap = false;
|
||||
|
||||
|
||||
if( vendorStr.find("INTEL", 0, String::NoCase | String::Left ) != String::NPos)
|
||||
{
|
||||
// @todo OPENGL INTEL - This is a workaround for a warning spam or even crashes with actual framebuffer code, remove when implemented TGL layer.
|
||||
__openglBindFramebuffer = glBindFramebuffer;
|
||||
glBindFramebuffer = &_t3d_glBindFramebuffer;
|
||||
}
|
||||
|
||||
#if TORQUE_DEBUG
|
||||
if( gglHasExtension(ARB_debug_output) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -84,13 +84,16 @@ void main()
|
|||
// The CoC will be 1 if the depth is negative, so use "min" to pick
|
||||
// between "sceneCoc" and "viewCoc".
|
||||
|
||||
coc = half4(0);
|
||||
for ( int i = 0; i < 4; i++ )
|
||||
{
|
||||
depth[0] = prepassUncondition( depthSampler, ( IN_tcDepth0.xy + rowOfs[i] ) ).w;
|
||||
depth[1] = prepassUncondition( depthSampler, ( IN_tcDepth1.xy + rowOfs[i] ) ).w;
|
||||
depth[2] = prepassUncondition( depthSampler, ( IN_tcDepth2.xy + rowOfs[i] ) ).w;
|
||||
depth[3] = prepassUncondition( depthSampler, ( IN_tcDepth3.xy + rowOfs[i] ) ).w;
|
||||
coc[i] = clamp( dofEqWorld.x * depth + dofEqWorld.y, 0.0, maxWorldCoC );
|
||||
|
||||
// @todo OPENGL INTEL need review
|
||||
coc = max( coc, clamp( half4(dofEqWorld.x) * depth + half4(dofEqWorld.y), half4(0.0), half4(maxWorldCoC) ) );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void main()
|
|||
{
|
||||
vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ) * 0.5f;
|
||||
|
||||
vec4 OUT_col = vec4(0);
|
||||
OUT_col = vec4(0);
|
||||
OUT_col += texture( diffuseMap, uv0 ) * kernel.x;
|
||||
OUT_col += texture( diffuseMap, uv1 ) * kernel.y;
|
||||
OUT_col += texture( diffuseMap, uv2 ) * kernel.z;
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ float calcBlend( float texId, vec2 layerCoord, float layerSize, vec4 layerSample
|
|||
// match the current texture id.
|
||||
vec4 factors = vec4(0);
|
||||
for(int i = 0; i < 4; i++)
|
||||
if(layerSample[i] == texId)
|
||||
factors[i] = 1;
|
||||
factors[i] = (layerSample[i] == texId) ? 1 : 0; // workaround for Intel
|
||||
|
||||
// This is a custom bilinear filter.
|
||||
|
||||
|
|
|
|||
|
|
@ -84,13 +84,16 @@ void main()
|
|||
// The CoC will be 1 if the depth is negative, so use "min" to pick
|
||||
// between "sceneCoc" and "viewCoc".
|
||||
|
||||
coc = half4(0);
|
||||
for ( int i = 0; i < 4; i++ )
|
||||
{
|
||||
depth[0] = prepassUncondition( depthSampler, ( IN_tcDepth0.xy + rowOfs[i] ) ).w;
|
||||
depth[1] = prepassUncondition( depthSampler, ( IN_tcDepth1.xy + rowOfs[i] ) ).w;
|
||||
depth[2] = prepassUncondition( depthSampler, ( IN_tcDepth2.xy + rowOfs[i] ) ).w;
|
||||
depth[3] = prepassUncondition( depthSampler, ( IN_tcDepth3.xy + rowOfs[i] ) ).w;
|
||||
coc[i] = clamp( dofEqWorld.x * depth + dofEqWorld.y, 0.0, maxWorldCoC );
|
||||
|
||||
// @todo OPENGL INTEL need review
|
||||
coc = max( coc, clamp( half4(dofEqWorld.x) * depth + half4(dofEqWorld.y), half4(0.0), half4(maxWorldCoC) ) );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void main()
|
|||
{
|
||||
vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ) * 0.5f;
|
||||
|
||||
vec4 OUT_col = vec4(0);
|
||||
OUT_col = vec4(0);
|
||||
OUT_col += texture( diffuseMap, uv0 ) * kernel.x;
|
||||
OUT_col += texture( diffuseMap, uv1 ) * kernel.y;
|
||||
OUT_col += texture( diffuseMap, uv2 ) * kernel.z;
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ float calcBlend( float texId, vec2 layerCoord, float layerSize, vec4 layerSample
|
|||
// match the current texture id.
|
||||
vec4 factors = vec4(0);
|
||||
for(int i = 0; i < 4; i++)
|
||||
if(layerSample[i] == texId)
|
||||
factors[i] = 1;
|
||||
factors[i] = (layerSample[i] == texId) ? 1 : 0; // workaround for Intel
|
||||
|
||||
// This is a custom bilinear filter.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue