| 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 { |
| 11 | 11 |
| 12 template <typename T> | 12 template <typename T> |
| 13 static T LocalGetAs(const std::vector<int8_t>& data, | 13 static T LocalGetAs(const std::vector<int8_t>& data, |
| 14 uint32_t offset, | 14 uint32_t offset, |
| 15 size_t size) { | 15 size_t size) { |
| 16 const int8_t* p = &data[0] + offset; | 16 const int8_t* p = &data[0] + offset; |
| 17 if (offset + size > data.size()) { | 17 if (offset + size > data.size()) { |
| 18 NOTREACHED(); | 18 NOTREACHED(); |
| 19 return NULL; | 19 return NULL; |
| 20 } | 20 } |
| 21 return static_cast<T>(static_cast<const void*>(p)); | 21 return static_cast<T>(static_cast<const void*>(p)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 } // namespace anonymous | 24 } // namespace |
| 25 | 25 |
| 26 namespace gpu { | 26 namespace gpu { |
| 27 namespace gles2 { | 27 namespace gles2 { |
| 28 | 28 |
| 29 ProgramInfoManager::Program::VertexAttrib::VertexAttrib( | 29 ProgramInfoManager::Program::VertexAttrib::VertexAttrib( |
| 30 GLsizei _size, GLenum _type, const std::string& _name, GLint _location) | 30 GLsizei _size, GLenum _type, const std::string& _name, GLint _location) |
| 31 : size(_size), | 31 : size(_size), |
| 32 type(_type), | 32 type(_type), |
| 33 location(_location), | 33 location(_location), |
| 34 name(_name) { | 34 name(_name) { |
| 35 } | 35 } |
| 36 | 36 |
| 37 ProgramInfoManager::Program::VertexAttrib::~VertexAttrib() { | 37 ProgramInfoManager::Program::VertexAttrib::~VertexAttrib() { |
| 38 } | 38 } |
| 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.back() == ']'); |
| 46 DCHECK(!(size > 1 && !is_array)); | 46 DCHECK(!(size > 1 && !is_array)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 ProgramInfoManager::Program::UniformInfo::UniformInfo( | 49 ProgramInfoManager::Program::UniformInfo::UniformInfo( |
| 50 const UniformInfo& other) = default; | 50 const UniformInfo& other) = default; |
| 51 | 51 |
| 52 ProgramInfoManager::Program::UniformInfo::~UniformInfo() { | 52 ProgramInfoManager::Program::UniformInfo::~UniformInfo() { |
| 53 } | 53 } |
| 54 | 54 |
| 55 ProgramInfoManager::Program::UniformES3::UniformES3() | 55 ProgramInfoManager::Program::UniformES3::UniformES3() |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 } | 1047 } |
| 1048 return true; | 1048 return true; |
| 1049 } | 1049 } |
| 1050 } | 1050 } |
| 1051 return gl->GetUniformIndicesHelper(program, count, names, indices); | 1051 return gl->GetUniformIndicesHelper(program, count, names, indices); |
| 1052 } | 1052 } |
| 1053 | 1053 |
| 1054 } // namespace gles2 | 1054 } // namespace gles2 |
| 1055 } // namespace gpu | 1055 } // namespace gpu |
| 1056 | 1056 |
| OLD | NEW |