Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Unified Diff: gpu/command_buffer/service/uniform_subscription_manager.h

Issue 659903002: Add subscribeUniform extension pipeline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V2 API Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698