| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "gpu/command_buffer/tests/gl_manager.h" | 12 #include "gpu/command_buffer/tests/gl_manager.h" |
| 13 #include "gpu/command_buffer/tests/gl_test_utils.h" | 13 #include "gpu/command_buffer/tests/gl_test_utils.h" |
| 14 #include "gpu/config/gpu_test_config.h" | 14 #include "gpu/config/gpu_test_config.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "ui/gl/gl_context.h" |
| 16 | 17 |
| 17 #define SHADER0(Src) #Src | 18 #define SHADER0(Src) #Src |
| 18 | 19 |
| 19 namespace gpu { | 20 namespace gpu { |
| 20 | 21 |
| 21 class EXTMultisampleCompatibilityTest : public testing::Test { | 22 class EXTMultisampleCompatibilityTest : public testing::Test { |
| 22 public: | 23 public: |
| 23 protected: | 24 protected: |
| 24 static const GLuint kWidth = 100; | 25 static const GLuint kWidth = 100; |
| 25 static const GLuint kHeight = 100; | 26 static const GLuint kHeight = 100; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 191 } |
| 191 | 192 |
| 192 TEST_F(EXTMultisampleCompatibilityTest, DrawAlphaOneAndResolve) { | 193 TEST_F(EXTMultisampleCompatibilityTest, DrawAlphaOneAndResolve) { |
| 193 // Test that enabling GL_SAMPLE_ALPHA_TO_ONE_EXT affects rendering. | 194 // Test that enabling GL_SAMPLE_ALPHA_TO_ONE_EXT affects rendering. |
| 194 if (!IsApplicable()) { | 195 if (!IsApplicable()) { |
| 195 return; | 196 return; |
| 196 } | 197 } |
| 197 | 198 |
| 198 #if defined(OS_ANDROID) | 199 #if defined(OS_ANDROID) |
| 199 // TODO: Figure out why this fails on NVIDIA Shield. crbug.com/700060. | 200 // TODO: Figure out why this fails on NVIDIA Shield. crbug.com/700060. |
| 200 std::string renderer(reinterpret_cast<const char*>(glGetString(GL_RENDERER))); | 201 std::string renderer(gl_.context()->GetGLRenderer()); |
| 201 std::string version(reinterpret_cast<const char*>(glGetString(GL_VERSION))); | 202 std::string version(gl_.context()->GetGLVersion()); |
| 202 if (renderer.find("NVIDIA Tegra") != std::string::npos && | 203 if (renderer.find("NVIDIA Tegra") != std::string::npos && |
| 203 version.find("OpenGL ES 3.2 NVIDIA 361.00") != std::string::npos) | 204 version.find("OpenGL ES 3.2 NVIDIA 361.00") != std::string::npos) |
| 204 return; | 205 return; |
| 205 #endif | 206 #endif |
| 206 | 207 |
| 207 // SAMPLE_ALPHA_TO_ONE is specified to transform alpha values of | 208 // SAMPLE_ALPHA_TO_ONE is specified to transform alpha values of |
| 208 // covered samples to 1.0. In order to detect it, we use non-1.0 | 209 // covered samples to 1.0. In order to detect it, we use non-1.0 |
| 209 // alpha. | 210 // alpha. |
| 210 static const float kBlue[] = {0.0f, 0.0f, 1.0f, 0.5f}; | 211 static const float kBlue[] = {0.0f, 0.0f, 1.0f, 0.5f}; |
| 211 static const float kGreen[] = {0.0f, 1.0f, 0.0f, 0.5f}; | 212 static const float kGreen[] = {0.0f, 1.0f, 0.0f, 0.5f}; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 glDisable(GL_SAMPLE_ALPHA_TO_ONE_EXT); | 246 glDisable(GL_SAMPLE_ALPHA_TO_ONE_EXT); |
| 246 } | 247 } |
| 247 } | 248 } |
| 248 EXPECT_NE(0, memcmp(results[0].get(), results[1].get(), kResultSize)); | 249 EXPECT_NE(0, memcmp(results[0].get(), results[1].get(), kResultSize)); |
| 249 // Verify that rendering is deterministic, so that the pass above does not | 250 // Verify that rendering is deterministic, so that the pass above does not |
| 250 // come from non-deterministic rendering. | 251 // come from non-deterministic rendering. |
| 251 EXPECT_EQ(0, memcmp(results[0].get(), results[2].get(), kResultSize)); | 252 EXPECT_EQ(0, memcmp(results[0].get(), results[2].get(), kResultSize)); |
| 252 } | 253 } |
| 253 | 254 |
| 254 } // namespace gpu | 255 } // namespace gpu |
| OLD | NEW |