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

Side by Side Diff: ui/gl/test/gl_image_test_template.h

Issue 2388653002: gpu: Add CHROMIUM_texture_from_image spec and fence support.
Patch Set: rebase Created 4 years, 2 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
OLDNEW
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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 // Create an uninitialized image of preferred format. 245 // Create an uninitialized image of preferred format.
246 scoped_refptr<GLImage> image = this->delegate_.CreateImage(image_size); 246 scoped_refptr<GLImage> image = this->delegate_.CreateImage(image_size);
247 247
248 // Create a texture that |image| will be bound to. 248 // Create a texture that |image| will be bound to.
249 GLenum target = this->delegate_.GetTextureTarget(); 249 GLenum target = this->delegate_.GetTextureTarget();
250 GLuint texture = GLTestHelper::CreateTexture(target); 250 GLuint texture = GLTestHelper::CreateTexture(target);
251 glBindTexture(target, texture); 251 glBindTexture(target, texture);
252 252
253 // Bind |image| to |texture|. 253 // Bind |image| to |texture|.
254 bool rv = image->BindTexImage(target); 254 bool rv = image->BindTexImage(target, nullptr);
255 EXPECT_TRUE(rv); 255 EXPECT_TRUE(rv);
256 256
257 // Draw |texture| to viewport. 257 // Draw |texture| to viewport.
258 DrawTextureQuad(target, image_size); 258 DrawTextureQuad(target, image_size);
259 259
260 // Release |image| from |texture|. 260 // Release |image| from |texture|.
261 image->ReleaseTexImage(target); 261 image->ReleaseTexImage(target);
262 262
263 // Read back pixels to check expectations. 263 // Read back pixels to check expectations.
264 const uint8_t zero_color[] = {0, 0, 0, 0}; 264 const uint8_t zero_color[] = {0, 0, 0, 0};
(...skipping 28 matching lines...) Expand all
293 scoped_refptr<GLImage> image = 293 scoped_refptr<GLImage> image =
294 this->delegate_.CreateSolidColorImage(image_size, image_color); 294 this->delegate_.CreateSolidColorImage(image_size, image_color);
295 ASSERT_TRUE(image); 295 ASSERT_TRUE(image);
296 296
297 // Initialize a blue texture of the same size as |image|. 297 // Initialize a blue texture of the same size as |image|.
298 unsigned target = this->delegate_.GetTextureTarget(); 298 unsigned target = this->delegate_.GetTextureTarget();
299 GLuint texture = GLTestHelper::CreateTexture(target); 299 GLuint texture = GLTestHelper::CreateTexture(target);
300 glBindTexture(target, texture); 300 glBindTexture(target, texture);
301 301
302 // Bind |image| to |texture|. 302 // Bind |image| to |texture|.
303 bool rv = image->BindTexImage(target); 303 bool rv = image->BindTexImage(target, nullptr);
304 EXPECT_TRUE(rv); 304 EXPECT_TRUE(rv);
305 305
306 glClearColor(0.0f, 0.0f, 1.0f, 1.0f); 306 glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
307 glClear(GL_COLOR_BUFFER_BIT); 307 glClear(GL_COLOR_BUFFER_BIT);
308 // Draw |texture| to viewport. 308 // Draw |texture| to viewport.
309 DrawTextureQuad(target, image_size); 309 DrawTextureQuad(target, image_size);
310 310
311 // Read back pixels to check expectations. 311 // Read back pixels to check expectations.
312 GLTestHelper::CheckPixels(0, 0, image_size.width(), image_size.height(), 312 GLTestHelper::CheckPixels(0, 0, image_size.width(), image_size.height(),
313 image_color); 313 image_color);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 } 383 }
384 } 384 }
385 385
386 // The GLImageCopyTest test case verifies that the GLImage implementation 386 // The GLImageCopyTest test case verifies that the GLImage implementation
387 // handles CopyTexImage correctly. 387 // handles CopyTexImage correctly.
388 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage); 388 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage);
389 389
390 } // namespace gl 390 } // namespace gl
391 391
392 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ 392 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698