| OLD | NEW |
| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // Check the FB is still bound. | 336 // Check the FB is still bound. |
| 337 GLint value = 0; | 337 GLint value = 0; |
| 338 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); | 338 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); |
| 339 GLuint fb_id = value; | 339 GLuint fb_id = value; |
| 340 EXPECT_EQ(framebuffer_id_, fb_id); | 340 EXPECT_EQ(framebuffer_id_, fb_id); |
| 341 | 341 |
| 342 // Check that FB is complete. | 342 // Check that FB is complete. |
| 343 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 343 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 344 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 344 glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
| 345 | 345 |
| 346 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels); | 346 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels, nullptr); |
| 347 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 347 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 348 } | 348 } |
| 349 | 349 |
| 350 TEST_P(GLCopyTextureCHROMIUMES3Test, FormatCombinations) { | 350 TEST_P(GLCopyTextureCHROMIUMES3Test, FormatCombinations) { |
| 351 if (ShouldSkipTest()) | 351 if (ShouldSkipTest()) |
| 352 return; | 352 return; |
| 353 CopyType copy_type = GetParam(); | 353 CopyType copy_type = GetParam(); |
| 354 | 354 |
| 355 struct FormatType { | 355 struct FormatType { |
| 356 GLenum internal_format; | 356 GLenum internal_format; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 glBindTexture(GL_TEXTURE_2D, texture); | 487 glBindTexture(GL_TEXTURE_2D, texture); |
| 488 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | 488 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 489 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | 489 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 490 CreateBackingForTexture(GL_TEXTURE_2D, kWidth, kHeight); | 490 CreateBackingForTexture(GL_TEXTURE_2D, kWidth, kHeight); |
| 491 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 491 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| 492 GL_TEXTURE_2D, texture, 0); | 492 GL_TEXTURE_2D, texture, 0); |
| 493 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 493 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 494 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 494 glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
| 495 glViewport(0, 0, kWidth, kHeight); | 495 glViewport(0, 0, kWidth, kHeight); |
| 496 | 496 |
| 497 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
| 497 std::string fragment_shader_source = | 498 std::string fragment_shader_source = |
| 498 GetFragmentShaderSource(dest_format_type.internal_format); | 499 GetFragmentShaderSource(dest_format_type.internal_format); |
| 499 GLuint program = GLTestHelper::LoadProgram( | 500 GLTestHelper::DrawTextureQuad(kSimpleVertexShaderES3, |
| 500 kSimpleVertexShaderES3, fragment_shader_source.c_str()); | 501 fragment_shader_source.c_str(), |
| 501 EXPECT_NE(program, 0u); | 502 "a_position", "u_texture"); |
| 502 GLint position_loc = glGetAttribLocation(program, "a_position"); | |
| 503 GLint texture_loc = glGetUniformLocation(program, "u_texture"); | |
| 504 ASSERT_NE(position_loc, -1); | |
| 505 ASSERT_NE(texture_loc, -1); | |
| 506 glUseProgram(program); | |
| 507 | 503 |
| 508 GLuint vbo = GLTestHelper::SetupUnitQuad(position_loc); | 504 uint8_t tolerance = dest_format_type.internal_format == GL_RGBA4 ? 20 : 7; |
| 509 ASSERT_NE(vbo, 0u); | 505 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, kWidth, kHeight, tolerance, |
| 510 | 506 expected_color, mask)) |
| 511 glActiveTexture(GL_TEXTURE0); | 507 << " src_internal_format: " |
| 512 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 508 << gles2::GLES2Util::GetStringEnum(src_format_type.internal_format) |
| 513 | 509 << " dest_internal_format: " |
| 514 glDrawArrays(GL_TRIANGLES, 0, 6); | 510 << gles2::GLES2Util::GetStringEnum(dest_format_type.internal_format); |
| 515 | |
| 516 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 511 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 517 | 512 |
| 518 GLsizei size = kWidth * kHeight * 4; | |
| 519 std::unique_ptr<uint8_t[]> result(new uint8_t[size]); | |
| 520 glReadPixels(0, 0, kWidth, kHeight, GL_RGBA, GL_UNSIGNED_BYTE, | |
| 521 result.get()); | |
| 522 uint8_t tolerance = dest_format_type.internal_format == GL_RGBA4 ? 20 : 7; | |
| 523 for (GLint yy = 0; yy < kHeight; ++yy) { | |
| 524 for (GLint xx = 0; xx < kWidth; ++xx) { | |
| 525 int offset = yy * kWidth * 4 + xx * 4; | |
| 526 for (int jj = 0; jj < 4; ++jj) { | |
| 527 uint8_t actual = result[offset + jj]; | |
| 528 uint8_t expected = expected_color[jj]; | |
| 529 int diff = actual - expected; | |
| 530 diff = diff < 0 ? -diff : diff; | |
| 531 if (mask[jj] && diff > tolerance) { | |
| 532 EXPECT_EQ(expected, actual) | |
| 533 << " at " << xx << ", " << yy << " channel " << jj | |
| 534 << " src_internal_format: " | |
| 535 << gles2::GLES2Util::GetStringEnum( | |
| 536 src_format_type.internal_format) | |
| 537 << " dest_internal_format: " | |
| 538 << gles2::GLES2Util::GetStringEnum( | |
| 539 dest_format_type.internal_format); | |
| 540 } | |
| 541 } | |
| 542 } | |
| 543 } | |
| 544 | |
| 545 glDeleteTextures(1, &texture); | 513 glDeleteTextures(1, &texture); |
| 546 glDeleteFramebuffers(1, &framebuffer); | 514 glDeleteFramebuffers(1, &framebuffer); |
| 547 glDeleteTextures(2, textures_); | 515 glDeleteTextures(2, textures_); |
| 548 glDeleteFramebuffers(1, &framebuffer_id_); | 516 glDeleteFramebuffers(1, &framebuffer_id_); |
| 549 } | 517 } |
| 550 } | 518 } |
| 551 } | 519 } |
| 552 | 520 |
| 553 TEST_P(GLCopyTextureCHROMIUMTest, ImmutableTexture) { | 521 TEST_P(GLCopyTextureCHROMIUMTest, ImmutableTexture) { |
| 554 if (!GLTestHelper::HasExtension("GL_EXT_texture_storage")) { | 522 if (!GLTestHelper::HasExtension("GL_EXT_texture_storage")) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 // Check the FB is still bound. | 560 // Check the FB is still bound. |
| 593 GLint value = 0; | 561 GLint value = 0; |
| 594 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); | 562 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); |
| 595 GLuint fb_id = value; | 563 GLuint fb_id = value; |
| 596 EXPECT_EQ(framebuffer_id_, fb_id); | 564 EXPECT_EQ(framebuffer_id_, fb_id); |
| 597 | 565 |
| 598 // Check that FB is complete. | 566 // Check that FB is complete. |
| 599 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 567 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 600 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 568 glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
| 601 | 569 |
| 602 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels); | 570 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels, nullptr); |
| 603 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 571 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 604 } | 572 } |
| 605 } | 573 } |
| 606 } | 574 } |
| 607 } | 575 } |
| 608 | 576 |
| 609 TEST_P(GLCopyTextureCHROMIUMTest, InternalFormat) { | 577 TEST_P(GLCopyTextureCHROMIUMTest, InternalFormat) { |
| 610 CopyType copy_type = GetParam(); | 578 CopyType copy_type = GetParam(); |
| 611 GLint src_formats[] = {GL_ALPHA, GL_RGB, GL_RGBA, | 579 GLint src_formats[] = {GL_ALPHA, GL_RGB, GL_RGBA, |
| 612 GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_BGRA_EXT}; | 580 GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_BGRA_EXT}; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 // Check the FB is still bound. | 706 // Check the FB is still bound. |
| 739 GLint value = 0; | 707 GLint value = 0; |
| 740 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); | 708 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); |
| 741 GLuint fb_id = value; | 709 GLuint fb_id = value; |
| 742 EXPECT_EQ(framebuffer_id_, fb_id); | 710 EXPECT_EQ(framebuffer_id_, fb_id); |
| 743 | 711 |
| 744 // Check that FB is complete. | 712 // Check that FB is complete. |
| 745 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 713 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 746 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 714 glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
| 747 | 715 |
| 748 GLTestHelper::CheckPixels(1, 1, 1, 1, 0, &pixels[12]); | 716 GLTestHelper::CheckPixels(1, 1, 1, 1, 0, &pixels[12], nullptr); |
| 749 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 717 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 750 } | 718 } |
| 751 | 719 |
| 752 namespace { | 720 namespace { |
| 753 | 721 |
| 754 void glEnableDisable(GLint param, GLboolean value) { | 722 void glEnableDisable(GLint param, GLboolean value) { |
| 755 if (value) | 723 if (value) |
| 756 glEnable(param); | 724 glEnable(param); |
| 757 else | 725 else |
| 758 glDisable(param); | 726 glDisable(param); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 texture_id, 0); | 881 texture_id, 0); |
| 914 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, | 882 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, |
| 915 GL_RENDERBUFFER, renderbuffer_id); | 883 GL_RENDERBUFFER, renderbuffer_id); |
| 916 EXPECT_TRUE( | 884 EXPECT_TRUE( |
| 917 GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 885 GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
| 918 | 886 |
| 919 // Test that we can write to the bound framebuffer | 887 // Test that we can write to the bound framebuffer |
| 920 uint8_t expected_color[4] = {255u, 255u, 0, 255u}; | 888 uint8_t expected_color[4] = {255u, 255u, 0, 255u}; |
| 921 glClearColor(1.0, 1.0, 0, 1.0); | 889 glClearColor(1.0, 1.0, 0, 1.0); |
| 922 glClear(GL_COLOR_BUFFER_BIT); | 890 glClear(GL_COLOR_BUFFER_BIT); |
| 923 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); | 891 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color, nullptr); |
| 924 | 892 |
| 925 if (copy_type == TexImage) { | 893 if (copy_type == TexImage) { |
| 926 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA, | 894 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA, |
| 927 GL_UNSIGNED_BYTE, false, false, false); | 895 GL_UNSIGNED_BYTE, false, false, false); |
| 928 } else { | 896 } else { |
| 929 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, 0, | 897 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, 0, |
| 930 0, 1, 1, false, false, false); | 898 0, 1, 1, false, false, false); |
| 931 } | 899 } |
| 932 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 900 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 933 | 901 |
| 934 EXPECT_TRUE(glIsFramebuffer(framebuffer_id)); | 902 EXPECT_TRUE(glIsFramebuffer(framebuffer_id)); |
| 935 | 903 |
| 936 // Ensure that reading from the framebuffer produces correct pixels. | 904 // Ensure that reading from the framebuffer produces correct pixels. |
| 937 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); | 905 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color, nullptr); |
| 938 | 906 |
| 939 uint8_t expected_color2[4] = {255u, 0, 255u, 255u}; | 907 uint8_t expected_color2[4] = {255u, 0, 255u, 255u}; |
| 940 glClearColor(1.0, 0, 1.0, 1.0); | 908 glClearColor(1.0, 0, 1.0, 1.0); |
| 941 glClear(GL_COLOR_BUFFER_BIT); | 909 glClear(GL_COLOR_BUFFER_BIT); |
| 942 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color2); | 910 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color2, nullptr); |
| 943 | 911 |
| 944 GLint bound_fbo = 0; | 912 GLint bound_fbo = 0; |
| 945 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &bound_fbo); | 913 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &bound_fbo); |
| 946 EXPECT_EQ(framebuffer_id, static_cast<GLuint>(bound_fbo)); | 914 EXPECT_EQ(framebuffer_id, static_cast<GLuint>(bound_fbo)); |
| 947 | 915 |
| 948 GLint fbo_params = 0; | 916 GLint fbo_params = 0; |
| 949 glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 917 glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| 950 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, | 918 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, |
| 951 &fbo_params); | 919 &fbo_params); |
| 952 EXPECT_EQ(GL_TEXTURE, fbo_params); | 920 EXPECT_EQ(GL_TEXTURE, fbo_params); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 GLTestHelper::SetupUnitQuad(position_loc); | 987 GLTestHelper::SetupUnitQuad(position_loc); |
| 1020 | 988 |
| 1021 // test using program before | 989 // test using program before |
| 1022 uint8_t expected[] = { | 990 uint8_t expected[] = { |
| 1023 0, 255, 0, 255, | 991 0, 255, 0, 255, |
| 1024 }; | 992 }; |
| 1025 uint8_t zero[] = { | 993 uint8_t zero[] = { |
| 1026 0, 0, 0, 0, | 994 0, 0, 0, 0, |
| 1027 }; | 995 }; |
| 1028 glClear(GL_COLOR_BUFFER_BIT); | 996 glClear(GL_COLOR_BUFFER_BIT); |
| 1029 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); | 997 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero, nullptr)); |
| 1030 glDrawArrays(GL_TRIANGLES, 0, 6); | 998 glDrawArrays(GL_TRIANGLES, 0, 6); |
| 1031 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); | 999 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected, nullptr)); |
| 1032 | 1000 |
| 1033 // Call copyTextureCHROMIUM | 1001 // Call copyTextureCHROMIUM |
| 1034 uint8_t pixels[1 * 4] = {255u, 0u, 0u, 255u}; | 1002 uint8_t pixels[1 * 4] = {255u, 0u, 0u, 255u}; |
| 1035 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 1003 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
| 1036 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 1004 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 1037 pixels); | 1005 pixels); |
| 1038 if (copy_type == TexImage) { | 1006 if (copy_type == TexImage) { |
| 1039 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA, | 1007 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA, |
| 1040 GL_UNSIGNED_BYTE, false, false, false); | 1008 GL_UNSIGNED_BYTE, false, false, false); |
| 1041 } else { | 1009 } else { |
| 1042 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 1010 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
| 1043 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 1011 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 1044 nullptr); | 1012 nullptr); |
| 1045 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, 0, | 1013 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, 0, |
| 1046 0, 1, 1, false, false, false); | 1014 0, 1, 1, false, false, false); |
| 1047 } | 1015 } |
| 1048 | 1016 |
| 1049 // test using program after | 1017 // test using program after |
| 1050 glClear(GL_COLOR_BUFFER_BIT); | 1018 glClear(GL_COLOR_BUFFER_BIT); |
| 1051 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); | 1019 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero, nullptr)); |
| 1052 glDrawArrays(GL_TRIANGLES, 0, 6); | 1020 glDrawArrays(GL_TRIANGLES, 0, 6); |
| 1053 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); | 1021 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected, nullptr)); |
| 1054 | 1022 |
| 1055 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 1023 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 1056 | 1024 |
| 1057 gl2.MakeCurrent(); | 1025 gl2.MakeCurrent(); |
| 1058 gl2.Destroy(); | 1026 gl2.Destroy(); |
| 1059 gl_.MakeCurrent(); | 1027 gl_.MakeCurrent(); |
| 1060 } | 1028 } |
| 1061 | 1029 |
| 1062 // Test that glCopyTextureCHROMIUM doesn't leak uninitialized textures. | 1030 // Test that glCopyTextureCHROMIUM doesn't leak uninitialized textures. |
| 1063 TEST_P(GLCopyTextureCHROMIUMTest, UninitializedSource) { | 1031 TEST_P(GLCopyTextureCHROMIUMTest, UninitializedSource) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 EXPECT_EQ(framebuffer_id_, fb_id); | 1177 EXPECT_EQ(framebuffer_id_, fb_id); |
| 1210 | 1178 |
| 1211 // Check that FB is complete. | 1179 // Check that FB is complete. |
| 1212 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 1180 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 1213 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 1181 glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
| 1214 | 1182 |
| 1215 uint8_t transparent[1 * 4] = {0u, 0u, 0u, 0u}; | 1183 uint8_t transparent[1 * 4] = {0u, 0u, 0u, 0u}; |
| 1216 uint8_t red[1 * 4] = {255u, 0u, 0u, 255u}; | 1184 uint8_t red[1 * 4] = {255u, 0u, 0u, 255u}; |
| 1217 uint8_t green[1 * 4] = {0u, 255u, 0u, 255u}; | 1185 uint8_t green[1 * 4] = {0u, 255u, 0u, 255u}; |
| 1218 uint8_t blue[1 * 4] = {0u, 0u, 255u, 255u}; | 1186 uint8_t blue[1 * 4] = {0u, 0u, 255u, 255u}; |
| 1219 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, transparent); | 1187 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, transparent, nullptr); |
| 1220 GLTestHelper::CheckPixels(1, 1, 1, 1, 0, red); | 1188 GLTestHelper::CheckPixels(1, 1, 1, 1, 0, red, nullptr); |
| 1221 GLTestHelper::CheckPixels(1, 0, 1, 1, 0, green); | 1189 GLTestHelper::CheckPixels(1, 0, 1, 1, 0, green, nullptr); |
| 1222 GLTestHelper::CheckPixels(0, 1, 1, 1, 0, blue); | 1190 GLTestHelper::CheckPixels(0, 1, 1, 1, 0, blue, nullptr); |
| 1223 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 1191 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 1224 } | 1192 } |
| 1225 | 1193 |
| 1226 TEST_F(GLCopyTextureCHROMIUMTest, CopyTextureBetweenTexture2DAndRectangleArb) { | 1194 TEST_F(GLCopyTextureCHROMIUMTest, CopyTextureBetweenTexture2DAndRectangleArb) { |
| 1227 if (!GLTestHelper::HasExtension("GL_ARB_texture_rectangle")) { | 1195 if (!GLTestHelper::HasExtension("GL_ARB_texture_rectangle")) { |
| 1228 LOG(INFO) << | 1196 LOG(INFO) << |
| 1229 "GL_ARB_texture_rectangle not supported. Skipping test..."; | 1197 "GL_ARB_texture_rectangle not supported. Skipping test..."; |
| 1230 return; | 1198 return; |
| 1231 } | 1199 } |
| 1232 | 1200 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 glClear(GL_COLOR_BUFFER_BIT); | 1261 glClear(GL_COLOR_BUFFER_BIT); |
| 1294 glCopySubTextureCHROMIUM(textures_[0], textures_[1], copy_region_x, | 1262 glCopySubTextureCHROMIUM(textures_[0], textures_[1], copy_region_x, |
| 1295 copy_region_y, 13, 6, copy_region_width, | 1263 copy_region_y, 13, 6, copy_region_width, |
| 1296 copy_region_height, false, false, false); | 1264 copy_region_height, false, false, false); |
| 1297 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 1265 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 1298 | 1266 |
| 1299 for (GLint x = 0; x < dest_width; ++x) { | 1267 for (GLint x = 0; x < dest_width; ++x) { |
| 1300 for (GLint y = 0; y < dest_height; ++y) { | 1268 for (GLint y = 0; y < dest_height; ++y) { |
| 1301 if (x < copy_region_x || x >= copy_region_x + copy_region_width || | 1269 if (x < copy_region_x || x >= copy_region_x + copy_region_width || |
| 1302 y < copy_region_y || y >= copy_region_y + copy_region_height) { | 1270 y < copy_region_y || y >= copy_region_y + copy_region_height) { |
| 1303 GLTestHelper::CheckPixels(x, y, 1, 1, 0, grey); | 1271 GLTestHelper::CheckPixels(x, y, 1, 1, 0, grey, nullptr); |
| 1304 continue; | 1272 continue; |
| 1305 } | 1273 } |
| 1306 | 1274 |
| 1307 uint8_t* expected_color; | 1275 uint8_t* expected_color; |
| 1308 if (x < copy_region_x + 2) { | 1276 if (x < copy_region_x + 2) { |
| 1309 expected_color = y < copy_region_y + 1 ? red : green; | 1277 expected_color = y < copy_region_y + 1 ? red : green; |
| 1310 } else { | 1278 } else { |
| 1311 expected_color = y < copy_region_y + 1 ? blue : white; | 1279 expected_color = y < copy_region_y + 1 ? blue : white; |
| 1312 } | 1280 } |
| 1313 GLTestHelper::CheckPixels(x, y, 1, 1, 0, expected_color); | 1281 GLTestHelper::CheckPixels(x, y, 1, 1, 0, expected_color, nullptr); |
| 1314 } | 1282 } |
| 1315 } | 1283 } |
| 1316 } | 1284 } |
| 1317 } | 1285 } |
| 1318 } | 1286 } |
| 1319 | 1287 |
| 1320 } // namespace gpu | 1288 } // namespace gpu |
| OLD | NEW |