Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simpler mesa 22.1.x bug workaround #2433

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading