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

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

Issue 2460973002: gpu, cmaa: reuse CopyTextureCHROMIUMResourceManager (Closed)
Patch Set: revert unrelated change Created 4 years, 1 month 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_decoder.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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 glBindFramebuffer(GL_FRAMEBUFFER, 0); 131 glBindFramebuffer(GL_FRAMEBUFFER, 0);
132 glApplyScreenSpaceAntialiasingCHROMIUM(); 132 glApplyScreenSpaceAntialiasingCHROMIUM();
133 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError()); 133 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError());
134 } 134 }
135 135
136 TEST_F(GLApplyScreenSpaceAntialiasingCHROMIUMTest, InternalFormat) { 136 TEST_F(GLApplyScreenSpaceAntialiasingCHROMIUMTest, InternalFormat) {
137 if (!available_) 137 if (!available_)
138 return; 138 return;
139 139
140 GLint formats[] = {GL_RGB, GL_RGBA}; 140 GLint formats[] = {GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE,
141 GL_LUMINANCE_ALPHA};
141 for (size_t index = 0; index < arraysize(formats); index++) { 142 for (size_t index = 0; index < arraysize(formats); index++) {
142 glTexImage2D(GL_TEXTURE_2D, 0, formats[index], 1, 1, 0, formats[index], 143 glTexImage2D(GL_TEXTURE_2D, 0, formats[index], 1, 1, 0, formats[index],
143 GL_UNSIGNED_BYTE, nullptr); 144 GL_UNSIGNED_BYTE, nullptr);
144 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); 145 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
145 146
146 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 147 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
147 textures_, 0); 148 textures_, 0);
148 149
150 // Only if the format is supported by FBO, supported by this extension.
151 if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
152 continue;
153
149 glClear(GL_COLOR_BUFFER_BIT); 154 glClear(GL_COLOR_BUFFER_BIT);
155 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
150 156
151 glApplyScreenSpaceAntialiasingCHROMIUM(); 157 glApplyScreenSpaceAntialiasingCHROMIUM();
152 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()) << "index:" 158 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()) << "index:"
153 << index; 159 << index;
154 160
155 uint8_t pixels[1 * 4] = {0u, 255u, 0u, 255u}; 161 uint8_t pixels[1 * 4] = {0u, 255u, 0u, 255u};
156 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels); 162 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels);
157 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); 163 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
158 } 164 }
159 } 165 }
160 166
161 TEST_F(GLApplyScreenSpaceAntialiasingCHROMIUMTest, InternalFormatNotSupported) {
162 if (!available_)
163 return;
164
165 // Check unsupported format reports error.
166 GLint unsupported_formats[] = {GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA};
167 for (size_t index = 0; index < arraysize(unsupported_formats); index++) {
168 glTexImage2D(GL_TEXTURE_2D, 0, unsupported_formats[index], 1, 1, 0,
169 unsupported_formats[index], GL_UNSIGNED_BYTE, nullptr);
170 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
171
172 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
173 textures_, 0);
174
175 glClear(GL_COLOR_BUFFER_BIT);
176
177 glApplyScreenSpaceAntialiasingCHROMIUM();
178 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_FRAMEBUFFER_OPERATION),
179 glGetError())
180 << "index:" << index;
181 }
182 }
183
184 TEST_F(GLApplyScreenSpaceAntialiasingCHROMIUMTest, ImmutableTexture) { 167 TEST_F(GLApplyScreenSpaceAntialiasingCHROMIUMTest, ImmutableTexture) {
185 if (!available_) 168 if (!available_)
186 return; 169 return;
187 170
188 if (!GLTestHelper::HasExtension("GL_EXT_texture_storage")) { 171 if (!GLTestHelper::HasExtension("GL_EXT_texture_storage")) {
189 LOG(INFO) << "GL_EXT_texture_storage not supported. Skipping test..."; 172 LOG(INFO) << "GL_EXT_texture_storage not supported. Skipping test...";
190 return; 173 return;
191 } 174 }
192 GLenum internal_formats[] = {GL_RGB8_OES, GL_RGBA8_OES, GL_BGRA8_EXT}; 175 GLenum internal_formats[] = {GL_RGB8_OES, GL_RGBA8_OES, GL_BGRA8_EXT};
193 for (auto internal_format : internal_formats) { 176 for (auto internal_format : internal_formats) {
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); 414 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected));
432 415
433 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); 416 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
434 417
435 gl2.MakeCurrent(); 418 gl2.MakeCurrent();
436 gl2.Destroy(); 419 gl2.Destroy();
437 gl_.MakeCurrent(); 420 gl_.MakeCurrent();
438 } 421 }
439 422
440 } // namespace gpu 423 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698