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

Side by Side Diff: gpu/command_buffer/tests/gl_bind_uniform_location_unittest.cc

Issue 1542513002: Switch to standard integer types in gpu/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <GLES2/gl2ext.h> 6 #include <GLES2/gl2ext.h>
7 #include <GLES2/gl2extchromium.h> 7 #include <GLES2/gl2extchromium.h>
8 #include <stdint.h>
8 9
9 #include "gpu/command_buffer/tests/gl_manager.h" 10 #include "gpu/command_buffer/tests/gl_manager.h"
10 #include "gpu/command_buffer/tests/gl_test_utils.h" 11 #include "gpu/command_buffer/tests/gl_test_utils.h"
11 #include "testing/gmock/include/gmock/gmock.h" 12 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 #define SHADER(Src) #Src 15 #define SHADER(Src) #Src
15 16
16 namespace gpu { 17 namespace gpu {
17 18
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 0.0f, 0.50f, 0.0f, 0.0f, 87 0.0f, 0.50f, 0.0f, 0.0f,
87 0.0f, 0.0f, 0.75f, 0.0f, 88 0.0f, 0.0f, 0.75f, 0.0f,
88 }; 89 };
89 90
90 glUniform4f(color_a_location, 0.25f, 0.0f, 0.0f, 0.0f); 91 glUniform4f(color_a_location, 0.25f, 0.0f, 0.0f, 0.0f);
91 glUniform4fv(color_b_location, 2, color_b); 92 glUniform4fv(color_b_location, 2, color_b);
92 glUniform4f(color_c_location, 0.0f, 0.0f, 0.0f, 1.0f); 93 glUniform4f(color_c_location, 0.0f, 0.0f, 0.0f, 1.0f);
93 94
94 glDrawArrays(GL_TRIANGLES, 0, 6); 95 glDrawArrays(GL_TRIANGLES, 0, 6);
95 96
96 static const uint8 expected[] = { 64, 128, 192, 255 }; 97 static const uint8_t expected[] = {64, 128, 192, 255};
97 EXPECT_TRUE( 98 EXPECT_TRUE(
98 GLTestHelper::CheckPixels(0, 0, kResolution, kResolution, 1, expected)); 99 GLTestHelper::CheckPixels(0, 0, kResolution, kResolution, 1, expected));
99 100
100 GLTestHelper::CheckGLError("no errors", __LINE__); 101 GLTestHelper::CheckGLError("no errors", __LINE__);
101 } 102 }
102 103
103 TEST_P(BindUniformLocationTest, ConflictsDetection) { 104 TEST_P(BindUniformLocationTest, ConflictsDetection) {
104 ASSERT_TRUE( 105 ASSERT_TRUE(
105 GLTestHelper::HasExtension("GL_CHROMIUM_bind_uniform_location")); 106 GLTestHelper::HasExtension("GL_CHROMIUM_bind_uniform_location"));
106 107
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 254
254 glUniformMatrix4fv(matrix_location, 1, false, identity); 255 glUniformMatrix4fv(matrix_location, 1, false, identity);
255 glUniform2fv(color_a_location, 4, color_a); 256 glUniform2fv(color_a_location, 4, color_a);
256 glUniform4f(color_b_location, 0.2f, 0.2f, 0.2f, 0.2f); 257 glUniform4f(color_b_location, 0.2f, 0.2f, 0.2f, 0.2f);
257 glUniform1f(alpha_location, 0.8f); 258 glUniform1f(alpha_location, 0.8f);
258 glUniform4f(multiplier_location, 0.5f, 0.5f, 0.5f, 0.5f); 259 glUniform4f(multiplier_location, 0.5f, 0.5f, 0.5f, 0.5f);
259 glUniform3fv(color_c_location, 8, color_c); 260 glUniform3fv(color_c_location, 8, color_c);
260 261
261 glDrawArrays(GL_TRIANGLES, 0, 6); 262 glDrawArrays(GL_TRIANGLES, 0, 6);
262 263
263 static const uint8 expected[] = { 204, 204, 204, 204 }; 264 static const uint8_t expected[] = {204, 204, 204, 204};
264 EXPECT_TRUE( 265 EXPECT_TRUE(
265 GLTestHelper::CheckPixels(0, 0, kResolution, kResolution, 1, expected)); 266 GLTestHelper::CheckPixels(0, 0, kResolution, kResolution, 1, expected));
266 267
267 GLTestHelper::CheckGLError("no errors", __LINE__); 268 GLTestHelper::CheckGLError("no errors", __LINE__);
268 269
269 } 270 }
270 271
271 TEST_P(BindUniformLocationTest, UnusedUniformUpdate) { 272 TEST_P(BindUniformLocationTest, UnusedUniformUpdate) {
272 ASSERT_TRUE(GLTestHelper::HasExtension("GL_CHROMIUM_bind_uniform_location")); 273 ASSERT_TRUE(GLTestHelper::HasExtension("GL_CHROMIUM_bind_uniform_location"));
273 274
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 362 }
362 363
363 INSTANTIATE_TEST_CASE_P(WithAndWithoutShaderNameMapping, 364 INSTANTIATE_TEST_CASE_P(WithAndWithoutShaderNameMapping,
364 BindUniformLocationTest, 365 BindUniformLocationTest,
365 ::testing::Bool()); 366 ::testing::Bool());
366 367
367 } // namespace gpu 368 } // namespace gpu
368 369
369 370
370 371
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698