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

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, 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 | « ui/gl/gl_image_surface_texture.cc ('k') | ui/ozone/platform/drm/gpu/gbm_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 263
264 // Create an uninitialized image of preferred format. 264 // Create an uninitialized image of preferred format.
265 scoped_refptr<GLImage> image = this->delegate_.CreateImage(image_size); 265 scoped_refptr<GLImage> image = this->delegate_.CreateImage(image_size);
266 266
267 // Create a texture that |image| will be bound to. 267 // Create a texture that |image| will be bound to.
268 GLenum target = this->delegate_.GetTextureTarget(); 268 GLenum target = this->delegate_.GetTextureTarget();
269 GLuint texture = GLTestHelper::CreateTexture(target); 269 GLuint texture = GLTestHelper::CreateTexture(target);
270 glBindTexture(target, texture); 270 glBindTexture(target, texture);
271 271
272 // Bind |image| to |texture|. 272 // Bind |image| to |texture|.
273 bool rv = image->BindTexImage(target); 273 bool rv = image->BindTexImage(target, nullptr);
274 EXPECT_TRUE(rv); 274 EXPECT_TRUE(rv);
275 275
276 // Draw |texture| to viewport. 276 // Draw |texture| to viewport.
277 DrawTextureQuad(target, image_size); 277 DrawTextureQuad(target, image_size);
278 278
279 // Release |image| from |texture|. 279 // Release |image| from |texture|.
280 image->ReleaseTexImage(target); 280 image->ReleaseTexImage(target);
281 281
282 // Read back pixels to check expectations. 282 // Read back pixels to check expectations.
283 const uint8_t zero_color[] = {0, 0, 0, 0}; 283 const uint8_t zero_color[] = {0, 0, 0, 0};
(...skipping 27 matching lines...) Expand all
311 scoped_refptr<GLImage> image = 311 scoped_refptr<GLImage> image =
312 this->delegate_.CreateSolidColorImage(image_size, image_color); 312 this->delegate_.CreateSolidColorImage(image_size, image_color);
313 ASSERT_TRUE(image); 313 ASSERT_TRUE(image);
314 314
315 // Initialize a blue texture of the same size as |image|. 315 // Initialize a blue texture of the same size as |image|.
316 unsigned target = this->delegate_.GetTextureTarget(); 316 unsigned target = this->delegate_.GetTextureTarget();
317 GLuint texture = GLTestHelper::CreateTexture(target); 317 GLuint texture = GLTestHelper::CreateTexture(target);
318 glBindTexture(target, texture); 318 glBindTexture(target, texture);
319 319
320 // Bind |image| to |texture|. 320 // Bind |image| to |texture|.
321 bool rv = image->BindTexImage(target); 321 bool rv = image->BindTexImage(target, nullptr);
322 EXPECT_TRUE(rv); 322 EXPECT_TRUE(rv);
323 323
324 glClearColor(0.0f, 0.0f, 1.0f, 1.0f); 324 glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
325 glClear(GL_COLOR_BUFFER_BIT); 325 glClear(GL_COLOR_BUFFER_BIT);
326 // Draw |texture| to viewport. 326 // Draw |texture| to viewport.
327 DrawTextureQuad(target, image_size); 327 DrawTextureQuad(target, image_size);
328 328
329 // Read back pixels to check expectations. 329 // Read back pixels to check expectations.
330 GLTestHelper::CheckPixels(0, 0, image_size.width(), image_size.height(), 330 GLTestHelper::CheckPixels(0, 0, image_size.width(), image_size.height(),
331 image_color); 331 image_color);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 } 399 }
400 } 400 }
401 401
402 // The GLImageCopyTest test case verifies that the GLImage implementation 402 // The GLImageCopyTest test case verifies that the GLImage implementation
403 // handles CopyTexImage correctly. 403 // handles CopyTexImage correctly.
404 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage); 404 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage);
405 405
406 } // namespace gl 406 } // namespace gl
407 407
408 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ 408 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_
OLDNEW
« no previous file with comments | « ui/gl/gl_image_surface_texture.cc ('k') | ui/ozone/platform/drm/gpu/gbm_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698