Hash :
7c1cfd61
Author :
Date :
2014-10-15T14:59:57
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>
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// API_test.cpp:
// Some tests for the compiler API.
//
#include "angle_gl.h"
#include "gtest/gtest.h"
#include "GLSLANG/ShaderLang.h"
TEST(APITest, CompareShBuiltInResources)
{
ShBuiltInResources a_resources;
memset(&a_resources, 88, sizeof(a_resources));
ShInitBuiltInResources(&a_resources);
ShBuiltInResources b_resources;
memset(&b_resources, 77, sizeof(b_resources));
ShInitBuiltInResources(&b_resources);
EXPECT_TRUE(memcmp(&a_resources, &b_resources, sizeof(a_resources)) == 0);
}