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

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

Issue 760173002: Revert of gpu: fix CopyTextureCHROMIUM for immutable texture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/gles2_cmd_copy_texture_chromium.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef GL_GLEXT_PROTOTYPES 5 #ifndef GL_GLEXT_PROTOTYPES
6 #define GL_GLEXT_PROTOTYPES 6 #define GL_GLEXT_PROTOTYPES
7 #endif 7 #endif
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // Test to ensure that the basic functionality of the extension works. 53 // Test to ensure that the basic functionality of the extension works.
54 TEST_F(GLCopyTextureCHROMIUMTest, Basic) { 54 TEST_F(GLCopyTextureCHROMIUMTest, Basic) {
55 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; 55 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u };
56 56
57 glBindTexture(GL_TEXTURE_2D, textures_[0]); 57 glBindTexture(GL_TEXTURE_2D, textures_[0]);
58 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 58 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
59 pixels); 59 pixels);
60 60
61 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, 61 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA,
62 GL_UNSIGNED_BYTE); 62 GL_UNSIGNED_BYTE);
63 EXPECT_TRUE(glGetError() == GL_NO_ERROR);
64
65 // Check the FB is still bound.
66 GLint value = 0;
67 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value);
68 GLuint fb_id = value;
69 EXPECT_EQ(framebuffer_id_, fb_id);
70
71 // Check that FB is complete.
72 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE),
73 glCheckFramebufferStatus(GL_FRAMEBUFFER));
74
75 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels);
76 EXPECT_TRUE(GL_NO_ERROR == glGetError());
77 }
78
79 TEST_F(GLCopyTextureCHROMIUMTest, ImmutableTexture) {
80 if (!GLTestHelper::HasExtension("GL_EXT_texture_storage")) {
81 LOG(INFO) << "GL_EXT_texture_storage not supported. Skipping test...";
82 return;
83 }
84
85 uint8 pixels[1 * 4] = {255u, 0u, 0u, 255u};
86
87 glBindTexture(GL_TEXTURE_2D, textures_[0]);
88 glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 1, 1);
89 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE,
90 pixels);
91
92 glBindTexture(GL_TEXTURE_2D, textures_[1]);
93 glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 1, 1);
94 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
95 textures_[1], 0);
96 EXPECT_TRUE(glGetError() == GL_NO_ERROR);
97
98 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA,
99 GL_UNSIGNED_BYTE);
100 EXPECT_TRUE(glGetError() == GL_NO_ERROR); 63 EXPECT_TRUE(glGetError() == GL_NO_ERROR);
101 64
102 // Check the FB is still bound. 65 // Check the FB is still bound.
103 GLint value = 0; 66 GLint value = 0;
104 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); 67 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value);
105 GLuint fb_id = value; 68 GLuint fb_id = value;
106 EXPECT_EQ(framebuffer_id_, fb_id); 69 EXPECT_EQ(framebuffer_id_, fb_id);
107 70
108 // Check that FB is complete. 71 // Check that FB is complete.
109 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), 72 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE),
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 EXPECT_EQ(0, pixels[y][x][1]); 623 EXPECT_EQ(0, pixels[y][x][1]);
661 EXPECT_EQ(0, pixels[y][x][2]); 624 EXPECT_EQ(0, pixels[y][x][2]);
662 EXPECT_EQ(0, pixels[y][x][3]); 625 EXPECT_EQ(0, pixels[y][x][3]);
663 } 626 }
664 } 627 }
665 628
666 EXPECT_TRUE(GL_NO_ERROR == glGetError()); 629 EXPECT_TRUE(GL_NO_ERROR == glGetError());
667 } 630 }
668 631
669 } // namespace gpu 632 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698