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

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

Issue 1922633002: Implement TransformFeedbackManager in GPU command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/transform_feedback_manager.h
diff --git a/gpu/command_buffer/service/transform_feedback_manager.h b/gpu/command_buffer/service/transform_feedback_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..6ab09b1ea6a6088efb7af25ede2d7018c5c41e2a
--- /dev/null
+++ b/gpu/command_buffer/service/transform_feedback_manager.h
@@ -0,0 +1,125 @@
+// Copyright (c) 2016 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_TRANSFORM_FEEDBACK_MANAGER_H_
+#define GPU_COMMAND_BUFFER_SERVICE_TRANSFORM_FEEDBACK_MANAGER_H_
+
+#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/indexed_buffer_binding_host.h"
+#include "gpu/gpu_export.h"
+
+namespace gfx {
+struct GLVersionInfo;
+};
+
+namespace gpu {
+namespace gles2 {
+
+class Buffer;
+class TransformFeedbackManager;
+
+// Info about TransformFeedbacks currently in the system.
+class GPU_EXPORT TransformFeedback : public IndexedBufferBindingHost {
+ public:
+ TransformFeedback(TransformFeedbackManager* manager, GLuint service_id);
+
+ // All the following functions do state update and call the underlying GL
+ // function. All validations have been done already and the GL function is
+ // guaranteed to succeed.
+ void DoBindTransformFeedback(
+ const gfx::GLVersionInfo& gl_version_info, GLenum target);
+ void DoBeginTransformFeedback(GLenum primitive_mode);
+ void DoEndTransformFeedback();
+ void DoPauseTransformFeedback();
+ void DoResumeTransformFeedback();
+
+ void MarkAsDeleted() {
+ deleted_ = true;
+ }
+
+ GLuint service_id() const {
+ return service_id_;
+ }
+
+ bool deleted() const {
+ return deleted_;
+ }
+
+ bool active() const {
+ return active_;
+ }
+
+ bool paused() const {
+ return paused_;
+ }
+
+ GLenum primitive_mode() const {
+ return primitive_mode_;
+ }
+
+ private:
+ ~TransformFeedback() override;
+
+ // The manager that owns this Buffer.
+ TransformFeedbackManager* manager_;
+
+ GLuint service_id_;
+
+ bool deleted_;
+
+ bool active_;
+ bool paused_;
+
+ GLenum primitive_mode_;
+};
+
+// This class keeps tracks of the transform feedbacks and their states.
+class GPU_EXPORT TransformFeedbackManager {
+ public:
+ TransformFeedbackManager(GLuint max_transform_feedback_separate_attribs);
+ ~TransformFeedbackManager();
+
+ // Must call before destruction.
+ void Destroy(bool have_context);
+
+ // Creates a TransformFeedback from the given client/service IDs and
+ // insert it into the list.
+ TransformFeedback* CreateTransformFeedback(
+ GLuint client_id, GLuint service_id);
+
+ TransformFeedback* GetTransformFeedback(GLuint client_id);
+
+ // Removes a TransformFeedback info for the given client ID.
+ void RemoveTransformFeedback(GLuint client_id);
+
+ void RemoveBoundBuffer(Buffer* buffer);
+
+ GLuint max_transform_feedback_separate_attribs() const {
+ return max_transform_feedback_separate_attribs_;
+ }
+
+ bool have_context() const {
+ return have_context_;
+ }
+
+ private:
+ // Info for each transform feedback in the system.
+ base::hash_map<GLuint,
+ scoped_refptr<TransformFeedback> > transform_feedbacks_;
+
+ GLuint max_transform_feedback_separate_attribs_;
+
+ bool have_context_;
+
+ DISALLOW_COPY_AND_ASSIGN(TransformFeedbackManager);
+};
+
+} // namespace gles2
+} // namespace gpu
+
+#endif // GPU_COMMAND_BUFFER_SERVICE_TRANSFORM_FEEDBACK_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698