| Index: gpu/command_buffer/service/program_manager.h
|
| diff --git a/gpu/command_buffer/service/program_manager.h b/gpu/command_buffer/service/program_manager.h
|
| index d2655cc97ae2345e5806984389c24af88d1d96c4..964b9337be2c4a39b784bce23c02c534ee0e6416 100644
|
| --- a/gpu/command_buffer/service/program_manager.h
|
| +++ b/gpu/command_buffer/service/program_manager.h
|
| @@ -36,11 +36,16 @@ class GPU_EXPORT ProgramManager {
|
| static const int kMaxAttachedShaders = 2;
|
|
|
| struct UniformInfo {
|
| + UniformInfo();
|
| UniformInfo(
|
| GLsizei _size, GLenum _type, GLint _fake_location_base,
|
| const std::string& _name);
|
| ~UniformInfo();
|
|
|
| + bool IsValid() const {
|
| + return size != 0;
|
| + }
|
| +
|
| bool IsSampler() const {
|
| return type == GL_SAMPLER_2D || type == GL_SAMPLER_2D_RECT_ARB ||
|
| type == GL_SAMPLER_CUBE || type == GL_SAMPLER_EXTERNAL_OES;
|
| @@ -103,10 +108,7 @@ class GPU_EXPORT ProgramManager {
|
| return NULL;
|
| }
|
|
|
| - const UniformInfo* GetUniformInfo(GLint index) const {
|
| - return (static_cast<size_t>(index) < uniform_infos_.size()) ?
|
| - &uniform_infos_[index] : NULL;
|
| - }
|
| + const UniformInfo* GetUniformInfo(GLint index) const;
|
|
|
| // If the original name is not found, return NULL.
|
| const std::string* GetAttribMappedName(
|
| @@ -163,11 +165,14 @@ class GPU_EXPORT ProgramManager {
|
| }
|
|
|
| // Sets attribute-location binding from a glBindAttribLocation() call.
|
| - void SetAttribLocationBinding(const std::string& attrib,
|
| - GLint location) {
|
| + void SetAttribLocationBinding(const std::string& attrib, GLint location) {
|
| bind_attrib_location_map_[attrib] = location;
|
| }
|
|
|
| + // Sets uniform-location binding from a glBindUniformLocationCHROMIUM call.
|
| + // returns false if error.
|
| + bool SetUniformLocationBinding(const std::string& name, GLint location);
|
| +
|
| // Detects if there are attribute location conflicts from
|
| // glBindAttribLocation() calls.
|
| // We only consider the declared attributes in the program.
|
| @@ -177,6 +182,8 @@ class GPU_EXPORT ProgramManager {
|
| friend class base::RefCounted<ProgramInfo>;
|
| friend class ProgramManager;
|
|
|
| + typedef std::map<std::string, GLint> LocationMap;
|
| +
|
| ~ProgramInfo();
|
|
|
| void set_log_info(const char* str) {
|
| @@ -219,9 +226,10 @@ class GPU_EXPORT ProgramManager {
|
| // translated.
|
| void ExecuteBindAttribLocationCalls();
|
|
|
| - const UniformInfo* AddUniformInfo(
|
| - GLsizei size, GLenum type, GLint location,
|
| - const std::string& name, const std::string& original_name);
|
| + bool AddUniformInfo(
|
| + GLsizei size, GLenum type, GLint location, GLint fake_base_location,
|
| + const std::string& name, const std::string& original_name,
|
| + size_t* next_available_index);
|
|
|
| void GetCorrectedVariableInfo(
|
| bool use_uniforms, const std::string& name, std::string* corrected_name,
|
| @@ -277,11 +285,18 @@ class GPU_EXPORT ProgramManager {
|
| // True if the uniforms have been cleared.
|
| bool uniforms_cleared_;
|
|
|
| + // This is different than uniform_infos_.size() because
|
| + // that is a sparce array.
|
| + GLint num_uniforms_;
|
| +
|
| // Log info
|
| scoped_ptr<std::string> log_info_;
|
|
|
| // attribute-location binding map from glBindAttribLocation() calls.
|
| - std::map<std::string, GLint> bind_attrib_location_map_;
|
| + LocationMap bind_attrib_location_map_;
|
| +
|
| + // uniform-location binding map from glBindUniformLocationCHROMIUM() calls.
|
| + LocationMap bind_uniform_location_map_;
|
| };
|
|
|
| ProgramManager();
|
| @@ -317,6 +332,8 @@ class GPU_EXPORT ProgramManager {
|
| // Check if a ProgramInfo is owned by this ProgramManager.
|
| bool IsOwned(ProgramInfo* info);
|
|
|
| + static int32 MakeFakeLocation(int32 index, int32 element);
|
| +
|
| private:
|
| void StartTracking(ProgramInfo* info);
|
| void StopTracking(ProgramInfo* info);
|
|
|