Make ShBuiltInResources comparable with memcmp
Chromium builds a std::map with ShBuiltInResources as part of the key.
Comparator for == and < are needed for the map implementation.
Currently Chromium uses memcmp as the comparator. Padding
in ShBuiltInResources causes uninitialized reads.
Fix this by clearing the padding with memset during ShBuiltInResources
initialization.
Change-Id: I78aa3c59ce165503831aa2a67c96cf8af316c152
Reviewed-on: https://chromium-review.googlesource.com/223431
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Shannon Woods <shannonwoods@chromium.org>
diff --git a/src/compiler/translator/ShaderLang.cpp b/src/compiler/translator/ShaderLang.cpp
index e0ed5f5..144ef90 100644
--- a/src/compiler/translator/ShaderLang.cpp
+++ b/src/compiler/translator/ShaderLang.cpp
@@ -183,6 +183,9 @@
//
void ShInitBuiltInResources(ShBuiltInResources* resources)
{
+ // Make comparable.
+ memset(resources, 0, sizeof(*resources));
+
// Constants.
resources->MaxVertexAttribs = 8;
resources->MaxVertexUniformVectors = 128;