Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: gpu/command_buffer/tests/gl_cube_map_texture_unittest.cc

Issue 1280163004: gpu: workaround force_cube_map_positive_x_allocation fixes Android crash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable ReadPixels test in linux and mac due to NVIDIA Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include <GLES2/gl2.h>
6
7 #include "gpu/command_buffer/tests/gl_manager.h"
8 #include "gpu/command_buffer/tests/gl_test_utils.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace gpu {
12
13 namespace {
14 const GLenum kCubeMapTextureTargets[] = {
15 GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
16 GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
17 GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
18 };
19 } // namespace
20
21 // A collection of tests that exercise the cube map texture.
22 class GLCubeMapTextureTest : public testing::TestWithParam<GLenum> {
23 protected:
24 void SetUp() override {
25 gl_.Initialize(GLManager::Options());
26 for (int i = 0; i < 256; i++) {
27 pixels_[i * 4] = 255u;
28 pixels_[(i * 4) + 1] = 0;
29 pixels_[(i * 4) + 2] = 0;
30 pixels_[(i * 4) + 3] = 255u;
31 }
32 }
33
34 void TearDown() override { gl_.Destroy(); }
35
36 uint8 pixels_[256 * 4];
37 const int width_ = 16;
38 GLManager gl_;
39 };
40
41 INSTANTIATE_TEST_CASE_P(GLCubeMapTextureTests,
42 GLCubeMapTextureTest,
43 ::testing::ValuesIn(kCubeMapTextureTargets));
44
45 TEST_P(GLCubeMapTextureTest, TexImage2DAfterFBOBinding) {
46 GLenum cube_map_target = GetParam();
47
48 GLuint texture = 0;
49 glGenTextures(1, &texture);
50
51 glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
52 EXPECT_TRUE(glGetError() == GL_NO_ERROR);
53
54 GLuint framebuffer_id = 0;
55 glGenFramebuffers(1, &framebuffer_id);
56 glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id);
57 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cube_map_target,
58 texture, 0);
59 EXPECT_TRUE(glGetError() == GL_NO_ERROR);
60
61 // force_gl_finish_after_compositing workaround prevents Nexus 5 crash.
62 // TODO(dshwang): remove the workaround when it's fixed. crbug.com/518889
63 glTexImage2D(cube_map_target, 0, GL_RGBA, width_, width_, 0, GL_RGBA,
64 GL_UNSIGNED_BYTE, pixels_);
65 EXPECT_TRUE(glGetError() == GL_NO_ERROR);
66 }
67
68 #if defined(OS_WIN)
69 // ANGLE crashes. crbug.com/518889
70 TEST_P(GLCubeMapTextureTest, DISABLED_ReadPixels) {
71 #elif defined(OS_LINUX) || defined(OS_MACOSX)
72 // NVIDIA reports GL_INVALID_FRAMEBUFFER_OPERATION : glReadPixels: framebuffer
73 // incomplete. crbug.com/518889
Ken Russell (switch to Gerrit) 2015/08/11 18:17:49 I think this test is wrong. Section 4.4.4 "Framebu
dshwang 2015/08/11 19:15:43 Aha, thank you for enlightening me. you are right.
74 TEST_P(GLCubeMapTextureTest, DISABLED_ReadPixels) {
75 #else
76 TEST_P(GLCubeMapTextureTest, ReadPixels) {
77 #endif
78 GLenum cube_map_target = GetParam();
79
80 GLuint texture = 0;
81 glGenTextures(1, &texture);
82
83 glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
84 EXPECT_TRUE(glGetError() == GL_NO_ERROR);
85
86 glTexImage2D(cube_map_target, 0, GL_RGBA, width_, width_, 0, GL_RGBA,
87 GL_UNSIGNED_BYTE, pixels_);
88 EXPECT_TRUE(glGetError() == GL_NO_ERROR);
89
90 GLuint framebuffer_id = 0;
91 glGenFramebuffers(1, &framebuffer_id);
92 glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id);
93 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cube_map_target,
94 texture, 0);
95 // force_gl_finish_after_compositing workaround prevents Nexus 5 crash.
96 // TODO(dshwang): remove the workaround when it's fixed. crbug.com/518889
97 EXPECT_TRUE(glGetError() == GL_NO_ERROR);
98
99 // Check that FB is complete.
100 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE),
101 glCheckFramebufferStatus(GL_FRAMEBUFFER));
dshwang 2015/08/11 19:15:43 by the way, NVIDIA should fail here, not glRealPix
102
103 // ANGLE crashes on glReadPixels() except for CUBE_MAP_POSITIVE_X.
104 GLTestHelper::CheckPixels(0, 0, width_, width_, 0, pixels_);
105 EXPECT_TRUE(GL_NO_ERROR == glGetError());
106 }
107
108 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698