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

Side by Side Diff: gpu/command_buffer/client/program_info_manager.cc

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/client/program_info_manager.h" 5 #include "gpu/command_buffer/client/program_info_manager.h"
6 6
7 namespace { 7 namespace {
8 8
9 template<typename T> static T LocalGetAs( 9 template<typename T> static T LocalGetAs(
10 const std::vector<int8>& data, uint32 offset, size_t size) { 10 const std::vector<int8>& data, uint32 offset, size_t size) {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 // This should only happen on a lost context. 325 // This should only happen on a lost context.
326 return; 326 return;
327 } 327 }
328 DCHECK_GE(result.size(), sizeof(ProgramInfoHeader)); 328 DCHECK_GE(result.size(), sizeof(ProgramInfoHeader));
329 const ProgramInfoHeader* header = LocalGetAs<const ProgramInfoHeader*>( 329 const ProgramInfoHeader* header = LocalGetAs<const ProgramInfoHeader*>(
330 result, 0, sizeof(header)); 330 result, 0, sizeof(header));
331 link_status_ = header->link_status != 0; 331 link_status_ = header->link_status != 0;
332 if (!link_status_) { 332 if (!link_status_) {
333 return; 333 return;
334 } 334 }
335 DCHECK_EQ(0u, attrib_infos_.size()); 335 attrib_infos_.clear();
336 DCHECK_EQ(0u, uniform_infos_.size()); 336 uniform_infos_.clear();
337 DCHECK_EQ(0, max_attrib_name_length_); 337 frag_data_locations_.clear();
338 DCHECK_EQ(0, max_uniform_name_length_); 338 max_attrib_name_length_ = 0;
339 max_uniform_name_length_ = 0;
339 const ProgramInput* inputs = LocalGetAs<const ProgramInput*>( 340 const ProgramInput* inputs = LocalGetAs<const ProgramInput*>(
340 result, sizeof(*header), 341 result, sizeof(*header),
341 sizeof(ProgramInput) * (header->num_attribs + header->num_uniforms)); 342 sizeof(ProgramInput) * (header->num_attribs + header->num_uniforms));
342 const ProgramInput* input = inputs; 343 const ProgramInput* input = inputs;
343 for (uint32 ii = 0; ii < header->num_attribs; ++ii) { 344 for (uint32 ii = 0; ii < header->num_attribs; ++ii) {
344 const int32* location = LocalGetAs<const int32*>( 345 const int32* location = LocalGetAs<const int32*>(
345 result, input->location_offset, sizeof(int32)); 346 result, input->location_offset, sizeof(int32));
346 const char* name_buf = LocalGetAs<const char*>( 347 const char* name_buf = LocalGetAs<const char*>(
347 result, input->name_offset, input->name_length); 348 result, input->name_offset, input->name_length);
348 std::string name(name_buf, input->name_length); 349 std::string name(name_buf, input->name_length);
(...skipping 25 matching lines...) Expand all
374 375
375 void ProgramInfoManager::Program::UpdateES3UniformBlocks( 376 void ProgramInfoManager::Program::UpdateES3UniformBlocks(
376 const std::vector<int8>& result) { 377 const std::vector<int8>& result) {
377 if (cached_es3_uniform_blocks_) { 378 if (cached_es3_uniform_blocks_) {
378 return; 379 return;
379 } 380 }
380 if (result.empty()) { 381 if (result.empty()) {
381 // This should only happen on a lost context. 382 // This should only happen on a lost context.
382 return; 383 return;
383 } 384 }
384 DCHECK_EQ(0u, uniform_blocks_.size()); 385 uniform_blocks_.clear();
385 DCHECK_EQ(0u, active_uniform_block_max_name_length_); 386 active_uniform_block_max_name_length_ = 0;
386 387
387 // |result| comes from GPU process. We consider it trusted data. Therefore, 388 // |result| comes from GPU process. We consider it trusted data. Therefore,
388 // no need to check for overflows as the GPU side did the checks already. 389 // no need to check for overflows as the GPU side did the checks already.
389 uint32_t header_size = sizeof(UniformBlocksHeader); 390 uint32_t header_size = sizeof(UniformBlocksHeader);
390 DCHECK_GE(result.size(), header_size); 391 DCHECK_GE(result.size(), header_size);
391 const UniformBlocksHeader* header = LocalGetAs<const UniformBlocksHeader*>( 392 const UniformBlocksHeader* header = LocalGetAs<const UniformBlocksHeader*>(
392 result, 0, header_size); 393 result, 0, header_size);
393 DCHECK(header); 394 DCHECK(header);
394 if (header->num_uniform_blocks == 0) { 395 if (header->num_uniform_blocks == 0) {
395 DCHECK_EQ(result.size(), header_size); 396 DCHECK_EQ(result.size(), header_size);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 446
446 void ProgramInfoManager::Program::UpdateES3Uniformsiv( 447 void ProgramInfoManager::Program::UpdateES3Uniformsiv(
447 const std::vector<int8>& result) { 448 const std::vector<int8>& result) {
448 if (cached_es3_uniformsiv_) { 449 if (cached_es3_uniformsiv_) {
449 return; 450 return;
450 } 451 }
451 if (result.empty()) { 452 if (result.empty()) {
452 // This should only happen on a lost context. 453 // This should only happen on a lost context.
453 return; 454 return;
454 } 455 }
455 DCHECK_EQ(0u, uniforms_es3_.size()); 456 uniforms_es3_.clear();
456 457
457 // |result| comes from GPU process. We consider it trusted data. Therefore, 458 // |result| comes from GPU process. We consider it trusted data. Therefore,
458 // no need to check for overflows as the GPU side did the checks already. 459 // no need to check for overflows as the GPU side did the checks already.
459 uint32_t header_size = sizeof(UniformsES3Header); 460 uint32_t header_size = sizeof(UniformsES3Header);
460 DCHECK_GE(result.size(), header_size); 461 DCHECK_GE(result.size(), header_size);
461 const UniformsES3Header* header = LocalGetAs<const UniformsES3Header*>( 462 const UniformsES3Header* header = LocalGetAs<const UniformsES3Header*>(
462 result, 0, header_size); 463 result, 0, header_size);
463 DCHECK(header); 464 DCHECK(header);
464 if (header->num_uniforms == 0) { 465 if (header->num_uniforms == 0) {
465 DCHECK_EQ(result.size(), header_size); 466 DCHECK_EQ(result.size(), header_size);
(...skipping 21 matching lines...) Expand all
487 488
488 void ProgramInfoManager::Program::UpdateES3TransformFeedbackVaryings( 489 void ProgramInfoManager::Program::UpdateES3TransformFeedbackVaryings(
489 const std::vector<int8>& result) { 490 const std::vector<int8>& result) {
490 if (cached_es3_transform_feedback_varyings_) { 491 if (cached_es3_transform_feedback_varyings_) {
491 return; 492 return;
492 } 493 }
493 if (result.empty()) { 494 if (result.empty()) {
494 // This should only happen on a lost context. 495 // This should only happen on a lost context.
495 return; 496 return;
496 } 497 }
497 DCHECK_EQ(0u, transform_feedback_varyings_.size()); 498 transform_feedback_varyings_.clear();
498 DCHECK_EQ(0u, transform_feedback_varying_max_length_); 499 transform_feedback_varying_max_length_ = 0;
499 500
500 // |result| comes from GPU process. We consider it trusted data. Therefore, 501 // |result| comes from GPU process. We consider it trusted data. Therefore,
501 // no need to check for overflows as the GPU side did the checks already. 502 // no need to check for overflows as the GPU side did the checks already.
502 uint32_t header_size = sizeof(TransformFeedbackVaryingsHeader); 503 uint32_t header_size = sizeof(TransformFeedbackVaryingsHeader);
503 DCHECK_GE(result.size(), header_size); 504 DCHECK_GE(result.size(), header_size);
504 const TransformFeedbackVaryingsHeader* header = 505 const TransformFeedbackVaryingsHeader* header =
505 LocalGetAs<const TransformFeedbackVaryingsHeader*>( 506 LocalGetAs<const TransformFeedbackVaryingsHeader*>(
506 result, 0, header_size); 507 result, 0, header_size);
507 DCHECK(header); 508 DCHECK(header);
508 if (header->num_transform_feedback_varyings == 0) { 509 if (header->num_transform_feedback_varyings == 0) {
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 } 991 }
991 return true; 992 return true;
992 } 993 }
993 } 994 }
994 return gl->GetUniformIndicesHelper(program, count, names, indices); 995 return gl->GetUniformIndicesHelper(program, count, names, indices);
995 } 996 }
996 997
997 } // namespace gles2 998 } // namespace gles2
998 } // namespace gpu 999 } // namespace gpu
999 1000
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h ('k') | gpu/command_buffer/cmd_buffer_functions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698