From 5c047bc12854afd53d5918299c13d517a239b928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 6 Oct 2024 17:00:11 +0200 Subject: [PATCH] Shaders: work around a bogus shader compilation warning on NVidia. --- src/Magnum/Shaders/MeshVisualizer.geom | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Magnum/Shaders/MeshVisualizer.geom b/src/Magnum/Shaders/MeshVisualizer.geom index 4ac993909..8aaa156b4 100644 --- a/src/Magnum/Shaders/MeshVisualizer.geom +++ b/src/Magnum/Shaders/MeshVisualizer.geom @@ -377,6 +377,12 @@ void main() { /* If wireframe is enabled, add distance to opposite side to each vertex. Otherwise make all distances the same to avoid any lines being drawn. Propagate also mapped vertex ID, since that changes per-vertex also. */ + #if defined(VERTEX_ID) && defined(__GLSL_CG_DATA_TYPES) + /* Without this, NVidia says "warning C7050: "interpolatedMappedVertexId" + might be used before being initialized". Interestingly enough, it + doesn't say that for interpolatedTextureCoordinates. */ + interpolatedMappedVertexId = 0.0; + #endif for(int i = 0; i != 3; ++i) { dist = vec3(0.0, 0.0, 0.0); #ifdef WIREFRAME_RENDERING