| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "gpu/command_buffer/client/program_info_manager.h" | 8 #include "gpu/command_buffer/client/program_info_manager.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 ProgramInfoManager::Program::UniformInfo::UniformInfo( | 40 ProgramInfoManager::Program::UniformInfo::UniformInfo( |
| 41 GLsizei _size, GLenum _type, const std::string& _name) | 41 GLsizei _size, GLenum _type, const std::string& _name) |
| 42 : size(_size), | 42 : size(_size), |
| 43 type(_type), | 43 type(_type), |
| 44 name(_name) { | 44 name(_name) { |
| 45 is_array = (!name.empty() && name[name.size() - 1] == ']'); | 45 is_array = (!name.empty() && name[name.size() - 1] == ']'); |
| 46 DCHECK(!(size > 1 && !is_array)); | 46 DCHECK(!(size > 1 && !is_array)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 ProgramInfoManager::Program::UniformInfo::UniformInfo( |
| 50 const UniformInfo& other) = default; |
| 51 |
| 49 ProgramInfoManager::Program::UniformInfo::~UniformInfo() { | 52 ProgramInfoManager::Program::UniformInfo::~UniformInfo() { |
| 50 } | 53 } |
| 51 | 54 |
| 52 ProgramInfoManager::Program::UniformES3::UniformES3() | 55 ProgramInfoManager::Program::UniformES3::UniformES3() |
| 53 : block_index(-1), | 56 : block_index(-1), |
| 54 offset(-1), | 57 offset(-1), |
| 55 array_stride(-1), | 58 array_stride(-1), |
| 56 matrix_stride(-1), | 59 matrix_stride(-1), |
| 57 is_row_major(0) { | 60 is_row_major(0) { |
| 58 } | 61 } |
| 59 | 62 |
| 60 ProgramInfoManager::Program::UniformES3::~UniformES3() { | 63 ProgramInfoManager::Program::UniformES3::~UniformES3() { |
| 61 } | 64 } |
| 62 | 65 |
| 63 ProgramInfoManager::Program::UniformBlock::UniformBlock() | 66 ProgramInfoManager::Program::UniformBlock::UniformBlock() |
| 64 : binding(0), | 67 : binding(0), |
| 65 data_size(0), | 68 data_size(0), |
| 66 referenced_by_vertex_shader(false), | 69 referenced_by_vertex_shader(false), |
| 67 referenced_by_fragment_shader(false) { | 70 referenced_by_fragment_shader(false) { |
| 68 } | 71 } |
| 69 | 72 |
| 73 ProgramInfoManager::Program::UniformBlock::UniformBlock( |
| 74 const UniformBlock& other) = default; |
| 75 |
| 70 ProgramInfoManager::Program::UniformBlock::~UniformBlock() { | 76 ProgramInfoManager::Program::UniformBlock::~UniformBlock() { |
| 71 } | 77 } |
| 72 | 78 |
| 73 ProgramInfoManager::Program::TransformFeedbackVarying:: | 79 ProgramInfoManager::Program::TransformFeedbackVarying:: |
| 74 TransformFeedbackVarying() | 80 TransformFeedbackVarying() |
| 75 : size(0), | 81 : size(0), |
| 76 type(0) { | 82 type(0) { |
| 77 } | 83 } |
| 78 | 84 |
| 79 ProgramInfoManager::Program::TransformFeedbackVarying:: | 85 ProgramInfoManager::Program::TransformFeedbackVarying:: |
| 80 ~TransformFeedbackVarying() { | 86 ~TransformFeedbackVarying() { |
| 81 } | 87 } |
| 82 | 88 |
| 83 ProgramInfoManager::Program::Program() | 89 ProgramInfoManager::Program::Program() |
| 84 : cached_es2_(false), | 90 : cached_es2_(false), |
| 85 max_attrib_name_length_(0), | 91 max_attrib_name_length_(0), |
| 86 max_uniform_name_length_(0), | 92 max_uniform_name_length_(0), |
| 87 link_status_(false), | 93 link_status_(false), |
| 88 cached_es3_uniform_blocks_(false), | 94 cached_es3_uniform_blocks_(false), |
| 89 active_uniform_block_max_name_length_(0), | 95 active_uniform_block_max_name_length_(0), |
| 90 cached_es3_transform_feedback_varyings_(false), | 96 cached_es3_transform_feedback_varyings_(false), |
| 91 transform_feedback_varying_max_length_(0), | 97 transform_feedback_varying_max_length_(0), |
| 92 transform_feedback_buffer_mode_(0), | 98 transform_feedback_buffer_mode_(0), |
| 93 cached_es3_uniformsiv_(false) { | 99 cached_es3_uniformsiv_(false) { |
| 94 } | 100 } |
| 95 | 101 |
| 102 ProgramInfoManager::Program::Program(const Program& other) = default; |
| 103 |
| 96 ProgramInfoManager::Program::~Program() { | 104 ProgramInfoManager::Program::~Program() { |
| 97 } | 105 } |
| 98 | 106 |
| 99 // TODO(gman): Add a faster lookup. | 107 // TODO(gman): Add a faster lookup. |
| 100 GLint ProgramInfoManager::Program::GetAttribLocation( | 108 GLint ProgramInfoManager::Program::GetAttribLocation( |
| 101 const std::string& name) const { | 109 const std::string& name) const { |
| 102 for (GLuint ii = 0; ii < attrib_infos_.size(); ++ii) { | 110 for (GLuint ii = 0; ii < attrib_infos_.size(); ++ii) { |
| 103 const VertexAttrib& info = attrib_infos_[ii]; | 111 const VertexAttrib& info = attrib_infos_[ii]; |
| 104 if (info.name == name) { | 112 if (info.name == name) { |
| 105 return info.location; | 113 return info.location; |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 } | 1047 } |
| 1040 return true; | 1048 return true; |
| 1041 } | 1049 } |
| 1042 } | 1050 } |
| 1043 return gl->GetUniformIndicesHelper(program, count, names, indices); | 1051 return gl->GetUniformIndicesHelper(program, count, names, indices); |
| 1044 } | 1052 } |
| 1045 | 1053 |
| 1046 } // namespace gles2 | 1054 } // namespace gles2 |
| 1047 } // namespace gpu | 1055 } // namespace gpu |
| 1048 | 1056 |
| OLD | NEW |