| 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 : manager_(manager), | 331 : manager_(manager), |
| 332 use_count_(0), | 332 use_count_(0), |
| 333 max_attrib_name_length_(0), | 333 max_attrib_name_length_(0), |
| 334 max_uniform_name_length_(0), | 334 max_uniform_name_length_(0), |
| 335 service_id_(service_id), | 335 service_id_(service_id), |
| 336 deleted_(false), | 336 deleted_(false), |
| 337 valid_(false), | 337 valid_(false), |
| 338 link_status_(false), | 338 link_status_(false), |
| 339 uniforms_cleared_(false), | 339 uniforms_cleared_(false), |
| 340 transform_feedback_buffer_mode_(GL_NONE), | 340 transform_feedback_buffer_mode_(GL_NONE), |
| 341 effective_transform_feedback_buffer_mode_(GL_NONE), |
| 341 fragment_output_type_mask_(0u), | 342 fragment_output_type_mask_(0u), |
| 342 fragment_output_written_mask_(0u) { | 343 fragment_output_written_mask_(0u) { |
| 343 DCHECK(manager_); | 344 DCHECK(manager_); |
| 344 manager_->StartTracking(this); | 345 manager_->StartTracking(this); |
| 345 uint32_t packed_size = (manager_->max_vertex_attribs() + 15) / 16; | 346 uint32_t packed_size = (manager_->max_vertex_attribs() + 15) / 16; |
| 346 vertex_input_base_type_mask_.resize(packed_size); | 347 vertex_input_base_type_mask_.resize(packed_size); |
| 347 vertex_input_active_mask_.resize(packed_size); | 348 vertex_input_active_mask_.resize(packed_size); |
| 348 ClearVertexInputMasks(); | 349 ClearVertexInputMasks(); |
| 349 } | 350 } |
| 350 | 351 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 << ", name = " << info.name; | 687 << ", name = " << info.name; |
| 687 } | 688 } |
| 688 } | 689 } |
| 689 | 690 |
| 690 UpdateFragmentInputs(); | 691 UpdateFragmentInputs(); |
| 691 UpdateProgramOutputs(); | 692 UpdateProgramOutputs(); |
| 692 UpdateFragmentOutputBaseTypes(); | 693 UpdateFragmentOutputBaseTypes(); |
| 693 UpdateVertexInputBaseTypes(); | 694 UpdateVertexInputBaseTypes(); |
| 694 UpdateUniformBlockSizeInfo(); | 695 UpdateUniformBlockSizeInfo(); |
| 695 | 696 |
| 697 effective_transform_feedback_buffer_mode_ = transform_feedback_buffer_mode_; |
| 698 effective_transform_feedback_varyings_ = transform_feedback_varyings_; |
| 699 |
| 696 valid_ = true; | 700 valid_ = true; |
| 697 } | 701 } |
| 698 | 702 |
| 699 void Program::UpdateUniforms() { | 703 void Program::UpdateUniforms() { |
| 700 // Reserve each client-bound uniform location. This way unbound uniforms will | 704 // Reserve each client-bound uniform location. This way unbound uniforms will |
| 701 // not be allocated to locations that user expects bound uniforms to be, even | 705 // not be allocated to locations that user expects bound uniforms to be, even |
| 702 // if the expected uniforms are optimized away by the driver. | 706 // if the expected uniforms are optimized away by the driver. |
| 703 for (const auto& binding : bind_uniform_location_map_) { | 707 for (const auto& binding : bind_uniform_location_map_) { |
| 704 if (binding.second < 0) | 708 if (binding.second < 0) |
| 705 continue; | 709 continue; |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 if (link) { | 1322 if (link) { |
| 1319 // ANGLE updates the translated shader sources on link. | 1323 // ANGLE updates the translated shader sources on link. |
| 1320 for (auto shader : attached_shaders_) { | 1324 for (auto shader : attached_shaders_) { |
| 1321 shader->RefreshTranslatedShaderSource(); | 1325 shader->RefreshTranslatedShaderSource(); |
| 1322 } | 1326 } |
| 1323 if (cache) { | 1327 if (cache) { |
| 1324 cache->SaveLinkedProgram(service_id(), | 1328 cache->SaveLinkedProgram(service_id(), |
| 1325 attached_shaders_[0].get(), | 1329 attached_shaders_[0].get(), |
| 1326 attached_shaders_[1].get(), | 1330 attached_shaders_[1].get(), |
| 1327 &bind_attrib_location_map_, | 1331 &bind_attrib_location_map_, |
| 1328 transform_feedback_varyings_, | 1332 effective_transform_feedback_varyings_, |
| 1329 transform_feedback_buffer_mode_, | 1333 effective_transform_feedback_buffer_mode_, |
| 1330 shader_callback); | 1334 shader_callback); |
| 1331 } | 1335 } |
| 1332 UMA_HISTOGRAM_CUSTOM_COUNTS( | 1336 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 1333 "GPU.ProgramCache.BinaryCacheMissTime", | 1337 "GPU.ProgramCache.BinaryCacheMissTime", |
| 1334 static_cast<base::HistogramBase::Sample>( | 1338 static_cast<base::HistogramBase::Sample>( |
| 1335 (TimeTicks::Now() - before_time).InMicroseconds()), | 1339 (TimeTicks::Now() - before_time).InMicroseconds()), |
| 1336 1, | 1340 1, |
| 1337 static_cast<base::HistogramBase::Sample>( | 1341 static_cast<base::HistogramBase::Sample>( |
| 1338 TimeDelta::FromSeconds(10).InMicroseconds()), | 1342 TimeDelta::FromSeconds(10).InMicroseconds()), |
| 1339 50); | 1343 50); |
| (...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2578 DCHECK(program); | 2582 DCHECK(program); |
| 2579 program->ClearUniforms(&zero_); | 2583 program->ClearUniforms(&zero_); |
| 2580 } | 2584 } |
| 2581 | 2585 |
| 2582 int32_t ProgramManager::MakeFakeLocation(int32_t index, int32_t element) { | 2586 int32_t ProgramManager::MakeFakeLocation(int32_t index, int32_t element) { |
| 2583 return index + element * 0x10000; | 2587 return index + element * 0x10000; |
| 2584 } | 2588 } |
| 2585 | 2589 |
| 2586 } // namespace gles2 | 2590 } // namespace gles2 |
| 2587 } // namespace gpu | 2591 } // namespace gpu |
| OLD | NEW |