Commit 730fb0d7 authored by zmo's avatar zmo Committed by Commit bot

Get rid of NonCachedProgramInfoManager.

It is not used at all.

Note that I didn't change any logic at all except
1) Get rid of NonCachedProgramInfoManager.
2) Merge CachedProgramInfoManager into ProgramInfoManager.
3) Get rid of the Create() function.
4) Add ~VertexAttrib() ~UniformInfo() ~Program() as required by compiler.

BUG=453127
TEST=no change at all
R=piman@chromium.org

Review URL: https://codereview.chromium.org/893713002

Cr-Commit-Position: refs/heads/master@{#314027}
parent b2ae7e31
...@@ -142,7 +142,6 @@ test("gpu_unittests") { ...@@ -142,7 +142,6 @@ test("gpu_unittests") {
"command_buffer/client/gles2_implementation_unittest.cc", "command_buffer/client/gles2_implementation_unittest.cc",
"command_buffer/client/mapped_memory_unittest.cc", "command_buffer/client/mapped_memory_unittest.cc",
"command_buffer/client/query_tracker_unittest.cc", "command_buffer/client/query_tracker_unittest.cc",
"command_buffer/client/program_info_manager_unittest.cc",
"command_buffer/client/ring_buffer_test.cc", "command_buffer/client/ring_buffer_test.cc",
"command_buffer/client/transfer_buffer_unittest.cc", "command_buffer/client/transfer_buffer_unittest.cc",
"command_buffer/client/vertex_array_object_manager_unittest.cc", "command_buffer/client/vertex_array_object_manager_unittest.cc",
......
...@@ -6,48 +6,122 @@ ...@@ -6,48 +6,122 @@
#define GPU_COMMAND_BUFFER_CLIENT_PROGRAM_INFO_MANAGER_H_ #define GPU_COMMAND_BUFFER_CLIENT_PROGRAM_INFO_MANAGER_H_
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
#include <string>
#include <vector>
#include "base/containers/hash_tables.h"
#include "base/synchronization/lock.h"
#include "gles2_impl_export.h" #include "gles2_impl_export.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
namespace gpu { namespace gpu {
namespace gles2 { namespace gles2 {
class GLES2Implementation;
// Manages info about OpenGL ES Programs. // Manages info about OpenGL ES Programs.
class GLES2_IMPL_EXPORT ProgramInfoManager { class GLES2_IMPL_EXPORT ProgramInfoManager {
public: public:
virtual ~ProgramInfoManager(); ProgramInfoManager();
~ProgramInfoManager();
static ProgramInfoManager* Create(bool shared_resources_across_processes); void CreateInfo(GLuint program);
virtual void CreateInfo(GLuint program) = 0; void DeleteInfo(GLuint program);
virtual void DeleteInfo(GLuint program) = 0; bool GetProgramiv(
GLES2Implementation* gl, GLuint program, GLenum pname, GLint* params);
virtual bool GetProgramiv( GLint GetAttribLocation(
GLES2Implementation* gl, GLuint program, GLenum pname, GLint* params) = 0; GLES2Implementation* gl, GLuint program, const char* name);
virtual GLint GetAttribLocation( GLint GetUniformLocation(
GLES2Implementation* gl, GLuint program, const char* name) = 0; GLES2Implementation* gl, GLuint program, const char* name);
virtual GLint GetUniformLocation( GLint GetFragDataLocation(
GLES2Implementation* gl, GLuint program, const char* name) = 0; GLES2Implementation* gl, GLuint program, const char* name);
virtual GLint GetFragDataLocation( bool GetActiveAttrib(
GLES2Implementation* gl, GLuint program, const char* name) = 0; GLES2Implementation* gl, GLuint program, GLuint index, GLsizei bufsize,
GLsizei* length, GLint* size, GLenum* type, char* name);
virtual bool GetActiveAttrib( bool GetActiveUniform(
GLES2Implementation* gl, GLES2Implementation* gl, GLuint program, GLuint index, GLsizei bufsize,
GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLsizei* length, GLint* size, GLenum* type, char* name);
GLint* size, GLenum* type, char* name) = 0;
virtual bool GetActiveUniform( private:
GLES2Implementation* gl, class Program {
GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, public:
GLint* size, GLenum* type, char* name) = 0; struct UniformInfo {
UniformInfo(GLsizei _size, GLenum _type, const std::string& _name);
~UniformInfo();
protected: GLsizei size;
ProgramInfoManager(); GLenum type;
bool is_array;
std::string name;
std::vector<GLint> element_locations;
};
struct VertexAttrib {
VertexAttrib(GLsizei _size, GLenum _type, const std::string& _name,
GLint _location);
~VertexAttrib();
GLsizei size;
GLenum type;
GLint location;
std::string name;
};
Program();
~Program();
const VertexAttrib* GetAttribInfo(GLint index) const;
GLint GetAttribLocation(const std::string& name) const;
const UniformInfo* GetUniformInfo(GLint index) const;
// Gets the location of a uniform by name.
GLint GetUniformLocation(const std::string& name) const;
GLint GetFragDataLocation(const std::string& name) const;
void CacheFragDataLocation(const std::string& name, GLint loc);
bool GetProgramiv(GLenum pname, GLint* params);
// Updates the program info after a successful link.
void Update(GLES2Implementation* gl,
GLuint program,
const std::vector<int8>& result);
bool cached() const;
private:
bool cached_;
GLsizei max_attrib_name_length_;
// Attrib by index.
std::vector<VertexAttrib> attrib_infos_;
GLsizei max_uniform_name_length_;
// Uniform info by index.
std::vector<UniformInfo> uniform_infos_;
base::hash_map<std::string, GLint> frag_data_locations_;
// This is true if glLinkProgram was successful last time it was called.
bool link_status_;
};
Program* GetProgramInfo(GLES2Implementation* gl, GLuint program);
typedef base::hash_map<GLuint, Program> ProgramInfoMap;
ProgramInfoMap program_infos_;
mutable base::Lock lock_;
}; };
} // namespace gles2 } // namespace gles2
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Tests for the Command Buffer Helper.
#include "gpu/command_buffer/client/program_info_manager.h"
#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace gpu {
namespace gles2 {
class ProgramInfoManagerTest : public testing::Test {
protected:
void SetUp() override {}
void TearDown() override {}
scoped_ptr<ProgramInfoManager> program_info_manager_;
};
TEST_F(ProgramInfoManagerTest, Basic) {
}
} // namespace gles2
} // namespace gpu
...@@ -338,7 +338,7 @@ ShareGroup::ShareGroup(bool bind_generates_resource) ...@@ -338,7 +338,7 @@ ShareGroup::ShareGroup(bool bind_generates_resource)
} }
} }
} }
program_info_manager_.reset(ProgramInfoManager::Create(false)); program_info_manager_.reset(new ProgramInfoManager);
} }
void ShareGroup::set_program_info_manager(ProgramInfoManager* manager) { void ShareGroup::set_program_info_manager(ProgramInfoManager* manager) {
......
...@@ -179,7 +179,6 @@ ...@@ -179,7 +179,6 @@
'command_buffer/client/gles2_implementation_unittest.cc', 'command_buffer/client/gles2_implementation_unittest.cc',
'command_buffer/client/mapped_memory_unittest.cc', 'command_buffer/client/mapped_memory_unittest.cc',
'command_buffer/client/query_tracker_unittest.cc', 'command_buffer/client/query_tracker_unittest.cc',
'command_buffer/client/program_info_manager_unittest.cc',
'command_buffer/client/ring_buffer_test.cc', 'command_buffer/client/ring_buffer_test.cc',
'command_buffer/client/transfer_buffer_unittest.cc', 'command_buffer/client/transfer_buffer_unittest.cc',
'command_buffer/client/vertex_array_object_manager_unittest.cc', 'command_buffer/client/vertex_array_object_manager_unittest.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment