| Index: gpu/command_buffer/service/valuebuffer_manager.h
|
| diff --git a/gpu/command_buffer/service/valuebuffer_manager.h b/gpu/command_buffer/service/valuebuffer_manager.h
|
| index 3cc4ac194a8a5ac73eb08dffe9cb34347c9419b3..022bf411cc434133d994fe445d3bb2cf16597f91 100644
|
| --- a/gpu/command_buffer/service/valuebuffer_manager.h
|
| +++ b/gpu/command_buffer/service/valuebuffer_manager.h
|
| @@ -9,7 +9,7 @@
|
| #include "base/containers/hash_tables.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/scoped_ptr.h"
|
| -#include "gpu/command_buffer/service/gl_utils.h"
|
| +#include "gpu/command_buffer/common/value_state.h"
|
| #include "gpu/gpu_export.h"
|
|
|
| namespace gpu {
|
| @@ -17,16 +17,11 @@ namespace gles2 {
|
|
|
| class ValuebufferManager;
|
|
|
| -union ValueState {
|
| - float float_value[4];
|
| - int int_value[4];
|
| -};
|
| -
|
| class GPU_EXPORT Valuebuffer : public base::RefCounted<Valuebuffer> {
|
| public:
|
| - Valuebuffer(ValuebufferManager* manager, GLuint client_id);
|
| + Valuebuffer(ValuebufferManager* manager, unsigned int client_id);
|
|
|
| - GLuint client_id() const { return client_id_; }
|
| + unsigned int client_id() const { return client_id_; }
|
|
|
| bool IsDeleted() const { return client_id_ == 0; }
|
|
|
| @@ -34,26 +29,25 @@ class GPU_EXPORT Valuebuffer : public base::RefCounted<Valuebuffer> {
|
|
|
| bool IsValid() const { return has_been_bound_ && !IsDeleted(); }
|
|
|
| - void AddSubscription(GLenum subscription);
|
| - void RemoveSubscription(GLenum subscription);
|
| + void AddSubscription(unsigned int subscription);
|
| + void RemoveSubscription(unsigned int subscription);
|
|
|
| // Returns true if this Valuebuffer is subscribed to subscription
|
| - bool IsSubscribed(GLenum subscription);
|
| + bool IsSubscribed(unsigned int subscription);
|
|
|
| // Returns the active state for a given target in this Valuebuffer
|
| // returns NULL if target state doesn't exist
|
| - const ValueState* GetState(GLenum target) const;
|
| + const ValueState* GetState(unsigned int target) const;
|
|
|
| private:
|
| friend class ValuebufferManager;
|
| friend class base::RefCounted<Valuebuffer>;
|
|
|
| - typedef base::hash_map<GLenum, ValueState> StateMap;
|
| - typedef base::hash_set<GLenum> SubscriptionSet;
|
| + typedef base::hash_set<unsigned int> SubscriptionSet;
|
|
|
| ~Valuebuffer();
|
|
|
| - void UpdateState(const StateMap& pending_state);
|
| + void UpdateState(const ValueStateMap* pending_state);
|
|
|
| void MarkAsDeleted() { client_id_ = 0; }
|
|
|
| @@ -61,58 +55,57 @@ class GPU_EXPORT Valuebuffer : public base::RefCounted<Valuebuffer> {
|
| ValuebufferManager* manager_;
|
|
|
| // Client side Valuebuffer id.
|
| - GLuint client_id_;
|
| + unsigned int client_id_;
|
|
|
| // Whether this Valuebuffer has ever been bound.
|
| bool has_been_bound_;
|
|
|
| SubscriptionSet subscriptions_;
|
|
|
| - StateMap active_state_map_;
|
| + scoped_refptr<ValueStateMap> active_state_map_;
|
| };
|
|
|
| class GPU_EXPORT ValuebufferManager {
|
| public:
|
| - ValuebufferManager();
|
| + ValuebufferManager(ValueStateMap* state_map);
|
| ~ValuebufferManager();
|
|
|
| // Must call before destruction.
|
| void Destroy();
|
|
|
| // Creates a Valuebuffer for the given Valuebuffer ids.
|
| - void CreateValuebuffer(GLuint client_id);
|
| + void CreateValuebuffer(unsigned int client_id);
|
|
|
| // Gets the Valuebuffer for the given Valuebuffer id.
|
| - Valuebuffer* GetValuebuffer(GLuint client_id);
|
| + Valuebuffer* GetValuebuffer(unsigned int client_id);
|
|
|
| // Removes a Valuebuffer for the given Valuebuffer id.
|
| - void RemoveValuebuffer(GLuint client_id);
|
| + void RemoveValuebuffer(unsigned int client_id);
|
|
|
| // Updates the value state for the given Valuebuffer
|
| void UpdateValuebufferState(Valuebuffer* valuebuffer);
|
|
|
| - // Gets the state for the given subscription target
|
| - void UpdateValueState(GLenum target, const ValueState& state);
|
| -
|
| - static uint32 ApiTypeForSubscriptionTarget(GLenum target);
|
| + static uint32 ApiTypeForSubscriptionTarget(unsigned int target);
|
|
|
| private:
|
| friend class Valuebuffer;
|
|
|
| - typedef base::hash_map<GLuint, scoped_refptr<Valuebuffer>> ValuebufferMap;
|
| + typedef base::hash_map<unsigned int, scoped_refptr<Valuebuffer>>
|
| + ValuebufferMap;
|
|
|
| void StartTracking(Valuebuffer* valuebuffer);
|
| void StopTracking(Valuebuffer* valuebuffer);
|
|
|
| // Counts the number of Valuebuffer allocated with 'this' as its manager.
|
| // Allows to check no Valuebuffer will outlive this.
|
| - unsigned valuebuffer_count_;
|
| + unsigned int valuebuffer_count_;
|
|
|
| // Info for each Valuebuffer in the system.
|
| ValuebufferMap valuebuffer_map_;
|
|
|
| // Current value state in the system
|
| - Valuebuffer::StateMap pending_state_map_;
|
| + // Updated by GpuChannel
|
| + scoped_refptr<ValueStateMap> pending_state_map_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ValuebufferManager);
|
| };
|
|
|