| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <stdint.h> |
| 6 | 7 |
| 7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 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 "gpu/config/gpu_switches.h" | 12 #include "gpu/config/gpu_switches.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 14 |
| 14 namespace gpu { | 15 namespace gpu { |
| 15 | 16 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 glGenFramebuffers(1, &framebuffer_id_); | 53 glGenFramebuffers(1, &framebuffer_id_); |
| 53 } | 54 } |
| 54 | 55 |
| 55 void TearDown() override { | 56 void TearDown() override { |
| 56 glDeleteTextures(1, &texture_); | 57 glDeleteTextures(1, &texture_); |
| 57 glDeleteFramebuffers(1, &framebuffer_id_); | 58 glDeleteFramebuffers(1, &framebuffer_id_); |
| 58 gl_.Destroy(); | 59 gl_.Destroy(); |
| 59 } | 60 } |
| 60 | 61 |
| 61 GLManager gl_; | 62 GLManager gl_; |
| 62 uint8 pixels_[256 * 4]; | 63 uint8_t pixels_[256 * 4]; |
| 63 const int width_ = 16; | 64 const int width_ = 16; |
| 64 GLuint texture_; | 65 GLuint texture_; |
| 65 GLuint framebuffer_id_; | 66 GLuint framebuffer_id_; |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 INSTANTIATE_TEST_CASE_P(GLCubeMapTextureTests, | 69 INSTANTIATE_TEST_CASE_P(GLCubeMapTextureTests, |
| 69 GLCubeMapTextureTest, | 70 GLCubeMapTextureTest, |
| 70 ::testing::ValuesIn(kCubeMapTextureTargets)); | 71 ::testing::ValuesIn(kCubeMapTextureTargets)); |
| 71 | 72 |
| 72 TEST_P(GLCubeMapTextureTest, TexImage2DAfterFBOBinding) { | 73 TEST_P(GLCubeMapTextureTest, TexImage2DAfterFBOBinding) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); | 132 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
| 132 | 133 |
| 133 // Check that FB is complete. | 134 // Check that FB is complete. |
| 134 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 135 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 135 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 136 glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
| 136 #if defined(OS_ANDROID) | 137 #if defined(OS_ANDROID) |
| 137 // No way to workaround on Android NVIDIA drivers. Users have to texImage2D | 138 // No way to workaround on Android NVIDIA drivers. Users have to texImage2D |
| 138 // by (POSITIVE_X, NEGATIVE_Z) order only once. If users call texImage2D again | 139 // by (POSITIVE_X, NEGATIVE_Z) order only once. If users call texImage2D again |
| 139 // after defining all faces, glReadPixels fails. | 140 // after defining all faces, glReadPixels fails. |
| 140 GLsizei size = width_ * width_ * 4; | 141 GLsizei size = width_ * width_ * 4; |
| 141 scoped_ptr<uint8[]> pixels(new uint8[size]); | 142 scoped_ptr<uint8_t[]> pixels(new uint8_t[size]); |
| 142 glReadPixels(0, 0, width_, width_, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get()); | 143 glReadPixels(0, 0, width_, width_, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get()); |
| 143 #else | 144 #else |
| 144 // Without force_cube_complete workaround, | 145 // Without force_cube_complete workaround, |
| 145 // 1. ANGLE crashes on glReadPixels() from incomplete cube texture. | 146 // 1. ANGLE crashes on glReadPixels() from incomplete cube texture. |
| 146 // 2. NVidia fails on glReadPixels() from incomplete cube texture. | 147 // 2. NVidia fails on glReadPixels() from incomplete cube texture. |
| 147 GLTestHelper::CheckPixels(0, 0, width_, width_, 0, pixels_); | 148 GLTestHelper::CheckPixels(0, 0, width_, width_, 0, pixels_); |
| 148 #endif | 149 #endif |
| 149 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); | 150 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
| 150 } | 151 } |
| 151 | 152 |
| 152 } // namespace gpu | 153 } // namespace gpu |
| OLD | NEW |