Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef GL_GLEXT_PROTOTYPES | |
| 6 #define GL_GLEXT_PROTOTYPES | |
|
no sievers
2015/08/10 19:34:10
nit: we don't do that elsewhere, it comes in throu
dshwang
2015/08/11 06:28:53
Done.
| |
| 7 #endif | |
| 8 | |
| 9 #include <GLES2/gl2.h> | |
| 10 | |
| 11 #include "gpu/command_buffer/tests/gl_manager.h" | |
| 12 #include "gpu/command_buffer/tests/gl_test_utils.h" | |
| 13 #include "testing/gtest/include/gtest/gtest.h" | |
| 14 | |
| 15 namespace gpu { | |
| 16 | |
| 17 namespace { | |
| 18 const GLenum kCubeMapTextureTargets[] = { | |
| 19 GL_TEXTURE_CUBE_MAP_POSITIVE_X, | |
| 20 GL_TEXTURE_CUBE_MAP_NEGATIVE_X, | |
| 21 GL_TEXTURE_CUBE_MAP_POSITIVE_Y, | |
| 22 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, | |
| 23 GL_TEXTURE_CUBE_MAP_POSITIVE_Z, | |
| 24 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, | |
| 25 }; | |
| 26 } // namespace | |
| 27 | |
| 28 // A collection of tests that exercise the GL_CHROMIUM_copy_texture extension. | |
|
no sievers
2015/08/10 19:34:10
update comment
dshwang
2015/08/11 06:28:53
Done.
| |
| 29 class GLCubeMapTextureTest | |
| 30 : public testing::TestWithParam<GLenum> { | |
| 31 protected: | |
| 32 void SetUp() override { | |
| 33 gl_.Initialize(GLManager::Options()); | |
| 34 } | |
| 35 | |
| 36 void TearDown() override { | |
| 37 gl_.Destroy(); | |
| 38 } | |
| 39 | |
| 40 GLManager gl_; | |
| 41 }; | |
| 42 | |
| 43 INSTANTIATE_TEST_CASE_P( | |
| 44 GLCubeMapTextureTests, | |
| 45 GLCubeMapTextureTest, | |
| 46 ::testing::ValuesIn(kCubeMapTextureTargets)); | |
| 47 | |
| 48 TEST_P(GLCubeMapTextureTest, DISABLED_FramebufferTexture2D) { | |
| 49 GLenum cube_map_target = GetParam(); | |
| 50 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; | |
|
no sievers
2015/08/10 19:34:10
should we make it slightly more interesting/realis
dshwang
2015/08/11 06:28:53
Done.
| |
| 51 | |
| 52 GLuint texture = 0; | |
| 53 glGenTextures(1, &texture); | |
| 54 | |
| 55 glBindTexture(GL_TEXTURE_CUBE_MAP, texture); | |
| 56 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
| 57 | |
| 58 glTexImage2D(cube_map_target, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
| 59 pixels); | |
| 60 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
| 61 | |
| 62 GLuint framebuffer_id = 0; | |
| 63 glGenFramebuffers(1, &framebuffer_id); | |
| 64 glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id); | |
| 65 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cube_map_target, | |
| 66 texture, 0); | |
| 67 // Nexus 5 crashes on this glGetError() except for CUBE_MAP_POSITIVE_X. | |
| 68 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
| 69 } | |
| 70 | |
| 71 TEST_P(GLCubeMapTextureTest, DISABLED_TexImage2DAfterFBOBinding) { | |
| 72 GLenum cube_map_target = GetParam(); | |
| 73 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; | |
| 74 | |
| 75 GLuint texture = 0; | |
| 76 glGenTextures(1, &texture); | |
| 77 | |
| 78 glBindTexture(GL_TEXTURE_CUBE_MAP, texture); | |
| 79 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
| 80 | |
| 81 GLuint framebuffer_id = 0; | |
| 82 glGenFramebuffers(1, &framebuffer_id); | |
| 83 glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id); | |
| 84 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cube_map_target, | |
| 85 texture, 0); | |
| 86 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
| 87 | |
| 88 // Nexus 5 crashes on glTexImage2D() except for CUBE_MAP_POSITIVE_X. | |
| 89 glTexImage2D(cube_map_target, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
| 90 pixels); | |
| 91 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
| 92 } | |
| 93 | |
| 94 TEST_P(GLCubeMapTextureTest, DISABLED_ReadPixels) { | |
| 95 GLenum cube_map_target = GetParam(); | |
| 96 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; | |
| 97 | |
| 98 GLuint texture = 0; | |
| 99 glGenTextures(1, &texture); | |
| 100 | |
| 101 glBindTexture(GL_TEXTURE_CUBE_MAP, texture); | |
| 102 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
| 103 | |
| 104 glTexImage2D(cube_map_target, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
| 105 pixels); | |
| 106 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
| 107 | |
| 108 GLuint framebuffer_id = 0; | |
| 109 glGenFramebuffers(1, &framebuffer_id); | |
| 110 glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id); | |
| 111 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cube_map_target, | |
| 112 texture, 0); | |
| 113 // Nexus 5 crashes on this glGetError() except for CUBE_MAP_POSITIVE_X. | |
| 114 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
| 115 | |
| 116 // Check that FB is complete. | |
| 117 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | |
| 118 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | |
| 119 | |
| 120 // ANGLE crashes on glReadPixels() except for CUBE_MAP_POSITIVE_X. | |
| 121 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels); | |
|
no sievers
2015/08/10 19:34:10
This seems to be just an extended version of the f
dshwang
2015/08/11 06:28:53
Done.
| |
| 122 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | |
| 123 } | |
| 124 | |
| 125 } // namespace gpu | |
| OLD | NEW |