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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc

Issue 2443553002: Create correct GLES3 context for GLES3 unittest (Closed)
Patch Set: remove context_type since it is equivalent to enable_es3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 GenerateMipmap cmd; 72 GenerateMipmap cmd;
73 cmd.Init(GL_TEXTURE_2D); 73 cmd.Init(GL_TEXTURE_2D);
74 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 74 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
75 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 75 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
76 } 76 }
77 77
78 TEST_P(GLES2DecoderTest, GenerateMipmapHandlesOutOfMemory) { 78 TEST_P(GLES2DecoderTest, GenerateMipmapHandlesOutOfMemory) {
79 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 79 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
80 TextureManager* manager = group().texture_manager(); 80 TextureManager* manager = group().texture_manager();
81 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); 81 TextureRef* texture_ref = manager->GetTexture(client_texture_id_);
82 ASSERT_TRUE(texture_ref != NULL); 82 ASSERT_TRUE(texture_ref != nullptr);
83 Texture* texture = texture_ref->texture(); 83 Texture* texture = texture_ref->texture();
84 GLint width = 0; 84 GLint width = 0;
85 GLint height = 0; 85 GLint height = 0;
86 EXPECT_FALSE( 86 EXPECT_FALSE(
87 texture->GetLevelSize(GL_TEXTURE_2D, 2, &width, &height, nullptr)); 87 texture->GetLevelSize(GL_TEXTURE_2D, 2, &width, &height, nullptr));
88 DoTexImage2D(GL_TEXTURE_2D, 88 DoTexImage2D(GL_TEXTURE_2D,
89 0, 89 0,
90 GL_RGBA, 90 GL_RGBA,
91 16, 91 16,
92 16, 92 16,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 .RetiresOnSaturation(); 151 .RetiresOnSaturation();
152 GenerateMipmap cmd; 152 GenerateMipmap cmd;
153 cmd.Init(GL_TEXTURE_2D); 153 cmd.Init(GL_TEXTURE_2D);
154 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 154 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
155 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 155 EXPECT_EQ(GL_NO_ERROR, GetGLError());
156 } 156 }
157 157
158 // Same as GenerateMipmapClearsUnclearedTexture, but with workaround 158 // Same as GenerateMipmapClearsUnclearedTexture, but with workaround
159 // |set_texture_filters_before_generating_mipmap|. 159 // |set_texture_filters_before_generating_mipmap|.
160 TEST_P(GLES2DecoderManualInitTest, SetTextureFiltersBeforeGenerateMipmap) { 160 TEST_P(GLES2DecoderManualInitTest, SetTextureFiltersBeforeGenerateMipmap) {
161 base::CommandLine command_line(0, NULL); 161 base::CommandLine command_line(0, nullptr);
162 command_line.AppendSwitchASCII( 162 command_line.AppendSwitchASCII(
163 switches::kGpuDriverBugWorkarounds, 163 switches::kGpuDriverBugWorkarounds,
164 base::IntToString(gpu::SET_TEXTURE_FILTER_BEFORE_GENERATING_MIPMAP)); 164 base::IntToString(gpu::SET_TEXTURE_FILTER_BEFORE_GENERATING_MIPMAP));
165 InitState init; 165 InitState init;
166 init.bind_generates_resource = true; 166 init.bind_generates_resource = true;
167 InitDecoderWithCommandLine(init, &command_line); 167 InitDecoderWithCommandLine(init, &command_line);
168 168
169 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)).Times(0); 169 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)).Times(0);
170 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 170 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
171 DoTexImage2D( 171 DoTexImage2D(
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 GLint level = 0; 666 GLint level = 0;
667 GLenum internal_format = GL_RGBA; 667 GLenum internal_format = GL_RGBA;
668 GLsizei width = 2; 668 GLsizei width = 2;
669 GLsizei height = 4; 669 GLsizei height = 4;
670 GLint border = 0; 670 GLint border = 0;
671 GLenum format = GL_RGBA; 671 GLenum format = GL_RGBA;
672 GLenum type = GL_UNSIGNED_BYTE; 672 GLenum type = GL_UNSIGNED_BYTE;
673 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 673 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
674 TextureManager* manager = group().texture_manager(); 674 TextureManager* manager = group().texture_manager();
675 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); 675 TextureRef* texture_ref = manager->GetTexture(client_texture_id_);
676 ASSERT_TRUE(texture_ref != NULL); 676 ASSERT_TRUE(texture_ref != nullptr);
677 Texture* texture = texture_ref->texture(); 677 Texture* texture = texture_ref->texture();
678 EXPECT_FALSE( 678 EXPECT_FALSE(
679 texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height, nullptr)); 679 texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height, nullptr));
680 EXPECT_CALL(*gl_, GetError()) 680 EXPECT_CALL(*gl_, GetError())
681 .WillOnce(Return(GL_NO_ERROR)) 681 .WillOnce(Return(GL_NO_ERROR))
682 .WillOnce(Return(GL_OUT_OF_MEMORY)) 682 .WillOnce(Return(GL_OUT_OF_MEMORY))
683 .RetiresOnSaturation(); 683 .RetiresOnSaturation();
684 EXPECT_CALL(*gl_, 684 EXPECT_CALL(*gl_,
685 TexImage2D(target, 685 TexImage2D(target,
686 level, 686 level,
(...skipping 25 matching lines...) Expand all
712 TEST_P(GLES2DecoderTest, CopyTexImage2DGLError) { 712 TEST_P(GLES2DecoderTest, CopyTexImage2DGLError) {
713 GLenum target = GL_TEXTURE_2D; 713 GLenum target = GL_TEXTURE_2D;
714 GLint level = 0; 714 GLint level = 0;
715 GLenum internal_format = GL_RGBA; 715 GLenum internal_format = GL_RGBA;
716 GLsizei width = 2; 716 GLsizei width = 2;
717 GLsizei height = 4; 717 GLsizei height = 4;
718 GLint border = 0; 718 GLint border = 0;
719 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 719 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
720 TextureManager* manager = group().texture_manager(); 720 TextureManager* manager = group().texture_manager();
721 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); 721 TextureRef* texture_ref = manager->GetTexture(client_texture_id_);
722 ASSERT_TRUE(texture_ref != NULL); 722 ASSERT_TRUE(texture_ref != nullptr);
723 Texture* texture = texture_ref->texture(); 723 Texture* texture = texture_ref->texture();
724 EXPECT_FALSE( 724 EXPECT_FALSE(
725 texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height, nullptr)); 725 texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height, nullptr));
726 EXPECT_CALL(*gl_, GetError()) 726 EXPECT_CALL(*gl_, GetError())
727 .WillOnce(Return(GL_NO_ERROR)) 727 .WillOnce(Return(GL_NO_ERROR))
728 .WillOnce(Return(GL_OUT_OF_MEMORY)) 728 .WillOnce(Return(GL_OUT_OF_MEMORY))
729 .RetiresOnSaturation(); 729 .RetiresOnSaturation();
730 EXPECT_CALL(*gl_, 730 EXPECT_CALL(*gl_,
731 CopyTexImage2D( 731 CopyTexImage2D(
732 target, level, internal_format, 0, 0, width, height, border)) 732 target, level, internal_format, 0, 0, width, height, border))
733 .Times(1) 733 .Times(1)
734 .RetiresOnSaturation(); 734 .RetiresOnSaturation();
735 CopyTexImage2D cmd; 735 CopyTexImage2D cmd;
736 cmd.Init(target, level, internal_format, 0, 0, width, height); 736 cmd.Init(target, level, internal_format, 0, 0, width, height);
737 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 737 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
738 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); 738 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError());
739 EXPECT_FALSE( 739 EXPECT_FALSE(
740 texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height, nullptr)); 740 texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height, nullptr));
741 } 741 }
742 742
743 TEST_P(GLES2DecoderManualInitTest, CopyTexImage2DUnsizedInternalFormat) { 743 TEST_P(GLES2DecoderManualInitTest, CopyTexImage2DUnsizedInternalFormat) {
744 base::CommandLine command_line(0, NULL); 744 base::CommandLine command_line(0, nullptr);
745 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs); 745 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs);
746 InitState init; 746 InitState init;
747 init.gl_version = "OpenGL ES 3.0"; 747 init.gl_version = "OpenGL ES 3.0";
748 init.extensions = "GL_APPLE_texture_format_BGRA8888 GL_EXT_sRGB"; 748 init.extensions = "GL_APPLE_texture_format_BGRA8888 GL_EXT_sRGB";
749 init.has_alpha = true; 749 init.has_alpha = true;
750 init.request_alpha = true; 750 init.request_alpha = true;
751 init.bind_generates_resource = true; 751 init.bind_generates_resource = true;
752 init.context_type = CONTEXT_TYPE_OPENGLES2; 752 init.context_type = CONTEXT_TYPE_OPENGLES2;
753 InitDecoderWithCommandLine(init, &command_line); 753 InitDecoderWithCommandLine(init, &command_line);
754 754
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 825 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
826 if (complete) { 826 if (complete) {
827 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 827 EXPECT_EQ(GL_NO_ERROR, GetGLError());
828 } else { 828 } else {
829 EXPECT_EQ(GL_INVALID_FRAMEBUFFER_OPERATION, GetGLError()); 829 EXPECT_EQ(GL_INVALID_FRAMEBUFFER_OPERATION, GetGLError());
830 } 830 }
831 } 831 }
832 } 832 }
833 833
834 TEST_P(GLES2DecoderManualInitTest, CopyTexImage2DUnsizedInternalFormatES3) { 834 TEST_P(GLES2DecoderManualInitTest, CopyTexImage2DUnsizedInternalFormatES3) {
835 base::CommandLine command_line(0, NULL); 835 base::CommandLine command_line(0, nullptr);
836 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs); 836 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs);
837 InitState init; 837 InitState init;
838 init.gl_version = "OpenGL ES 3.0"; 838 init.gl_version = "OpenGL ES 3.0";
839 init.extensions = "GL_APPLE_texture_format_BGRA8888"; 839 init.extensions = "GL_APPLE_texture_format_BGRA8888";
840 init.has_alpha = true; 840 init.has_alpha = true;
841 init.request_alpha = true; 841 init.request_alpha = true;
842 init.bind_generates_resource = true; 842 init.bind_generates_resource = true;
843 init.context_type = CONTEXT_TYPE_OPENGLES3; 843 init.context_type = CONTEXT_TYPE_OPENGLES3;
844 InitDecoderWithCommandLine(init, &command_line); 844 InitDecoderWithCommandLine(init, &command_line);
845 845
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 const uint32_t kBucketId = 123; 933 const uint32_t kBucketId = 123;
934 const uint32_t kBadBucketId = 99; 934 const uint32_t kBadBucketId = 99;
935 const GLenum kTarget = GL_TEXTURE_2D_ARRAY; 935 const GLenum kTarget = GL_TEXTURE_2D_ARRAY;
936 const GLint kLevel = 0; 936 const GLint kLevel = 0;
937 const GLenum kInternalFormat = GL_COMPRESSED_R11_EAC; 937 const GLenum kInternalFormat = GL_COMPRESSED_R11_EAC;
938 const GLsizei kWidth = 4; 938 const GLsizei kWidth = 4;
939 const GLsizei kHeight = 4; 939 const GLsizei kHeight = 4;
940 const GLsizei kDepth = 4; 940 const GLsizei kDepth = 4;
941 const GLint kBorder = 0; 941 const GLint kBorder = 0;
942 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); 942 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId);
943 ASSERT_TRUE(bucket != NULL); 943 ASSERT_TRUE(bucket != nullptr);
944 const GLsizei kImageSize = 32; 944 const GLsizei kImageSize = 32;
945 bucket->SetSize(kImageSize); 945 bucket->SetSize(kImageSize);
946 946
947 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId); 947 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
948 948
949 CompressedTexImage3DBucket cmd; 949 CompressedTexImage3DBucket cmd;
950 cmd.Init(kTarget, 950 cmd.Init(kTarget,
951 kLevel, 951 kLevel,
952 kInternalFormat, 952 kInternalFormat,
953 kWidth, 953 kWidth,
(...skipping 26 matching lines...) Expand all
980 const uint32_t kBucketId = 123; 980 const uint32_t kBucketId = 123;
981 const uint32_t kBadBucketId = 99; 981 const uint32_t kBadBucketId = 99;
982 const GLenum kTarget = GL_TEXTURE_2D_ARRAY; 982 const GLenum kTarget = GL_TEXTURE_2D_ARRAY;
983 const GLint kLevel = 0; 983 const GLint kLevel = 0;
984 const GLenum kInternalFormat = GL_COMPRESSED_R11_EAC; 984 const GLenum kInternalFormat = GL_COMPRESSED_R11_EAC;
985 const GLsizei kWidth = 4; 985 const GLsizei kWidth = 4;
986 const GLsizei kHeight = 4; 986 const GLsizei kHeight = 4;
987 const GLsizei kDepth = 4; 987 const GLsizei kDepth = 4;
988 const GLint kBorder = 0; 988 const GLint kBorder = 0;
989 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); 989 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId);
990 ASSERT_TRUE(bucket != NULL); 990 ASSERT_TRUE(bucket != nullptr);
991 const GLsizei kImageSize = 0; 991 const GLsizei kImageSize = 0;
992 bucket->SetSize(kImageSize); 992 bucket->SetSize(kImageSize);
993 993
994 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId); 994 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
995 995
996 // Bad bucket 996 // Bad bucket
997 CompressedTexImage3DBucket cmd; 997 CompressedTexImage3DBucket cmd;
998 cmd.Init(kTarget, 998 cmd.Init(kTarget,
999 kLevel, 999 kLevel,
1000 kInternalFormat, 1000 kInternalFormat,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 1038
1039 TEST_P(GLES2DecoderTest, CompressedTexImage3DFailsOnES2) { 1039 TEST_P(GLES2DecoderTest, CompressedTexImage3DFailsOnES2) {
1040 const uint32_t kBucketId = 123; 1040 const uint32_t kBucketId = 123;
1041 const GLenum kTarget = GL_TEXTURE_2D_ARRAY; 1041 const GLenum kTarget = GL_TEXTURE_2D_ARRAY;
1042 const GLint kLevel = 0; 1042 const GLint kLevel = 0;
1043 const GLenum kInternalFormat = GL_COMPRESSED_R11_EAC; 1043 const GLenum kInternalFormat = GL_COMPRESSED_R11_EAC;
1044 const GLsizei kWidth = 4; 1044 const GLsizei kWidth = 4;
1045 const GLsizei kHeight = 4; 1045 const GLsizei kHeight = 4;
1046 const GLsizei kDepth = 4; 1046 const GLsizei kDepth = 4;
1047 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); 1047 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId);
1048 ASSERT_TRUE(bucket != NULL); 1048 ASSERT_TRUE(bucket != nullptr);
1049 const GLsizei kImageSize = 32; 1049 const GLsizei kImageSize = 32;
1050 bucket->SetSize(kImageSize); 1050 bucket->SetSize(kImageSize);
1051 1051
1052 { 1052 {
1053 CompressedTexImage3DBucket cmd; 1053 CompressedTexImage3DBucket cmd;
1054 cmd.Init(kTarget, 1054 cmd.Init(kTarget,
1055 kLevel, 1055 kLevel,
1056 kInternalFormat, 1056 kInternalFormat,
1057 kWidth, 1057 kWidth,
1058 kHeight, 1058 kHeight,
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 const GLsizei kDepth = 2; 1382 const GLsizei kDepth = 2;
1383 const GLenum kFormat = GL_RGB; 1383 const GLenum kFormat = GL_RGB;
1384 const GLenum kType = GL_UNSIGNED_BYTE; 1384 const GLenum kType = GL_UNSIGNED_BYTE;
1385 const uint32_t kBufferSize = kWidth * kHeight * kDepth * 4; 1385 const uint32_t kBufferSize = kWidth * kHeight * kDepth * 4;
1386 1386
1387 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId); 1387 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
1388 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0, 1388 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0,
1389 kFormat, kType, 0, 0); 1389 kFormat, kType, 0, 0);
1390 TextureRef* texture_ref = 1390 TextureRef* texture_ref =
1391 group().texture_manager()->GetTexture(client_texture_id_); 1391 group().texture_manager()->GetTexture(client_texture_id_);
1392 ASSERT_TRUE(texture_ref != NULL); 1392 ASSERT_TRUE(texture_ref != nullptr);
1393 Texture* texture = texture_ref->texture(); 1393 Texture* texture = texture_ref->texture();
1394 1394
1395 EXPECT_FALSE(texture->SafeToRenderFrom()); 1395 EXPECT_FALSE(texture->SafeToRenderFrom());
1396 EXPECT_FALSE(texture->IsLevelCleared(kTarget, kLevel)); 1396 EXPECT_FALSE(texture->IsLevelCleared(kTarget, kLevel));
1397 1397
1398 // CopyTexSubImage3D will clear the uncleared texture 1398 // CopyTexSubImage3D will clear the uncleared texture
1399 EXPECT_CALL(*gl_, GenBuffersARB(1, _)) 1399 EXPECT_CALL(*gl_, GenBuffersARB(1, _))
1400 .Times(1) 1400 .Times(1)
1401 .RetiresOnSaturation(); 1401 .RetiresOnSaturation();
1402 EXPECT_CALL(*gl_, BindBuffer(GL_PIXEL_UNPACK_BUFFER, _)) 1402 EXPECT_CALL(*gl_, BindBuffer(GL_PIXEL_UNPACK_BUFFER, _))
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 1442
1443 TEST_P(GLES3DecoderTest, CompressedTexImage3DFailsWithBadImageSize) { 1443 TEST_P(GLES3DecoderTest, CompressedTexImage3DFailsWithBadImageSize) {
1444 const uint32_t kBucketId = 123; 1444 const uint32_t kBucketId = 123;
1445 const GLenum kTarget = GL_TEXTURE_2D_ARRAY; 1445 const GLenum kTarget = GL_TEXTURE_2D_ARRAY;
1446 const GLint kLevel = 0; 1446 const GLint kLevel = 0;
1447 const GLenum kInternalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC; 1447 const GLenum kInternalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC;
1448 const GLsizei kWidth = 4; 1448 const GLsizei kWidth = 4;
1449 const GLsizei kHeight = 8; 1449 const GLsizei kHeight = 8;
1450 const GLsizei kDepth = 4; 1450 const GLsizei kDepth = 4;
1451 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); 1451 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId);
1452 ASSERT_TRUE(bucket != NULL); 1452 ASSERT_TRUE(bucket != nullptr);
1453 const GLsizei kBadImageSize = 64; 1453 const GLsizei kBadImageSize = 64;
1454 bucket->SetSize(kBadImageSize); 1454 bucket->SetSize(kBadImageSize);
1455 1455
1456 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId); 1456 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
1457 1457
1458 CompressedTexImage3DBucket cmd; 1458 CompressedTexImage3DBucket cmd;
1459 cmd.Init(kTarget, 1459 cmd.Init(kTarget,
1460 kLevel, 1460 kLevel,
1461 kInternalFormat, 1461 kInternalFormat,
1462 kWidth, 1462 kWidth,
1463 kHeight, 1463 kHeight,
1464 kDepth, 1464 kDepth,
1465 kBucketId); 1465 kBucketId);
1466 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1466 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1467 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); 1467 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1468 } 1468 }
1469 1469
1470 TEST_P(GLES3DecoderTest, CompressedTexSubImage3DFails) { 1470 TEST_P(GLES3DecoderTest, CompressedTexSubImage3DFails) {
1471 const uint32_t kBucketId = 123; 1471 const uint32_t kBucketId = 123;
1472 const GLenum kTarget = GL_TEXTURE_2D_ARRAY; 1472 const GLenum kTarget = GL_TEXTURE_2D_ARRAY;
1473 const GLint kLevel = 0; 1473 const GLint kLevel = 0;
1474 const GLenum kInternalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC; 1474 const GLenum kInternalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC;
1475 const GLsizei kWidth = 4; 1475 const GLsizei kWidth = 4;
1476 const GLsizei kHeight = 8; 1476 const GLsizei kHeight = 8;
1477 const GLsizei kDepth = 4; 1477 const GLsizei kDepth = 4;
1478 const GLint kBorder = 0; 1478 const GLint kBorder = 0;
1479 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); 1479 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId);
1480 ASSERT_TRUE(bucket != NULL); 1480 ASSERT_TRUE(bucket != nullptr);
1481 const GLsizei kImageSize = 128; 1481 const GLsizei kImageSize = 128;
1482 bucket->SetSize(kImageSize); 1482 bucket->SetSize(kImageSize);
1483 1483
1484 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId); 1484 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
1485 1485
1486 CompressedTexImage3DBucket tex_cmd; 1486 CompressedTexImage3DBucket tex_cmd;
1487 tex_cmd.Init(kTarget, 1487 tex_cmd.Init(kTarget,
1488 kLevel, 1488 kLevel,
1489 kInternalFormat, 1489 kInternalFormat,
1490 kWidth, 1490 kWidth,
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 TEST_P(GLES3DecoderTest, CompressedTexImage2DBucketBucketSizeIsZero) { 1655 TEST_P(GLES3DecoderTest, CompressedTexImage2DBucketBucketSizeIsZero) {
1656 const uint32_t kBucketId = 123; 1656 const uint32_t kBucketId = 123;
1657 const uint32_t kBadBucketId = 99; 1657 const uint32_t kBadBucketId = 99;
1658 const GLenum kTarget = GL_TEXTURE_2D; 1658 const GLenum kTarget = GL_TEXTURE_2D;
1659 const GLint kLevel = 0; 1659 const GLint kLevel = 0;
1660 const GLenum kInternalFormat = GL_COMPRESSED_R11_EAC; 1660 const GLenum kInternalFormat = GL_COMPRESSED_R11_EAC;
1661 const GLsizei kWidth = 4; 1661 const GLsizei kWidth = 4;
1662 const GLsizei kHeight = 4; 1662 const GLsizei kHeight = 4;
1663 const GLint kBorder = 0; 1663 const GLint kBorder = 0;
1664 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); 1664 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId);
1665 ASSERT_TRUE(bucket != NULL); 1665 ASSERT_TRUE(bucket != nullptr);
1666 const GLsizei kImageSize = 0; 1666 const GLsizei kImageSize = 0;
1667 bucket->SetSize(kImageSize); 1667 bucket->SetSize(kImageSize);
1668 1668
1669 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId); 1669 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
1670 1670
1671 // Bad bucket 1671 // Bad bucket
1672 CompressedTexImage2DBucket cmd; 1672 CompressedTexImage2DBucket cmd;
1673 cmd.Init(kTarget, 1673 cmd.Init(kTarget,
1674 kLevel, 1674 kLevel,
1675 kInternalFormat, 1675 kInternalFormat,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 } // anonymous namespace. 1746 } // anonymous namespace.
1747 1747
1748 TEST_P(GLES2DecoderManualInitTest, CompressedTexImage2DS3TCWebGL) { 1748 TEST_P(GLES2DecoderManualInitTest, CompressedTexImage2DS3TCWebGL) {
1749 InitState init; 1749 InitState init;
1750 init.extensions = "GL_EXT_texture_compression_s3tc"; 1750 init.extensions = "GL_EXT_texture_compression_s3tc";
1751 init.bind_generates_resource = true; 1751 init.bind_generates_resource = true;
1752 init.context_type = CONTEXT_TYPE_WEBGL1; 1752 init.context_type = CONTEXT_TYPE_WEBGL1;
1753 InitDecoder(init); 1753 InitDecoder(init);
1754 const uint32_t kBucketId = 123; 1754 const uint32_t kBucketId = 123;
1755 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); 1755 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId);
1756 ASSERT_TRUE(bucket != NULL); 1756 ASSERT_TRUE(bucket != nullptr);
1757 1757
1758 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 1758 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
1759 1759
1760 static const S3TCTestData test_data[] = { 1760 static const S3TCTestData test_data[] = {
1761 { 1761 {
1762 GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 8, 1762 GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 8,
1763 }, 1763 },
1764 { 1764 {
1765 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 8, 1765 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 8,
1766 }, 1766 },
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 } 1903 }
1904 } 1904 }
1905 1905
1906 TEST_P(GLES2DecoderManualInitTest, CompressedTexImage2DS3TC) { 1906 TEST_P(GLES2DecoderManualInitTest, CompressedTexImage2DS3TC) {
1907 InitState init; 1907 InitState init;
1908 init.extensions = "GL_EXT_texture_compression_s3tc"; 1908 init.extensions = "GL_EXT_texture_compression_s3tc";
1909 init.bind_generates_resource = true; 1909 init.bind_generates_resource = true;
1910 InitDecoder(init); 1910 InitDecoder(init);
1911 const uint32_t kBucketId = 123; 1911 const uint32_t kBucketId = 123;
1912 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); 1912 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId);
1913 ASSERT_TRUE(bucket != NULL); 1913 ASSERT_TRUE(bucket != nullptr);
1914 1914
1915 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 1915 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
1916 1916
1917 static const S3TCTestData test_data[] = { 1917 static const S3TCTestData test_data[] = {
1918 { 1918 {
1919 GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 8, 1919 GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 8,
1920 }, 1920 },
1921 { 1921 {
1922 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 8, 1922 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 8,
1923 }, 1923 },
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 2174
2175 // Test CompressedTexSubImage not allowed 2175 // Test CompressedTexSubImage not allowed
2176 CompressedTexSubImage2DBucket sub_cmd; 2176 CompressedTexSubImage2DBucket sub_cmd;
2177 bucket->SetSize(kBlockSize); 2177 bucket->SetSize(kBlockSize);
2178 sub_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 4, 4, kFormat, kBucketId); 2178 sub_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 4, 4, kFormat, kBucketId);
2179 EXPECT_EQ(error::kNoError, ExecuteCmd(sub_cmd)); 2179 EXPECT_EQ(error::kNoError, ExecuteCmd(sub_cmd));
2180 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 2180 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
2181 2181
2182 // Test TexSubImage not allowed for ETC1 compressed texture 2182 // Test TexSubImage not allowed for ETC1 compressed texture
2183 TextureRef* texture_ref = GetTexture(client_texture_id_); 2183 TextureRef* texture_ref = GetTexture(client_texture_id_);
2184 ASSERT_TRUE(texture_ref != NULL); 2184 ASSERT_TRUE(texture_ref != nullptr);
2185 Texture* texture = texture_ref->texture(); 2185 Texture* texture = texture_ref->texture();
2186 GLenum type, internal_format; 2186 GLenum type, internal_format;
2187 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); 2187 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format));
2188 EXPECT_EQ(kFormat, internal_format); 2188 EXPECT_EQ(kFormat, internal_format);
2189 TexSubImage2D texsub_cmd; 2189 TexSubImage2D texsub_cmd;
2190 texsub_cmd.Init(GL_TEXTURE_2D, 2190 texsub_cmd.Init(GL_TEXTURE_2D,
2191 0, 2191 0,
2192 0, 2192 0,
2193 0, 2193 0,
2194 4, 2194 4,
(...skipping 22 matching lines...) Expand all
2217 init.bind_generates_resource = true; 2217 init.bind_generates_resource = true;
2218 InitDecoder(init); 2218 InitDecoder(init);
2219 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId)); 2219 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId));
2220 EXPECT_CALL(*gl_, GenTextures(1, _)) 2220 EXPECT_CALL(*gl_, GenTextures(1, _))
2221 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); 2221 .WillOnce(SetArgumentPointee<1>(kNewServiceId));
2222 BindTexture cmd; 2222 BindTexture cmd;
2223 cmd.Init(GL_TEXTURE_EXTERNAL_OES, kNewClientId); 2223 cmd.Init(GL_TEXTURE_EXTERNAL_OES, kNewClientId);
2224 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2224 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2225 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2225 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2226 TextureRef* texture_ref = GetTexture(kNewClientId); 2226 TextureRef* texture_ref = GetTexture(kNewClientId);
2227 EXPECT_TRUE(texture_ref != NULL); 2227 EXPECT_TRUE(texture_ref != nullptr);
2228 EXPECT_TRUE(texture_ref->texture()->target() == GL_TEXTURE_EXTERNAL_OES); 2228 EXPECT_TRUE(texture_ref->texture()->target() == GL_TEXTURE_EXTERNAL_OES);
2229 } 2229 }
2230 2230
2231 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalGetBinding) { 2231 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalGetBinding) {
2232 InitState init; 2232 InitState init;
2233 init.extensions = "GL_OES_EGL_image_external"; 2233 init.extensions = "GL_OES_EGL_image_external";
2234 init.gl_version = "opengl es 2.0"; 2234 init.gl_version = "opengl es 2.0";
2235 init.bind_generates_resource = true; 2235 init.bind_generates_resource = true;
2236 InitDecoder(init); 2236 InitDecoder(init);
2237 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); 2237 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
(...skipping 22 matching lines...) Expand all
2260 2260
2261 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalTextureDefaults) { 2261 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalTextureDefaults) {
2262 InitState init; 2262 InitState init;
2263 init.extensions = "GL_OES_EGL_image_external"; 2263 init.extensions = "GL_OES_EGL_image_external";
2264 init.gl_version = "opengl es 2.0"; 2264 init.gl_version = "opengl es 2.0";
2265 init.bind_generates_resource = true; 2265 init.bind_generates_resource = true;
2266 InitDecoder(init); 2266 InitDecoder(init);
2267 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); 2267 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
2268 2268
2269 TextureRef* texture_ref = GetTexture(client_texture_id_); 2269 TextureRef* texture_ref = GetTexture(client_texture_id_);
2270 EXPECT_TRUE(texture_ref != NULL); 2270 EXPECT_TRUE(texture_ref != nullptr);
2271 Texture* texture = texture_ref->texture(); 2271 Texture* texture = texture_ref->texture();
2272 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); 2272 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES);
2273 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); 2273 EXPECT_TRUE(texture->min_filter() == GL_LINEAR);
2274 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); 2274 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE);
2275 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); 2275 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE);
2276 } 2276 }
2277 2277
2278 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalTextureParam) { 2278 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalTextureParam) {
2279 InitState init; 2279 InitState init;
2280 init.extensions = "GL_OES_EGL_image_external"; 2280 init.extensions = "GL_OES_EGL_image_external";
(...skipping 27 matching lines...) Expand all
2308 2308
2309 cmd.Init(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 2309 cmd.Init(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
2310 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2310 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2311 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2311 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2312 2312
2313 cmd.Init(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 2313 cmd.Init(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
2314 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2314 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2315 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2315 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2316 2316
2317 TextureRef* texture_ref = GetTexture(client_texture_id_); 2317 TextureRef* texture_ref = GetTexture(client_texture_id_);
2318 EXPECT_TRUE(texture_ref != NULL); 2318 EXPECT_TRUE(texture_ref != nullptr);
2319 Texture* texture = texture_ref->texture(); 2319 Texture* texture = texture_ref->texture();
2320 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); 2320 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES);
2321 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); 2321 EXPECT_TRUE(texture->min_filter() == GL_LINEAR);
2322 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); 2322 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE);
2323 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); 2323 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE);
2324 } 2324 }
2325 2325
2326 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalTextureParamInvalid) { 2326 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalTextureParamInvalid) {
2327 InitState init; 2327 InitState init;
2328 init.extensions = "GL_OES_EGL_image_external"; 2328 init.extensions = "GL_OES_EGL_image_external";
(...skipping 11 matching lines...) Expand all
2340 2340
2341 cmd.Init(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_REPEAT); 2341 cmd.Init(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_REPEAT);
2342 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2342 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2343 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 2343 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
2344 2344
2345 cmd.Init(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_REPEAT); 2345 cmd.Init(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_REPEAT);
2346 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2346 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2347 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 2347 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
2348 2348
2349 TextureRef* texture_ref = GetTexture(client_texture_id_); 2349 TextureRef* texture_ref = GetTexture(client_texture_id_);
2350 EXPECT_TRUE(texture_ref != NULL); 2350 EXPECT_TRUE(texture_ref != nullptr);
2351 Texture* texture = texture_ref->texture(); 2351 Texture* texture = texture_ref->texture();
2352 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); 2352 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES);
2353 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); 2353 EXPECT_TRUE(texture->min_filter() == GL_LINEAR);
2354 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); 2354 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE);
2355 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); 2355 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE);
2356 } 2356 }
2357 2357
2358 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalTexImage2DError) { 2358 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalTexImage2DError) {
2359 InitState init; 2359 InitState init;
2360 init.extensions = "GL_OES_EGL_image_external"; 2360 init.extensions = "GL_OES_EGL_image_external";
2361 init.gl_version = "opengl es 2.0"; 2361 init.gl_version = "opengl es 2.0";
2362 init.bind_generates_resource = true; 2362 init.bind_generates_resource = true;
2363 InitDecoder(init); 2363 InitDecoder(init);
2364 2364
2365 GLenum target = GL_TEXTURE_EXTERNAL_OES; 2365 GLenum target = GL_TEXTURE_EXTERNAL_OES;
2366 GLint level = 0; 2366 GLint level = 0;
2367 GLenum internal_format = GL_RGBA; 2367 GLenum internal_format = GL_RGBA;
2368 GLsizei width = 2; 2368 GLsizei width = 2;
2369 GLsizei height = 4; 2369 GLsizei height = 4;
2370 GLenum format = GL_RGBA; 2370 GLenum format = GL_RGBA;
2371 GLenum type = GL_UNSIGNED_BYTE; 2371 GLenum type = GL_UNSIGNED_BYTE;
2372 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); 2372 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
2373 ASSERT_TRUE(GetTexture(client_texture_id_) != NULL); 2373 ASSERT_TRUE(GetTexture(client_texture_id_) != nullptr);
2374 TexImage2D cmd; 2374 TexImage2D cmd;
2375 cmd.Init(target, 2375 cmd.Init(target,
2376 level, 2376 level,
2377 internal_format, 2377 internal_format,
2378 width, 2378 width,
2379 height, 2379 height,
2380 format, 2380 format,
2381 type, 2381 type,
2382 kSharedMemoryId, 2382 kSharedMemoryId,
2383 kSharedMemoryOffset); 2383 kSharedMemoryOffset);
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
2622 init.bind_generates_resource = true; 2622 init.bind_generates_resource = true;
2623 InitDecoder(init); 2623 InitDecoder(init);
2624 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_RECTANGLE_ARB, kNewServiceId)); 2624 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_RECTANGLE_ARB, kNewServiceId));
2625 EXPECT_CALL(*gl_, GenTextures(1, _)) 2625 EXPECT_CALL(*gl_, GenTextures(1, _))
2626 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); 2626 .WillOnce(SetArgumentPointee<1>(kNewServiceId));
2627 BindTexture cmd; 2627 BindTexture cmd;
2628 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, kNewClientId); 2628 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, kNewClientId);
2629 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2629 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2630 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2630 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2631 Texture* texture = GetTexture(kNewClientId)->texture(); 2631 Texture* texture = GetTexture(kNewClientId)->texture();
2632 EXPECT_TRUE(texture != NULL); 2632 EXPECT_TRUE(texture != nullptr);
2633 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); 2633 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB);
2634 } 2634 }
2635 2635
2636 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleGetBinding) { 2636 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleGetBinding) {
2637 InitState init; 2637 InitState init;
2638 init.extensions = "GL_ARB_texture_rectangle"; 2638 init.extensions = "GL_ARB_texture_rectangle";
2639 init.bind_generates_resource = true; 2639 init.bind_generates_resource = true;
2640 InitDecoder(init); 2640 InitDecoder(init);
2641 DoBindTexture( 2641 DoBindTexture(
2642 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); 2642 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId);
(...skipping 22 matching lines...) Expand all
2665 2665
2666 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleTextureDefaults) { 2666 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleTextureDefaults) {
2667 InitState init; 2667 InitState init;
2668 init.extensions = "GL_ARB_texture_rectangle"; 2668 init.extensions = "GL_ARB_texture_rectangle";
2669 init.bind_generates_resource = true; 2669 init.bind_generates_resource = true;
2670 InitDecoder(init); 2670 InitDecoder(init);
2671 DoBindTexture( 2671 DoBindTexture(
2672 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); 2672 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId);
2673 2673
2674 Texture* texture = GetTexture(client_texture_id_)->texture(); 2674 Texture* texture = GetTexture(client_texture_id_)->texture();
2675 EXPECT_TRUE(texture != NULL); 2675 EXPECT_TRUE(texture != nullptr);
2676 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); 2676 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB);
2677 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); 2677 EXPECT_TRUE(texture->min_filter() == GL_LINEAR);
2678 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); 2678 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE);
2679 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); 2679 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE);
2680 } 2680 }
2681 2681
2682 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParam) { 2682 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParam) {
2683 InitState init; 2683 InitState init;
2684 init.extensions = "GL_ARB_texture_rectangle"; 2684 init.extensions = "GL_ARB_texture_rectangle";
2685 init.bind_generates_resource = true; 2685 init.bind_generates_resource = true;
(...skipping 27 matching lines...) Expand all
2713 2713
2714 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 2714 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
2715 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2715 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2716 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2716 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2717 2717
2718 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 2718 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
2719 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2719 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2720 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2720 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2721 2721
2722 Texture* texture = GetTexture(client_texture_id_)->texture(); 2722 Texture* texture = GetTexture(client_texture_id_)->texture();
2723 EXPECT_TRUE(texture != NULL); 2723 EXPECT_TRUE(texture != nullptr);
2724 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); 2724 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB);
2725 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); 2725 EXPECT_TRUE(texture->min_filter() == GL_LINEAR);
2726 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); 2726 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE);
2727 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); 2727 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE);
2728 } 2728 }
2729 2729
2730 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParamInvalid) { 2730 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParamInvalid) {
2731 InitState init; 2731 InitState init;
2732 init.extensions = "GL_ARB_texture_rectangle"; 2732 init.extensions = "GL_ARB_texture_rectangle";
2733 init.bind_generates_resource = true; 2733 init.bind_generates_resource = true;
(...skipping 11 matching lines...) Expand all
2745 2745
2746 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_REPEAT); 2746 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_REPEAT);
2747 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2747 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2748 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 2748 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
2749 2749
2750 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_REPEAT); 2750 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_REPEAT);
2751 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2751 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2752 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 2752 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
2753 2753
2754 Texture* texture = GetTexture(client_texture_id_)->texture(); 2754 Texture* texture = GetTexture(client_texture_id_)->texture();
2755 EXPECT_TRUE(texture != NULL); 2755 EXPECT_TRUE(texture != nullptr);
2756 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); 2756 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB);
2757 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); 2757 EXPECT_TRUE(texture->min_filter() == GL_LINEAR);
2758 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); 2758 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE);
2759 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); 2759 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE);
2760 } 2760 }
2761 2761
2762 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleTexImage2D) { 2762 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleTexImage2D) {
2763 InitState init; 2763 InitState init;
2764 init.extensions = "GL_ARB_texture_rectangle"; 2764 init.extensions = "GL_ARB_texture_rectangle";
2765 init.bind_generates_resource = true; 2765 init.bind_generates_resource = true;
2766 InitDecoder(init); 2766 InitDecoder(init);
2767 2767
2768 GLenum target = GL_TEXTURE_RECTANGLE_ARB; 2768 GLenum target = GL_TEXTURE_RECTANGLE_ARB;
2769 GLint level = 0; 2769 GLint level = 0;
2770 GLenum internal_format = GL_RGBA; 2770 GLenum internal_format = GL_RGBA;
2771 GLsizei width = 2; 2771 GLsizei width = 2;
2772 GLsizei height = 4; 2772 GLsizei height = 4;
2773 GLenum format = GL_RGBA; 2773 GLenum format = GL_RGBA;
2774 GLenum type = GL_UNSIGNED_BYTE; 2774 GLenum type = GL_UNSIGNED_BYTE;
2775 2775
2776 DoBindTexture( 2776 DoBindTexture(
2777 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); 2777 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId);
2778 ASSERT_TRUE(GetTexture(client_texture_id_) != NULL); 2778 ASSERT_TRUE(GetTexture(client_texture_id_) != nullptr);
2779 2779
2780 TexImage2D cmd; 2780 TexImage2D cmd;
2781 cmd.Init(target, 2781 cmd.Init(target,
2782 level, 2782 level,
2783 internal_format, 2783 internal_format,
2784 width, 2784 width,
2785 height, 2785 height,
2786 format, 2786 format,
2787 type, 2787 type,
2788 kSharedMemoryId, 2788 kSharedMemoryId,
(...skipping 12 matching lines...) Expand all
2801 GLenum target = GL_TEXTURE_RECTANGLE_ARB; 2801 GLenum target = GL_TEXTURE_RECTANGLE_ARB;
2802 GLint level = 1; 2802 GLint level = 1;
2803 GLenum internal_format = GL_RGBA; 2803 GLenum internal_format = GL_RGBA;
2804 GLsizei width = 2; 2804 GLsizei width = 2;
2805 GLsizei height = 4; 2805 GLsizei height = 4;
2806 GLenum format = GL_RGBA; 2806 GLenum format = GL_RGBA;
2807 GLenum type = GL_UNSIGNED_BYTE; 2807 GLenum type = GL_UNSIGNED_BYTE;
2808 2808
2809 DoBindTexture( 2809 DoBindTexture(
2810 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); 2810 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId);
2811 ASSERT_TRUE(GetTexture(client_texture_id_) != NULL); 2811 ASSERT_TRUE(GetTexture(client_texture_id_) != nullptr);
2812 2812
2813 TexImage2D cmd; 2813 TexImage2D cmd;
2814 cmd.Init(target, 2814 cmd.Init(target,
2815 level, 2815 level,
2816 internal_format, 2816 internal_format,
2817 width, 2817 width,
2818 height, 2818 height,
2819 format, 2819 format,
2820 type, 2820 type,
2821 kSharedMemoryId, 2821 kSharedMemoryId,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
2910 GL_UNSIGNED_BYTE, 2910 GL_UNSIGNED_BYTE,
2911 shared_memory_address_)) 2911 shared_memory_address_))
2912 .Times(1) 2912 .Times(1)
2913 .RetiresOnSaturation(); 2913 .RetiresOnSaturation();
2914 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2914 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2915 } 2915 }
2916 2916
2917 TEST_P( 2917 TEST_P(
2918 GLES2DecoderManualInitTest, 2918 GLES2DecoderManualInitTest,
2919 TexSubImage2DDoesNotClearAfterTexImage2DNULLThenDataWithTexImage2DIsFaster) { 2919 TexSubImage2DDoesNotClearAfterTexImage2DNULLThenDataWithTexImage2DIsFaster) {
2920 base::CommandLine command_line(0, NULL); 2920 base::CommandLine command_line(0, nullptr);
2921 command_line.AppendSwitchASCII( 2921 command_line.AppendSwitchASCII(
2922 switches::kGpuDriverBugWorkarounds, 2922 switches::kGpuDriverBugWorkarounds,
2923 base::IntToString(gpu::TEXSUBIMAGE_FASTER_THAN_TEXIMAGE)); 2923 base::IntToString(gpu::TEXSUBIMAGE_FASTER_THAN_TEXIMAGE));
2924 InitState init; 2924 InitState init;
2925 init.bind_generates_resource = true; 2925 init.bind_generates_resource = true;
2926 InitDecoderWithCommandLine(init, &command_line); 2926 InitDecoderWithCommandLine(init, &command_line);
2927 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 2927 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
2928 DoTexImage2D( 2928 DoTexImage2D(
2929 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 2929 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
2930 2930
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
3024 cmd.Init(GL_TEXTURE_2D, 0, 0, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 3024 cmd.Init(GL_TEXTURE_2D, 0, 0, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE,
3025 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE); 3025 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE);
3026 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 3026 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
3027 } 3027 }
3028 3028
3029 TEST_P(GLES2DecoderTest, CopyTexImage2DMarksTextureAsCleared) { 3029 TEST_P(GLES2DecoderTest, CopyTexImage2DMarksTextureAsCleared) {
3030 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 3030 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
3031 3031
3032 TextureManager* manager = group().texture_manager(); 3032 TextureManager* manager = group().texture_manager();
3033 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); 3033 TextureRef* texture_ref = manager->GetTexture(client_texture_id_);
3034 ASSERT_TRUE(texture_ref != NULL); 3034 ASSERT_TRUE(texture_ref != nullptr);
3035 Texture* texture = texture_ref->texture(); 3035 Texture* texture = texture_ref->texture();
3036 3036
3037 EXPECT_CALL(*gl_, GetError()) 3037 EXPECT_CALL(*gl_, GetError())
3038 .WillOnce(Return(GL_NO_ERROR)) 3038 .WillOnce(Return(GL_NO_ERROR))
3039 .RetiresOnSaturation(); 3039 .RetiresOnSaturation();
3040 EXPECT_CALL(*gl_, CopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1, 1, 0)) 3040 EXPECT_CALL(*gl_, CopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1, 1, 0))
3041 .Times(1) 3041 .Times(1)
3042 .RetiresOnSaturation(); 3042 .RetiresOnSaturation();
3043 EXPECT_CALL(*gl_, GetError()) 3043 EXPECT_CALL(*gl_, GetError())
3044 .WillOnce(Return(GL_NO_ERROR)) 3044 .WillOnce(Return(GL_NO_ERROR))
(...skipping 25 matching lines...) Expand all
3070 EXPECT_CALL(*gl_, CopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 1, 0, 0, 2, 1)) 3070 EXPECT_CALL(*gl_, CopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 1, 0, 0, 2, 1))
3071 .Times(1) 3071 .Times(1)
3072 .RetiresOnSaturation(); 3072 .RetiresOnSaturation();
3073 CopyTexSubImage2D cmd; 3073 CopyTexSubImage2D cmd;
3074 cmd.Init(GL_TEXTURE_2D, 0, 0, 1, 0, 0, 2, 1); 3074 cmd.Init(GL_TEXTURE_2D, 0, 0, 1, 0, 0, 2, 1);
3075 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 3075 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
3076 } 3076 }
3077 3077
3078 TextureManager* manager = group().texture_manager(); 3078 TextureManager* manager = group().texture_manager();
3079 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); 3079 TextureRef* texture_ref = manager->GetTexture(client_texture_id_);
3080 ASSERT_TRUE(texture_ref != NULL); 3080 ASSERT_TRUE(texture_ref != nullptr);
3081 Texture* texture = texture_ref->texture(); 3081 Texture* texture = texture_ref->texture();
3082 EXPECT_TRUE(texture->SafeToRenderFrom()); 3082 EXPECT_TRUE(texture->SafeToRenderFrom());
3083 } 3083 }
3084 3084
3085 TEST_P(GLES2DecoderTest, CopyTexSubImage2DTwiceClearsUnclearedTexture) { 3085 TEST_P(GLES2DecoderTest, CopyTexSubImage2DTwiceClearsUnclearedTexture) {
3086 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 3086 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
3087 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 3087 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0,
3088 0); 3088 0);
3089 3089
3090 // This will initialize the top part. 3090 // This will initialize the top part.
(...skipping 16 matching lines...) Expand all
3107 EXPECT_CALL(*gl_, CopyTexSubImage2D(GL_TEXTURE_2D, 0, 1, 1, 0, 0, 1, 1)) 3107 EXPECT_CALL(*gl_, CopyTexSubImage2D(GL_TEXTURE_2D, 0, 1, 1, 0, 0, 1, 1))
3108 .Times(1) 3108 .Times(1)
3109 .RetiresOnSaturation(); 3109 .RetiresOnSaturation();
3110 CopyTexSubImage2D cmd; 3110 CopyTexSubImage2D cmd;
3111 cmd.Init(GL_TEXTURE_2D, 0, 1, 1, 0, 0, 1, 1); 3111 cmd.Init(GL_TEXTURE_2D, 0, 1, 1, 0, 0, 1, 1);
3112 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 3112 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
3113 } 3113 }
3114 3114
3115 TextureManager* manager = group().texture_manager(); 3115 TextureManager* manager = group().texture_manager();
3116 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); 3116 TextureRef* texture_ref = manager->GetTexture(client_texture_id_);
3117 ASSERT_TRUE(texture_ref != NULL); 3117 ASSERT_TRUE(texture_ref != nullptr);
3118 Texture* texture = texture_ref->texture(); 3118 Texture* texture = texture_ref->texture();
3119 EXPECT_TRUE(texture->SafeToRenderFrom()); 3119 EXPECT_TRUE(texture->SafeToRenderFrom());
3120 } 3120 }
3121 3121
3122 TEST_P(GLES2DecoderTest, CopyTexSubImage2DClearsUnclearedBackBufferSizedTexture) { 3122 TEST_P(GLES2DecoderTest, CopyTexSubImage2DClearsUnclearedBackBufferSizedTexture) {
3123 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 3123 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
3124 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kBackBufferWidth, kBackBufferHeight, 3124 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kBackBufferWidth, kBackBufferHeight,
3125 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 3125 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
3126 3126
3127 EXPECT_CALL(*gl_, CopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 3127 EXPECT_CALL(*gl_, CopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0,
3128 kBackBufferWidth, kBackBufferHeight)) 3128 kBackBufferWidth, kBackBufferHeight))
3129 .Times(1) 3129 .Times(1)
3130 .RetiresOnSaturation(); 3130 .RetiresOnSaturation();
3131 CopyTexSubImage2D cmd; 3131 CopyTexSubImage2D cmd;
3132 cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, kBackBufferWidth, kBackBufferHeight); 3132 cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, kBackBufferWidth, kBackBufferHeight);
3133 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 3133 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
3134 3134
3135 TextureManager* manager = group().texture_manager(); 3135 TextureManager* manager = group().texture_manager();
3136 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); 3136 TextureRef* texture_ref = manager->GetTexture(client_texture_id_);
3137 ASSERT_TRUE(texture_ref != NULL); 3137 ASSERT_TRUE(texture_ref != nullptr);
3138 Texture* texture = texture_ref->texture(); 3138 Texture* texture = texture_ref->texture();
3139 EXPECT_TRUE(texture->SafeToRenderFrom()); 3139 EXPECT_TRUE(texture->SafeToRenderFrom());
3140 } 3140 }
3141 3141
3142 TEST_P(GLES2DecoderManualInitTest, CompressedImage2DMarksTextureAsCleared) { 3142 TEST_P(GLES2DecoderManualInitTest, CompressedImage2DMarksTextureAsCleared) {
3143 InitState init; 3143 InitState init;
3144 init.extensions = "GL_EXT_texture_compression_s3tc"; 3144 init.extensions = "GL_EXT_texture_compression_s3tc";
3145 init.bind_generates_resource = true; 3145 init.bind_generates_resource = true;
3146 InitDecoder(init); 3146 InitDecoder(init);
3147 3147
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3186 TEST_P(GLES2DecoderTest, ProduceAndConsumeTextureCHROMIUM) { 3186 TEST_P(GLES2DecoderTest, ProduceAndConsumeTextureCHROMIUM) {
3187 Mailbox mailbox = Mailbox::Generate(); 3187 Mailbox mailbox = Mailbox::Generate();
3188 3188
3189 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 3189 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
3190 DoTexImage2D( 3190 DoTexImage2D(
3191 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 3191 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
3192 DoTexImage2D( 3192 DoTexImage2D(
3193 GL_TEXTURE_2D, 1, GL_RGBA, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 3193 GL_TEXTURE_2D, 1, GL_RGBA, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
3194 TextureRef* texture_ref = 3194 TextureRef* texture_ref =
3195 group().texture_manager()->GetTexture(client_texture_id_); 3195 group().texture_manager()->GetTexture(client_texture_id_);
3196 ASSERT_TRUE(texture_ref != NULL); 3196 ASSERT_TRUE(texture_ref != nullptr);
3197 Texture* texture = texture_ref->texture(); 3197 Texture* texture = texture_ref->texture();
3198 EXPECT_EQ(kServiceTextureId, texture->service_id()); 3198 EXPECT_EQ(kServiceTextureId, texture->service_id());
3199 3199
3200 ProduceTextureCHROMIUMImmediate& produce_cmd = 3200 ProduceTextureCHROMIUMImmediate& produce_cmd =
3201 *GetImmediateAs<ProduceTextureCHROMIUMImmediate>(); 3201 *GetImmediateAs<ProduceTextureCHROMIUMImmediate>();
3202 produce_cmd.Init(GL_TEXTURE_2D, mailbox.name); 3202 produce_cmd.Init(GL_TEXTURE_2D, mailbox.name);
3203 EXPECT_EQ(error::kNoError, 3203 EXPECT_EQ(error::kNoError,
3204 ExecuteImmediateCmd(produce_cmd, sizeof(mailbox.name))); 3204 ExecuteImmediateCmd(produce_cmd, sizeof(mailbox.name)));
3205 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 3205 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3206 3206
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
3275 TEST_P(GLES2DecoderTest, ProduceAndConsumeDirectTextureCHROMIUM) { 3275 TEST_P(GLES2DecoderTest, ProduceAndConsumeDirectTextureCHROMIUM) {
3276 Mailbox mailbox = Mailbox::Generate(); 3276 Mailbox mailbox = Mailbox::Generate();
3277 3277
3278 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 3278 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
3279 DoTexImage2D( 3279 DoTexImage2D(
3280 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 3280 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
3281 DoTexImage2D( 3281 DoTexImage2D(
3282 GL_TEXTURE_2D, 1, GL_RGBA, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 3282 GL_TEXTURE_2D, 1, GL_RGBA, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
3283 TextureRef* texture_ref = 3283 TextureRef* texture_ref =
3284 group().texture_manager()->GetTexture(client_texture_id_); 3284 group().texture_manager()->GetTexture(client_texture_id_);
3285 ASSERT_TRUE(texture_ref != NULL); 3285 ASSERT_TRUE(texture_ref != nullptr);
3286 Texture* texture = texture_ref->texture(); 3286 Texture* texture = texture_ref->texture();
3287 EXPECT_EQ(kServiceTextureId, texture->service_id()); 3287 EXPECT_EQ(kServiceTextureId, texture->service_id());
3288 3288
3289 ProduceTextureDirectCHROMIUMImmediate& produce_cmd = 3289 ProduceTextureDirectCHROMIUMImmediate& produce_cmd =
3290 *GetImmediateAs<ProduceTextureDirectCHROMIUMImmediate>(); 3290 *GetImmediateAs<ProduceTextureDirectCHROMIUMImmediate>();
3291 produce_cmd.Init(client_texture_id_, GL_TEXTURE_2D, mailbox.name); 3291 produce_cmd.Init(client_texture_id_, GL_TEXTURE_2D, mailbox.name);
3292 EXPECT_EQ(error::kNoError, 3292 EXPECT_EQ(error::kNoError,
3293 ExecuteImmediateCmd(produce_cmd, sizeof(mailbox.name))); 3293 ExecuteImmediateCmd(produce_cmd, sizeof(mailbox.name)));
3294 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 3294 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3295 3295
(...skipping 26 matching lines...) Expand all
3322 GLuint new_texture_id = kNewClientId; 3322 GLuint new_texture_id = kNewClientId;
3323 CreateAndConsumeTextureINTERNALImmediate& consume_cmd = 3323 CreateAndConsumeTextureINTERNALImmediate& consume_cmd =
3324 *GetImmediateAs<CreateAndConsumeTextureINTERNALImmediate>(); 3324 *GetImmediateAs<CreateAndConsumeTextureINTERNALImmediate>();
3325 consume_cmd.Init(GL_TEXTURE_2D, new_texture_id, mailbox.name); 3325 consume_cmd.Init(GL_TEXTURE_2D, new_texture_id, mailbox.name);
3326 EXPECT_EQ(error::kNoError, 3326 EXPECT_EQ(error::kNoError,
3327 ExecuteImmediateCmd(consume_cmd, sizeof(mailbox.name))); 3327 ExecuteImmediateCmd(consume_cmd, sizeof(mailbox.name)));
3328 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 3328 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3329 3329
3330 // Make sure the new client ID is associated with the produced service ID. 3330 // Make sure the new client ID is associated with the produced service ID.
3331 texture_ref = group().texture_manager()->GetTexture(new_texture_id); 3331 texture_ref = group().texture_manager()->GetTexture(new_texture_id);
3332 ASSERT_TRUE(texture_ref != NULL); 3332 ASSERT_TRUE(texture_ref != nullptr);
3333 texture = texture_ref->texture(); 3333 texture = texture_ref->texture();
3334 EXPECT_EQ(kServiceTextureId, texture->service_id()); 3334 EXPECT_EQ(kServiceTextureId, texture->service_id());
3335 3335
3336 DoBindTexture(GL_TEXTURE_2D, kNewClientId, kServiceTextureId); 3336 DoBindTexture(GL_TEXTURE_2D, kNewClientId, kServiceTextureId);
3337 3337
3338 // Texture is redefined. 3338 // Texture is redefined.
3339 EXPECT_TRUE( 3339 EXPECT_TRUE(
3340 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); 3340 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
3341 EXPECT_EQ(3, width); 3341 EXPECT_EQ(3, width);
3342 EXPECT_EQ(1, height); 3342 EXPECT_EQ(1, height);
(...skipping 12 matching lines...) Expand all
3355 3355
3356 TEST_P(GLES2DecoderTest, ProduceTextureCHROMIUMInvalidTarget) { 3356 TEST_P(GLES2DecoderTest, ProduceTextureCHROMIUMInvalidTarget) {
3357 Mailbox mailbox = Mailbox::Generate(); 3357 Mailbox mailbox = Mailbox::Generate();
3358 3358
3359 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId); 3359 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId);
3360 DoTexImage2D( 3360 DoTexImage2D(
3361 GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA, 3, 1, 0, GL_RGBA, 3361 GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA, 3, 1, 0, GL_RGBA,
3362 GL_UNSIGNED_BYTE, 0, 0); 3362 GL_UNSIGNED_BYTE, 0, 0);
3363 TextureRef* texture_ref = 3363 TextureRef* texture_ref =
3364 group().texture_manager()->GetTexture(client_texture_id_); 3364 group().texture_manager()->GetTexture(client_texture_id_);
3365 ASSERT_TRUE(texture_ref != NULL); 3365 ASSERT_TRUE(texture_ref != nullptr);
3366 Texture* texture = texture_ref->texture(); 3366 Texture* texture = texture_ref->texture();
3367 EXPECT_EQ(kServiceTextureId, texture->service_id()); 3367 EXPECT_EQ(kServiceTextureId, texture->service_id());
3368 3368
3369 ProduceTextureDirectCHROMIUMImmediate& produce_cmd = 3369 ProduceTextureDirectCHROMIUMImmediate& produce_cmd =
3370 *GetImmediateAs<ProduceTextureDirectCHROMIUMImmediate>(); 3370 *GetImmediateAs<ProduceTextureDirectCHROMIUMImmediate>();
3371 produce_cmd.Init(client_texture_id_, GL_TEXTURE_2D, mailbox.name); 3371 produce_cmd.Init(client_texture_id_, GL_TEXTURE_2D, mailbox.name);
3372 EXPECT_EQ(error::kNoError, 3372 EXPECT_EQ(error::kNoError,
3373 ExecuteImmediateCmd(produce_cmd, sizeof(mailbox.name))); 3373 ExecuteImmediateCmd(produce_cmd, sizeof(mailbox.name)));
3374 3374
3375 // ProduceTexture should fail it the texture and produce targets don't match. 3375 // ProduceTexture should fail it the texture and produce targets don't match.
(...skipping 22 matching lines...) Expand all
3398 ExecuteImmediateCmd(consume_cmd, sizeof(mailbox.name))); 3398 ExecuteImmediateCmd(consume_cmd, sizeof(mailbox.name)));
3399 3399
3400 // CreateAndConsumeTexture should fail if the mailbox isn't associated with a 3400 // CreateAndConsumeTexture should fail if the mailbox isn't associated with a
3401 // texture. 3401 // texture.
3402 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 3402 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
3403 3403
3404 // Make sure the new client_id is associated with a texture ref even though 3404 // Make sure the new client_id is associated with a texture ref even though
3405 // CreateAndConsumeTexture failed. 3405 // CreateAndConsumeTexture failed.
3406 TextureRef* texture_ref = 3406 TextureRef* texture_ref =
3407 group().texture_manager()->GetTexture(new_texture_id); 3407 group().texture_manager()->GetTexture(new_texture_id);
3408 ASSERT_TRUE(texture_ref != NULL); 3408 ASSERT_TRUE(texture_ref != nullptr);
3409 Texture* texture = texture_ref->texture(); 3409 Texture* texture = texture_ref->texture();
3410 // New texture should have the correct target type. 3410 // New texture should have the correct target type.
3411 EXPECT_TRUE(texture->target() == GL_TEXTURE_2D); 3411 EXPECT_TRUE(texture->target() == GL_TEXTURE_2D);
3412 // New texture should have a valid service_id. 3412 // New texture should have a valid service_id.
3413 EXPECT_EQ(kNewServiceId, texture->service_id()); 3413 EXPECT_EQ(kNewServiceId, texture->service_id());
3414 } 3414 }
3415 3415
3416 TEST_P(GLES2DecoderTest, CreateAndConsumeTextureCHROMIUMInvalidTarget) { 3416 TEST_P(GLES2DecoderTest, CreateAndConsumeTextureCHROMIUMInvalidTarget) {
3417 Mailbox mailbox = Mailbox::Generate(); 3417 Mailbox mailbox = Mailbox::Generate();
3418 3418
3419 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 3419 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
3420 TextureRef* texture_ref = 3420 TextureRef* texture_ref =
3421 group().texture_manager()->GetTexture(client_texture_id_); 3421 group().texture_manager()->GetTexture(client_texture_id_);
3422 ASSERT_TRUE(texture_ref != NULL); 3422 ASSERT_TRUE(texture_ref != nullptr);
3423 3423
3424 ProduceTextureDirectCHROMIUMImmediate& produce_cmd = 3424 ProduceTextureDirectCHROMIUMImmediate& produce_cmd =
3425 *GetImmediateAs<ProduceTextureDirectCHROMIUMImmediate>(); 3425 *GetImmediateAs<ProduceTextureDirectCHROMIUMImmediate>();
3426 produce_cmd.Init(client_texture_id_, GL_TEXTURE_2D, mailbox.name); 3426 produce_cmd.Init(client_texture_id_, GL_TEXTURE_2D, mailbox.name);
3427 EXPECT_EQ(error::kNoError, 3427 EXPECT_EQ(error::kNoError,
3428 ExecuteImmediateCmd(produce_cmd, sizeof(mailbox.name))); 3428 ExecuteImmediateCmd(produce_cmd, sizeof(mailbox.name)));
3429 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 3429 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3430 3430
3431 EXPECT_CALL(*gl_, GenTextures(1, _)) 3431 EXPECT_CALL(*gl_, GenTextures(1, _))
3432 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) 3432 .WillOnce(SetArgumentPointee<1>(kNewServiceId))
(...skipping 13 matching lines...) Expand all
3446 EXPECT_EQ(error::kNoError, 3446 EXPECT_EQ(error::kNoError,
3447 ExecuteImmediateCmd(consume_cmd, sizeof(mailbox.name))); 3447 ExecuteImmediateCmd(consume_cmd, sizeof(mailbox.name)));
3448 3448
3449 // CreateAndConsumeTexture should fail if the produced texture had a different 3449 // CreateAndConsumeTexture should fail if the produced texture had a different
3450 // target. 3450 // target.
3451 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 3451 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
3452 3452
3453 // Make sure the new client_id is associated with a texture ref even though 3453 // Make sure the new client_id is associated with a texture ref even though
3454 // CreateAndConsumeTexture failed. 3454 // CreateAndConsumeTexture failed.
3455 texture_ref = group().texture_manager()->GetTexture(new_texture_id); 3455 texture_ref = group().texture_manager()->GetTexture(new_texture_id);
3456 ASSERT_TRUE(texture_ref != NULL); 3456 ASSERT_TRUE(texture_ref != nullptr);
3457 Texture* texture = texture_ref->texture(); 3457 Texture* texture = texture_ref->texture();
3458 // New texture should have the correct target type. 3458 // New texture should have the correct target type.
3459 EXPECT_TRUE(texture->target() == GL_TEXTURE_CUBE_MAP); 3459 EXPECT_TRUE(texture->target() == GL_TEXTURE_CUBE_MAP);
3460 // New texture should have a valid service_id. 3460 // New texture should have a valid service_id.
3461 EXPECT_EQ(kNewServiceId, texture->service_id()); 3461 EXPECT_EQ(kNewServiceId, texture->service_id());
3462 3462
3463 // Make sure the client_id did not become associated with the produced texture 3463 // Make sure the client_id did not become associated with the produced texture
3464 // service_id. 3464 // service_id.
3465 EXPECT_NE(kServiceTextureId, texture->service_id()); 3465 EXPECT_NE(kServiceTextureId, texture->service_id());
3466 } 3466 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
3570 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 3570 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
3571 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 3571 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
3572 } 3572 }
3573 3573
3574 TEST_P(GLES2DecoderTest, BindTexImage2DCHROMIUM) { 3574 TEST_P(GLES2DecoderTest, BindTexImage2DCHROMIUM) {
3575 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 3575 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
3576 DoTexImage2D( 3576 DoTexImage2D(
3577 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 3577 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
3578 TextureRef* texture_ref = 3578 TextureRef* texture_ref =
3579 group().texture_manager()->GetTexture(client_texture_id_); 3579 group().texture_manager()->GetTexture(client_texture_id_);
3580 ASSERT_TRUE(texture_ref != NULL); 3580 ASSERT_TRUE(texture_ref != nullptr);
3581 Texture* texture = texture_ref->texture(); 3581 Texture* texture = texture_ref->texture();
3582 EXPECT_EQ(kServiceTextureId, texture->service_id()); 3582 EXPECT_EQ(kServiceTextureId, texture->service_id());
3583 3583
3584 scoped_refptr<gl::GLImage> image(new gl::GLImageStub); 3584 scoped_refptr<gl::GLImage> image(new gl::GLImageStub);
3585 GetImageManager()->AddImage(image.get(), 1); 3585 GetImageManager()->AddImage(image.get(), 1);
3586 EXPECT_FALSE(GetImageManager()->LookupImage(1) == NULL); 3586 EXPECT_FALSE(GetImageManager()->LookupImage(1) == nullptr);
3587 3587
3588 GLsizei width; 3588 GLsizei width;
3589 GLsizei height; 3589 GLsizei height;
3590 GLenum type; 3590 GLenum type;
3591 GLenum internal_format; 3591 GLenum internal_format;
3592 3592
3593 EXPECT_TRUE( 3593 EXPECT_TRUE(
3594 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); 3594 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
3595 EXPECT_EQ(3, width); 3595 EXPECT_EQ(3, width);
3596 EXPECT_EQ(1, height); 3596 EXPECT_EQ(1, height);
3597 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); 3597 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format));
3598 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); 3598 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format);
3599 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); 3599 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
3600 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 3600 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == nullptr);
3601 3601
3602 // Bind image to texture. 3602 // Bind image to texture.
3603 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. 3603 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor.
3604 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1); 3604 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1);
3605 EXPECT_TRUE( 3605 EXPECT_TRUE(
3606 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); 3606 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
3607 // Image should now be set. 3607 // Image should now be set.
3608 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 3608 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == nullptr);
3609 3609
3610 // Define new texture image. 3610 // Define new texture image.
3611 DoTexImage2D( 3611 DoTexImage2D(
3612 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 3612 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
3613 EXPECT_TRUE( 3613 EXPECT_TRUE(
3614 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); 3614 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
3615 // Image should no longer be set. 3615 // Image should no longer be set.
3616 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 3616 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == nullptr);
3617 } 3617 }
3618 3618
3619 TEST_P(GLES2DecoderTest, BindTexImage2DCHROMIUMCubeMapNotAllowed) { 3619 TEST_P(GLES2DecoderTest, BindTexImage2DCHROMIUMCubeMapNotAllowed) {
3620 scoped_refptr<gl::GLImage> image(new gl::GLImageStub); 3620 scoped_refptr<gl::GLImage> image(new gl::GLImageStub);
3621 GetImageManager()->AddImage(image.get(), 1); 3621 GetImageManager()->AddImage(image.get(), 1);
3622 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId); 3622 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId);
3623 3623
3624 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; 3624 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd;
3625 bind_tex_image_2d_cmd.Init(GL_TEXTURE_CUBE_MAP, 1); 3625 bind_tex_image_2d_cmd.Init(GL_TEXTURE_CUBE_MAP, 1);
3626 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); 3626 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd));
3627 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 3627 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
3628 } 3628 }
3629 3629
3630 TEST_P(GLES2DecoderTest, OrphanGLImageWithTexImage2D) { 3630 TEST_P(GLES2DecoderTest, OrphanGLImageWithTexImage2D) {
3631 scoped_refptr<gl::GLImage> image(new gl::GLImageStub); 3631 scoped_refptr<gl::GLImage> image(new gl::GLImageStub);
3632 GetImageManager()->AddImage(image.get(), 1); 3632 GetImageManager()->AddImage(image.get(), 1);
3633 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 3633 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
3634 3634
3635 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1); 3635 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1);
3636 3636
3637 TextureRef* texture_ref = 3637 TextureRef* texture_ref =
3638 group().texture_manager()->GetTexture(client_texture_id_); 3638 group().texture_manager()->GetTexture(client_texture_id_);
3639 ASSERT_TRUE(texture_ref != NULL); 3639 ASSERT_TRUE(texture_ref != nullptr);
3640 Texture* texture = texture_ref->texture(); 3640 Texture* texture = texture_ref->texture();
3641 3641
3642 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); 3642 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get());
3643 DoTexImage2D( 3643 DoTexImage2D(
3644 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 3644 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
3645 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 3645 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == nullptr);
3646 } 3646 }
3647 3647
3648 TEST_P(GLES2DecoderTest, GLImageAttachedAfterSubTexImage2D) { 3648 TEST_P(GLES2DecoderTest, GLImageAttachedAfterSubTexImage2D) {
3649 // Specifically tests that TexSubImage2D is not optimized to TexImage2D 3649 // Specifically tests that TexSubImage2D is not optimized to TexImage2D
3650 // in the presence of image attachments. 3650 // in the presence of image attachments.
3651 ASSERT_FALSE( 3651 ASSERT_FALSE(
3652 feature_info()->workarounds().texsubimage_faster_than_teximage); 3652 feature_info()->workarounds().texsubimage_faster_than_teximage);
3653 3653
3654 scoped_refptr<gl::GLImage> image(new gl::GLImageStub); 3654 scoped_refptr<gl::GLImage> image(new gl::GLImageStub);
3655 GetImageManager()->AddImage(image.get(), 1); 3655 GetImageManager()->AddImage(image.get(), 1);
(...skipping 15 matching lines...) Expand all
3671 // Define texture first. 3671 // Define texture first.
3672 DoTexImage2D(target, level, format, width, height, border, format, type, 3672 DoTexImage2D(target, level, format, width, height, border, format, type,
3673 pixels_shm_id, pixels_shm_offset); 3673 pixels_shm_id, pixels_shm_offset);
3674 3674
3675 // Bind texture to GLImage. 3675 // Bind texture to GLImage.
3676 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1); 3676 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1);
3677 3677
3678 // Check binding. 3678 // Check binding.
3679 TextureRef* texture_ref = 3679 TextureRef* texture_ref =
3680 group().texture_manager()->GetTexture(client_texture_id_); 3680 group().texture_manager()->GetTexture(client_texture_id_);
3681 ASSERT_TRUE(texture_ref != NULL); 3681 ASSERT_TRUE(texture_ref != nullptr);
3682 Texture* texture = texture_ref->texture(); 3682 Texture* texture = texture_ref->texture();
3683 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); 3683 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get());
3684 3684
3685 // TexSubImage2D should not unbind GLImage. 3685 // TexSubImage2D should not unbind GLImage.
3686 EXPECT_CALL(*gl_, TexSubImage2D(target, level, xoffset, yoffset, width, 3686 EXPECT_CALL(*gl_, TexSubImage2D(target, level, xoffset, yoffset, width,
3687 height, format, type, _)) 3687 height, format, type, _))
3688 .Times(1) 3688 .Times(1)
3689 .RetiresOnSaturation(); 3689 .RetiresOnSaturation();
3690 TexSubImage2D tex_sub_image_2d_cmd; 3690 TexSubImage2D tex_sub_image_2d_cmd;
3691 tex_sub_image_2d_cmd.Init(target, level, xoffset, yoffset, width, height, 3691 tex_sub_image_2d_cmd.Init(target, level, xoffset, yoffset, width, height,
(...skipping 23 matching lines...) Expand all
3715 // Define texture first. 3715 // Define texture first.
3716 DoTexImage2D(target, level, format, width, height, border, format, type, 3716 DoTexImage2D(target, level, format, width, height, border, format, type,
3717 pixels_shm_id, pixels_shm_offset); 3717 pixels_shm_id, pixels_shm_offset);
3718 3718
3719 // Bind texture to GLImage. 3719 // Bind texture to GLImage.
3720 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1); 3720 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1);
3721 3721
3722 // Check binding. 3722 // Check binding.
3723 TextureRef* texture_ref = 3723 TextureRef* texture_ref =
3724 group().texture_manager()->GetTexture(client_texture_id_); 3724 group().texture_manager()->GetTexture(client_texture_id_);
3725 ASSERT_TRUE(texture_ref != NULL); 3725 ASSERT_TRUE(texture_ref != nullptr);
3726 Texture* texture = texture_ref->texture(); 3726 Texture* texture = texture_ref->texture();
3727 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); 3727 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get());
3728 3728
3729 // ClearLevel should use glTexSubImage2D to avoid unbinding GLImage. 3729 // ClearLevel should use glTexSubImage2D to avoid unbinding GLImage.
3730 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) 3730 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId))
3731 .Times(2) 3731 .Times(2)
3732 .RetiresOnSaturation(); 3732 .RetiresOnSaturation();
3733 EXPECT_CALL(*gl_, TexSubImage2D(target, level, xoffset, yoffset, width, 3733 EXPECT_CALL(*gl_, TexSubImage2D(target, level, xoffset, yoffset, width,
3734 height, format, type, _)) 3734 height, format, type, _))
3735 .Times(1) 3735 .Times(1)
3736 .RetiresOnSaturation(); 3736 .RetiresOnSaturation();
3737 GetDecoder()->ClearLevel(texture, target, level, format, type, 0, 0, width, 3737 GetDecoder()->ClearLevel(texture, target, level, format, type, 0, 0, width,
3738 height); 3738 height);
3739 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); 3739 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get());
3740 } 3740 }
3741 3741
3742 TEST_P(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) { 3742 TEST_P(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) {
3743 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 3743 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
3744 DoTexImage2D( 3744 DoTexImage2D(
3745 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 3745 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
3746 TextureRef* texture_ref = 3746 TextureRef* texture_ref =
3747 group().texture_manager()->GetTexture(client_texture_id_); 3747 group().texture_manager()->GetTexture(client_texture_id_);
3748 ASSERT_TRUE(texture_ref != NULL); 3748 ASSERT_TRUE(texture_ref != nullptr);
3749 Texture* texture = texture_ref->texture(); 3749 Texture* texture = texture_ref->texture();
3750 EXPECT_EQ(kServiceTextureId, texture->service_id()); 3750 EXPECT_EQ(kServiceTextureId, texture->service_id());
3751 3751
3752 scoped_refptr<gl::GLImage> image(new gl::GLImageStub); 3752 scoped_refptr<gl::GLImage> image(new gl::GLImageStub);
3753 GetImageManager()->AddImage(image.get(), 1); 3753 GetImageManager()->AddImage(image.get(), 1);
3754 EXPECT_FALSE(GetImageManager()->LookupImage(1) == NULL); 3754 EXPECT_FALSE(GetImageManager()->LookupImage(1) == nullptr);
3755 3755
3756 GLsizei width; 3756 GLsizei width;
3757 GLsizei height; 3757 GLsizei height;
3758 GLenum type; 3758 GLenum type;
3759 GLenum internal_format; 3759 GLenum internal_format;
3760 3760
3761 EXPECT_TRUE( 3761 EXPECT_TRUE(
3762 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); 3762 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
3763 EXPECT_EQ(3, width); 3763 EXPECT_EQ(3, width);
3764 EXPECT_EQ(1, height); 3764 EXPECT_EQ(1, height);
3765 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); 3765 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format));
3766 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); 3766 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format);
3767 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); 3767 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
3768 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 3768 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == nullptr);
3769 3769
3770 // Bind image to texture. 3770 // Bind image to texture.
3771 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. 3771 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor.
3772 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1); 3772 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1);
3773 EXPECT_TRUE( 3773 EXPECT_TRUE(
3774 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); 3774 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
3775 // Image should now be set. 3775 // Image should now be set.
3776 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 3776 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == nullptr);
3777 3777
3778 // Release image from texture. 3778 // Release image from texture.
3779 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. 3779 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor.
3780 EXPECT_CALL(*gl_, GetError()) 3780 EXPECT_CALL(*gl_, GetError())
3781 .WillOnce(Return(GL_NO_ERROR)) 3781 .WillOnce(Return(GL_NO_ERROR))
3782 .WillOnce(Return(GL_NO_ERROR)) 3782 .WillOnce(Return(GL_NO_ERROR))
3783 .RetiresOnSaturation(); 3783 .RetiresOnSaturation();
3784 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd; 3784 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd;
3785 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); 3785 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1);
3786 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd)); 3786 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd));
3787 EXPECT_TRUE( 3787 EXPECT_TRUE(
3788 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); 3788 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
3789 // Image should no longer be set. 3789 // Image should no longer be set.
3790 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 3790 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == nullptr);
3791 } 3791 }
3792 3792
3793 class MockGLImage : public gl::GLImage { 3793 class MockGLImage : public gl::GLImage {
3794 public: 3794 public:
3795 MockGLImage() {} 3795 MockGLImage() {}
3796 3796
3797 // Overridden from gl::GLImage: 3797 // Overridden from gl::GLImage:
3798 MOCK_METHOD0(GetSize, gfx::Size()); 3798 MOCK_METHOD0(GetSize, gfx::Size());
3799 MOCK_METHOD0(GetInternalFormat, unsigned()); 3799 MOCK_METHOD0(GetInternalFormat, unsigned());
3800 MOCK_METHOD1(Destroy, void(bool)); 3800 MOCK_METHOD1(Destroy, void(bool));
(...skipping 25 matching lines...) Expand all
3826 1, 3826 1,
3827 1, 3827 1,
3828 0, 3828 0,
3829 GL_RGBA, 3829 GL_RGBA,
3830 GL_UNSIGNED_BYTE, 3830 GL_UNSIGNED_BYTE,
3831 kSharedMemoryId, 3831 kSharedMemoryId,
3832 kSharedMemoryOffset); 3832 kSharedMemoryOffset);
3833 3833
3834 TextureRef* texture_ref = 3834 TextureRef* texture_ref =
3835 group().texture_manager()->GetTexture(client_texture_id_); 3835 group().texture_manager()->GetTexture(client_texture_id_);
3836 ASSERT_TRUE(texture_ref != NULL); 3836 ASSERT_TRUE(texture_ref != nullptr);
3837 Texture* texture = texture_ref->texture(); 3837 Texture* texture = texture_ref->texture();
3838 EXPECT_EQ(kServiceTextureId, texture->service_id()); 3838 EXPECT_EQ(kServiceTextureId, texture->service_id());
3839 3839
3840 const int32_t kImageId = 1; 3840 const int32_t kImageId = 1;
3841 scoped_refptr<MockGLImage> image(new MockGLImage); 3841 scoped_refptr<MockGLImage> image(new MockGLImage);
3842 GetImageManager()->AddImage(image.get(), kImageId); 3842 GetImageManager()->AddImage(image.get(), kImageId);
3843 3843
3844 // Bind image to texture. 3844 // Bind image to texture.
3845 EXPECT_CALL(*image.get(), BindTexImage(GL_TEXTURE_2D)) 3845 EXPECT_CALL(*image.get(), BindTexImage(GL_TEXTURE_2D))
3846 .Times(1) 3846 .Times(1)
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
3994 16, 3994 16,
3995 17, 3995 17,
3996 0, 3996 0,
3997 GL_LUMINANCE_ALPHA, 3997 GL_LUMINANCE_ALPHA,
3998 GL_FLOAT, 3998 GL_FLOAT,
3999 0, 3999 0,
4000 0); 4000 0);
4001 } 4001 }
4002 4002
4003 TEST_P(GLES2DecoderManualInitTest, TexImage2DFloatOnGLES3) { 4003 TEST_P(GLES2DecoderManualInitTest, TexImage2DFloatOnGLES3) {
4004 base::CommandLine command_line(0, nullptr);
4005 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs);
4004 InitState init; 4006 InitState init;
4005 init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float"; 4007 init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float";
4006 init.gl_version = "opengl es 3.0"; 4008 init.gl_version = "opengl es 3.0";
4007 InitDecoder(init); 4009 init.context_type = CONTEXT_TYPE_OPENGLES3;
4010 InitDecoderWithCommandLine(init, &command_line);
4008 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 4011 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
4009 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0); 4012 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0);
4010 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0); 4013 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0);
4011 DoTexImage2D( 4014 DoTexImage2D(
4012 GL_TEXTURE_2D, 0, GL_RGBA32F, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0); 4015 GL_TEXTURE_2D, 0, GL_RGBA32F, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0);
4013 DoTexImage2D( 4016 DoTexImage2D(
4014 GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, GL_LUMINANCE, GL_FLOAT, 0, 0); 4017 GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, GL_LUMINANCE, GL_FLOAT, 0, 0);
4015 DoTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, GL_ALPHA, GL_FLOAT, 0, 0); 4018 DoTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, GL_ALPHA, GL_FLOAT, 0, 0);
4016 DoTexImage2D(GL_TEXTURE_2D, 4019 DoTexImage2D(GL_TEXTURE_2D,
4017 0, 4020 0,
4018 GL_LUMINANCE_ALPHA, 4021 GL_LUMINANCE_ALPHA,
4019 16, 4022 16,
4020 17, 4023 17,
4021 0, 4024 0,
4022 GL_LUMINANCE_ALPHA, 4025 GL_LUMINANCE_ALPHA,
4023 GL_FLOAT, 4026 GL_FLOAT,
4024 0, 4027 0,
4025 0); 4028 0);
4026 } 4029 }
4027 4030
4028 TEST_P(GLES2DecoderManualInitTest, TexSubImage2DFloatOnGLES3) { 4031 TEST_P(GLES2DecoderManualInitTest, TexSubImage2DFloatOnGLES3) {
4032 base::CommandLine command_line(0, nullptr);
4033 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs);
4029 InitState init; 4034 InitState init;
4030 init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float"; 4035 init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float";
4031 init.gl_version = "opengl es 3.0"; 4036 init.gl_version = "opengl es 3.0";
4032 InitDecoder(init); 4037 init.context_type = CONTEXT_TYPE_OPENGLES3;
4038 InitDecoderWithCommandLine(init, &command_line);
4033 const int kWidth = 8; 4039 const int kWidth = 8;
4034 const int kHeight = 4; 4040 const int kHeight = 4;
4035 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 4041 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
4036 DoTexImage2D(GL_TEXTURE_2D, 4042 DoTexImage2D(GL_TEXTURE_2D,
4037 0, 4043 0,
4038 GL_RGBA32F, 4044 GL_RGBA32F,
4039 kWidth, 4045 kWidth,
4040 kHeight, 4046 kHeight,
4041 0, 4047 0,
4042 GL_RGBA, 4048 GL_RGBA,
(...skipping 22 matching lines...) Expand all
4065 GL_RGBA, 4071 GL_RGBA,
4066 GL_FLOAT, 4072 GL_FLOAT,
4067 kSharedMemoryId, 4073 kSharedMemoryId,
4068 kSharedMemoryOffset, 4074 kSharedMemoryOffset,
4069 GL_FALSE); 4075 GL_FALSE);
4070 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 4076 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4071 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 4077 EXPECT_EQ(GL_NO_ERROR, GetGLError());
4072 } 4078 }
4073 4079
4074 TEST_P(GLES2DecoderManualInitTest, TexSubImage2DFloatDoesClearOnGLES3) { 4080 TEST_P(GLES2DecoderManualInitTest, TexSubImage2DFloatDoesClearOnGLES3) {
4081 base::CommandLine command_line(0, nullptr);
4082 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs);
Zhenyao Mo 2016/11/01 22:28:45 Qiankun: sorry about this, but we are in the proce
qiankun 2016/11/02 01:43:14 So, we are not able to add new ES3 tests and fix b
4075 InitState init; 4083 InitState init;
4076 init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float"; 4084 init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float";
4077 init.gl_version = "opengl es 3.0"; 4085 init.gl_version = "opengl es 3.0";
4078 InitDecoder(init); 4086 init.context_type = CONTEXT_TYPE_OPENGLES3;
4087 InitDecoderWithCommandLine(init, &command_line);
4079 const int kWidth = 8; 4088 const int kWidth = 8;
4080 const int kHeight = 4; 4089 const int kHeight = 4;
4081 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 4090 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
4082 DoTexImage2D(GL_TEXTURE_2D, 4091 DoTexImage2D(GL_TEXTURE_2D,
4083 0, 4092 0,
4084 GL_RGBA32F, 4093 GL_RGBA32F,
4085 kWidth, 4094 kWidth,
4086 kHeight, 4095 kHeight,
4087 0, 4096 0,
4088 GL_RGBA, 4097 GL_RGBA,
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
4373 const GLsizei kDepth = 2; 4382 const GLsizei kDepth = 2;
4374 const GLenum kFormat = GL_RGBA; 4383 const GLenum kFormat = GL_RGBA;
4375 const GLenum kType = GL_UNSIGNED_BYTE; 4384 const GLenum kType = GL_UNSIGNED_BYTE;
4376 const uint32_t kBufferSize = kWidth * kHeight * kDepth * 4; 4385 const uint32_t kBufferSize = kWidth * kHeight * kDepth * 4;
4377 4386
4378 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId); 4387 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
4379 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0, 4388 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0,
4380 kFormat, kType, 0, 0); 4389 kFormat, kType, 0, 0);
4381 TextureRef* texture_ref = 4390 TextureRef* texture_ref =
4382 group().texture_manager()->GetTexture(client_texture_id_); 4391 group().texture_manager()->GetTexture(client_texture_id_);
4383 ASSERT_TRUE(texture_ref != NULL); 4392 ASSERT_TRUE(texture_ref != nullptr);
4384 Texture* texture = texture_ref->texture(); 4393 Texture* texture = texture_ref->texture();
4385 4394
4386 EXPECT_CALL(*gl_, GenBuffersARB(1, _)) 4395 EXPECT_CALL(*gl_, GenBuffersARB(1, _))
4387 .Times(1) 4396 .Times(1)
4388 .RetiresOnSaturation(); 4397 .RetiresOnSaturation();
4389 EXPECT_CALL(*gl_, BindBuffer(GL_PIXEL_UNPACK_BUFFER, _)) 4398 EXPECT_CALL(*gl_, BindBuffer(GL_PIXEL_UNPACK_BUFFER, _))
4390 .Times(1) 4399 .Times(1)
4391 .RetiresOnSaturation(); 4400 .RetiresOnSaturation();
4392 EXPECT_CALL(*gl_, BufferData(GL_PIXEL_UNPACK_BUFFER, 4401 EXPECT_CALL(*gl_, BufferData(GL_PIXEL_UNPACK_BUFFER,
4393 kBufferSize, _, GL_STATIC_DRAW)) 4402 kBufferSize, _, GL_STATIC_DRAW))
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4427 const GLsizei kDepth = 7; 4436 const GLsizei kDepth = 7;
4428 const GLenum kFormat = GL_RGBA; 4437 const GLenum kFormat = GL_RGBA;
4429 const GLenum kType = GL_UNSIGNED_BYTE; 4438 const GLenum kType = GL_UNSIGNED_BYTE;
4430 const uint32_t kBufferSize = 1024 * 1024 * 2; // Max buffer size per call. 4439 const uint32_t kBufferSize = 1024 * 1024 * 2; // Max buffer size per call.
4431 4440
4432 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId); 4441 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
4433 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0, 4442 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0,
4434 kFormat, kType, 0, 0); 4443 kFormat, kType, 0, 0);
4435 TextureRef* texture_ref = 4444 TextureRef* texture_ref =
4436 group().texture_manager()->GetTexture(client_texture_id_); 4445 group().texture_manager()->GetTexture(client_texture_id_);
4437 ASSERT_TRUE(texture_ref != NULL); 4446 ASSERT_TRUE(texture_ref != nullptr);
4438 Texture* texture = texture_ref->texture(); 4447 Texture* texture = texture_ref->texture();
4439 4448
4440 EXPECT_CALL(*gl_, GenBuffersARB(1, _)) 4449 EXPECT_CALL(*gl_, GenBuffersARB(1, _))
4441 .Times(1) 4450 .Times(1)
4442 .RetiresOnSaturation(); 4451 .RetiresOnSaturation();
4443 EXPECT_CALL(*gl_, BindBuffer(GL_PIXEL_UNPACK_BUFFER, _)) 4452 EXPECT_CALL(*gl_, BindBuffer(GL_PIXEL_UNPACK_BUFFER, _))
4444 .Times(1) 4453 .Times(1)
4445 .RetiresOnSaturation(); 4454 .RetiresOnSaturation();
4446 EXPECT_CALL(*gl_, BufferData(GL_PIXEL_UNPACK_BUFFER, 4455 EXPECT_CALL(*gl_, BufferData(GL_PIXEL_UNPACK_BUFFER,
4447 kBufferSize, _, GL_STATIC_DRAW)) 4456 kBufferSize, _, GL_STATIC_DRAW))
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4492 const GLsizei kDepth = 2; 4501 const GLsizei kDepth = 2;
4493 const GLenum kFormat = GL_RGBA; 4502 const GLenum kFormat = GL_RGBA;
4494 const GLenum kType = GL_UNSIGNED_BYTE; 4503 const GLenum kType = GL_UNSIGNED_BYTE;
4495 const uint32_t kBufferSize = 1024 * 1024 * 2; // Max buffer size per call. 4504 const uint32_t kBufferSize = 1024 * 1024 * 2; // Max buffer size per call.
4496 4505
4497 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId); 4506 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
4498 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0, 4507 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0,
4499 kFormat, kType, 0, 0); 4508 kFormat, kType, 0, 0);
4500 TextureRef* texture_ref = 4509 TextureRef* texture_ref =
4501 group().texture_manager()->GetTexture(client_texture_id_); 4510 group().texture_manager()->GetTexture(client_texture_id_);
4502 ASSERT_TRUE(texture_ref != NULL); 4511 ASSERT_TRUE(texture_ref != nullptr);
4503 Texture* texture = texture_ref->texture(); 4512 Texture* texture = texture_ref->texture();
4504 4513
4505 EXPECT_CALL(*gl_, GenBuffersARB(1, _)) 4514 EXPECT_CALL(*gl_, GenBuffersARB(1, _))
4506 .Times(1) 4515 .Times(1)
4507 .RetiresOnSaturation(); 4516 .RetiresOnSaturation();
4508 EXPECT_CALL(*gl_, BindBuffer(GL_PIXEL_UNPACK_BUFFER, _)) 4517 EXPECT_CALL(*gl_, BindBuffer(GL_PIXEL_UNPACK_BUFFER, _))
4509 .Times(1) 4518 .Times(1)
4510 .RetiresOnSaturation(); 4519 .RetiresOnSaturation();
4511 EXPECT_CALL(*gl_, BufferData(GL_PIXEL_UNPACK_BUFFER, 4520 EXPECT_CALL(*gl_, BufferData(GL_PIXEL_UNPACK_BUFFER,
4512 kBufferSize, _, GL_STATIC_DRAW)) 4521 kBufferSize, _, GL_STATIC_DRAW))
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
4578 // Generate and bind the source image. Making a new image for each set of 4587 // Generate and bind the source image. Making a new image for each set of
4579 // parameters is easier than trying to reuse images. Obviously there's no 4588 // parameters is easier than trying to reuse images. Obviously there's no
4580 // performance penalty. 4589 // performance penalty.
4581 int image_id = use_rgb_emulation * 2 + destination_texture_index; 4590 int image_id = use_rgb_emulation * 2 + destination_texture_index;
4582 scoped_refptr<gl::GLImage> image; 4591 scoped_refptr<gl::GLImage> image;
4583 if (use_rgb_emulation) 4592 if (use_rgb_emulation)
4584 image = new EmulatingRGBImageStub; 4593 image = new EmulatingRGBImageStub;
4585 else 4594 else
4586 image = new gl::GLImageStub; 4595 image = new gl::GLImageStub;
4587 GetImageManager()->AddImage(image.get(), image_id); 4596 GetImageManager()->AddImage(image.get(), image_id);
4588 EXPECT_FALSE(GetImageManager()->LookupImage(image_id) == NULL); 4597 EXPECT_FALSE(GetImageManager()->LookupImage(image_id) == nullptr);
4589 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); 4598 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId);
4590 4599
4591 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id); 4600 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id);
4592 DoFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, 4601 DoFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target,
4593 kFBOClientTextureId, kFBOServiceTextureId, level, 4602 kFBOClientTextureId, kFBOServiceTextureId, level,
4594 GL_NO_ERROR); 4603 GL_NO_ERROR);
4595 4604
4596 GLenum destination_texture_format = 4605 GLenum destination_texture_format =
4597 destination_texture_formats[destination_texture_index]; 4606 destination_texture_formats[destination_texture_index];
4598 bool should_succeed = 4607 bool should_succeed =
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4656 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D, 4665 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D,
4657 GL_DEPTH_TEXTURE_MODE, 4666 GL_DEPTH_TEXTURE_MODE,
4658 GL_RED)) 4667 GL_RED))
4659 .Times(1) 4668 .Times(1)
4660 .RetiresOnSaturation(); 4669 .RetiresOnSaturation();
4661 } 4670 }
4662 BindTexture cmd; 4671 BindTexture cmd;
4663 cmd.Init(GL_TEXTURE_2D, kNewClientId); 4672 cmd.Init(GL_TEXTURE_2D, kNewClientId);
4664 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 4673 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4665 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 4674 EXPECT_EQ(GL_NO_ERROR, GetGLError());
4666 EXPECT_TRUE(GetTexture(kNewClientId) != NULL); 4675 EXPECT_TRUE(GetTexture(kNewClientId) != nullptr);
4667 } 4676 }
4668 4677
4669 TEST_P(GLES2DecoderTest, BindTextureInvalidArgs) { 4678 TEST_P(GLES2DecoderTest, BindTextureInvalidArgs) {
4670 EXPECT_CALL(*gl_, BindTexture(_, _)).Times(0); 4679 EXPECT_CALL(*gl_, BindTexture(_, _)).Times(0);
4671 BindTexture cmd; 4680 BindTexture cmd;
4672 cmd.Init(GL_TEXTURE_1D, client_texture_id_); 4681 cmd.Init(GL_TEXTURE_1D, client_texture_id_);
4673 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 4682 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4674 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 4683 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
4675 4684
4676 cmd.Init(GL_TEXTURE_3D, client_texture_id_); 4685 cmd.Init(GL_TEXTURE_3D, client_texture_id_);
(...skipping 12 matching lines...) Expand all
4689 // TODO(gman): CompressedTexSubImage2DImmediate 4698 // TODO(gman): CompressedTexSubImage2DImmediate
4690 4699
4691 // TODO(gman): TexImage2D 4700 // TODO(gman): TexImage2D
4692 4701
4693 // TODO(gman): TexImage2DImmediate 4702 // TODO(gman): TexImage2DImmediate
4694 4703
4695 // TODO(gman): TexSubImage2DImmediate 4704 // TODO(gman): TexSubImage2DImmediate
4696 4705
4697 } // namespace gles2 4706 } // namespace gles2
4698 } // namespace gpu 4707 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698