OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
6 | 6 |
7 #include "gpu/command_buffer/service/shader_translator_cache.h" | 7 #include "gpu/command_buffer/service/shader_translator_cache.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace gpu { | 10 namespace gpu { |
(...skipping 12 matching lines...) Expand all Loading... |
23 ShInitBuiltInResources(&b_resources); | 23 ShInitBuiltInResources(&b_resources); |
24 | 24 |
25 EXPECT_TRUE(memcmp(&a_resources, &b_resources, sizeof(a_resources)) == 0); | 25 EXPECT_TRUE(memcmp(&a_resources, &b_resources, sizeof(a_resources)) == 0); |
26 | 26 |
27 ShCompileOptions driver_bug_workarounds = SH_VALIDATE; | 27 ShCompileOptions driver_bug_workarounds = SH_VALIDATE; |
28 | 28 |
29 char a_storage[sizeof(ShaderTranslatorCache::ShaderTranslatorInitParams)]; | 29 char a_storage[sizeof(ShaderTranslatorCache::ShaderTranslatorInitParams)]; |
30 memset(a_storage, 55, sizeof(a_storage)); | 30 memset(a_storage, 55, sizeof(a_storage)); |
31 ShaderTranslatorCache::ShaderTranslatorInitParams* a = | 31 ShaderTranslatorCache::ShaderTranslatorInitParams* a = |
32 new (&a_storage) ShaderTranslatorCache::ShaderTranslatorInitParams( | 32 new (&a_storage) ShaderTranslatorCache::ShaderTranslatorInitParams( |
33 GL_VERTEX_SHADER, | 33 GL_VERTEX_SHADER, SH_GLES2_SPEC, a_resources, SH_ESSL_OUTPUT, |
34 SH_GLES2_SPEC, | |
35 a_resources, | |
36 ShaderTranslatorInterface::kGlslES, | |
37 driver_bug_workarounds); | 34 driver_bug_workarounds); |
38 | 35 |
39 ShaderTranslatorCache::ShaderTranslatorInitParams b( | 36 ShaderTranslatorCache::ShaderTranslatorInitParams b( |
40 GL_VERTEX_SHADER, | 37 GL_VERTEX_SHADER, SH_GLES2_SPEC, b_resources, SH_ESSL_OUTPUT, |
41 SH_GLES2_SPEC, | |
42 b_resources, | |
43 ShaderTranslatorInterface::kGlslES, | |
44 driver_bug_workarounds); | 38 driver_bug_workarounds); |
45 | 39 |
46 EXPECT_TRUE(*a == b); | 40 EXPECT_TRUE(*a == b); |
47 EXPECT_FALSE(*a < b || b < *a); | 41 EXPECT_FALSE(*a < b || b < *a); |
48 | 42 |
49 memset(a_storage, 55, sizeof(a_storage)); | 43 memset(a_storage, 55, sizeof(a_storage)); |
50 a = new (&a_storage) ShaderTranslatorCache::ShaderTranslatorInitParams(b); | 44 a = new (&a_storage) ShaderTranslatorCache::ShaderTranslatorInitParams(b); |
51 | 45 |
52 EXPECT_TRUE(*a == b); | 46 EXPECT_TRUE(*a == b); |
53 EXPECT_FALSE(*a < b || b < *a); | 47 EXPECT_FALSE(*a < b || b < *a); |
54 } | 48 } |
55 } // namespace gles2 | 49 } // namespace gles2 |
56 } // namespace gpu | 50 } // namespace gpu |
OLD | NEW |