Chromium Code Reviews| Index: gpu/command_buffer/service/uniform_subscription_manager.h |
| diff --git a/gpu/command_buffer/service/uniform_subscription_manager.h b/gpu/command_buffer/service/uniform_subscription_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6b562eb74e139b807b4f5d74bf45e1b963cfcf0c |
| --- /dev/null |
| +++ b/gpu/command_buffer/service/uniform_subscription_manager.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright (c) 2014 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. |
| + |
| +#ifndef GPU_COMMAND_BUFFER_SERVICE_UNIFORM_SUBSCRIPTION_MANAGER_H_ |
| +#define GPU_COMMAND_BUFFER_SERVICE_UNIFORM_SUBSCRIPTION_MANAGER_H_ |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/containers/hash_tables.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "gpu/command_buffer/service/gl_utils.h" |
| +#include "gpu/command_buffer/service/program_manager.h" |
| +#include "gpu/gpu_export.h" |
| + |
| +namespace gpu { |
| +namespace gles2 { |
| + |
| +// This class keeps track of the mapping of uniform locations to types, |
| +// along with the current uniform state |
| +class GPU_EXPORT UniformSubscriptionManager { |
| + public: |
| + typedef std::vector<std::pair<GLenum, GLint>> ProgramSubscriptions; |
|
piman
2014/10/21 20:00:41
Please define a real struct for the pair. At the c
orglofch
2014/10/22 23:10:21
I've changed this to be a map to enforce 1:1 mappi
|
| + |
| + UniformSubscriptionManager(); |
| + ~UniformSubscriptionManager(); |
| + |
| + void Destroy(bool have_context); |
| + |
| + // Subscribe uniform |location| in program specified by |client_id| |
| + // to |target| |
| + void AddSubscription(GLuint client_id, GLint location, GLenum target); |
| + |
| + // Update the active_state of the subscriptions |
| + void ActivateUniformSubscriptionState(); |
| + |
| + const ProgramSubscriptions* SubscriptionsForProgram(GLuint client_id); |
| + |
| + static Program::UniformApiType ApiTypeForTarget(GLenum target); |
| + |
| + private: |
| + typedef base::hash_map<GLint, ProgramSubscriptions> SubscriptionMap; |
| + |
| + SubscriptionMap subscriptions_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(UniformSubscriptionManager); |
| +}; |
| + |
| +} // namespage gles2 |
| +} // namespace gpu |
| + |
| +#endif // GPU_COMMAND_BUFFER_SERVICE_UNIFORM_SUBSCRIPTION_MANAGER_H_ |