diff --git a/src/osgEarthDrivers/engine_rex/RexEngine.ImageLayer.glsl b/src/osgEarthDrivers/engine_rex/RexEngine.ImageLayer.glsl index 6e952c1a85..ccd449badc 100644 --- a/src/osgEarthDrivers/engine_rex/RexEngine.ImageLayer.glsl +++ b/src/osgEarthDrivers/engine_rex/RexEngine.ImageLayer.glsl @@ -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; @@ -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; } diff --git a/src/osgEarthDrivers/engine_rex/RexEngine.vert.glsl b/src/osgEarthDrivers/engine_rex/RexEngine.vert.glsl index 06aca1787b..5a4222f505 100644 --- a/src/osgEarthDrivers/engine_rex/RexEngine.vert.glsl +++ b/src/osgEarthDrivers/engine_rex/RexEngine.vert.glsl @@ -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; diff --git a/src/osgEarthDrivers/engine_rex/RexTerrainEngineNode.cpp b/src/osgEarthDrivers/engine_rex/RexTerrainEngineNode.cpp index ae1c5f76f6..c596db5e6b 100644 --- a/src/osgEarthDrivers/engine_rex/RexTerrainEngineNode.cpp +++ b/src/osgEarthDrivers/engine_rex/RexTerrainEngineNode.cpp @@ -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. @@ -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)