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

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

Issue 2602563002: Refactor DrawTextureQuad and CheckPixels in gl_tests util (Closed)
Patch Set: rebase only Created 3 years, 11 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 (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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 // Check the FB is still bound. 329 // Check the FB is still bound.
330 GLint value = 0; 330 GLint value = 0;
331 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); 331 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value);
332 GLuint fb_id = value; 332 GLuint fb_id = value;
333 EXPECT_EQ(framebuffer_id_, fb_id); 333 EXPECT_EQ(framebuffer_id_, fb_id);
334 334
335 // Check that FB is complete. 335 // Check that FB is complete.
336 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), 336 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE),
337 glCheckFramebufferStatus(GL_FRAMEBUFFER)); 337 glCheckFramebufferStatus(GL_FRAMEBUFFER));
338 338
339 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels); 339 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels, nullptr);
340 EXPECT_TRUE(GL_NO_ERROR == glGetError()); 340 EXPECT_TRUE(GL_NO_ERROR == glGetError());
341 } 341 }
342 342
343 TEST_P(GLCopyTextureCHROMIUMES3Test, FormatCombinations) { 343 TEST_P(GLCopyTextureCHROMIUMES3Test, FormatCombinations) {
344 if (ShouldSkipTest()) 344 if (ShouldSkipTest())
345 return; 345 return;
346 CopyType copy_type = GetParam(); 346 CopyType copy_type = GetParam();
347 347
348 struct FormatType { 348 struct FormatType {
349 GLenum internal_format; 349 GLenum internal_format;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 glBindTexture(GL_TEXTURE_2D, texture); 480 glBindTexture(GL_TEXTURE_2D, texture);
481 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 481 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
482 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 482 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
483 CreateBackingForTexture(GL_TEXTURE_2D, kWidth, kHeight); 483 CreateBackingForTexture(GL_TEXTURE_2D, kWidth, kHeight);
484 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 484 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
485 GL_TEXTURE_2D, texture, 0); 485 GL_TEXTURE_2D, texture, 0);
486 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), 486 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE),
487 glCheckFramebufferStatus(GL_FRAMEBUFFER)); 487 glCheckFramebufferStatus(GL_FRAMEBUFFER));
488 glViewport(0, 0, kWidth, kHeight); 488 glViewport(0, 0, kWidth, kHeight);
489 489
490 glBindTexture(GL_TEXTURE_2D, textures_[1]);
490 std::string fragment_shader_source = 491 std::string fragment_shader_source =
491 GetFragmentShaderSource(dest_format_type.internal_format); 492 GetFragmentShaderSource(dest_format_type.internal_format);
492 GLuint program = GLTestHelper::LoadProgram( 493 GLTestHelper::DrawTextureQuad(kSimpleVertexShaderES3,
493 kSimpleVertexShaderES3, fragment_shader_source.c_str()); 494 fragment_shader_source.c_str(),
494 EXPECT_NE(program, 0u); 495 "a_position", "u_texture");
495 GLint position_loc = glGetAttribLocation(program, "a_position");
496 GLint texture_loc = glGetUniformLocation(program, "u_texture");
497 ASSERT_NE(position_loc, -1);
498 ASSERT_NE(texture_loc, -1);
499 glUseProgram(program);
500 496
501 GLuint vbo = GLTestHelper::SetupUnitQuad(position_loc); 497 uint8_t tolerance = dest_format_type.internal_format == GL_RGBA4 ? 20 : 7;
502 ASSERT_NE(vbo, 0u); 498 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, kWidth, kHeight, tolerance,
503 499 expected_color, mask))
504 glActiveTexture(GL_TEXTURE0); 500 << " src_internal_format: "
505 glBindTexture(GL_TEXTURE_2D, textures_[1]); 501 << gles2::GLES2Util::GetStringEnum(src_format_type.internal_format)
506 502 << " dest_internal_format: "
507 glDrawArrays(GL_TRIANGLES, 0, 6); 503 << gles2::GLES2Util::GetStringEnum(dest_format_type.internal_format);
508
509 EXPECT_TRUE(GL_NO_ERROR == glGetError()); 504 EXPECT_TRUE(GL_NO_ERROR == glGetError());
510 505
511 GLsizei size = kWidth * kHeight * 4;
512 std::unique_ptr<uint8_t[]> result(new uint8_t[size]);
513 glReadPixels(0, 0, kWidth, kHeight, GL_RGBA, GL_UNSIGNED_BYTE,
514 result.get());
515 uint8_t tolerance = dest_format_type.internal_format == GL_RGBA4 ? 20 : 7;
516 for (GLint yy = 0; yy < kHeight; ++yy) {
517 for (GLint xx = 0; xx < kWidth; ++xx) {
518 int offset = yy * kWidth * 4 + xx * 4;
519 for (int jj = 0; jj < 4; ++jj) {
520 uint8_t actual = result[offset + jj];
521 uint8_t expected = expected_color[jj];
522 int diff = actual - expected;
523 diff = diff < 0 ? -diff : diff;
524 if (mask[jj] && diff > tolerance) {
525 EXPECT_EQ(expected, actual)
526 << " at " << xx << ", " << yy << " channel " << jj
527 << " src_internal_format: "
528 << gles2::GLES2Util::GetStringEnum(
529 src_format_type.internal_format)
530 << " dest_internal_format: "
531 << gles2::GLES2Util::GetStringEnum(
532 dest_format_type.internal_format);
533 }
534 }
535 }
536 }
537
538 glDeleteTextures(1, &texture); 506 glDeleteTextures(1, &texture);
539 glDeleteFramebuffers(1, &framebuffer); 507 glDeleteFramebuffers(1, &framebuffer);
540 glDeleteTextures(2, textures_); 508 glDeleteTextures(2, textures_);
541 glDeleteFramebuffers(1, &framebuffer_id_); 509 glDeleteFramebuffers(1, &framebuffer_id_);
542 } 510 }
543 } 511 }
544 } 512 }
545 513
546 TEST_P(GLCopyTextureCHROMIUMTest, ImmutableTexture) { 514 TEST_P(GLCopyTextureCHROMIUMTest, ImmutableTexture) {
547 if (!GLTestHelper::HasExtension("GL_EXT_texture_storage")) { 515 if (!GLTestHelper::HasExtension("GL_EXT_texture_storage")) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 // Check the FB is still bound. 550 // Check the FB is still bound.
583 GLint value = 0; 551 GLint value = 0;
584 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); 552 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value);
585 GLuint fb_id = value; 553 GLuint fb_id = value;
586 EXPECT_EQ(framebuffer_id_, fb_id); 554 EXPECT_EQ(framebuffer_id_, fb_id);
587 555
588 // Check that FB is complete. 556 // Check that FB is complete.
589 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), 557 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE),
590 glCheckFramebufferStatus(GL_FRAMEBUFFER)); 558 glCheckFramebufferStatus(GL_FRAMEBUFFER));
591 559
592 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels); 560 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels, nullptr);
593 EXPECT_TRUE(GL_NO_ERROR == glGetError()); 561 EXPECT_TRUE(GL_NO_ERROR == glGetError());
594 } 562 }
595 glDeleteTextures(2, textures_); 563 glDeleteTextures(2, textures_);
596 glDeleteFramebuffers(1, &framebuffer_id_); 564 glDeleteFramebuffers(1, &framebuffer_id_);
597 } 565 }
598 } 566 }
599 } 567 }
600 568
601 TEST_P(GLCopyTextureCHROMIUMTest, InternalFormat) { 569 TEST_P(GLCopyTextureCHROMIUMTest, InternalFormat) {
602 CopyType copy_type = GetParam(); 570 CopyType copy_type = GetParam();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 // Check the FB is still bound. 708 // Check the FB is still bound.
741 GLint value = 0; 709 GLint value = 0;
742 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); 710 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value);
743 GLuint fb_id = value; 711 GLuint fb_id = value;
744 EXPECT_EQ(framebuffer_id_, fb_id); 712 EXPECT_EQ(framebuffer_id_, fb_id);
745 713
746 // Check that FB is complete. 714 // Check that FB is complete.
747 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), 715 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE),
748 glCheckFramebufferStatus(GL_FRAMEBUFFER)); 716 glCheckFramebufferStatus(GL_FRAMEBUFFER));
749 717
750 GLTestHelper::CheckPixels(1, 1, 1, 1, 0, &pixels[12]); 718 GLTestHelper::CheckPixels(1, 1, 1, 1, 0, &pixels[12], nullptr);
751 719
752 glDeleteTextures(2, textures_); 720 glDeleteTextures(2, textures_);
753 glDeleteFramebuffers(1, &framebuffer_id_); 721 glDeleteFramebuffers(1, &framebuffer_id_);
754 722
755 EXPECT_TRUE(GL_NO_ERROR == glGetError()); 723 EXPECT_TRUE(GL_NO_ERROR == glGetError());
756 } 724 }
757 725
758 namespace { 726 namespace {
759 727
760 void glEnableDisable(GLint param, GLboolean value) { 728 void glEnableDisable(GLint param, GLboolean value) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 texture_id, 0); 895 texture_id, 0);
928 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, 896 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
929 GL_RENDERBUFFER, renderbuffer_id); 897 GL_RENDERBUFFER, renderbuffer_id);
930 EXPECT_TRUE( 898 EXPECT_TRUE(
931 GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER)); 899 GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER));
932 900
933 // Test that we can write to the bound framebuffer 901 // Test that we can write to the bound framebuffer
934 uint8_t expected_color[4] = {255u, 255u, 0, 255u}; 902 uint8_t expected_color[4] = {255u, 255u, 0, 255u};
935 glClearColor(1.0, 1.0, 0, 1.0); 903 glClearColor(1.0, 1.0, 0, 1.0);
936 glClear(GL_COLOR_BUFFER_BIT); 904 glClear(GL_COLOR_BUFFER_BIT);
937 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); 905 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color, nullptr);
938 906
939 if (copy_type == TexImage) { 907 if (copy_type == TexImage) {
940 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA, 908 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA,
941 GL_UNSIGNED_BYTE, false, false, false); 909 GL_UNSIGNED_BYTE, false, false, false);
942 } else { 910 } else {
943 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, 0, 911 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, 0,
944 0, 1, 1, false, false, false); 912 0, 1, 1, false, false, false);
945 } 913 }
946 EXPECT_TRUE(GL_NO_ERROR == glGetError()); 914 EXPECT_TRUE(GL_NO_ERROR == glGetError());
947 915
948 EXPECT_TRUE(glIsFramebuffer(framebuffer_id)); 916 EXPECT_TRUE(glIsFramebuffer(framebuffer_id));
949 917
950 // Ensure that reading from the framebuffer produces correct pixels. 918 // Ensure that reading from the framebuffer produces correct pixels.
951 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); 919 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color, nullptr);
952 920
953 uint8_t expected_color2[4] = {255u, 0, 255u, 255u}; 921 uint8_t expected_color2[4] = {255u, 0, 255u, 255u};
954 glClearColor(1.0, 0, 1.0, 1.0); 922 glClearColor(1.0, 0, 1.0, 1.0);
955 glClear(GL_COLOR_BUFFER_BIT); 923 glClear(GL_COLOR_BUFFER_BIT);
956 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color2); 924 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color2, nullptr);
957 925
958 GLint bound_fbo = 0; 926 GLint bound_fbo = 0;
959 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &bound_fbo); 927 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &bound_fbo);
960 EXPECT_EQ(framebuffer_id, static_cast<GLuint>(bound_fbo)); 928 EXPECT_EQ(framebuffer_id, static_cast<GLuint>(bound_fbo));
961 929
962 GLint fbo_params = 0; 930 GLint fbo_params = 0;
963 glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 931 glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
964 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, 932 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE,
965 &fbo_params); 933 &fbo_params);
966 EXPECT_EQ(GL_TEXTURE, fbo_params); 934 EXPECT_EQ(GL_TEXTURE, fbo_params);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 GLTestHelper::SetupUnitQuad(position_loc); 1003 GLTestHelper::SetupUnitQuad(position_loc);
1036 1004
1037 // test using program before 1005 // test using program before
1038 uint8_t expected[] = { 1006 uint8_t expected[] = {
1039 0, 255, 0, 255, 1007 0, 255, 0, 255,
1040 }; 1008 };
1041 uint8_t zero[] = { 1009 uint8_t zero[] = {
1042 0, 0, 0, 0, 1010 0, 0, 0, 0,
1043 }; 1011 };
1044 glClear(GL_COLOR_BUFFER_BIT); 1012 glClear(GL_COLOR_BUFFER_BIT);
1045 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); 1013 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero, nullptr));
1046 glDrawArrays(GL_TRIANGLES, 0, 6); 1014 glDrawArrays(GL_TRIANGLES, 0, 6);
1047 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); 1015 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected, nullptr));
1048 1016
1049 // Call copyTextureCHROMIUM 1017 // Call copyTextureCHROMIUM
1050 uint8_t pixels[1 * 4] = {255u, 0u, 0u, 255u}; 1018 uint8_t pixels[1 * 4] = {255u, 0u, 0u, 255u};
1051 glBindTexture(GL_TEXTURE_2D, textures_[0]); 1019 glBindTexture(GL_TEXTURE_2D, textures_[0]);
1052 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 1020 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
1053 pixels); 1021 pixels);
1054 if (copy_type == TexImage) { 1022 if (copy_type == TexImage) {
1055 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA, 1023 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA,
1056 GL_UNSIGNED_BYTE, false, false, false); 1024 GL_UNSIGNED_BYTE, false, false, false);
1057 } else { 1025 } else {
1058 glBindTexture(GL_TEXTURE_2D, textures_[1]); 1026 glBindTexture(GL_TEXTURE_2D, textures_[1]);
1059 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 1027 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
1060 nullptr); 1028 nullptr);
1061 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, 0, 1029 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, 0,
1062 0, 1, 1, false, false, false); 1030 0, 1, 1, false, false, false);
1063 } 1031 }
1064 1032
1065 // test using program after 1033 // test using program after
1066 glClear(GL_COLOR_BUFFER_BIT); 1034 glClear(GL_COLOR_BUFFER_BIT);
1067 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); 1035 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero, nullptr));
1068 glDrawArrays(GL_TRIANGLES, 0, 6); 1036 glDrawArrays(GL_TRIANGLES, 0, 6);
1069 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); 1037 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected, nullptr));
1070 1038
1071 glDeleteTextures(2, textures_); 1039 glDeleteTextures(2, textures_);
1072 glDeleteFramebuffers(1, &framebuffer_id_); 1040 glDeleteFramebuffers(1, &framebuffer_id_);
1073 1041
1074 EXPECT_TRUE(GL_NO_ERROR == glGetError()); 1042 EXPECT_TRUE(GL_NO_ERROR == glGetError());
1075 1043
1076 gl2.MakeCurrent(); 1044 gl2.MakeCurrent();
1077 gl2.Destroy(); 1045 gl2.Destroy();
1078 gl_.MakeCurrent(); 1046 gl_.MakeCurrent();
1079 } 1047 }
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 EXPECT_EQ(framebuffer_id_, fb_id); 1213 EXPECT_EQ(framebuffer_id_, fb_id);
1246 1214
1247 // Check that FB is complete. 1215 // Check that FB is complete.
1248 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), 1216 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE),
1249 glCheckFramebufferStatus(GL_FRAMEBUFFER)); 1217 glCheckFramebufferStatus(GL_FRAMEBUFFER));
1250 1218
1251 uint8_t transparent[1 * 4] = {0u, 0u, 0u, 0u}; 1219 uint8_t transparent[1 * 4] = {0u, 0u, 0u, 0u};
1252 uint8_t red[1 * 4] = {255u, 0u, 0u, 255u}; 1220 uint8_t red[1 * 4] = {255u, 0u, 0u, 255u};
1253 uint8_t green[1 * 4] = {0u, 255u, 0u, 255u}; 1221 uint8_t green[1 * 4] = {0u, 255u, 0u, 255u};
1254 uint8_t blue[1 * 4] = {0u, 0u, 255u, 255u}; 1222 uint8_t blue[1 * 4] = {0u, 0u, 255u, 255u};
1255 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, transparent); 1223 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, transparent, nullptr);
1256 GLTestHelper::CheckPixels(1, 1, 1, 1, 0, red); 1224 GLTestHelper::CheckPixels(1, 1, 1, 1, 0, red, nullptr);
1257 GLTestHelper::CheckPixels(1, 0, 1, 1, 0, green); 1225 GLTestHelper::CheckPixels(1, 0, 1, 1, 0, green, nullptr);
1258 GLTestHelper::CheckPixels(0, 1, 1, 1, 0, blue); 1226 GLTestHelper::CheckPixels(0, 1, 1, 1, 0, blue, nullptr);
1259 EXPECT_TRUE(GL_NO_ERROR == glGetError()); 1227 EXPECT_TRUE(GL_NO_ERROR == glGetError());
1260 1228
1261 glDeleteTextures(2, textures_); 1229 glDeleteTextures(2, textures_);
1262 glDeleteFramebuffers(1, &framebuffer_id_); 1230 glDeleteFramebuffers(1, &framebuffer_id_);
1263 } 1231 }
1264 1232
1265 TEST_F(GLCopyTextureCHROMIUMTest, CopyTextureBetweenTexture2DAndRectangleArb) { 1233 TEST_F(GLCopyTextureCHROMIUMTest, CopyTextureBetweenTexture2DAndRectangleArb) {
1266 if (!GLTestHelper::HasExtension("GL_ARB_texture_rectangle")) { 1234 if (!GLTestHelper::HasExtension("GL_ARB_texture_rectangle")) {
1267 LOG(INFO) << 1235 LOG(INFO) <<
1268 "GL_ARB_texture_rectangle not supported. Skipping test..."; 1236 "GL_ARB_texture_rectangle not supported. Skipping test...";
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 glClear(GL_COLOR_BUFFER_BIT); 1295 glClear(GL_COLOR_BUFFER_BIT);
1328 glCopySubTextureCHROMIUM(textures_[0], textures_[1], copy_region_x, 1296 glCopySubTextureCHROMIUM(textures_[0], textures_[1], copy_region_x,
1329 copy_region_y, 13, 6, copy_region_width, 1297 copy_region_y, 13, 6, copy_region_width,
1330 copy_region_height, false, false, false); 1298 copy_region_height, false, false, false);
1331 EXPECT_TRUE(GL_NO_ERROR == glGetError()); 1299 EXPECT_TRUE(GL_NO_ERROR == glGetError());
1332 1300
1333 for (GLint x = 0; x < dest_width; ++x) { 1301 for (GLint x = 0; x < dest_width; ++x) {
1334 for (GLint y = 0; y < dest_height; ++y) { 1302 for (GLint y = 0; y < dest_height; ++y) {
1335 if (x < copy_region_x || x >= copy_region_x + copy_region_width || 1303 if (x < copy_region_x || x >= copy_region_x + copy_region_width ||
1336 y < copy_region_y || y >= copy_region_y + copy_region_height) { 1304 y < copy_region_y || y >= copy_region_y + copy_region_height) {
1337 GLTestHelper::CheckPixels(x, y, 1, 1, 0, grey); 1305 GLTestHelper::CheckPixels(x, y, 1, 1, 0, grey, nullptr);
1338 continue; 1306 continue;
1339 } 1307 }
1340 1308
1341 uint8_t* expected_color; 1309 uint8_t* expected_color;
1342 if (x < copy_region_x + 2) { 1310 if (x < copy_region_x + 2) {
1343 expected_color = y < copy_region_y + 1 ? red : green; 1311 expected_color = y < copy_region_y + 1 ? red : green;
1344 } else { 1312 } else {
1345 expected_color = y < copy_region_y + 1 ? blue : white; 1313 expected_color = y < copy_region_y + 1 ? blue : white;
1346 } 1314 }
1347 GLTestHelper::CheckPixels(x, y, 1, 1, 0, expected_color); 1315 GLTestHelper::CheckPixels(x, y, 1, 1, 0, expected_color, nullptr);
1348 } 1316 }
1349 } 1317 }
1350 1318
1351 glDeleteTextures(2, textures_); 1319 glDeleteTextures(2, textures_);
1352 glDeleteFramebuffers(1, &framebuffer_id_); 1320 glDeleteFramebuffers(1, &framebuffer_id_);
1353 } 1321 }
1354 } 1322 }
1355 } 1323 }
1356 1324
1357 } // namespace gpu 1325 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698