| OLD | NEW |
| 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 #include <stdint.h> |
| 9 | 9 |
| 10 #include "gpu/command_buffer/tests/gl_manager.h" | 10 #include "gpu/command_buffer/tests/gl_manager.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 0.0f, 0.0f, 0.75f, 0.0f, | 88 0.0f, 0.0f, 0.75f, 0.0f, |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 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); |
| 92 glUniform4fv(color_b_location, 2, color_b); | 92 glUniform4fv(color_b_location, 2, color_b); |
| 93 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); |
| 94 | 94 |
| 95 glDrawArrays(GL_TRIANGLES, 0, 6); | 95 glDrawArrays(GL_TRIANGLES, 0, 6); |
| 96 | 96 |
| 97 static const uint8_t expected[] = {64, 128, 192, 255}; | 97 static const uint8_t expected[] = {64, 128, 192, 255}; |
| 98 EXPECT_TRUE( | 98 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, kResolution, kResolution, 1, |
| 99 GLTestHelper::CheckPixels(0, 0, kResolution, kResolution, 1, expected)); | 99 expected, nullptr)); |
| 100 | 100 |
| 101 GLTestHelper::CheckGLError("no errors", __LINE__); | 101 GLTestHelper::CheckGLError("no errors", __LINE__); |
| 102 } | 102 } |
| 103 | 103 |
| 104 TEST_P(BindUniformLocationTest, ConflictsDetection) { | 104 TEST_P(BindUniformLocationTest, ConflictsDetection) { |
| 105 ASSERT_TRUE( | 105 ASSERT_TRUE( |
| 106 GLTestHelper::HasExtension("GL_CHROMIUM_bind_uniform_location")); | 106 GLTestHelper::HasExtension("GL_CHROMIUM_bind_uniform_location")); |
| 107 | 107 |
| 108 static const char* v_shader_str = SHADER( | 108 static const char* v_shader_str = SHADER( |
| 109 attribute vec4 a_position; | 109 attribute vec4 a_position; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 glUniformMatrix4fv(matrix_location, 1, false, identity); | 255 glUniformMatrix4fv(matrix_location, 1, false, identity); |
| 256 glUniform2fv(color_a_location, 4, color_a); | 256 glUniform2fv(color_a_location, 4, color_a); |
| 257 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); |
| 258 glUniform1f(alpha_location, 0.8f); | 258 glUniform1f(alpha_location, 0.8f); |
| 259 glUniform4f(multiplier_location, 0.5f, 0.5f, 0.5f, 0.5f); | 259 glUniform4f(multiplier_location, 0.5f, 0.5f, 0.5f, 0.5f); |
| 260 glUniform3fv(color_c_location, 8, color_c); | 260 glUniform3fv(color_c_location, 8, color_c); |
| 261 | 261 |
| 262 glDrawArrays(GL_TRIANGLES, 0, 6); | 262 glDrawArrays(GL_TRIANGLES, 0, 6); |
| 263 | 263 |
| 264 static const uint8_t expected[] = {204, 204, 204, 204}; | 264 static const uint8_t expected[] = {204, 204, 204, 204}; |
| 265 EXPECT_TRUE( | 265 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, kResolution, kResolution, 1, |
| 266 GLTestHelper::CheckPixels(0, 0, kResolution, kResolution, 1, expected)); | 266 expected, nullptr)); |
| 267 | 267 |
| 268 GLTestHelper::CheckGLError("no errors", __LINE__); | 268 GLTestHelper::CheckGLError("no errors", __LINE__); |
| 269 | 269 |
| 270 } | 270 } |
| 271 | 271 |
| 272 TEST_P(BindUniformLocationTest, UnusedUniformUpdate) { | 272 TEST_P(BindUniformLocationTest, UnusedUniformUpdate) { |
| 273 ASSERT_TRUE(GLTestHelper::HasExtension("GL_CHROMIUM_bind_uniform_location")); | 273 ASSERT_TRUE(GLTestHelper::HasExtension("GL_CHROMIUM_bind_uniform_location")); |
| 274 | 274 |
| 275 // clang-format off | 275 // clang-format off |
| 276 static const char* kVertexShaderString = SHADER( | 276 static const char* kVertexShaderString = SHADER( |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 } | 403 } |
| 404 | 404 |
| 405 INSTANTIATE_TEST_CASE_P(WithAndWithoutShaderNameMapping, | 405 INSTANTIATE_TEST_CASE_P(WithAndWithoutShaderNameMapping, |
| 406 BindUniformLocationTest, | 406 BindUniformLocationTest, |
| 407 ::testing::Bool()); | 407 ::testing::Bool()); |
| 408 | 408 |
| 409 } // namespace gpu | 409 } // namespace gpu |
| 410 | 410 |
| 411 | 411 |
| 412 | 412 |
| OLD | NEW |