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 #include <stdint.h> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "gpu/command_buffer/tests/gl_manager.h" | 10 #include "gpu/command_buffer/tests/gl_manager.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 // A collection of tests that exercise the cube map texture. | 25 // A collection of tests that exercise the cube map texture. |
26 class GLCubeMapTextureTest : public testing::TestWithParam<GLenum> { | 26 class GLCubeMapTextureTest : public testing::TestWithParam<GLenum> { |
27 protected: | 27 protected: |
28 void SetUp() override { | 28 void SetUp() override { |
29 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); | 29 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
30 // ANGLE and NVidia fails ReadPixelsFromIncompleteCubeTexture without this | 30 // ANGLE and NVidia fails ReadPixelsFromIncompleteCubeTexture without this |
31 // workaround. | 31 // workaround. |
32 command_line.AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, | 32 command_line.AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, |
33 base::IntToString(gpu::FORCE_CUBE_COMPLETE)); | 33 base::IntToString(gpu::FORCE_CUBE_COMPLETE)); |
34 gl_.InitializeWithCommandLine(GLManager::Options(), &command_line); | 34 gl_.InitializeWithCommandLine(GLManager::Options(), command_line); |
35 DCHECK(gl_.workarounds().force_cube_complete); | 35 DCHECK(gl_.workarounds().force_cube_complete); |
36 for (int i = 0; i < 256; i++) { | 36 for (int i = 0; i < 256; i++) { |
37 pixels_[i * 4] = 255u; | 37 pixels_[i * 4] = 255u; |
38 pixels_[(i * 4) + 1] = 0; | 38 pixels_[(i * 4) + 1] = 0; |
39 pixels_[(i * 4) + 2] = 0; | 39 pixels_[(i * 4) + 2] = 0; |
40 pixels_[(i * 4) + 3] = 255u; | 40 pixels_[(i * 4) + 3] = 255u; |
41 } | 41 } |
42 | 42 |
43 glGenTextures(1, &texture_); | 43 glGenTextures(1, &texture_); |
44 glBindTexture(GL_TEXTURE_CUBE_MAP, texture_); | 44 glBindTexture(GL_TEXTURE_CUBE_MAP, texture_); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT), | 135 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT), |
136 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 136 glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
137 GLsizei size = width_ * width_ * 4; | 137 GLsizei size = width_ * width_ * 4; |
138 scoped_ptr<uint8_t[]> pixels(new uint8_t[size]); | 138 scoped_ptr<uint8_t[]> pixels(new uint8_t[size]); |
139 glReadPixels(0, 0, width_, width_, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get()); | 139 glReadPixels(0, 0, width_, width_, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get()); |
140 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_FRAMEBUFFER_OPERATION), | 140 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_FRAMEBUFFER_OPERATION), |
141 glGetError()); | 141 glGetError()); |
142 } | 142 } |
143 | 143 |
144 } // namespace gpu | 144 } // namespace gpu |
OLD | NEW |