OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 | 7 |
8 #include "gpu/command_buffer/tests/gl_manager.h" | 8 #include "gpu/command_buffer/tests/gl_manager.h" |
9 #include "gpu/command_buffer/tests/gl_test_utils.h" | 9 #include "gpu/command_buffer/tests/gl_test_utils.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace gpu { | 13 namespace gpu { |
14 | 14 |
15 class TextureStorageTest : public testing::Test { | 15 class TextureStorageTest : public testing::Test { |
16 protected: | 16 protected: |
17 static const GLsizei kResolution = 64; | 17 static const GLsizei kResolution = 64; |
18 virtual void SetUp() { | 18 void SetUp() override { |
19 GLManager::Options options; | 19 GLManager::Options options; |
20 options.size = gfx::Size(kResolution, kResolution); | 20 options.size = gfx::Size(kResolution, kResolution); |
21 gl_.Initialize(options); | 21 gl_.Initialize(options); |
22 gl_.MakeCurrent(); | 22 gl_.MakeCurrent(); |
23 | 23 |
24 glGenTextures(1, &tex_); | 24 glGenTextures(1, &tex_); |
25 glBindTexture(GL_TEXTURE_2D, tex_); | 25 glBindTexture(GL_TEXTURE_2D, tex_); |
26 | 26 |
27 glGenFramebuffers(1, &fbo_); | 27 glGenFramebuffers(1, &fbo_); |
28 glBindFramebuffer(GL_FRAMEBUFFER, fbo_); | 28 glBindFramebuffer(GL_FRAMEBUFFER, fbo_); |
29 glFramebufferTexture2D(GL_FRAMEBUFFER, | 29 glFramebufferTexture2D(GL_FRAMEBUFFER, |
30 GL_COLOR_ATTACHMENT0, | 30 GL_COLOR_ATTACHMENT0, |
31 GL_TEXTURE_2D, | 31 GL_TEXTURE_2D, |
32 tex_, | 32 tex_, |
33 0); | 33 0); |
34 | 34 |
35 const GLubyte* extensions = glGetString(GL_EXTENSIONS); | 35 const GLubyte* extensions = glGetString(GL_EXTENSIONS); |
36 extension_available_ = strstr(reinterpret_cast<const char*>( | 36 extension_available_ = strstr(reinterpret_cast<const char*>( |
37 extensions), "GL_EXT_texture_storage"); | 37 extensions), "GL_EXT_texture_storage"); |
38 } | 38 } |
39 | 39 |
40 virtual void TearDown() { | 40 void TearDown() override { gl_.Destroy(); } |
41 gl_.Destroy(); | |
42 } | |
43 | 41 |
44 GLManager gl_; | 42 GLManager gl_; |
45 GLuint tex_; | 43 GLuint tex_; |
46 GLuint fbo_; | 44 GLuint fbo_; |
47 bool extension_available_; | 45 bool extension_available_; |
48 }; | 46 }; |
49 | 47 |
50 TEST_F(TextureStorageTest, CorrectPixels) { | 48 TEST_F(TextureStorageTest, CorrectPixels) { |
51 if (!extension_available_) | 49 if (!extension_available_) |
52 return; | 50 return; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 GL_RGBA, | 149 GL_RGBA, |
152 GL_UNSIGNED_BYTE, | 150 GL_UNSIGNED_BYTE, |
153 NULL); | 151 NULL); |
154 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError()); | 152 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError()); |
155 } | 153 } |
156 | 154 |
157 } // namespace gpu | 155 } // namespace gpu |
158 | 156 |
159 | 157 |
160 | 158 |
OLD | NEW |