Skip to content

Commit

Permalink
Attempt a simpler mesa bug workaround (#2433)
Browse files Browse the repository at this point in the history
  • Loading branch information
gwaldron committed Jan 24, 2024
1 parent 2925142 commit d0ac011
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
11 changes: 2 additions & 9 deletions src/osgEarthDrivers/engine_rex/RexEngine.ImageLayer.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
#pragma vp_location vertex_view
#pragma vp_order 0.4

#pragma import_defines(OE_MESA_23_WORKAROUND)
#ifdef OE_MESA_23_WORKAROUND
#define TILE_COORDS gl_MultiTexCoord0
#else
#define TILE_COORDS oe_layer_tilec
#endif

// Stage globals
vec4 oe_layer_tilec;
vec2 oe_layer_texc;
Expand All @@ -21,8 +14,8 @@ uniform mat4 oe_layer_texParentMatrix;
void oe_rex_imageLayer_VS(inout vec4 vertexView)
{
// calculate the texture coordinates:
oe_layer_texc = (oe_layer_texMatrix * TILE_COORDS).st;
oe_layer_texcParent = (oe_layer_texParentMatrix * TILE_COORDS).st;
oe_layer_texc = (oe_layer_texMatrix * oe_layer_tilec).st;
oe_layer_texcParent = (oe_layer_texParentMatrix * oe_layer_tilec).st;
}


Expand Down
7 changes: 6 additions & 1 deletion src/osgEarthDrivers/engine_rex/RexEngine.vert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ void oe_rex_init_model(inout vec4 vertexModel)
oe_layer_tilec = gl_MultiTexCoord0;

// Extract the vertex type marker
oe_terrain_vertexMarker = int(oe_layer_tilec.z);
//oe_terrain_vertexMarker = int(oe_layer_tilec.z);

// Doing this instead of the commented-out line above is a workaround
// for the Mesa driver bug described here:
// https://gitlab.freedesktop.org/mesa/mesa/-/issues/10482
oe_terrain_vertexMarker = int(gl_MultiTexCoord0.z);

// Color of the underlying map geometry (untextured)
vp_Color = oe_terrain_color;
Expand Down
2 changes: 2 additions & 0 deletions src/osgEarthDrivers/engine_rex/RexTerrainEngineNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ RexTerrainEngineNode::onSetMap()
_morphingSupported = false;
}

#if 0
// There is an (apparent) bug in the mesa 23.1.4 driver that causes display artifacts
// when doing morphing; this code will attempt to detect that condition and disable
// the offending code until we can find a workaround.
Expand All @@ -275,6 +276,7 @@ RexTerrainEngineNode::onSetMap()
getOrCreateStateSet()->setDefine("OE_MESA_23_WORKAROUND");
}
}
#endif

// morphing imagery LODs requires we bind parent textures to their own unit.
if (options.getMorphImagery() && _morphingSupported)
Expand Down

0 comments on commit d0ac011

Please sign in to comment.