Merge pull request #1083 from BeamNG/opengl_intel_WIP

Fix/walkaround for OpenGL on Intel
This commit is contained in:
Luis Anton Rebollo 2014-12-27 01:13:14 +01:00
commit 9eb05b2bdc
7 changed files with 42 additions and 9 deletions

View file

@ -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) ) );
}
/*

View file

@ -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;

View file

@ -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.

View file

@ -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) ) );
}
/*

View file

@ -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;

View file

@ -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.