Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1225)

Unified Diff: gpu/command_buffer/service/shader_translator_cache_unittest.cc

Issue 723343002: Update from https://crrev.com/304121 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/shader_translator_cache_unittest.cc
diff --git a/gpu/command_buffer/service/shader_translator_cache_unittest.cc b/gpu/command_buffer/service/shader_translator_cache_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c5233e510e8351a54ae36d65f97a07345cea8429
--- /dev/null
+++ b/gpu/command_buffer/service/shader_translator_cache_unittest.cc
@@ -0,0 +1,56 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <GLES2/gl2.h>
+
+#include "gpu/command_buffer/service/shader_translator_cache.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace gpu {
+namespace gles2 {
+
+TEST(ShaderTranslatorCacheTest, InitParamComparable) {
+ // Tests that ShaderTranslatorInitParams padding or padding of its
+ // members does not affect the object equality or ordering.
+
+ 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);
+
+ ShCompileOptions driver_bug_workarounds = SH_VALIDATE;
+
+ char a_storage[sizeof(ShaderTranslatorCache::ShaderTranslatorInitParams)];
+ memset(a_storage, 55, sizeof(a_storage));
+ ShaderTranslatorCache::ShaderTranslatorInitParams* a =
+ new (&a_storage) ShaderTranslatorCache::ShaderTranslatorInitParams(
+ GL_VERTEX_SHADER,
+ SH_GLES2_SPEC,
+ a_resources,
+ ShaderTranslatorInterface::kGlslES,
+ driver_bug_workarounds);
+
+ ShaderTranslatorCache::ShaderTranslatorInitParams b(
+ GL_VERTEX_SHADER,
+ SH_GLES2_SPEC,
+ b_resources,
+ ShaderTranslatorInterface::kGlslES,
+ driver_bug_workarounds);
+
+ EXPECT_TRUE(*a == b);
+ EXPECT_FALSE(*a < b || b < *a);
+
+ memset(a_storage, 55, sizeof(a_storage));
+ a = new (&a_storage) ShaderTranslatorCache::ShaderTranslatorInitParams(b);
+
+ EXPECT_TRUE(*a == b);
+ EXPECT_FALSE(*a < b || b < *a);
+}
+} // namespace gles2
+} // namespace gpu
« no previous file with comments | « gpu/command_buffer/service/shader_translator_cache.h ('k') | gpu/command_buffer/service/valuebuffer_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698