Chromium Code Reviews| 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 // This file defines tests that implementations of GLImage should pass in order | 5 // This file defines tests that implementations of GLImage should pass in order |
| 6 // to be conformant. | 6 // to be conformant. |
| 7 | 7 |
| 8 #ifndef UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ | 8 #ifndef UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ |
| 9 #define UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ | 9 #define UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ |
| 10 | 10 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 REGISTER_TYPED_TEST_CASE_P(GLImageTest, CreateAndDestroy); | 163 REGISTER_TYPED_TEST_CASE_P(GLImageTest, CreateAndDestroy); |
| 164 | 164 |
| 165 template <typename GLImageTestDelegate> | 165 template <typename GLImageTestDelegate> |
| 166 class GLImageZeroInitializeTest : public GLImageTest<GLImageTestDelegate> {}; | 166 class GLImageZeroInitializeTest : public GLImageTest<GLImageTestDelegate> {}; |
| 167 | 167 |
| 168 // This test verifies that if an uninitialized image is bound to a texture, the | 168 // This test verifies that if an uninitialized image is bound to a texture, the |
| 169 // result is zero-initialized. | 169 // result is zero-initialized. |
| 170 TYPED_TEST_CASE_P(GLImageZeroInitializeTest); | 170 TYPED_TEST_CASE_P(GLImageZeroInitializeTest); |
| 171 | 171 |
| 172 // TODO(erikchen): Enable this test when it actually passes on Mac. | 172 // TODO(erikchen): Enable this test when it actually passes on Mac. |
| 173 // https://crbug.com/584760. | 173 // https://crbug.com/584760. |
|
Avi (use Gerrit)
2016/02/17 23:07:25
Drop the comment? It's no longer accurate.
erikchen
2016/02/17 23:55:30
Done.
| |
| 174 TYPED_TEST_P(GLImageZeroInitializeTest, DISABLED_ZeroInitialize) { | 174 TYPED_TEST_P(GLImageZeroInitializeTest, ZeroInitialize) { |
| 175 const gfx::Size image_size(256, 256); | 175 const gfx::Size image_size(256, 256); |
| 176 scoped_refptr<gl::GLImage> image = this->delegate_.CreateImage(image_size); | 176 scoped_refptr<gl::GLImage> image = this->delegate_.CreateImage(image_size); |
| 177 GLenum target = this->delegate_.GetTextureTarget(); | 177 GLenum target = this->delegate_.GetTextureTarget(); |
| 178 GLuint uninitialized_texture = GLTestHelper::CreateTexture(target); | 178 GLuint uninitialized_texture = GLTestHelper::CreateTexture(target); |
| 179 | 179 |
| 180 glBindTexture(target, uninitialized_texture); | 180 glBindTexture(target, uninitialized_texture); |
| 181 ASSERT_TRUE(image->BindTexImage(target)); | 181 ASSERT_TRUE(image->BindTexImage(target)); |
| 182 GLuint framebuffer = | 182 GLuint framebuffer = |
| 183 GLTestHelper::SetupFramebuffer(image_size.width(), image_size.height()); | 183 GLTestHelper::SetupFramebuffer(image_size.width(), image_size.height()); |
| 184 ASSERT_TRUE(framebuffer); | 184 ASSERT_TRUE(framebuffer); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 198 glDeleteShader(pas.vertex_shader); | 198 glDeleteShader(pas.vertex_shader); |
| 199 glDeleteShader(pas.fragment_shader); | 199 glDeleteShader(pas.fragment_shader); |
| 200 glDeleteBuffersARB(1, &vertex_buffer); | 200 glDeleteBuffersARB(1, &vertex_buffer); |
| 201 glDeleteFramebuffersEXT(1, &framebuffer); | 201 glDeleteFramebuffersEXT(1, &framebuffer); |
| 202 | 202 |
| 203 image->ReleaseTexImage(target); | 203 image->ReleaseTexImage(target); |
| 204 image->Destroy(true); | 204 image->Destroy(true); |
| 205 glDeleteTextures(1, &uninitialized_texture); | 205 glDeleteTextures(1, &uninitialized_texture); |
| 206 } | 206 } |
| 207 | 207 |
| 208 REGISTER_TYPED_TEST_CASE_P(GLImageZeroInitializeTest, DISABLED_ZeroInitialize); | 208 REGISTER_TYPED_TEST_CASE_P(GLImageZeroInitializeTest, ZeroInitialize); |
| 209 | 209 |
| 210 template <typename GLImageTestDelegate> | 210 template <typename GLImageTestDelegate> |
| 211 class GLImageCopyTest : public GLImageTest<GLImageTestDelegate> {}; | 211 class GLImageCopyTest : public GLImageTest<GLImageTestDelegate> {}; |
| 212 | 212 |
| 213 TYPED_TEST_CASE_P(GLImageCopyTest); | 213 TYPED_TEST_CASE_P(GLImageCopyTest); |
| 214 | 214 |
| 215 TYPED_TEST_P(GLImageCopyTest, CopyTexImage) { | 215 TYPED_TEST_P(GLImageCopyTest, CopyTexImage) { |
| 216 const gfx::Size image_size(256, 256); | 216 const gfx::Size image_size(256, 256); |
| 217 // These values are picked so that RGB -> YUV on the CPU converted | 217 // These values are picked so that RGB -> YUV on the CPU converted |
| 218 // back to RGB on the GPU produces the original RGB values without | 218 // back to RGB on the GPU produces the original RGB values without |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 image->Destroy(true); | 271 image->Destroy(true); |
| 272 } | 272 } |
| 273 | 273 |
| 274 // The GLImageCopyTest test case verifies that the GLImage implementation | 274 // The GLImageCopyTest test case verifies that the GLImage implementation |
| 275 // handles CopyTexImage correctly. | 275 // handles CopyTexImage correctly. |
| 276 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage); | 276 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage); |
| 277 | 277 |
| 278 } // namespace gl | 278 } // namespace gl |
| 279 | 279 |
| 280 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ | 280 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ |
| OLD | NEW |