OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/command_buffer/service/program_manager.h" | 5 #include "gpu/command_buffer/service/program_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
490 for (GLint ii = 0; ii <= max_location; ++ii) { | 490 for (GLint ii = 0; ii <= max_location; ++ii) { |
491 attrib_location_to_index_map_[ii] = -1; | 491 attrib_location_to_index_map_[ii] = -1; |
492 } | 492 } |
493 for (size_t ii = 0; ii < attrib_infos_.size(); ++ii) { | 493 for (size_t ii = 0; ii < attrib_infos_.size(); ++ii) { |
494 const VertexAttrib& info = attrib_infos_[ii]; | 494 const VertexAttrib& info = attrib_infos_[ii]; |
495 if (info.location >= 0 && info.location <= max_location) { | 495 if (info.location >= 0 && info.location <= max_location) { |
496 attrib_location_to_index_map_[info.location] = ii; | 496 attrib_location_to_index_map_[info.location] = ii; |
497 } | 497 } |
498 } | 498 } |
499 | 499 |
500 #if !defined(NDEBUG) | |
Peter Kasting
2016/05/19 07:43:37
Because this section and the one below are already
| |
501 if (manager_->gpu_preferences_.enable_gpu_service_logging_gpu) { | 500 if (manager_->gpu_preferences_.enable_gpu_service_logging_gpu) { |
502 DVLOG(1) << "----: attribs for service_id: " << service_id(); | 501 DVLOG(1) << "----: attribs for service_id: " << service_id(); |
503 for (size_t ii = 0; ii < attrib_infos_.size(); ++ii) { | 502 for (size_t ii = 0; ii < attrib_infos_.size(); ++ii) { |
504 const VertexAttrib& info = attrib_infos_[ii]; | 503 const VertexAttrib& info = attrib_infos_[ii]; |
505 DVLOG(1) << ii << ": loc = " << info.location | 504 DVLOG(1) << ii << ": loc = " << info.location |
506 << ", size = " << info.size | 505 << ", size = " << info.size |
507 << ", type = " << GLES2Util::GetStringEnum(info.type) | 506 << ", type = " << GLES2Util::GetStringEnum(info.type) |
508 << ", name = " << info.name; | 507 << ", name = " << info.name; |
509 } | 508 } |
510 } | 509 } |
511 #endif | 510 |
512 UpdateUniforms(); | 511 UpdateUniforms(); |
513 | 512 |
514 #if !defined(NDEBUG) | |
515 if (manager_->gpu_preferences_.enable_gpu_service_logging_gpu) { | 513 if (manager_->gpu_preferences_.enable_gpu_service_logging_gpu) { |
516 DVLOG(1) << "----: uniforms for service_id: " << service_id(); | 514 DVLOG(1) << "----: uniforms for service_id: " << service_id(); |
517 size_t ii = 0; | 515 size_t ii = 0; |
518 for (const UniformInfo& info : uniform_infos_) { | 516 for (const UniformInfo& info : uniform_infos_) { |
519 DVLOG(1) << ii++ << ": loc = " << info.element_locations[0] | 517 DVLOG(1) << ii++ << ": loc = " << info.element_locations[0] |
520 << ", size = " << info.size | 518 << ", size = " << info.size |
521 << ", type = " << GLES2Util::GetStringEnum(info.type) | 519 << ", type = " << GLES2Util::GetStringEnum(info.type) |
522 << ", name = " << info.name; | 520 << ", name = " << info.name; |
523 } | 521 } |
524 } | 522 } |
525 #endif | |
526 | 523 |
527 UpdateFragmentInputs(); | 524 UpdateFragmentInputs(); |
528 UpdateProgramOutputs(); | 525 UpdateProgramOutputs(); |
529 | 526 |
530 valid_ = true; | 527 valid_ = true; |
531 } | 528 } |
532 | 529 |
533 void Program::UpdateUniforms() { | 530 void Program::UpdateUniforms() { |
534 // Reserve each client-bound uniform location. This way unbound uniforms will | 531 // Reserve each client-bound uniform location. This way unbound uniforms will |
535 // not be allocated to locations that user expects bound uniforms to be, even | 532 // not be allocated to locations that user expects bound uniforms to be, even |
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2369 DCHECK(program); | 2366 DCHECK(program); |
2370 program->ClearUniforms(&zero_); | 2367 program->ClearUniforms(&zero_); |
2371 } | 2368 } |
2372 | 2369 |
2373 int32_t ProgramManager::MakeFakeLocation(int32_t index, int32_t element) { | 2370 int32_t ProgramManager::MakeFakeLocation(int32_t index, int32_t element) { |
2374 return index + element * 0x10000; | 2371 return index + element * 0x10000; |
2375 } | 2372 } |
2376 | 2373 |
2377 } // namespace gles2 | 2374 } // namespace gles2 |
2378 } // namespace gpu | 2375 } // namespace gpu |
OLD | NEW |