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

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

Issue 10389077: Consolidate GPU unit test expectiation functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix license Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/program_manager.h" 5 #include "gpu/command_buffer/service/program_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "gpu/command_buffer/common/gl_mock.h" 12 #include "gpu/command_buffer/common/gl_mock.h"
13 #include "gpu/command_buffer/common/gles2_cmd_format.h" 13 #include "gpu/command_buffer/common/gles2_cmd_format.h"
14 #include "gpu/command_buffer/service/common_decoder.h" 14 #include "gpu/command_buffer/service/common_decoder.h"
15 #include "gpu/command_buffer/service/mocks.h" 15 #include "gpu/command_buffer/service/mocks.h"
16 #include "gpu/command_buffer/service/test_helper.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 using ::gfx::MockGLInterface; 19 using ::gfx::MockGLInterface;
19 using ::testing::_; 20 using ::testing::_;
20 using ::testing::DoAll; 21 using ::testing::DoAll;
21 using ::testing::InSequence; 22 using ::testing::InSequence;
22 using ::testing::MatcherCast; 23 using ::testing::MatcherCast;
23 using ::testing::Pointee; 24 using ::testing::Pointee;
24 using ::testing::Return; 25 using ::testing::Return;
25 using ::testing::ReturnRef; 26 using ::testing::ReturnRef;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 static const GLenum kUniform1Type = GL_FLOAT_VEC4; 192 static const GLenum kUniform1Type = GL_FLOAT_VEC4;
192 static const GLenum kUniform2Type = GL_INT_VEC2; 193 static const GLenum kUniform2Type = GL_INT_VEC2;
193 static const GLenum kUniform3Type = GL_FLOAT_VEC3; 194 static const GLenum kUniform3Type = GL_FLOAT_VEC3;
194 static const GLint kInvalidUniformLocation = 30; 195 static const GLint kInvalidUniformLocation = 30;
195 static const GLint kBadUniformIndex = 1000; 196 static const GLint kBadUniformIndex = 1000;
196 197
197 static const size_t kNumAttribs; 198 static const size_t kNumAttribs;
198 static const size_t kNumUniforms; 199 static const size_t kNumUniforms;
199 200
200 protected: 201 protected:
201 struct AttribInfo { 202 typedef TestHelper::AttribInfo AttribInfo;
202 const char* name; 203 typedef TestHelper::UniformInfo UniformInfo;
203 GLint size;
204 GLenum type;
205 GLint location;
206 };
207
208 struct UniformInfo {
209 const char* name;
210 const char* good_name;
211 GLint size;
212 GLenum type;
213 GLint fake_location;
214 GLint real_location;
215 };
216 204
217 virtual void SetUp() { 205 virtual void SetUp() {
218 gl_.reset(new StrictMock<gfx::MockGLInterface>()); 206 gl_.reset(new StrictMock<gfx::MockGLInterface>());
219 ::gfx::GLInterface::SetGLInterface(gl_.get()); 207 ::gfx::GLInterface::SetGLInterface(gl_.get());
220 208
221 SetupDefaultShaderExpectations(); 209 SetupDefaultShaderExpectations();
222 210
223 ShaderManager::ShaderInfo* vertex_shader = shader_manager_.CreateShaderInfo( 211 ShaderManager::ShaderInfo* vertex_shader = shader_manager_.CreateShaderInfo(
224 kVertexShaderClientId, kVertexShaderServiceId, GL_VERTEX_SHADER); 212 kVertexShaderClientId, kVertexShaderServiceId, GL_VERTEX_SHADER);
225 ShaderManager::ShaderInfo* fragment_shader = 213 ShaderManager::ShaderInfo* fragment_shader =
(...skipping 10 matching lines...) Expand all
236 ASSERT_TRUE(program_info_ != NULL); 224 ASSERT_TRUE(program_info_ != NULL);
237 225
238 program_info_->AttachShader(&shader_manager_, vertex_shader); 226 program_info_->AttachShader(&shader_manager_, vertex_shader);
239 program_info_->AttachShader(&shader_manager_, fragment_shader); 227 program_info_->AttachShader(&shader_manager_, fragment_shader);
240 program_info_->Link(); 228 program_info_->Link();
241 } 229 }
242 230
243 void SetupShader(AttribInfo* attribs, size_t num_attribs, 231 void SetupShader(AttribInfo* attribs, size_t num_attribs,
244 UniformInfo* uniforms, size_t num_uniforms, 232 UniformInfo* uniforms, size_t num_uniforms,
245 GLuint service_id) { 233 GLuint service_id) {
246 InSequence s; 234 TestHelper::SetupShader(
247 235 gl_.get(), attribs, num_attribs, uniforms, num_uniforms, service_id);
248 EXPECT_CALL(*gl_,
249 LinkProgram(service_id))
250 .Times(1)
251 .RetiresOnSaturation();
252 EXPECT_CALL(*gl_,
253 GetProgramiv(service_id, GL_LINK_STATUS, _))
254 .WillOnce(SetArgumentPointee<2>(1))
255 .RetiresOnSaturation();
256 EXPECT_CALL(*gl_,
257 GetProgramiv(service_id, GL_INFO_LOG_LENGTH, _))
258 .WillOnce(SetArgumentPointee<2>(0))
259 .RetiresOnSaturation();
260 EXPECT_CALL(*gl_,
261 GetProgramiv(service_id, GL_ACTIVE_ATTRIBUTES, _))
262 .WillOnce(SetArgumentPointee<2>(num_attribs))
263 .RetiresOnSaturation();
264 size_t max_attrib_len = 0;
265 for (size_t ii = 0; ii < num_attribs; ++ii) {
266 size_t len = strlen(attribs[ii].name) + 1;
267 max_attrib_len = std::max(max_attrib_len, len);
268 }
269 EXPECT_CALL(*gl_,
270 GetProgramiv(service_id, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, _))
271 .WillOnce(SetArgumentPointee<2>(max_attrib_len))
272 .RetiresOnSaturation();
273 for (size_t ii = 0; ii < num_attribs; ++ii) {
274 const AttribInfo& info = attribs[ii];
275 EXPECT_CALL(*gl_,
276 GetActiveAttrib(service_id, ii,
277 max_attrib_len, _, _, _, _))
278 .WillOnce(DoAll(
279 SetArgumentPointee<3>(strlen(info.name)),
280 SetArgumentPointee<4>(info.size),
281 SetArgumentPointee<5>(info.type),
282 SetArrayArgument<6>(info.name,
283 info.name + strlen(info.name) + 1)))
284 .RetiresOnSaturation();
285 if (!ProgramManager::IsInvalidPrefix(info.name, strlen(info.name))) {
286 EXPECT_CALL(*gl_, GetAttribLocation(service_id,
287 StrEq(info.name)))
288 .WillOnce(Return(info.location))
289 .RetiresOnSaturation();
290 }
291 }
292 EXPECT_CALL(*gl_,
293 GetProgramiv(service_id, GL_ACTIVE_UNIFORMS, _))
294 .WillOnce(SetArgumentPointee<2>(num_uniforms))
295 .RetiresOnSaturation();
296 size_t max_uniform_len = 0;
297 for (size_t ii = 0; ii < num_uniforms; ++ii) {
298 size_t len = strlen(uniforms[ii].name) + 1;
299 max_uniform_len = std::max(max_uniform_len, len);
300 }
301 EXPECT_CALL(*gl_,
302 GetProgramiv(service_id, GL_ACTIVE_UNIFORM_MAX_LENGTH, _))
303 .WillOnce(SetArgumentPointee<2>(max_uniform_len))
304 .RetiresOnSaturation();
305 for (size_t ii = 0; ii < num_uniforms; ++ii) {
306 const UniformInfo& info = uniforms[ii];
307 EXPECT_CALL(*gl_,
308 GetActiveUniform(service_id, ii,
309 max_uniform_len, _, _, _, _))
310 .WillOnce(DoAll(
311 SetArgumentPointee<3>(strlen(info.name)),
312 SetArgumentPointee<4>(info.size),
313 SetArgumentPointee<5>(info.type),
314 SetArrayArgument<6>(info.name,
315 info.name + strlen(info.name) + 1)))
316 .RetiresOnSaturation();
317 if (!ProgramManager::IsInvalidPrefix(info.name, strlen(info.name))) {
318 EXPECT_CALL(*gl_, GetUniformLocation(service_id,
319 StrEq(info.name)))
320 .WillOnce(Return(info.real_location))
321 .RetiresOnSaturation();
322 if (info.size > 1) {
323 std::string base_name = info.name;
324 size_t array_pos = base_name.rfind("[0]");
325 if (base_name.size() > 3 && array_pos == base_name.size() - 3) {
326 base_name = base_name.substr(0, base_name.size() - 3);
327 }
328 for (GLsizei jj = 1; jj < info.size; ++jj) {
329 std::string element_name(
330 std::string(base_name) + "[" + base::IntToString(jj) + "]");
331 EXPECT_CALL(*gl_, GetUniformLocation(service_id,
332 StrEq(element_name)))
333 .WillOnce(Return(info.real_location + jj * 2))
334 .RetiresOnSaturation();
335 }
336 }
337 }
338 }
339 } 236 }
340 237
341 void SetupDefaultShaderExpectations() { 238 void SetupDefaultShaderExpectations() {
342 SetupShader(kAttribs, kNumAttribs, kUniforms, kNumUniforms, 239 SetupShader(kAttribs, kNumAttribs, kUniforms, kNumUniforms,
343 kServiceProgramId); 240 kServiceProgramId);
344 } 241 }
345 242
346 void SetupExpectationsForClearingUniforms( 243 void SetupExpectationsForClearingUniforms(
347 UniformInfo* uniforms, size_t num_uniforms) { 244 UniformInfo* uniforms, size_t num_uniforms) {
348 for (size_t ii = 0; ii < num_uniforms; ++ii) { 245 TestHelper::SetupExpectationsForClearingUniforms(
349 const UniformInfo& info = uniforms[ii]; 246 gl_.get(), uniforms, num_uniforms);
350 switch (info.type) {
351 case GL_FLOAT:
352 EXPECT_CALL(*gl_, Uniform1fv(info.real_location, info.size, _))
353 .Times(1)
354 .RetiresOnSaturation();
355 break;
356 case GL_FLOAT_VEC2:
357 EXPECT_CALL(*gl_, Uniform2fv(info.real_location, info.size, _))
358 .Times(1)
359 .RetiresOnSaturation();
360 break;
361 case GL_FLOAT_VEC3:
362 EXPECT_CALL(*gl_, Uniform3fv(info.real_location, info.size, _))
363 .Times(1)
364 .RetiresOnSaturation();
365 break;
366 case GL_FLOAT_VEC4:
367 EXPECT_CALL(*gl_, Uniform4fv(info.real_location, info.size, _))
368 .Times(1)
369 .RetiresOnSaturation();
370 break;
371 case GL_INT:
372 case GL_BOOL:
373 case GL_SAMPLER_2D:
374 case GL_SAMPLER_CUBE:
375 case GL_SAMPLER_EXTERNAL_OES:
376 case GL_SAMPLER_3D_OES:
377 case GL_SAMPLER_2D_RECT_ARB:
378 EXPECT_CALL(*gl_, Uniform1iv(info.real_location, info.size, _))
379 .Times(1)
380 .RetiresOnSaturation();
381 break;
382 case GL_INT_VEC2:
383 case GL_BOOL_VEC2:
384 EXPECT_CALL(*gl_, Uniform2iv(info.real_location, info.size, _))
385 .Times(1)
386 .RetiresOnSaturation();
387 break;
388 case GL_INT_VEC3:
389 case GL_BOOL_VEC3:
390 EXPECT_CALL(*gl_, Uniform3iv(info.real_location, info.size, _))
391 .Times(1)
392 .RetiresOnSaturation();
393 break;
394 case GL_INT_VEC4:
395 case GL_BOOL_VEC4:
396 EXPECT_CALL(*gl_, Uniform4iv(info.real_location, info.size, _))
397 .Times(1)
398 .RetiresOnSaturation();
399 break;
400 case GL_FLOAT_MAT2:
401 EXPECT_CALL(*gl_, UniformMatrix2fv(
402 info.real_location, info.size, false, _))
403 .Times(1)
404 .RetiresOnSaturation();
405 break;
406 case GL_FLOAT_MAT3:
407 EXPECT_CALL(*gl_, UniformMatrix3fv(
408 info.real_location, info.size, false, _))
409 .Times(1)
410 .RetiresOnSaturation();
411 break;
412 case GL_FLOAT_MAT4:
413 EXPECT_CALL(*gl_, UniformMatrix4fv(
414 info.real_location, info.size, false, _))
415 .Times(1)
416 .RetiresOnSaturation();
417 break;
418 default:
419 NOTREACHED();
420 break;
421 }
422 }
423 } 247 }
424 248
425 virtual void TearDown() { 249 virtual void TearDown() {
426 ::gfx::GLInterface::SetGLInterface(NULL); 250 ::gfx::GLInterface::SetGLInterface(NULL);
427 } 251 }
428 252
429 // Return true if link status matches expected_link_status 253 // Return true if link status matches expected_link_status
430 bool LinkAsExpected(ProgramManager::ProgramInfo* program_info, 254 bool LinkAsExpected(ProgramManager::ProgramInfo* program_info,
431 bool expected_link_status) { 255 bool expected_link_status) {
432 GLuint service_id = program_info->service_id(); 256 GLuint service_id = program_info->service_id();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 const GLint ProgramManagerWithShaderTest::kInvalidUniformLocation; 316 const GLint ProgramManagerWithShaderTest::kInvalidUniformLocation;
493 const GLint ProgramManagerWithShaderTest::kBadUniformIndex; 317 const GLint ProgramManagerWithShaderTest::kBadUniformIndex;
494 #endif 318 #endif
495 319
496 const size_t ProgramManagerWithShaderTest::kNumAttribs = 320 const size_t ProgramManagerWithShaderTest::kNumAttribs =
497 arraysize(ProgramManagerWithShaderTest::kAttribs); 321 arraysize(ProgramManagerWithShaderTest::kAttribs);
498 322
499 ProgramManagerWithShaderTest::UniformInfo 323 ProgramManagerWithShaderTest::UniformInfo
500 ProgramManagerWithShaderTest::kUniforms[] = { 324 ProgramManagerWithShaderTest::kUniforms[] = {
501 { kUniform1Name, 325 { kUniform1Name,
502 kUniform1Name,
503 kUniform1Size, 326 kUniform1Size,
504 kUniform1Type, 327 kUniform1Type,
505 kUniform1FakeLocation, 328 kUniform1FakeLocation,
506 kUniform1RealLocation, 329 kUniform1RealLocation,
330 kUniform1Name,
507 }, 331 },
508 { kUniform2Name, 332 { kUniform2Name,
509 kUniform2Name,
510 kUniform2Size, 333 kUniform2Size,
511 kUniform2Type, 334 kUniform2Type,
512 kUniform2FakeLocation, 335 kUniform2FakeLocation,
513 kUniform2RealLocation, 336 kUniform2RealLocation,
337 kUniform2Name,
514 }, 338 },
515 { kUniform3BadName, 339 { kUniform3BadName,
516 kUniform3GoodName,
517 kUniform3Size, 340 kUniform3Size,
518 kUniform3Type, 341 kUniform3Type,
519 kUniform3FakeLocation, 342 kUniform3FakeLocation,
520 kUniform3RealLocation, 343 kUniform3RealLocation,
344 kUniform3GoodName,
521 }, 345 },
522 }; 346 };
523 347
524 const size_t ProgramManagerWithShaderTest::kNumUniforms = 348 const size_t ProgramManagerWithShaderTest::kNumUniforms =
525 arraysize(ProgramManagerWithShaderTest::kUniforms); 349 arraysize(ProgramManagerWithShaderTest::kUniforms);
526 350
527 const char* ProgramManagerWithShaderTest::kAttrib1Name = "attrib1"; 351 const char* ProgramManagerWithShaderTest::kAttrib1Name = "attrib1";
528 const char* ProgramManagerWithShaderTest::kAttrib2Name = "attrib2"; 352 const char* ProgramManagerWithShaderTest::kAttrib2Name = "attrib2";
529 const char* ProgramManagerWithShaderTest::kAttrib3Name = "attrib3"; 353 const char* ProgramManagerWithShaderTest::kAttrib3Name = "attrib3";
530 const char* ProgramManagerWithShaderTest::kUniform1Name = "uniform1"; 354 const char* ProgramManagerWithShaderTest::kUniform1Name = "uniform1";
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 EXPECT_EQ(2, array_index); 535 EXPECT_EQ(2, array_index);
712 } 536 }
713 537
714 // Some GL drivers incorrectly return gl_DepthRange and possibly other uniforms 538 // Some GL drivers incorrectly return gl_DepthRange and possibly other uniforms
715 // that start with "gl_". Our implementation catches these and does not allow 539 // that start with "gl_". Our implementation catches these and does not allow
716 // them back to client. 540 // them back to client.
717 TEST_F(ProgramManagerWithShaderTest, GLDriverReturnsGLUnderscoreUniform) { 541 TEST_F(ProgramManagerWithShaderTest, GLDriverReturnsGLUnderscoreUniform) {
718 static const char* kUniform2Name = "gl_longNameWeCanCheckFor"; 542 static const char* kUniform2Name = "gl_longNameWeCanCheckFor";
719 static ProgramManagerWithShaderTest::UniformInfo kUniforms[] = { 543 static ProgramManagerWithShaderTest::UniformInfo kUniforms[] = {
720 { kUniform1Name, 544 { kUniform1Name,
721 kUniform1Name,
722 kUniform1Size, 545 kUniform1Size,
723 kUniform1Type, 546 kUniform1Type,
724 kUniform1FakeLocation, 547 kUniform1FakeLocation,
725 kUniform1RealLocation, 548 kUniform1RealLocation,
549 kUniform1Name,
726 }, 550 },
727 { kUniform2Name, 551 { kUniform2Name,
728 kUniform2Name,
729 kUniform2Size, 552 kUniform2Size,
730 kUniform2Type, 553 kUniform2Type,
731 kUniform2FakeLocation, 554 kUniform2FakeLocation,
732 kUniform2RealLocation, 555 kUniform2RealLocation,
556 kUniform2Name,
733 }, 557 },
734 { kUniform3BadName, 558 { kUniform3BadName,
735 kUniform3GoodName,
736 kUniform3Size, 559 kUniform3Size,
737 kUniform3Type, 560 kUniform3Type,
738 kUniform3FakeLocation, 561 kUniform3FakeLocation,
739 kUniform3RealLocation, 562 kUniform3RealLocation,
563 kUniform3GoodName,
740 }, 564 },
741 }; 565 };
742 const size_t kNumUniforms = arraysize(kUniforms); 566 const size_t kNumUniforms = arraysize(kUniforms);
743 static const GLuint kClientProgramId = 1234; 567 static const GLuint kClientProgramId = 1234;
744 static const GLuint kServiceProgramId = 5679; 568 static const GLuint kServiceProgramId = 5679;
745 const GLuint kVShaderClientId = 2001; 569 const GLuint kVShaderClientId = 2001;
746 const GLuint kFShaderClientId = 2002; 570 const GLuint kFShaderClientId = 2002;
747 const GLuint kVShaderServiceId = 3001; 571 const GLuint kVShaderServiceId = 3001;
748 const GLuint kFShaderServiceId = 3002; 572 const GLuint kFShaderServiceId = 3002;
749 SetupShader( 573 SetupShader(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 kFShaderClientId, kFShaderServiceId, GL_FRAGMENT_SHADER); 637 kFShaderClientId, kFShaderServiceId, GL_FRAGMENT_SHADER);
814 ASSERT_TRUE(fshader != NULL); 638 ASSERT_TRUE(fshader != NULL);
815 fshader->SetStatus(true, "", &shader_translator); 639 fshader->SetStatus(true, "", &shader_translator);
816 static ProgramManagerWithShaderTest::AttribInfo kAttribs[] = { 640 static ProgramManagerWithShaderTest::AttribInfo kAttribs[] = {
817 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, 641 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, },
818 { kAttrib2Name, kAttrib2Size, kAttrib2BadType, kAttrib2Location, }, 642 { kAttrib2Name, kAttrib2Size, kAttrib2BadType, kAttrib2Location, },
819 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, }, 643 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, },
820 }; 644 };
821 static ProgramManagerWithShaderTest::UniformInfo kUniforms[] = { 645 static ProgramManagerWithShaderTest::UniformInfo kUniforms[] = {
822 { kUniform1Name, 646 { kUniform1Name,
823 kUniform1Name,
824 kUniform1Size, 647 kUniform1Size,
825 kUniform1Type, 648 kUniform1Type,
826 kUniform1FakeLocation, 649 kUniform1FakeLocation,
827 kUniform1RealLocation, 650 kUniform1RealLocation,
651 kUniform1Name,
828 }, 652 },
829 { kUniform2Name, 653 { kUniform2Name,
830 kUniform2Name,
831 kUniform2Size, 654 kUniform2Size,
832 kUniform2BadType, 655 kUniform2BadType,
833 kUniform2FakeLocation, 656 kUniform2FakeLocation,
834 kUniform2RealLocation, 657 kUniform2RealLocation,
658 kUniform2Name,
835 }, 659 },
836 { kUniform3BadName, 660 { kUniform3BadName,
837 kUniform3GoodName,
838 kUniform3Size, 661 kUniform3Size,
839 kUniform3Type, 662 kUniform3Type,
840 kUniform3FakeLocation, 663 kUniform3FakeLocation,
841 kUniform3RealLocation, 664 kUniform3RealLocation,
665 kUniform3GoodName,
842 }, 666 },
843 }; 667 };
844 const size_t kNumAttribs= arraysize(kAttribs); 668 const size_t kNumAttribs= arraysize(kAttribs);
845 const size_t kNumUniforms = arraysize(kUniforms); 669 const size_t kNumUniforms = arraysize(kUniforms);
846 static const GLuint kClientProgramId = 1234; 670 static const GLuint kClientProgramId = 1234;
847 static const GLuint kServiceProgramId = 5679; 671 static const GLuint kServiceProgramId = 5679;
848 SetupShader(kAttribs, kNumAttribs, kUniforms, kNumUniforms, 672 SetupShader(kAttribs, kNumAttribs, kUniforms, kNumUniforms,
849 kServiceProgramId); 673 kServiceProgramId);
850 ProgramManager::ProgramInfo* program_info = manager_.CreateProgramInfo( 674 ProgramManager::ProgramInfo* program_info = manager_.CreateProgramInfo(
851 kClientProgramId, kServiceProgramId); 675 kClientProgramId, kServiceProgramId);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 }; 961 };
1138 const size_t kNumSamplerTypes = arraysize(kSamplerTypes); 962 const size_t kNumSamplerTypes = arraysize(kSamplerTypes);
1139 for (size_t ii = 0; ii < kNumSamplerTypes; ++ii) { 963 for (size_t ii = 0; ii < kNumSamplerTypes; ++ii) {
1140 static ProgramManagerWithShaderTest::AttribInfo kAttribs[] = { 964 static ProgramManagerWithShaderTest::AttribInfo kAttribs[] = {
1141 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, 965 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, },
1142 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, }, 966 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, },
1143 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, }, 967 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, },
1144 }; 968 };
1145 ProgramManagerWithShaderTest::UniformInfo kUniforms[] = { 969 ProgramManagerWithShaderTest::UniformInfo kUniforms[] = {
1146 { kUniform1Name, 970 { kUniform1Name,
1147 kUniform1Name,
1148 kUniform1Size, 971 kUniform1Size,
1149 kUniform1Type, 972 kUniform1Type,
1150 kUniform1FakeLocation, 973 kUniform1FakeLocation,
1151 kUniform1RealLocation, 974 kUniform1RealLocation,
975 kUniform1Name,
1152 }, 976 },
1153 { kUniform2Name, 977 { kUniform2Name,
1154 kUniform2Name,
1155 kUniform2Size, 978 kUniform2Size,
1156 kSamplerTypes[ii], 979 kSamplerTypes[ii],
1157 kUniform2FakeLocation, 980 kUniform2FakeLocation,
1158 kUniform2RealLocation, 981 kUniform2RealLocation,
982 kUniform2Name,
1159 }, 983 },
1160 { kUniform3BadName, 984 { kUniform3BadName,
1161 kUniform3GoodName,
1162 kUniform3Size, 985 kUniform3Size,
1163 kUniform3Type, 986 kUniform3Type,
1164 kUniform3FakeLocation, 987 kUniform3FakeLocation,
1165 kUniform3RealLocation, 988 kUniform3RealLocation,
989 kUniform3GoodName,
1166 }, 990 },
1167 }; 991 };
1168 const size_t kNumAttribs = arraysize(kAttribs); 992 const size_t kNumAttribs = arraysize(kAttribs);
1169 const size_t kNumUniforms = arraysize(kUniforms); 993 const size_t kNumUniforms = arraysize(kUniforms);
1170 SetupShader(kAttribs, kNumAttribs, kUniforms, kNumUniforms, 994 SetupShader(kAttribs, kNumAttribs, kUniforms, kNumUniforms,
1171 kServiceProgramId); 995 kServiceProgramId);
1172 program_info->Link(); 996 program_info->Link();
1173 SetupExpectationsForClearingUniforms(kUniforms, kNumUniforms); 997 SetupExpectationsForClearingUniforms(kUniforms, kNumUniforms);
1174 manager_.ClearUniforms(program_info); 998 manager_.ClearUniforms(program_info);
1175 } 999 }
1176 } 1000 }
1177 1001
1178 } // namespace gles2 1002 } // namespace gles2
1179 } // namespace gpu 1003 } // namespace gpu
1180 1004
1181 1005
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc ('k') | gpu/command_buffer/service/test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698