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

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

Issue 245923008: Optimize GLES2DecoderImpl::ApplyDirtyState. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on refactored gles2_cmd_decoder_unittest.cc Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" 9 #include "gpu/command_buffer/common/gles2_cmd_format.h"
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 using ::testing::SetArgumentPointee; 47 using ::testing::SetArgumentPointee;
48 using ::testing::SetArgPointee; 48 using ::testing::SetArgPointee;
49 using ::testing::StrEq; 49 using ::testing::StrEq;
50 using ::testing::StrictMock; 50 using ::testing::StrictMock;
51 51
52 namespace gpu { 52 namespace gpu {
53 namespace gles2 { 53 namespace gles2 {
54 54
55 using namespace cmds; 55 using namespace cmds;
56 56
57 TEST_F(GLES2DecoderTest, GenerateMipmapWrongFormatsFails) { 57 TEST_P(GLES2DecoderTest, GenerateMipmapWrongFormatsFails) {
58 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)).Times(0); 58 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)).Times(0);
59 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 59 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
60 DoTexImage2D( 60 DoTexImage2D(
61 GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 61 GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
62 GenerateMipmap cmd; 62 GenerateMipmap cmd;
63 cmd.Init(GL_TEXTURE_2D); 63 cmd.Init(GL_TEXTURE_2D);
64 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 64 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
65 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 65 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
66 } 66 }
67 67
68 TEST_F(GLES2DecoderTest, GenerateMipmapHandlesOutOfMemory) { 68 TEST_P(GLES2DecoderTest, GenerateMipmapHandlesOutOfMemory) {
69 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 69 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
70 TextureManager* manager = group().texture_manager(); 70 TextureManager* manager = group().texture_manager();
71 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); 71 TextureRef* texture_ref = manager->GetTexture(client_texture_id_);
72 ASSERT_TRUE(texture_ref != NULL); 72 ASSERT_TRUE(texture_ref != NULL);
73 Texture* texture = texture_ref->texture(); 73 Texture* texture = texture_ref->texture();
74 GLint width = 0; 74 GLint width = 0;
75 GLint height = 0; 75 GLint height = 0;
76 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, 2, &width, &height)); 76 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, 2, &width, &height));
77 DoTexImage2D(GL_TEXTURE_2D, 77 DoTexImage2D(GL_TEXTURE_2D,
78 0, 78 0,
(...skipping 10 matching lines...) Expand all
89 .WillOnce(Return(GL_NO_ERROR)) 89 .WillOnce(Return(GL_NO_ERROR))
90 .WillOnce(Return(GL_OUT_OF_MEMORY)) 90 .WillOnce(Return(GL_OUT_OF_MEMORY))
91 .RetiresOnSaturation(); 91 .RetiresOnSaturation();
92 GenerateMipmap cmd; 92 GenerateMipmap cmd;
93 cmd.Init(GL_TEXTURE_2D); 93 cmd.Init(GL_TEXTURE_2D);
94 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 94 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
95 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); 95 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError());
96 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, 2, &width, &height)); 96 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, 2, &width, &height));
97 } 97 }
98 98
99 TEST_F(GLES2DecoderTest, GenerateMipmapClearsUnclearedTexture) { 99 TEST_P(GLES2DecoderTest, GenerateMipmapClearsUnclearedTexture) {
100 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)).Times(0); 100 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)).Times(0);
101 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 101 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
102 DoTexImage2D( 102 DoTexImage2D(
103 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 103 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
104 SetupClearTextureExpectations(kServiceTextureId, 104 SetupClearTextureExpectations(kServiceTextureId,
105 kServiceTextureId, 105 kServiceTextureId,
106 GL_TEXTURE_2D, 106 GL_TEXTURE_2D,
107 GL_TEXTURE_2D, 107 GL_TEXTURE_2D,
108 0, 108 0,
109 GL_RGBA, 109 GL_RGBA,
110 GL_RGBA, 110 GL_RGBA,
111 GL_UNSIGNED_BYTE, 111 GL_UNSIGNED_BYTE,
112 2, 112 2,
113 2); 113 2);
114 EXPECT_CALL(*gl_, GenerateMipmapEXT(GL_TEXTURE_2D)); 114 EXPECT_CALL(*gl_, GenerateMipmapEXT(GL_TEXTURE_2D));
115 EXPECT_CALL(*gl_, GetError()) 115 EXPECT_CALL(*gl_, GetError())
116 .WillOnce(Return(GL_NO_ERROR)) 116 .WillOnce(Return(GL_NO_ERROR))
117 .WillOnce(Return(GL_NO_ERROR)) 117 .WillOnce(Return(GL_NO_ERROR))
118 .RetiresOnSaturation(); 118 .RetiresOnSaturation();
119 GenerateMipmap cmd; 119 GenerateMipmap cmd;
120 cmd.Init(GL_TEXTURE_2D); 120 cmd.Init(GL_TEXTURE_2D);
121 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 121 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
122 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 122 EXPECT_EQ(GL_NO_ERROR, GetGLError());
123 } 123 }
124 124
125 // Same as GenerateMipmapClearsUnclearedTexture, but with workaround 125 // Same as GenerateMipmapClearsUnclearedTexture, but with workaround
126 // |set_texture_filters_before_generating_mipmap|. 126 // |set_texture_filters_before_generating_mipmap|.
127 TEST_F(GLES2DecoderManualInitTest, SetTextureFiltersBeforeGenerateMipmap) { 127 TEST_P(GLES2DecoderManualInitTest, SetTextureFiltersBeforeGenerateMipmap) {
128 CommandLine command_line(0, NULL); 128 CommandLine command_line(0, NULL);
129 command_line.AppendSwitchASCII( 129 command_line.AppendSwitchASCII(
130 switches::kGpuDriverBugWorkarounds, 130 switches::kGpuDriverBugWorkarounds,
131 base::IntToString(gpu::SET_TEXTURE_FILTER_BEFORE_GENERATING_MIPMAP)); 131 base::IntToString(gpu::SET_TEXTURE_FILTER_BEFORE_GENERATING_MIPMAP));
132 InitState init; 132 InitState init;
133 init.gl_version = "3.0"; 133 init.gl_version = "3.0";
134 init.bind_generates_resource = true; 134 init.bind_generates_resource = true;
135 InitDecoderWithCommandLine(init, &command_line); 135 InitDecoderWithCommandLine(init, &command_line);
136 136
137 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)).Times(0); 137 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)).Times(0);
(...skipping 26 matching lines...) Expand all
164 EXPECT_CALL(*gl_, GetError()) 164 EXPECT_CALL(*gl_, GetError())
165 .WillOnce(Return(GL_NO_ERROR)) 165 .WillOnce(Return(GL_NO_ERROR))
166 .WillOnce(Return(GL_NO_ERROR)) 166 .WillOnce(Return(GL_NO_ERROR))
167 .RetiresOnSaturation(); 167 .RetiresOnSaturation();
168 GenerateMipmap cmd; 168 GenerateMipmap cmd;
169 cmd.Init(GL_TEXTURE_2D); 169 cmd.Init(GL_TEXTURE_2D);
170 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 170 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
171 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 171 EXPECT_EQ(GL_NO_ERROR, GetGLError());
172 } 172 }
173 173
174 TEST_F(GLES2DecoderTest, ActiveTextureValidArgs) { 174 TEST_P(GLES2DecoderTest, ActiveTextureValidArgs) {
175 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE1)); 175 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE1));
176 SpecializedSetup<ActiveTexture, 0>(true); 176 SpecializedSetup<ActiveTexture, 0>(true);
177 ActiveTexture cmd; 177 ActiveTexture cmd;
178 cmd.Init(GL_TEXTURE1); 178 cmd.Init(GL_TEXTURE1);
179 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 179 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
180 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 180 EXPECT_EQ(GL_NO_ERROR, GetGLError());
181 } 181 }
182 182
183 TEST_F(GLES2DecoderTest, ActiveTextureInvalidArgs) { 183 TEST_P(GLES2DecoderTest, ActiveTextureInvalidArgs) {
184 EXPECT_CALL(*gl_, ActiveTexture(_)).Times(0); 184 EXPECT_CALL(*gl_, ActiveTexture(_)).Times(0);
185 SpecializedSetup<ActiveTexture, 0>(false); 185 SpecializedSetup<ActiveTexture, 0>(false);
186 ActiveTexture cmd; 186 ActiveTexture cmd;
187 cmd.Init(GL_TEXTURE0 - 1); 187 cmd.Init(GL_TEXTURE0 - 1);
188 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 188 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
189 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 189 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
190 cmd.Init(kNumTextureUnits); 190 cmd.Init(kNumTextureUnits);
191 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 191 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
192 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 192 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
193 } 193 }
194 194
195 TEST_F(GLES2DecoderTest, TexSubImage2DValidArgs) { 195 TEST_P(GLES2DecoderTest, TexSubImage2DValidArgs) {
196 const int kWidth = 16; 196 const int kWidth = 16;
197 const int kHeight = 8; 197 const int kHeight = 8;
198 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 198 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
199 DoTexImage2D(GL_TEXTURE_2D, 199 DoTexImage2D(GL_TEXTURE_2D,
200 1, 200 1,
201 GL_RGBA, 201 GL_RGBA,
202 kWidth, 202 kWidth,
203 kHeight, 203 kHeight,
204 0, 204 0,
205 GL_RGBA, 205 GL_RGBA,
(...skipping 21 matching lines...) Expand all
227 kHeight, 227 kHeight,
228 GL_RGBA, 228 GL_RGBA,
229 GL_UNSIGNED_BYTE, 229 GL_UNSIGNED_BYTE,
230 kSharedMemoryId, 230 kSharedMemoryId,
231 kSharedMemoryOffset, 231 kSharedMemoryOffset,
232 GL_FALSE); 232 GL_FALSE);
233 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 233 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
234 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 234 EXPECT_EQ(GL_NO_ERROR, GetGLError());
235 } 235 }
236 236
237 TEST_F(GLES2DecoderTest, TexSubImage2DBadArgs) { 237 TEST_P(GLES2DecoderTest, TexSubImage2DBadArgs) {
238 const int kWidth = 16; 238 const int kWidth = 16;
239 const int kHeight = 8; 239 const int kHeight = 8;
240 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 240 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
241 DoTexImage2D(GL_TEXTURE_2D, 241 DoTexImage2D(GL_TEXTURE_2D,
242 1, 242 1,
243 GL_RGBA, 243 GL_RGBA,
244 kWidth, 244 kWidth,
245 kHeight, 245 kHeight,
246 0, 246 0,
247 GL_RGBA, 247 GL_RGBA,
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 kWidth, 411 kWidth,
412 kHeight, 412 kHeight,
413 GL_RGBA, 413 GL_RGBA,
414 GL_UNSIGNED_BYTE, 414 GL_UNSIGNED_BYTE,
415 kSharedMemoryId, 415 kSharedMemoryId,
416 kInvalidSharedMemoryOffset, 416 kInvalidSharedMemoryOffset,
417 GL_FALSE); 417 GL_FALSE);
418 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); 418 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
419 } 419 }
420 420
421 TEST_F(GLES2DecoderTest, CopyTexSubImage2DValidArgs) { 421 TEST_P(GLES2DecoderTest, CopyTexSubImage2DValidArgs) {
422 const int kWidth = 16; 422 const int kWidth = 16;
423 const int kHeight = 8; 423 const int kHeight = 8;
424 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 424 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
425 DoTexImage2D(GL_TEXTURE_2D, 425 DoTexImage2D(GL_TEXTURE_2D,
426 1, 426 1,
427 GL_RGBA, 427 GL_RGBA,
428 kWidth, 428 kWidth,
429 kHeight, 429 kHeight,
430 0, 430 0,
431 GL_RGBA, 431 GL_RGBA,
432 GL_UNSIGNED_BYTE, 432 GL_UNSIGNED_BYTE,
433 kSharedMemoryId, 433 kSharedMemoryId,
434 kSharedMemoryOffset); 434 kSharedMemoryOffset);
435 EXPECT_CALL(*gl_, 435 EXPECT_CALL(*gl_,
436 CopyTexSubImage2D(GL_TEXTURE_2D, 1, 0, 0, 0, 0, kWidth, kHeight)) 436 CopyTexSubImage2D(GL_TEXTURE_2D, 1, 0, 0, 0, 0, kWidth, kHeight))
437 .Times(1) 437 .Times(1)
438 .RetiresOnSaturation(); 438 .RetiresOnSaturation();
439 CopyTexSubImage2D cmd; 439 CopyTexSubImage2D cmd;
440 cmd.Init(GL_TEXTURE_2D, 1, 0, 0, 0, 0, kWidth, kHeight); 440 cmd.Init(GL_TEXTURE_2D, 1, 0, 0, 0, 0, kWidth, kHeight);
441 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 441 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
442 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 442 EXPECT_EQ(GL_NO_ERROR, GetGLError());
443 } 443 }
444 444
445 TEST_F(GLES2DecoderTest, CopyTexSubImage2DBadArgs) { 445 TEST_P(GLES2DecoderTest, CopyTexSubImage2DBadArgs) {
446 const int kWidth = 16; 446 const int kWidth = 16;
447 const int kHeight = 8; 447 const int kHeight = 8;
448 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 448 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
449 DoTexImage2D(GL_TEXTURE_2D, 449 DoTexImage2D(GL_TEXTURE_2D,
450 1, 450 1,
451 GL_RGBA, 451 GL_RGBA,
452 kWidth, 452 kWidth,
453 kHeight, 453 kHeight,
454 0, 454 0,
455 GL_RGBA, 455 GL_RGBA,
(...skipping 17 matching lines...) Expand all
473 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 473 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
474 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); 474 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
475 cmd.Init(GL_TEXTURE_2D, 1, 0, 0, 0, 0, kWidth + 1, kHeight); 475 cmd.Init(GL_TEXTURE_2D, 1, 0, 0, 0, 0, kWidth + 1, kHeight);
476 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 476 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
477 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); 477 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
478 cmd.Init(GL_TEXTURE_2D, 1, 0, 0, 0, 0, kWidth, kHeight + 1); 478 cmd.Init(GL_TEXTURE_2D, 1, 0, 0, 0, 0, kWidth, kHeight + 1);
479 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 479 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
480 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); 480 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
481 } 481 }
482 482
483 TEST_F(GLES2DecoderTest, TexImage2DRedefinitionSucceeds) { 483 TEST_P(GLES2DecoderTest, TexImage2DRedefinitionSucceeds) {
484 const int kWidth = 16; 484 const int kWidth = 16;
485 const int kHeight = 8; 485 const int kHeight = 8;
486 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 486 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
487 EXPECT_CALL(*gl_, GetError()).WillRepeatedly(Return(GL_NO_ERROR)); 487 EXPECT_CALL(*gl_, GetError()).WillRepeatedly(Return(GL_NO_ERROR));
488 for (int ii = 0; ii < 2; ++ii) { 488 for (int ii = 0; ii < 2; ++ii) {
489 TexImage2D cmd; 489 TexImage2D cmd;
490 if (ii == 0) { 490 if (ii == 0) {
491 EXPECT_CALL(*gl_, 491 EXPECT_CALL(*gl_,
492 TexImage2D(GL_TEXTURE_2D, 492 TexImage2D(GL_TEXTURE_2D,
493 0, 493 0,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 kHeight - 1, 557 kHeight - 1,
558 GL_RGBA, 558 GL_RGBA,
559 GL_UNSIGNED_BYTE, 559 GL_UNSIGNED_BYTE,
560 kSharedMemoryId, 560 kSharedMemoryId,
561 kSharedMemoryOffset, 561 kSharedMemoryOffset,
562 GL_TRUE); 562 GL_TRUE);
563 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); 563 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
564 } 564 }
565 } 565 }
566 566
567 TEST_F(GLES2DecoderTest, TexImage2DGLError) { 567 TEST_P(GLES2DecoderTest, TexImage2DGLError) {
568 GLenum target = GL_TEXTURE_2D; 568 GLenum target = GL_TEXTURE_2D;
569 GLint level = 0; 569 GLint level = 0;
570 GLenum internal_format = GL_RGBA; 570 GLenum internal_format = GL_RGBA;
571 GLsizei width = 2; 571 GLsizei width = 2;
572 GLsizei height = 4; 572 GLsizei height = 4;
573 GLint border = 0; 573 GLint border = 0;
574 GLenum format = GL_RGBA; 574 GLenum format = GL_RGBA;
575 GLenum type = GL_UNSIGNED_BYTE; 575 GLenum type = GL_UNSIGNED_BYTE;
576 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 576 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
577 TextureManager* manager = group().texture_manager(); 577 TextureManager* manager = group().texture_manager();
(...skipping 26 matching lines...) Expand all
604 border, 604 border,
605 format, 605 format,
606 type, 606 type,
607 kSharedMemoryId, 607 kSharedMemoryId,
608 kSharedMemoryOffset); 608 kSharedMemoryOffset);
609 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 609 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
610 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); 610 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError());
611 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height)); 611 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height));
612 } 612 }
613 613
614 TEST_F(GLES2DecoderTest, CopyTexImage2DGLError) { 614 TEST_P(GLES2DecoderTest, CopyTexImage2DGLError) {
615 GLenum target = GL_TEXTURE_2D; 615 GLenum target = GL_TEXTURE_2D;
616 GLint level = 0; 616 GLint level = 0;
617 GLenum internal_format = GL_RGBA; 617 GLenum internal_format = GL_RGBA;
618 GLsizei width = 2; 618 GLsizei width = 2;
619 GLsizei height = 4; 619 GLsizei height = 4;
620 GLint border = 0; 620 GLint border = 0;
621 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 621 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
622 TextureManager* manager = group().texture_manager(); 622 TextureManager* manager = group().texture_manager();
623 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); 623 TextureRef* texture_ref = manager->GetTexture(client_texture_id_);
624 ASSERT_TRUE(texture_ref != NULL); 624 ASSERT_TRUE(texture_ref != NULL);
625 Texture* texture = texture_ref->texture(); 625 Texture* texture = texture_ref->texture();
626 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height)); 626 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height));
627 EXPECT_CALL(*gl_, GetError()) 627 EXPECT_CALL(*gl_, GetError())
628 .WillOnce(Return(GL_NO_ERROR)) 628 .WillOnce(Return(GL_NO_ERROR))
629 .WillOnce(Return(GL_OUT_OF_MEMORY)) 629 .WillOnce(Return(GL_OUT_OF_MEMORY))
630 .RetiresOnSaturation(); 630 .RetiresOnSaturation();
631 EXPECT_CALL(*gl_, 631 EXPECT_CALL(*gl_,
632 CopyTexImage2D( 632 CopyTexImage2D(
633 target, level, internal_format, 0, 0, width, height, border)) 633 target, level, internal_format, 0, 0, width, height, border))
634 .Times(1) 634 .Times(1)
635 .RetiresOnSaturation(); 635 .RetiresOnSaturation();
636 CopyTexImage2D cmd; 636 CopyTexImage2D cmd;
637 cmd.Init(target, level, internal_format, 0, 0, width, height, border); 637 cmd.Init(target, level, internal_format, 0, 0, width, height, border);
638 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 638 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
639 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); 639 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError());
640 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height)); 640 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height));
641 } 641 }
642 642
643 TEST_F(GLES2DecoderManualInitTest, CompressedTexImage2DBucketBadBucket) { 643 TEST_P(GLES2DecoderManualInitTest, CompressedTexImage2DBucketBadBucket) {
644 InitState init; 644 InitState init;
645 init.extensions = "GL_EXT_texture_compression_s3tc"; 645 init.extensions = "GL_EXT_texture_compression_s3tc";
646 init.gl_version = "3.0"; 646 init.gl_version = "3.0";
647 init.bind_generates_resource = true; 647 init.bind_generates_resource = true;
648 InitDecoder(init); 648 InitDecoder(init);
649 649
650 const uint32 kBadBucketId = 123; 650 const uint32 kBadBucketId = 123;
651 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 651 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
652 CompressedTexImage2DBucket cmd; 652 CompressedTexImage2DBucket cmd;
653 cmd.Init(GL_TEXTURE_2D, 653 cmd.Init(GL_TEXTURE_2D,
(...skipping 18 matching lines...) Expand all
672 672
673 namespace { 673 namespace {
674 674
675 struct S3TCTestData { 675 struct S3TCTestData {
676 GLenum format; 676 GLenum format;
677 size_t block_size; 677 size_t block_size;
678 }; 678 };
679 679
680 } // anonymous namespace. 680 } // anonymous namespace.
681 681
682 TEST_F(GLES2DecoderManualInitTest, CompressedTexImage2DS3TC) { 682 TEST_P(GLES2DecoderManualInitTest, CompressedTexImage2DS3TC) {
683 InitState init; 683 InitState init;
684 init.extensions = "GL_EXT_texture_compression_s3tc"; 684 init.extensions = "GL_EXT_texture_compression_s3tc";
685 init.gl_version = "3.0"; 685 init.gl_version = "3.0";
686 init.bind_generates_resource = true; 686 init.bind_generates_resource = true;
687 InitDecoder(init); 687 InitDecoder(init);
688 const uint32 kBucketId = 123; 688 const uint32 kBucketId = 123;
689 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); 689 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId);
690 ASSERT_TRUE(bucket != NULL); 690 ASSERT_TRUE(bucket != NULL);
691 691
692 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 692 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 kBucketId); 830 kBucketId);
831 EXPECT_EQ(error::kNoError, ExecuteCmd(sub_cmd)); 831 EXPECT_EQ(error::kNoError, ExecuteCmd(sub_cmd));
832 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 832 EXPECT_EQ(GL_NO_ERROR, GetGLError());
833 } 833 }
834 } 834 }
835 } 835 }
836 } 836 }
837 } 837 }
838 } 838 }
839 839
840 TEST_F(GLES2DecoderManualInitTest, CompressedTexImage2DETC1) { 840 TEST_P(GLES2DecoderManualInitTest, CompressedTexImage2DETC1) {
841 InitState init; 841 InitState init;
842 init.extensions = "GL_OES_compressed_ETC1_RGB8_texture"; 842 init.extensions = "GL_OES_compressed_ETC1_RGB8_texture";
843 init.gl_version = "opengl es 2.0"; 843 init.gl_version = "opengl es 2.0";
844 init.bind_generates_resource = true; 844 init.bind_generates_resource = true;
845 InitDecoder(init); 845 InitDecoder(init);
846 const uint32 kBucketId = 123; 846 const uint32 kBucketId = 123;
847 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); 847 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId);
848 ASSERT_TRUE(bucket != NULL); 848 ASSERT_TRUE(bucket != NULL);
849 849
850 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 850 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 EXPECT_EQ(error::kNoError, ExecuteCmd(texsub_cmd)); 907 EXPECT_EQ(error::kNoError, ExecuteCmd(texsub_cmd));
908 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 908 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
909 909
910 // Test CopyTexSubImage not allowed for ETC1 compressed texture 910 // Test CopyTexSubImage not allowed for ETC1 compressed texture
911 CopyTexSubImage2D copy_cmd; 911 CopyTexSubImage2D copy_cmd;
912 copy_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 4, 4); 912 copy_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 4, 4);
913 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_cmd)); 913 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_cmd));
914 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 914 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
915 } 915 }
916 916
917 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalBindTexture) { 917 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalBindTexture) {
918 InitState init; 918 InitState init;
919 init.extensions = "GL_OES_EGL_image_external"; 919 init.extensions = "GL_OES_EGL_image_external";
920 init.gl_version = "opengl es 2.0"; 920 init.gl_version = "opengl es 2.0";
921 init.bind_generates_resource = true; 921 init.bind_generates_resource = true;
922 InitDecoder(init); 922 InitDecoder(init);
923 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId)); 923 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId));
924 EXPECT_CALL(*gl_, GenTextures(1, _)) 924 EXPECT_CALL(*gl_, GenTextures(1, _))
925 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); 925 .WillOnce(SetArgumentPointee<1>(kNewServiceId));
926 BindTexture cmd; 926 BindTexture cmd;
927 cmd.Init(GL_TEXTURE_EXTERNAL_OES, kNewClientId); 927 cmd.Init(GL_TEXTURE_EXTERNAL_OES, kNewClientId);
928 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 928 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
929 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 929 EXPECT_EQ(GL_NO_ERROR, GetGLError());
930 TextureRef* texture_ref = GetTexture(kNewClientId); 930 TextureRef* texture_ref = GetTexture(kNewClientId);
931 EXPECT_TRUE(texture_ref != NULL); 931 EXPECT_TRUE(texture_ref != NULL);
932 EXPECT_TRUE(texture_ref->texture()->target() == GL_TEXTURE_EXTERNAL_OES); 932 EXPECT_TRUE(texture_ref->texture()->target() == GL_TEXTURE_EXTERNAL_OES);
933 } 933 }
934 934
935 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalGetBinding) { 935 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalGetBinding) {
936 InitState init; 936 InitState init;
937 init.extensions = "GL_OES_EGL_image_external"; 937 init.extensions = "GL_OES_EGL_image_external";
938 init.gl_version = "opengl es 2.0"; 938 init.gl_version = "opengl es 2.0";
939 init.bind_generates_resource = true; 939 init.bind_generates_resource = true;
940 InitDecoder(init); 940 InitDecoder(init);
941 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); 941 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
942 942
943 EXPECT_CALL(*gl_, GetError()) 943 EXPECT_CALL(*gl_, GetError())
944 .WillOnce(Return(GL_NO_ERROR)) 944 .WillOnce(Return(GL_NO_ERROR))
945 .WillOnce(Return(GL_NO_ERROR)) 945 .WillOnce(Return(GL_NO_ERROR))
946 .RetiresOnSaturation(); 946 .RetiresOnSaturation();
947 typedef GetIntegerv::Result Result; 947 typedef GetIntegerv::Result Result;
948 Result* result = static_cast<Result*>(shared_memory_address_); 948 Result* result = static_cast<Result*>(shared_memory_address_);
949 EXPECT_CALL(*gl_, 949 EXPECT_CALL(*gl_,
950 GetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, result->GetData())) 950 GetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, result->GetData()))
951 .Times(0); 951 .Times(0);
952 result->size = 0; 952 result->size = 0;
953 GetIntegerv cmd; 953 GetIntegerv cmd;
954 cmd.Init(GL_TEXTURE_BINDING_EXTERNAL_OES, 954 cmd.Init(GL_TEXTURE_BINDING_EXTERNAL_OES,
955 shared_memory_id_, 955 shared_memory_id_,
956 shared_memory_offset_); 956 shared_memory_offset_);
957 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 957 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
958 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned( 958 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
959 GL_TEXTURE_BINDING_EXTERNAL_OES), 959 GL_TEXTURE_BINDING_EXTERNAL_OES),
960 result->GetNumResults()); 960 result->GetNumResults());
961 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 961 EXPECT_EQ(GL_NO_ERROR, GetGLError());
962 EXPECT_EQ(client_texture_id_, (uint32)result->GetData()[0]); 962 EXPECT_EQ(client_texture_id_, (uint32)result->GetData()[0]);
963 } 963 }
964 964
965 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureDefaults) { 965 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalTextureDefaults) {
966 InitState init; 966 InitState init;
967 init.extensions = "GL_OES_EGL_image_external"; 967 init.extensions = "GL_OES_EGL_image_external";
968 init.gl_version = "opengl es 2.0"; 968 init.gl_version = "opengl es 2.0";
969 init.bind_generates_resource = true; 969 init.bind_generates_resource = true;
970 InitDecoder(init); 970 InitDecoder(init);
971 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); 971 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
972 972
973 TextureRef* texture_ref = GetTexture(client_texture_id_); 973 TextureRef* texture_ref = GetTexture(client_texture_id_);
974 EXPECT_TRUE(texture_ref != NULL); 974 EXPECT_TRUE(texture_ref != NULL);
975 Texture* texture = texture_ref->texture(); 975 Texture* texture = texture_ref->texture();
976 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); 976 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES);
977 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); 977 EXPECT_TRUE(texture->min_filter() == GL_LINEAR);
978 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); 978 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE);
979 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); 979 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE);
980 } 980 }
981 981
982 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParam) { 982 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalTextureParam) {
983 InitState init; 983 InitState init;
984 init.extensions = "GL_OES_EGL_image_external"; 984 init.extensions = "GL_OES_EGL_image_external";
985 init.gl_version = "opengl es 2.0"; 985 init.gl_version = "opengl es 2.0";
986 init.bind_generates_resource = true; 986 init.bind_generates_resource = true;
987 InitDecoder(init); 987 InitDecoder(init);
988 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); 988 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
989 989
990 EXPECT_CALL(*gl_, 990 EXPECT_CALL(*gl_,
991 TexParameteri( 991 TexParameteri(
992 GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST)); 992 GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
(...skipping 27 matching lines...) Expand all
1020 1020
1021 TextureRef* texture_ref = GetTexture(client_texture_id_); 1021 TextureRef* texture_ref = GetTexture(client_texture_id_);
1022 EXPECT_TRUE(texture_ref != NULL); 1022 EXPECT_TRUE(texture_ref != NULL);
1023 Texture* texture = texture_ref->texture(); 1023 Texture* texture = texture_ref->texture();
1024 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); 1024 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES);
1025 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); 1025 EXPECT_TRUE(texture->min_filter() == GL_LINEAR);
1026 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); 1026 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE);
1027 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); 1027 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE);
1028 } 1028 }
1029 1029
1030 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParamInvalid) { 1030 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalTextureParamInvalid) {
1031 InitState init; 1031 InitState init;
1032 init.extensions = "GL_OES_EGL_image_external"; 1032 init.extensions = "GL_OES_EGL_image_external";
1033 init.gl_version = "opengl es 2.0"; 1033 init.gl_version = "opengl es 2.0";
1034 init.bind_generates_resource = true; 1034 init.bind_generates_resource = true;
1035 InitDecoder(init); 1035 InitDecoder(init);
1036 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); 1036 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
1037 1037
1038 TexParameteri cmd; 1038 TexParameteri cmd;
1039 cmd.Init(GL_TEXTURE_EXTERNAL_OES, 1039 cmd.Init(GL_TEXTURE_EXTERNAL_OES,
1040 GL_TEXTURE_MIN_FILTER, 1040 GL_TEXTURE_MIN_FILTER,
(...skipping 11 matching lines...) Expand all
1052 1052
1053 TextureRef* texture_ref = GetTexture(client_texture_id_); 1053 TextureRef* texture_ref = GetTexture(client_texture_id_);
1054 EXPECT_TRUE(texture_ref != NULL); 1054 EXPECT_TRUE(texture_ref != NULL);
1055 Texture* texture = texture_ref->texture(); 1055 Texture* texture = texture_ref->texture();
1056 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); 1056 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES);
1057 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); 1057 EXPECT_TRUE(texture->min_filter() == GL_LINEAR);
1058 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); 1058 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE);
1059 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); 1059 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE);
1060 } 1060 }
1061 1061
1062 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTexImage2DError) { 1062 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalTexImage2DError) {
1063 InitState init; 1063 InitState init;
1064 init.extensions = "GL_OES_EGL_image_external"; 1064 init.extensions = "GL_OES_EGL_image_external";
1065 init.gl_version = "opengl es 2.0"; 1065 init.gl_version = "opengl es 2.0";
1066 init.bind_generates_resource = true; 1066 init.bind_generates_resource = true;
1067 InitDecoder(init); 1067 InitDecoder(init);
1068 1068
1069 GLenum target = GL_TEXTURE_EXTERNAL_OES; 1069 GLenum target = GL_TEXTURE_EXTERNAL_OES;
1070 GLint level = 0; 1070 GLint level = 0;
1071 GLenum internal_format = GL_RGBA; 1071 GLenum internal_format = GL_RGBA;
1072 GLsizei width = 2; 1072 GLsizei width = 2;
(...skipping 13 matching lines...) Expand all
1086 format, 1086 format,
1087 type, 1087 type,
1088 kSharedMemoryId, 1088 kSharedMemoryId,
1089 kSharedMemoryOffset); 1089 kSharedMemoryOffset);
1090 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1090 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1091 1091
1092 // TexImage2D is not allowed with GL_TEXTURE_EXTERNAL_OES targets. 1092 // TexImage2D is not allowed with GL_TEXTURE_EXTERNAL_OES targets.
1093 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 1093 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1094 } 1094 }
1095 1095
1096 TEST_F(GLES2DecoderManualInitTest, DefaultTextureZero) { 1096 TEST_P(GLES2DecoderManualInitTest, DefaultTextureZero) {
1097 InitState init; 1097 InitState init;
1098 init.gl_version = "3.0"; 1098 init.gl_version = "3.0";
1099 InitDecoder(init); 1099 InitDecoder(init);
1100 1100
1101 BindTexture cmd1; 1101 BindTexture cmd1;
1102 cmd1.Init(GL_TEXTURE_2D, 0); 1102 cmd1.Init(GL_TEXTURE_2D, 0);
1103 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0)); 1103 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0));
1104 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); 1104 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1));
1105 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1105 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1106 1106
1107 BindTexture cmd2; 1107 BindTexture cmd2;
1108 cmd2.Init(GL_TEXTURE_CUBE_MAP, 0); 1108 cmd2.Init(GL_TEXTURE_CUBE_MAP, 0);
1109 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_CUBE_MAP, 0)); 1109 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_CUBE_MAP, 0));
1110 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); 1110 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
1111 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1111 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1112 } 1112 }
1113 1113
1114 TEST_F(GLES2DecoderManualInitTest, DefaultTextureBGR) { 1114 TEST_P(GLES2DecoderManualInitTest, DefaultTextureBGR) {
1115 InitState init; 1115 InitState init;
1116 init.gl_version = "3.0"; 1116 init.gl_version = "3.0";
1117 init.bind_generates_resource = true; 1117 init.bind_generates_resource = true;
1118 InitDecoder(init); 1118 InitDecoder(init);
1119 1119
1120 BindTexture cmd1; 1120 BindTexture cmd1;
1121 cmd1.Init(GL_TEXTURE_2D, 0); 1121 cmd1.Init(GL_TEXTURE_2D, 0);
1122 EXPECT_CALL( 1122 EXPECT_CALL(
1123 *gl_, BindTexture(GL_TEXTURE_2D, TestHelper::kServiceDefaultTexture2dId)); 1123 *gl_, BindTexture(GL_TEXTURE_2D, TestHelper::kServiceDefaultTexture2dId));
1124 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); 1124 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1));
1125 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1125 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1126 1126
1127 BindTexture cmd2; 1127 BindTexture cmd2;
1128 cmd2.Init(GL_TEXTURE_CUBE_MAP, 0); 1128 cmd2.Init(GL_TEXTURE_CUBE_MAP, 0);
1129 EXPECT_CALL(*gl_, 1129 EXPECT_CALL(*gl_,
1130 BindTexture(GL_TEXTURE_CUBE_MAP, 1130 BindTexture(GL_TEXTURE_CUBE_MAP,
1131 TestHelper::kServiceDefaultTextureCubemapId)); 1131 TestHelper::kServiceDefaultTextureCubemapId));
1132 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); 1132 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
1133 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1133 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1134 } 1134 }
1135 1135
1136 // Test that default texture 0 is immutable. 1136 // Test that default texture 0 is immutable.
1137 TEST_F(GLES2DecoderManualInitTest, NoDefaultTexParameterf) { 1137 TEST_P(GLES2DecoderManualInitTest, NoDefaultTexParameterf) {
1138 InitState init; 1138 InitState init;
1139 init.gl_version = "3.0"; 1139 init.gl_version = "3.0";
1140 InitDecoder(init); 1140 InitDecoder(init);
1141 1141
1142 { 1142 {
1143 BindTexture cmd1; 1143 BindTexture cmd1;
1144 cmd1.Init(GL_TEXTURE_2D, 0); 1144 cmd1.Init(GL_TEXTURE_2D, 0);
1145 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0)); 1145 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0));
1146 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); 1146 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1));
1147 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1147 EXPECT_EQ(GL_NO_ERROR, GetGLError());
(...skipping 11 matching lines...) Expand all
1159 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); 1159 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1));
1160 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1160 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1161 1161
1162 TexParameterf cmd2; 1162 TexParameterf cmd2;
1163 cmd2.Init(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 1163 cmd2.Init(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1164 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); 1164 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
1165 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); 1165 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1166 } 1166 }
1167 } 1167 }
1168 1168
1169 TEST_F(GLES2DecoderManualInitTest, NoDefaultTexParameteri) { 1169 TEST_P(GLES2DecoderManualInitTest, NoDefaultTexParameteri) {
1170 InitState init; 1170 InitState init;
1171 init.gl_version = "3.0"; 1171 init.gl_version = "3.0";
1172 InitDecoder(init); 1172 InitDecoder(init);
1173 1173
1174 { 1174 {
1175 BindTexture cmd1; 1175 BindTexture cmd1;
1176 cmd1.Init(GL_TEXTURE_2D, 0); 1176 cmd1.Init(GL_TEXTURE_2D, 0);
1177 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0)); 1177 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0));
1178 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); 1178 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1));
1179 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1179 EXPECT_EQ(GL_NO_ERROR, GetGLError());
(...skipping 11 matching lines...) Expand all
1191 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); 1191 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1));
1192 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1192 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1193 1193
1194 TexParameteri cmd2; 1194 TexParameteri cmd2;
1195 cmd2.Init(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 1195 cmd2.Init(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1196 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); 1196 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
1197 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); 1197 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1198 } 1198 }
1199 } 1199 }
1200 1200
1201 TEST_F(GLES2DecoderManualInitTest, NoDefaultTexParameterfv) { 1201 TEST_P(GLES2DecoderManualInitTest, NoDefaultTexParameterfv) {
1202 InitState init; 1202 InitState init;
1203 init.gl_version = "3.0"; 1203 init.gl_version = "3.0";
1204 InitDecoder(init); 1204 InitDecoder(init);
1205 1205
1206 { 1206 {
1207 BindTexture cmd1; 1207 BindTexture cmd1;
1208 cmd1.Init(GL_TEXTURE_2D, 0); 1208 cmd1.Init(GL_TEXTURE_2D, 0);
1209 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0)); 1209 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0));
1210 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); 1210 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1));
1211 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1211 EXPECT_EQ(GL_NO_ERROR, GetGLError());
(...skipping 19 matching lines...) Expand all
1231 cmd2.Init(GL_TEXTURE_CUBE_MAP, 1231 cmd2.Init(GL_TEXTURE_CUBE_MAP,
1232 GL_TEXTURE_MAG_FILTER, 1232 GL_TEXTURE_MAG_FILTER,
1233 shared_memory_id_, 1233 shared_memory_id_,
1234 shared_memory_offset_); 1234 shared_memory_offset_);
1235 GetSharedMemoryAs<GLfloat*>()[0] = GL_NEAREST; 1235 GetSharedMemoryAs<GLfloat*>()[0] = GL_NEAREST;
1236 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); 1236 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
1237 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); 1237 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1238 } 1238 }
1239 } 1239 }
1240 1240
1241 TEST_F(GLES2DecoderManualInitTest, NoDefaultTexParameteriv) { 1241 TEST_P(GLES2DecoderManualInitTest, NoDefaultTexParameteriv) {
1242 InitState init; 1242 InitState init;
1243 init.gl_version = "3.0"; 1243 init.gl_version = "3.0";
1244 InitDecoder(init); 1244 InitDecoder(init);
1245 1245
1246 { 1246 {
1247 BindTexture cmd1; 1247 BindTexture cmd1;
1248 cmd1.Init(GL_TEXTURE_2D, 0); 1248 cmd1.Init(GL_TEXTURE_2D, 0);
1249 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0)); 1249 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0));
1250 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); 1250 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1));
1251 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1251 EXPECT_EQ(GL_NO_ERROR, GetGLError());
(...skipping 19 matching lines...) Expand all
1271 cmd2.Init(GL_TEXTURE_CUBE_MAP, 1271 cmd2.Init(GL_TEXTURE_CUBE_MAP,
1272 GL_TEXTURE_MAG_FILTER, 1272 GL_TEXTURE_MAG_FILTER,
1273 shared_memory_id_, 1273 shared_memory_id_,
1274 shared_memory_offset_); 1274 shared_memory_offset_);
1275 GetSharedMemoryAs<GLint*>()[0] = GL_NEAREST; 1275 GetSharedMemoryAs<GLint*>()[0] = GL_NEAREST;
1276 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); 1276 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
1277 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); 1277 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1278 } 1278 }
1279 } 1279 }
1280 1280
1281 TEST_F(GLES2DecoderManualInitTest, NoDefaultTexImage2D) { 1281 TEST_P(GLES2DecoderManualInitTest, NoDefaultTexImage2D) {
1282 InitState init; 1282 InitState init;
1283 init.gl_version = "3.0"; 1283 init.gl_version = "3.0";
1284 InitDecoder(init); 1284 InitDecoder(init);
1285 1285
1286 BindTexture cmd1; 1286 BindTexture cmd1;
1287 cmd1.Init(GL_TEXTURE_2D, 0); 1287 cmd1.Init(GL_TEXTURE_2D, 0);
1288 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0)); 1288 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0));
1289 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); 1289 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1));
1290 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1290 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1291 1291
1292 TexImage2D cmd2; 1292 TexImage2D cmd2;
1293 cmd2.Init(GL_TEXTURE_2D, 1293 cmd2.Init(GL_TEXTURE_2D,
1294 0, 1294 0,
1295 GL_RGBA, 1295 GL_RGBA,
1296 2, 1296 2,
1297 2, 1297 2,
1298 0, 1298 0,
1299 GL_RGBA, 1299 GL_RGBA,
1300 GL_UNSIGNED_BYTE, 1300 GL_UNSIGNED_BYTE,
1301 kSharedMemoryId, 1301 kSharedMemoryId,
1302 kSharedMemoryOffset); 1302 kSharedMemoryOffset);
1303 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); 1303 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
1304 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 1304 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
1305 } 1305 }
1306 1306
1307 TEST_F(GLES2DecoderManualInitTest, NoDefaultTexSubImage2D) { 1307 TEST_P(GLES2DecoderManualInitTest, NoDefaultTexSubImage2D) {
1308 InitState init; 1308 InitState init;
1309 init.gl_version = "3.0"; 1309 init.gl_version = "3.0";
1310 InitDecoder(init); 1310 InitDecoder(init);
1311 1311
1312 BindTexture cmd1; 1312 BindTexture cmd1;
1313 cmd1.Init(GL_TEXTURE_2D, 0); 1313 cmd1.Init(GL_TEXTURE_2D, 0);
1314 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0)); 1314 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0));
1315 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); 1315 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1));
1316 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1316 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1317 1317
1318 TexSubImage2D cmd2; 1318 TexSubImage2D cmd2;
1319 cmd2.Init(GL_TEXTURE_2D, 1319 cmd2.Init(GL_TEXTURE_2D,
1320 0, 1320 0,
1321 1, 1321 1,
1322 1, 1322 1,
1323 1, 1323 1,
1324 1, 1324 1,
1325 GL_RGBA, 1325 GL_RGBA,
1326 GL_UNSIGNED_BYTE, 1326 GL_UNSIGNED_BYTE,
1327 kSharedMemoryId, 1327 kSharedMemoryId,
1328 kSharedMemoryOffset, 1328 kSharedMemoryOffset,
1329 GL_FALSE); 1329 GL_FALSE);
1330 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); 1330 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
1331 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 1331 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
1332 } 1332 }
1333 1333
1334 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) { 1334 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) {
1335 InitState init; 1335 InitState init;
1336 init.extensions = "GL_ARB_texture_rectangle"; 1336 init.extensions = "GL_ARB_texture_rectangle";
1337 init.gl_version = "3.0"; 1337 init.gl_version = "3.0";
1338 init.bind_generates_resource = true; 1338 init.bind_generates_resource = true;
1339 InitDecoder(init); 1339 InitDecoder(init);
1340 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_RECTANGLE_ARB, kNewServiceId)); 1340 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_RECTANGLE_ARB, kNewServiceId));
1341 EXPECT_CALL(*gl_, GenTextures(1, _)) 1341 EXPECT_CALL(*gl_, GenTextures(1, _))
1342 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); 1342 .WillOnce(SetArgumentPointee<1>(kNewServiceId));
1343 BindTexture cmd; 1343 BindTexture cmd;
1344 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, kNewClientId); 1344 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, kNewClientId);
1345 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1345 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1346 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1346 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1347 Texture* texture = GetTexture(kNewClientId)->texture(); 1347 Texture* texture = GetTexture(kNewClientId)->texture();
1348 EXPECT_TRUE(texture != NULL); 1348 EXPECT_TRUE(texture != NULL);
1349 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); 1349 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB);
1350 } 1350 }
1351 1351
1352 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleGetBinding) { 1352 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleGetBinding) {
1353 InitState init; 1353 InitState init;
1354 init.extensions = "GL_ARB_texture_rectangle"; 1354 init.extensions = "GL_ARB_texture_rectangle";
1355 init.gl_version = "3.0"; 1355 init.gl_version = "3.0";
1356 init.bind_generates_resource = true; 1356 init.bind_generates_resource = true;
1357 InitDecoder(init); 1357 InitDecoder(init);
1358 DoBindTexture( 1358 DoBindTexture(
1359 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); 1359 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId);
1360 1360
1361 EXPECT_CALL(*gl_, GetError()) 1361 EXPECT_CALL(*gl_, GetError())
1362 .WillOnce(Return(GL_NO_ERROR)) 1362 .WillOnce(Return(GL_NO_ERROR))
(...skipping 10 matching lines...) Expand all
1373 shared_memory_id_, 1373 shared_memory_id_,
1374 shared_memory_offset_); 1374 shared_memory_offset_);
1375 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1375 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1376 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned( 1376 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
1377 GL_TEXTURE_BINDING_RECTANGLE_ARB), 1377 GL_TEXTURE_BINDING_RECTANGLE_ARB),
1378 result->GetNumResults()); 1378 result->GetNumResults());
1379 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1379 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1380 EXPECT_EQ(client_texture_id_, (uint32)result->GetData()[0]); 1380 EXPECT_EQ(client_texture_id_, (uint32)result->GetData()[0]);
1381 } 1381 }
1382 1382
1383 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureDefaults) { 1383 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleTextureDefaults) {
1384 InitState init; 1384 InitState init;
1385 init.extensions = "GL_ARB_texture_rectangle"; 1385 init.extensions = "GL_ARB_texture_rectangle";
1386 init.gl_version = "3.0"; 1386 init.gl_version = "3.0";
1387 init.bind_generates_resource = true; 1387 init.bind_generates_resource = true;
1388 InitDecoder(init); 1388 InitDecoder(init);
1389 DoBindTexture( 1389 DoBindTexture(
1390 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); 1390 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId);
1391 1391
1392 Texture* texture = GetTexture(client_texture_id_)->texture(); 1392 Texture* texture = GetTexture(client_texture_id_)->texture();
1393 EXPECT_TRUE(texture != NULL); 1393 EXPECT_TRUE(texture != NULL);
1394 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); 1394 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB);
1395 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); 1395 EXPECT_TRUE(texture->min_filter() == GL_LINEAR);
1396 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); 1396 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE);
1397 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); 1397 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE);
1398 } 1398 }
1399 1399
1400 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParam) { 1400 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParam) {
1401 InitState init; 1401 InitState init;
1402 init.extensions = "GL_ARB_texture_rectangle"; 1402 init.extensions = "GL_ARB_texture_rectangle";
1403 init.gl_version = "3.0"; 1403 init.gl_version = "3.0";
1404 init.bind_generates_resource = true; 1404 init.bind_generates_resource = true;
1405 InitDecoder(init); 1405 InitDecoder(init);
1406 1406
1407 DoBindTexture( 1407 DoBindTexture(
1408 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); 1408 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId);
1409 1409
1410 EXPECT_CALL(*gl_, 1410 EXPECT_CALL(*gl_,
(...skipping 28 matching lines...) Expand all
1439 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1439 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1440 1440
1441 Texture* texture = GetTexture(client_texture_id_)->texture(); 1441 Texture* texture = GetTexture(client_texture_id_)->texture();
1442 EXPECT_TRUE(texture != NULL); 1442 EXPECT_TRUE(texture != NULL);
1443 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); 1443 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB);
1444 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); 1444 EXPECT_TRUE(texture->min_filter() == GL_LINEAR);
1445 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); 1445 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE);
1446 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); 1446 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE);
1447 } 1447 }
1448 1448
1449 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParamInvalid) { 1449 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParamInvalid) {
1450 InitState init; 1450 InitState init;
1451 init.extensions = "GL_ARB_texture_rectangle"; 1451 init.extensions = "GL_ARB_texture_rectangle";
1452 init.gl_version = "3.0"; 1452 init.gl_version = "3.0";
1453 init.bind_generates_resource = true; 1453 init.bind_generates_resource = true;
1454 InitDecoder(init); 1454 InitDecoder(init);
1455 1455
1456 DoBindTexture( 1456 DoBindTexture(
1457 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); 1457 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId);
1458 1458
1459 TexParameteri cmd; 1459 TexParameteri cmd;
(...skipping 12 matching lines...) Expand all
1472 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 1472 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1473 1473
1474 Texture* texture = GetTexture(client_texture_id_)->texture(); 1474 Texture* texture = GetTexture(client_texture_id_)->texture();
1475 EXPECT_TRUE(texture != NULL); 1475 EXPECT_TRUE(texture != NULL);
1476 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); 1476 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB);
1477 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); 1477 EXPECT_TRUE(texture->min_filter() == GL_LINEAR);
1478 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); 1478 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE);
1479 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); 1479 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE);
1480 } 1480 }
1481 1481
1482 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTexImage2DError) { 1482 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleTexImage2DError) {
1483 InitState init; 1483 InitState init;
1484 init.extensions = "GL_ARB_texture_rectangle"; 1484 init.extensions = "GL_ARB_texture_rectangle";
1485 init.gl_version = "3.0"; 1485 init.gl_version = "3.0";
1486 init.bind_generates_resource = true; 1486 init.bind_generates_resource = true;
1487 InitDecoder(init); 1487 InitDecoder(init);
1488 1488
1489 GLenum target = GL_TEXTURE_RECTANGLE_ARB; 1489 GLenum target = GL_TEXTURE_RECTANGLE_ARB;
1490 GLint level = 0; 1490 GLint level = 0;
1491 GLenum internal_format = GL_RGBA; 1491 GLenum internal_format = GL_RGBA;
1492 GLsizei width = 2; 1492 GLsizei width = 2;
(...skipping 14 matching lines...) Expand all
1507 format, 1507 format,
1508 type, 1508 type,
1509 kSharedMemoryId, 1509 kSharedMemoryId,
1510 kSharedMemoryOffset); 1510 kSharedMemoryOffset);
1511 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1511 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1512 1512
1513 // TexImage2D is not allowed with GL_TEXTURE_RECTANGLE_ARB targets. 1513 // TexImage2D is not allowed with GL_TEXTURE_RECTANGLE_ARB targets.
1514 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 1514 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1515 } 1515 }
1516 1516
1517 TEST_F(GLES2DecoderManualInitTest, TexSubImage2DClearsAfterTexImage2DNULL) { 1517 TEST_P(GLES2DecoderManualInitTest, TexSubImage2DClearsAfterTexImage2DNULL) {
1518 InitState init; 1518 InitState init;
1519 init.gl_version = "opengl es 2.0"; 1519 init.gl_version = "opengl es 2.0";
1520 init.has_alpha = true; 1520 init.has_alpha = true;
1521 init.has_depth = true; 1521 init.has_depth = true;
1522 init.request_alpha = true; 1522 init.request_alpha = true;
1523 init.request_depth = true; 1523 init.request_depth = true;
1524 InitDecoder(init); 1524 InitDecoder(init);
1525 1525
1526 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 1526 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
1527 DoTexImage2D( 1527 DoTexImage2D(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 1, 1570 1,
1571 1, 1571 1,
1572 GL_RGBA, 1572 GL_RGBA,
1573 GL_UNSIGNED_BYTE, 1573 GL_UNSIGNED_BYTE,
1574 shared_memory_address_)) 1574 shared_memory_address_))
1575 .Times(1) 1575 .Times(1)
1576 .RetiresOnSaturation(); 1576 .RetiresOnSaturation();
1577 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1577 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1578 } 1578 }
1579 1579
1580 TEST_F(GLES2DecoderTest, TexSubImage2DDoesNotClearAfterTexImage2DNULLThenData) { 1580 TEST_P(GLES2DecoderTest, TexSubImage2DDoesNotClearAfterTexImage2DNULLThenData) {
1581 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 1581 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
1582 DoTexImage2D( 1582 DoTexImage2D(
1583 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 1583 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
1584 DoTexImage2D(GL_TEXTURE_2D, 1584 DoTexImage2D(GL_TEXTURE_2D,
1585 0, 1585 0,
1586 GL_RGBA, 1586 GL_RGBA,
1587 2, 1587 2,
1588 2, 1588 2,
1589 0, 1589 0,
1590 GL_RGBA, 1590 GL_RGBA,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 1, 1625 1,
1626 1, 1626 1,
1627 GL_RGBA, 1627 GL_RGBA,
1628 GL_UNSIGNED_BYTE, 1628 GL_UNSIGNED_BYTE,
1629 shared_memory_address_)) 1629 shared_memory_address_))
1630 .Times(1) 1630 .Times(1)
1631 .RetiresOnSaturation(); 1631 .RetiresOnSaturation();
1632 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1632 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1633 } 1633 }
1634 1634
1635 TEST_F( 1635 TEST_P(
1636 GLES2DecoderManualInitTest, 1636 GLES2DecoderManualInitTest,
1637 TexSubImage2DDoesNotClearAfterTexImage2DNULLThenDataWithTexImage2DIsFaster) { 1637 TexSubImage2DDoesNotClearAfterTexImage2DNULLThenDataWithTexImage2DIsFaster) {
1638 CommandLine command_line(0, NULL); 1638 CommandLine command_line(0, NULL);
1639 command_line.AppendSwitchASCII( 1639 command_line.AppendSwitchASCII(
1640 switches::kGpuDriverBugWorkarounds, 1640 switches::kGpuDriverBugWorkarounds,
1641 base::IntToString(gpu::TEXSUBIMAGE2D_FASTER_THAN_TEXIMAGE2D)); 1641 base::IntToString(gpu::TEXSUBIMAGE2D_FASTER_THAN_TEXIMAGE2D));
1642 InitState init; 1642 InitState init;
1643 init.gl_version = "3.0"; 1643 init.gl_version = "3.0";
1644 init.bind_generates_resource = true; 1644 init.bind_generates_resource = true;
1645 InitDecoderWithCommandLine(init, &command_line); 1645 InitDecoderWithCommandLine(init, &command_line);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 1, 1703 1,
1704 1, 1704 1,
1705 GL_RGBA, 1705 GL_RGBA,
1706 GL_UNSIGNED_BYTE, 1706 GL_UNSIGNED_BYTE,
1707 shared_memory_address_)) 1707 shared_memory_address_))
1708 .Times(1) 1708 .Times(1)
1709 .RetiresOnSaturation(); 1709 .RetiresOnSaturation();
1710 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1710 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1711 } 1711 }
1712 1712
1713 TEST_F(GLES2DecoderTest, TexSubImage2DClearsAfterTexImage2DWithDataThenNULL) { 1713 TEST_P(GLES2DecoderTest, TexSubImage2DClearsAfterTexImage2DWithDataThenNULL) {
1714 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 1714 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
1715 // Put in data (so it should be marked as cleared) 1715 // Put in data (so it should be marked as cleared)
1716 DoTexImage2D(GL_TEXTURE_2D, 1716 DoTexImage2D(GL_TEXTURE_2D,
1717 0, 1717 0,
1718 GL_RGBA, 1718 GL_RGBA,
1719 2, 1719 2,
1720 2, 1720 2,
1721 0, 1721 0,
1722 GL_RGBA, 1722 GL_RGBA,
1723 GL_UNSIGNED_BYTE, 1723 GL_UNSIGNED_BYTE,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 1, 1760 1,
1761 1, 1761 1,
1762 GL_RGBA, 1762 GL_RGBA,
1763 GL_UNSIGNED_BYTE, 1763 GL_UNSIGNED_BYTE,
1764 kSharedMemoryId, 1764 kSharedMemoryId,
1765 kSharedMemoryOffset, 1765 kSharedMemoryOffset,
1766 GL_FALSE); 1766 GL_FALSE);
1767 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1767 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1768 } 1768 }
1769 1769
1770 TEST_F(GLES2DecoderTest, CopyTexImage2DMarksTextureAsCleared) { 1770 TEST_P(GLES2DecoderTest, CopyTexImage2DMarksTextureAsCleared) {
1771 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 1771 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
1772 1772
1773 TextureManager* manager = group().texture_manager(); 1773 TextureManager* manager = group().texture_manager();
1774 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); 1774 TextureRef* texture_ref = manager->GetTexture(client_texture_id_);
1775 ASSERT_TRUE(texture_ref != NULL); 1775 ASSERT_TRUE(texture_ref != NULL);
1776 Texture* texture = texture_ref->texture(); 1776 Texture* texture = texture_ref->texture();
1777 1777
1778 EXPECT_CALL(*gl_, GetError()) 1778 EXPECT_CALL(*gl_, GetError())
1779 .WillOnce(Return(GL_NO_ERROR)) 1779 .WillOnce(Return(GL_NO_ERROR))
1780 .RetiresOnSaturation(); 1780 .RetiresOnSaturation();
1781 EXPECT_CALL(*gl_, CopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1, 1, 0)) 1781 EXPECT_CALL(*gl_, CopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1, 1, 0))
1782 .Times(1) 1782 .Times(1)
1783 .RetiresOnSaturation(); 1783 .RetiresOnSaturation();
1784 EXPECT_CALL(*gl_, GetError()) 1784 EXPECT_CALL(*gl_, GetError())
1785 .WillOnce(Return(GL_NO_ERROR)) 1785 .WillOnce(Return(GL_NO_ERROR))
1786 .RetiresOnSaturation(); 1786 .RetiresOnSaturation();
1787 CopyTexImage2D cmd; 1787 CopyTexImage2D cmd;
1788 cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1, 1, 0); 1788 cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1, 1, 0);
1789 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1789 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1790 1790
1791 EXPECT_TRUE(texture->SafeToRenderFrom()); 1791 EXPECT_TRUE(texture->SafeToRenderFrom());
1792 } 1792 }
1793 1793
1794 TEST_F(GLES2DecoderTest, CopyTexSubImage2DClearsUnclearedTexture) { 1794 TEST_P(GLES2DecoderTest, CopyTexSubImage2DClearsUnclearedTexture) {
1795 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 1795 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
1796 DoTexImage2D( 1796 DoTexImage2D(
1797 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 1797 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
1798 1798
1799 SetupClearTextureExpectations(kServiceTextureId, 1799 SetupClearTextureExpectations(kServiceTextureId,
1800 kServiceTextureId, 1800 kServiceTextureId,
1801 GL_TEXTURE_2D, 1801 GL_TEXTURE_2D,
1802 GL_TEXTURE_2D, 1802 GL_TEXTURE_2D,
1803 0, 1803 0,
1804 GL_RGBA, 1804 GL_RGBA,
1805 GL_RGBA, 1805 GL_RGBA,
1806 GL_UNSIGNED_BYTE, 1806 GL_UNSIGNED_BYTE,
1807 2, 1807 2,
1808 2); 1808 2);
1809 EXPECT_CALL(*gl_, CopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1)) 1809 EXPECT_CALL(*gl_, CopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1))
1810 .Times(1) 1810 .Times(1)
1811 .RetiresOnSaturation(); 1811 .RetiresOnSaturation();
1812 CopyTexSubImage2D cmd; 1812 CopyTexSubImage2D cmd;
1813 cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1); 1813 cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1);
1814 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1814 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1815 } 1815 }
1816 1816
1817 TEST_F(GLES2DecoderManualInitTest, CompressedImage2DMarksTextureAsCleared) { 1817 TEST_P(GLES2DecoderManualInitTest, CompressedImage2DMarksTextureAsCleared) {
1818 InitState init; 1818 InitState init;
1819 init.extensions = "GL_EXT_texture_compression_s3tc"; 1819 init.extensions = "GL_EXT_texture_compression_s3tc";
1820 init.gl_version = "3.0"; 1820 init.gl_version = "3.0";
1821 init.bind_generates_resource = true; 1821 init.bind_generates_resource = true;
1822 InitDecoder(init); 1822 InitDecoder(init);
1823 1823
1824 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 1824 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
1825 EXPECT_CALL(*gl_, GetError()) 1825 EXPECT_CALL(*gl_, GetError())
1826 .WillOnce(Return(GL_NO_ERROR)) 1826 .WillOnce(Return(GL_NO_ERROR))
1827 .RetiresOnSaturation(); 1827 .RetiresOnSaturation();
(...skipping 15 matching lines...) Expand all
1843 0, 1843 0,
1844 8, 1844 8,
1845 kSharedMemoryId, 1845 kSharedMemoryId,
1846 kSharedMemoryOffset); 1846 kSharedMemoryOffset);
1847 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1847 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1848 TextureManager* manager = group().texture_manager(); 1848 TextureManager* manager = group().texture_manager();
1849 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); 1849 TextureRef* texture_ref = manager->GetTexture(client_texture_id_);
1850 EXPECT_TRUE(texture_ref->texture()->SafeToRenderFrom()); 1850 EXPECT_TRUE(texture_ref->texture()->SafeToRenderFrom());
1851 } 1851 }
1852 1852
1853 TEST_F(GLES2DecoderTest, TextureUsageAngleExtNotEnabledByDefault) { 1853 TEST_P(GLES2DecoderTest, TextureUsageAngleExtNotEnabledByDefault) {
1854 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 1854 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
1855 1855
1856 TexParameteri cmd; 1856 TexParameteri cmd;
1857 cmd.Init( 1857 cmd.Init(
1858 GL_TEXTURE_2D, GL_TEXTURE_USAGE_ANGLE, GL_FRAMEBUFFER_ATTACHMENT_ANGLE); 1858 GL_TEXTURE_2D, GL_TEXTURE_USAGE_ANGLE, GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
1859 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1859 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1860 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 1860 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1861 } 1861 }
1862 1862
1863 TEST_F(GLES2DecoderTest, ProduceAndConsumeTextureCHROMIUM) { 1863 TEST_P(GLES2DecoderTest, ProduceAndConsumeTextureCHROMIUM) {
1864 Mailbox mailbox = Mailbox::Generate(); 1864 Mailbox mailbox = Mailbox::Generate();
1865 1865
1866 memcpy(shared_memory_address_, mailbox.name, sizeof(mailbox.name)); 1866 memcpy(shared_memory_address_, mailbox.name, sizeof(mailbox.name));
1867 1867
1868 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 1868 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
1869 DoTexImage2D( 1869 DoTexImage2D(
1870 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 1870 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
1871 DoTexImage2D( 1871 DoTexImage2D(
1872 GL_TEXTURE_2D, 1, GL_RGBA, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 1872 GL_TEXTURE_2D, 1, GL_RGBA, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
1873 TextureRef* texture_ref = 1873 TextureRef* texture_ref =
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 EXPECT_EQ(2, width); 1934 EXPECT_EQ(2, width);
1935 EXPECT_EQ(4, height); 1935 EXPECT_EQ(4, height);
1936 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format)); 1936 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format));
1937 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); 1937 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format);
1938 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); 1938 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
1939 1939
1940 // Service ID is restored. 1940 // Service ID is restored.
1941 EXPECT_EQ(kServiceTextureId, texture->service_id()); 1941 EXPECT_EQ(kServiceTextureId, texture->service_id());
1942 } 1942 }
1943 1943
1944 TEST_F(GLES2DecoderManualInitTest, DepthTextureBadArgs) { 1944 TEST_P(GLES2DecoderManualInitTest, DepthTextureBadArgs) {
1945 InitState init; 1945 InitState init;
1946 init.extensions = "GL_ANGLE_depth_texture"; 1946 init.extensions = "GL_ANGLE_depth_texture";
1947 init.gl_version = "opengl es 2.0"; 1947 init.gl_version = "opengl es 2.0";
1948 init.has_depth = true; 1948 init.has_depth = true;
1949 init.has_stencil = true; 1949 init.has_stencil = true;
1950 init.request_depth = true; 1950 init.request_depth = true;
1951 init.request_stencil = true; 1951 init.request_stencil = true;
1952 init.bind_generates_resource = true; 1952 init.bind_generates_resource = true;
1953 InitDecoder(init); 1953 InitDecoder(init);
1954 1954
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2015 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_tex_cmd)); 2015 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_tex_cmd));
2016 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 2016 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
2017 2017
2018 // Check that trying to CopyTexSubImage2D fails 2018 // Check that trying to CopyTexSubImage2D fails
2019 CopyTexSubImage2D copy_sub_cmd; 2019 CopyTexSubImage2D copy_sub_cmd;
2020 copy_sub_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1); 2020 copy_sub_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1);
2021 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_sub_cmd)); 2021 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_sub_cmd));
2022 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 2022 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
2023 } 2023 }
2024 2024
2025 TEST_F(GLES2DecoderManualInitTest, GenerateMipmapDepthTexture) { 2025 TEST_P(GLES2DecoderManualInitTest, GenerateMipmapDepthTexture) {
2026 InitState init; 2026 InitState init;
2027 init.extensions = "GL_ANGLE_depth_texture"; 2027 init.extensions = "GL_ANGLE_depth_texture";
2028 init.gl_version = "opengl es 2.0"; 2028 init.gl_version = "opengl es 2.0";
2029 init.has_depth = true; 2029 init.has_depth = true;
2030 init.has_stencil = true; 2030 init.has_stencil = true;
2031 init.request_depth = true; 2031 init.request_depth = true;
2032 init.request_stencil = true; 2032 init.request_stencil = true;
2033 init.bind_generates_resource = true; 2033 init.bind_generates_resource = true;
2034 InitDecoder(init); 2034 InitDecoder(init);
2035 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 2035 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
2036 DoTexImage2D(GL_TEXTURE_2D, 2036 DoTexImage2D(GL_TEXTURE_2D,
2037 0, 2037 0,
2038 GL_DEPTH_COMPONENT, 2038 GL_DEPTH_COMPONENT,
2039 2, 2039 2,
2040 2, 2040 2,
2041 0, 2041 0,
2042 GL_DEPTH_COMPONENT, 2042 GL_DEPTH_COMPONENT,
2043 GL_UNSIGNED_INT, 2043 GL_UNSIGNED_INT,
2044 0, 2044 0,
2045 0); 2045 0);
2046 GenerateMipmap cmd; 2046 GenerateMipmap cmd;
2047 cmd.Init(GL_TEXTURE_2D); 2047 cmd.Init(GL_TEXTURE_2D);
2048 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2048 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2049 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 2049 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
2050 } 2050 }
2051 2051
2052 TEST_F(GLES2DecoderTest, BindTexImage2DCHROMIUM) { 2052 TEST_P(GLES2DecoderTest, BindTexImage2DCHROMIUM) {
2053 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 2053 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
2054 DoTexImage2D( 2054 DoTexImage2D(
2055 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 2055 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
2056 TextureRef* texture_ref = 2056 TextureRef* texture_ref =
2057 group().texture_manager()->GetTexture(client_texture_id_); 2057 group().texture_manager()->GetTexture(client_texture_id_);
2058 ASSERT_TRUE(texture_ref != NULL); 2058 ASSERT_TRUE(texture_ref != NULL);
2059 Texture* texture = texture_ref->texture(); 2059 Texture* texture = texture_ref->texture();
2060 EXPECT_EQ(kServiceTextureId, texture->service_id()); 2060 EXPECT_EQ(kServiceTextureId, texture->service_id());
2061 2061
2062 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0).get(), 1); 2062 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0).get(), 1);
(...skipping 26 matching lines...) Expand all
2089 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 2089 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
2090 2090
2091 // Define new texture image. 2091 // Define new texture image.
2092 DoTexImage2D( 2092 DoTexImage2D(
2093 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 2093 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
2094 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); 2094 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height));
2095 // Image should no longer be set. 2095 // Image should no longer be set.
2096 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 2096 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
2097 } 2097 }
2098 2098
2099 TEST_F(GLES2DecoderTest, BindTexImage2DCHROMIUMCubeMapNotAllowed) { 2099 TEST_P(GLES2DecoderTest, BindTexImage2DCHROMIUMCubeMapNotAllowed) {
2100 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0).get(), 1); 2100 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0).get(), 1);
2101 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId); 2101 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId);
2102 2102
2103 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; 2103 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd;
2104 bind_tex_image_2d_cmd.Init(GL_TEXTURE_CUBE_MAP, 1); 2104 bind_tex_image_2d_cmd.Init(GL_TEXTURE_CUBE_MAP, 1);
2105 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); 2105 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd));
2106 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 2106 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
2107 } 2107 }
2108 2108
2109 TEST_F(GLES2DecoderTest, OrphanGLImageWithTexImage2D) { 2109 TEST_P(GLES2DecoderTest, OrphanGLImageWithTexImage2D) {
2110 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0).get(), 1); 2110 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0).get(), 1);
2111 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId); 2111 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId);
2112 2112
2113 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; 2113 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd;
2114 bind_tex_image_2d_cmd.Init(GL_TEXTURE_CUBE_MAP, 1); 2114 bind_tex_image_2d_cmd.Init(GL_TEXTURE_CUBE_MAP, 1);
2115 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); 2115 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd));
2116 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 2116 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
2117 2117
2118 DoTexImage2D( 2118 DoTexImage2D(
2119 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 2119 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
2120 TextureRef* texture_ref = 2120 TextureRef* texture_ref =
2121 group().texture_manager()->GetTexture(client_texture_id_); 2121 group().texture_manager()->GetTexture(client_texture_id_);
2122 ASSERT_TRUE(texture_ref != NULL); 2122 ASSERT_TRUE(texture_ref != NULL);
2123 Texture* texture = texture_ref->texture(); 2123 Texture* texture = texture_ref->texture();
2124 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 2124 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
2125 } 2125 }
2126 2126
2127 TEST_F(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) { 2127 TEST_P(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) {
2128 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 2128 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
2129 DoTexImage2D( 2129 DoTexImage2D(
2130 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 2130 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
2131 TextureRef* texture_ref = 2131 TextureRef* texture_ref =
2132 group().texture_manager()->GetTexture(client_texture_id_); 2132 group().texture_manager()->GetTexture(client_texture_id_);
2133 ASSERT_TRUE(texture_ref != NULL); 2133 ASSERT_TRUE(texture_ref != NULL);
2134 Texture* texture = texture_ref->texture(); 2134 Texture* texture = texture_ref->texture();
2135 EXPECT_EQ(kServiceTextureId, texture->service_id()); 2135 EXPECT_EQ(kServiceTextureId, texture->service_id());
2136 2136
2137 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0).get(), 1); 2137 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0).get(), 1);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2188 MOCK_METHOD1(ReleaseTexImage, void(unsigned)); 2188 MOCK_METHOD1(ReleaseTexImage, void(unsigned));
2189 MOCK_METHOD0(WillUseTexImage, void()); 2189 MOCK_METHOD0(WillUseTexImage, void());
2190 MOCK_METHOD0(DidUseTexImage, void()); 2190 MOCK_METHOD0(DidUseTexImage, void());
2191 MOCK_METHOD0(WillModifyTexImage, void()); 2191 MOCK_METHOD0(WillModifyTexImage, void());
2192 MOCK_METHOD0(DidModifyTexImage, void()); 2192 MOCK_METHOD0(DidModifyTexImage, void());
2193 2193
2194 protected: 2194 protected:
2195 virtual ~MockGLImage() {} 2195 virtual ~MockGLImage() {}
2196 }; 2196 };
2197 2197
2198 TEST_F(GLES2DecoderWithShaderTest, UseTexImage) { 2198 TEST_P(GLES2DecoderWithShaderTest, UseTexImage) {
2199 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 2199 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
2200 DoTexImage2D(GL_TEXTURE_2D, 2200 DoTexImage2D(GL_TEXTURE_2D,
2201 0, 2201 0,
2202 GL_RGBA, 2202 GL_RGBA,
2203 1, 2203 1,
2204 1, 2204 1,
2205 0, 2205 0,
2206 GL_RGBA, 2206 GL_RGBA,
2207 GL_UNSIGNED_BYTE, 2207 GL_UNSIGNED_BYTE,
2208 kSharedMemoryId, 2208 kSharedMemoryId,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 .WillOnce(Return(GL_NO_ERROR)) 2314 .WillOnce(Return(GL_NO_ERROR))
2315 .RetiresOnSaturation(); 2315 .RetiresOnSaturation();
2316 FramebufferRenderbuffer fbrb_cmd; 2316 FramebufferRenderbuffer fbrb_cmd;
2317 fbrb_cmd.Init(GL_FRAMEBUFFER, 2317 fbrb_cmd.Init(GL_FRAMEBUFFER,
2318 GL_COLOR_ATTACHMENT0, 2318 GL_COLOR_ATTACHMENT0,
2319 GL_RENDERBUFFER, 2319 GL_RENDERBUFFER,
2320 client_renderbuffer_id_); 2320 client_renderbuffer_id_);
2321 EXPECT_EQ(error::kNoError, ExecuteCmd(fbrb_cmd)); 2321 EXPECT_EQ(error::kNoError, ExecuteCmd(fbrb_cmd));
2322 } 2322 }
2323 2323
2324 TEST_F(GLES2DecoderManualInitTest, DrawWithGLImageExternal) { 2324 TEST_P(GLES2DecoderManualInitTest, DrawWithGLImageExternal) {
2325 InitState init; 2325 InitState init;
2326 init.extensions = "GL_OES_EGL_image_external"; 2326 init.extensions = "GL_OES_EGL_image_external";
2327 init.gl_version = "opengl es 2.0"; 2327 init.gl_version = "opengl es 2.0";
2328 init.has_alpha = true; 2328 init.has_alpha = true;
2329 init.has_depth = true; 2329 init.has_depth = true;
2330 init.request_alpha = true; 2330 init.request_alpha = true;
2331 init.request_depth = true; 2331 init.request_depth = true;
2332 init.bind_generates_resource = true; 2332 init.bind_generates_resource = true;
2333 InitDecoder(init); 2333 InitDecoder(init);
2334 2334
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2379 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)).Times(1).RetiresOnSaturation(); 2379 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)).Times(1).RetiresOnSaturation();
2380 DrawElements cmd; 2380 DrawElements cmd;
2381 cmd.Init(GL_TRIANGLES, 2381 cmd.Init(GL_TRIANGLES,
2382 kValidIndexRangeCount, 2382 kValidIndexRangeCount,
2383 GL_UNSIGNED_SHORT, 2383 GL_UNSIGNED_SHORT,
2384 kValidIndexRangeStart * 2); 2384 kValidIndexRangeStart * 2);
2385 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2385 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2386 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2386 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2387 } 2387 }
2388 2388
2389 TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatOnGLES2) { 2389 TEST_P(GLES2DecoderManualInitTest, TexImage2DFloatOnGLES2) {
2390 InitState init; 2390 InitState init;
2391 init.extensions = "GL_OES_texture_float"; 2391 init.extensions = "GL_OES_texture_float";
2392 init.gl_version = "opengl es 2.0"; 2392 init.gl_version = "opengl es 2.0";
2393 InitDecoder(init); 2393 InitDecoder(init);
2394 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 2394 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
2395 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0); 2395 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0);
2396 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0); 2396 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0);
2397 DoTexImage2D( 2397 DoTexImage2D(
2398 GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, GL_LUMINANCE, GL_FLOAT, 0, 0); 2398 GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, GL_LUMINANCE, GL_FLOAT, 0, 0);
2399 DoTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, GL_ALPHA, GL_FLOAT, 0, 0); 2399 DoTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, GL_ALPHA, GL_FLOAT, 0, 0);
2400 DoTexImage2D(GL_TEXTURE_2D, 2400 DoTexImage2D(GL_TEXTURE_2D,
2401 0, 2401 0,
2402 GL_LUMINANCE_ALPHA, 2402 GL_LUMINANCE_ALPHA,
2403 16, 2403 16,
2404 17, 2404 17,
2405 0, 2405 0,
2406 GL_LUMINANCE_ALPHA, 2406 GL_LUMINANCE_ALPHA,
2407 GL_FLOAT, 2407 GL_FLOAT,
2408 0, 2408 0,
2409 0); 2409 0);
2410 } 2410 }
2411 2411
2412 TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatOnGLES3) { 2412 TEST_P(GLES2DecoderManualInitTest, TexImage2DFloatOnGLES3) {
2413 InitState init; 2413 InitState init;
2414 init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float"; 2414 init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float";
2415 init.gl_version = "opengl es 3.0"; 2415 init.gl_version = "opengl es 3.0";
2416 InitDecoder(init); 2416 InitDecoder(init);
2417 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 2417 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
2418 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0); 2418 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0);
2419 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0); 2419 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0);
2420 DoTexImage2D( 2420 DoTexImage2D(
2421 GL_TEXTURE_2D, 0, GL_RGBA32F, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0); 2421 GL_TEXTURE_2D, 0, GL_RGBA32F, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0);
2422 DoTexImage2D( 2422 DoTexImage2D(
2423 GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, GL_LUMINANCE, GL_FLOAT, 0, 0); 2423 GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, GL_LUMINANCE, GL_FLOAT, 0, 0);
2424 DoTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, GL_ALPHA, GL_FLOAT, 0, 0); 2424 DoTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, GL_ALPHA, GL_FLOAT, 0, 0);
2425 DoTexImage2D(GL_TEXTURE_2D, 2425 DoTexImage2D(GL_TEXTURE_2D,
2426 0, 2426 0,
2427 GL_LUMINANCE_ALPHA, 2427 GL_LUMINANCE_ALPHA,
2428 16, 2428 16,
2429 17, 2429 17,
2430 0, 2430 0,
2431 GL_LUMINANCE_ALPHA, 2431 GL_LUMINANCE_ALPHA,
2432 GL_FLOAT, 2432 GL_FLOAT,
2433 0, 2433 0,
2434 0); 2434 0);
2435 } 2435 }
2436 2436
2437 TEST_F(GLES2DecoderManualInitTest, TexSubImage2DFloatOnGLES3) { 2437 TEST_P(GLES2DecoderManualInitTest, TexSubImage2DFloatOnGLES3) {
2438 InitState init; 2438 InitState init;
2439 init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float"; 2439 init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float";
2440 init.gl_version = "opengl es 3.0"; 2440 init.gl_version = "opengl es 3.0";
2441 InitDecoder(init); 2441 InitDecoder(init);
2442 const int kWidth = 8; 2442 const int kWidth = 8;
2443 const int kHeight = 4; 2443 const int kHeight = 4;
2444 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 2444 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
2445 DoTexImage2D(GL_TEXTURE_2D, 2445 DoTexImage2D(GL_TEXTURE_2D,
2446 0, 2446 0,
2447 GL_RGBA32F, 2447 GL_RGBA32F,
(...skipping 25 matching lines...) Expand all
2473 kHeight, 2473 kHeight,
2474 GL_RGBA, 2474 GL_RGBA,
2475 GL_FLOAT, 2475 GL_FLOAT,
2476 kSharedMemoryId, 2476 kSharedMemoryId,
2477 kSharedMemoryOffset, 2477 kSharedMemoryOffset,
2478 GL_FALSE); 2478 GL_FALSE);
2479 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2479 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2480 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2480 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2481 } 2481 }
2482 2482
2483 TEST_F(GLES2DecoderManualInitTest, TexSubImage2DFloatDoesClearOnGLES3) { 2483 TEST_P(GLES2DecoderManualInitTest, TexSubImage2DFloatDoesClearOnGLES3) {
2484 InitState init; 2484 InitState init;
2485 init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float"; 2485 init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float";
2486 init.gl_version = "opengl es 3.0"; 2486 init.gl_version = "opengl es 3.0";
2487 InitDecoder(init); 2487 InitDecoder(init);
2488 const int kWidth = 8; 2488 const int kWidth = 8;
2489 const int kHeight = 4; 2489 const int kHeight = 4;
2490 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 2490 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
2491 DoTexImage2D(GL_TEXTURE_2D, 2491 DoTexImage2D(GL_TEXTURE_2D,
2492 0, 2492 0,
2493 GL_RGBA32F, 2493 GL_RGBA32F,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2529 kHeight, 2529 kHeight,
2530 GL_RGBA, 2530 GL_RGBA,
2531 GL_FLOAT, 2531 GL_FLOAT,
2532 kSharedMemoryId, 2532 kSharedMemoryId,
2533 kSharedMemoryOffset, 2533 kSharedMemoryOffset,
2534 GL_FALSE); 2534 GL_FALSE);
2535 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2535 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2536 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2536 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2537 } 2537 }
2538 2538
2539 TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatConvertsFormatDesktop) { 2539 TEST_P(GLES2DecoderManualInitTest, TexImage2DFloatConvertsFormatDesktop) {
2540 InitState init; 2540 InitState init;
2541 init.extensions = "GL_ARB_texture_float"; 2541 init.extensions = "GL_ARB_texture_float";
2542 init.gl_version = "2.1"; 2542 init.gl_version = "2.1";
2543 InitDecoder(init); 2543 InitDecoder(init);
2544 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 2544 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
2545 DoTexImage2D( 2545 DoTexImage2D(
2546 GL_TEXTURE_2D, 0, GL_RGBA32F, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0); 2546 GL_TEXTURE_2D, 0, GL_RGBA32F, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0);
2547 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0); 2547 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0);
2548 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 2548 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D,
2549 0, 2549 0,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2652 2652
2653 for (int i = 0; i < count; ++i) { 2653 for (int i = 0; i < count; ++i) {
2654 EXPECT_TRUE( 2654 EXPECT_TRUE(
2655 ValueInArray(formats[i], result->GetData(), result->GetNumResults())); 2655 ValueInArray(formats[i], result->GetData(), result->GetNumResults()));
2656 } 2656 }
2657 2657
2658 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2658 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2659 } 2659 }
2660 }; 2660 };
2661 2661
2662 TEST_F(GLES2DecoderCompressedFormatsTest, GetCompressedTextureFormatsS3TC) { 2662 INSTANTIATE_TEST_CASE_P(Service,
2663 GLES2DecoderCompressedFormatsTest,
2664 ::testing::Bool());
2665
2666 TEST_P(GLES2DecoderCompressedFormatsTest, GetCompressedTextureFormatsS3TC) {
2663 const GLenum formats[] = { 2667 const GLenum formats[] = {
2664 GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 2668 GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
2665 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT}; 2669 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT};
2666 CheckFormats("GL_EXT_texture_compression_s3tc", formats, 4); 2670 CheckFormats("GL_EXT_texture_compression_s3tc", formats, 4);
2667 } 2671 }
2668 2672
2669 TEST_F(GLES2DecoderCompressedFormatsTest, GetCompressedTextureFormatsATC) { 2673 TEST_P(GLES2DecoderCompressedFormatsTest, GetCompressedTextureFormatsATC) {
2670 const GLenum formats[] = {GL_ATC_RGB_AMD, GL_ATC_RGBA_EXPLICIT_ALPHA_AMD, 2674 const GLenum formats[] = {GL_ATC_RGB_AMD, GL_ATC_RGBA_EXPLICIT_ALPHA_AMD,
2671 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD}; 2675 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD};
2672 CheckFormats("GL_AMD_compressed_ATC_texture", formats, 3); 2676 CheckFormats("GL_AMD_compressed_ATC_texture", formats, 3);
2673 } 2677 }
2674 2678
2675 TEST_F(GLES2DecoderCompressedFormatsTest, GetCompressedTextureFormatsPVRTC) { 2679 TEST_P(GLES2DecoderCompressedFormatsTest, GetCompressedTextureFormatsPVRTC) {
2676 const GLenum formats[] = { 2680 const GLenum formats[] = {
2677 GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, 2681 GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
2678 GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}; 2682 GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG};
2679 CheckFormats("GL_IMG_texture_compression_pvrtc", formats, 4); 2683 CheckFormats("GL_IMG_texture_compression_pvrtc", formats, 4);
2680 } 2684 }
2681 2685
2682 TEST_F(GLES2DecoderCompressedFormatsTest, GetCompressedTextureFormatsETC1) { 2686 TEST_P(GLES2DecoderCompressedFormatsTest, GetCompressedTextureFormatsETC1) {
2683 const GLenum formats[] = {GL_ETC1_RGB8_OES}; 2687 const GLenum formats[] = {GL_ETC1_RGB8_OES};
2684 CheckFormats("GL_OES_compressed_ETC1_RGB8_texture", formats, 1); 2688 CheckFormats("GL_OES_compressed_ETC1_RGB8_texture", formats, 1);
2685 } 2689 }
2686 2690
2687 TEST_F(GLES2DecoderManualInitTest, GetNoCompressedTextureFormats) { 2691 TEST_P(GLES2DecoderManualInitTest, GetNoCompressedTextureFormats) {
2688 InitState init; 2692 InitState init;
2689 init.gl_version = "3.0"; 2693 init.gl_version = "3.0";
2690 init.bind_generates_resource = true; 2694 init.bind_generates_resource = true;
2691 InitDecoder(init); 2695 InitDecoder(init);
2692 2696
2693 EXPECT_CALL(*gl_, GetError()) 2697 EXPECT_CALL(*gl_, GetError())
2694 .WillOnce(Return(GL_NO_ERROR)) 2698 .WillOnce(Return(GL_NO_ERROR))
2695 .WillOnce(Return(GL_NO_ERROR)) 2699 .WillOnce(Return(GL_NO_ERROR))
2696 .WillOnce(Return(GL_NO_ERROR)) 2700 .WillOnce(Return(GL_NO_ERROR))
2697 .WillOnce(Return(GL_NO_ERROR)) 2701 .WillOnce(Return(GL_NO_ERROR))
(...skipping 16 matching lines...) Expand all
2714 result->size = 0; 2718 result->size = 0;
2715 cmd.Init( 2719 cmd.Init(
2716 GL_COMPRESSED_TEXTURE_FORMATS, shared_memory_id_, shared_memory_offset_); 2720 GL_COMPRESSED_TEXTURE_FORMATS, shared_memory_id_, shared_memory_offset_);
2717 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2721 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2718 EXPECT_EQ(num_formats, result->GetNumResults()); 2722 EXPECT_EQ(num_formats, result->GetNumResults());
2719 2723
2720 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2724 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2721 } 2725 }
2722 2726
2723 // TODO(gman): Complete this test. 2727 // TODO(gman): Complete this test.
2724 // TEST_F(GLES2DecoderTest, CompressedTexImage2DGLError) { 2728 // TEST_P(GLES2DecoderTest, CompressedTexImage2DGLError) {
2725 // } 2729 // }
2726 2730
2727 // TODO(gman): CompressedTexImage2D 2731 // TODO(gman): CompressedTexImage2D
2728 2732
2729 // TODO(gman): CompressedTexImage2DImmediate 2733 // TODO(gman): CompressedTexImage2DImmediate
2730 2734
2731 // TODO(gman): CompressedTexSubImage2DImmediate 2735 // TODO(gman): CompressedTexSubImage2DImmediate
2732 2736
2733 // TODO(gman): TexImage2D 2737 // TODO(gman): TexImage2D
2734 2738
2735 // TODO(gman): TexImage2DImmediate 2739 // TODO(gman): TexImage2DImmediate
2736 2740
2737 // TODO(gman): TexSubImage2DImmediate 2741 // TODO(gman): TexSubImage2DImmediate
2738 2742
2739 } // namespace gles2 2743 } // namespace gles2
2740 } // namespace gpu 2744 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698