summaryrefslogtreecommitdiffstats
path: root/o3d/gpu_plugin/command_buffer.h
diff options
context:
space:
mode:
authorapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-03 19:41:16 +0000
committerapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-03 19:41:16 +0000
commit1b8f411d2daf5212f678ea1493b6bd5416d0c8ad (patch)
treee10297c768c79c2cecd2fb3b49fb5a1ae98a20d1 /o3d/gpu_plugin/command_buffer.h
parentb6aa587dc3d810cbc73ad9f3f3ec062cb231d869 (diff)
downloadchromium_src-1b8f411d2daf5212f678ea1493b6bd5416d0c8ad.zip
chromium_src-1b8f411d2daf5212f678ea1493b6bd5416d0c8ad.tar.gz
chromium_src-1b8f411d2daf5212f678ea1493b6bd5416d0c8ad.tar.bz2
Exracted CommandBuffer class from GPUPluginObject.
TEST=none BUG=none Review URL: http://codereview.chromium.org/200005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25348 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/gpu_plugin/command_buffer.h')
-rw-r--r--o3d/gpu_plugin/command_buffer.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/o3d/gpu_plugin/command_buffer.h b/o3d/gpu_plugin/command_buffer.h
new file mode 100644
index 0000000..454e48a
--- /dev/null
+++ b/o3d/gpu_plugin/command_buffer.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2006-2008 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 O3D_GPU_PLUGIN_COMMAND_BUFFER_H_
+#define O3D_GPU_PLUGIN_COMMAND_BUFFER_H_
+
+#include "o3d/gpu_plugin/np_utils/dispatched_np_object.h"
+
+namespace o3d {
+namespace gpu_plugin {
+
+// An NPObject that implements a shared memory command buffer and a synchronous
+// API to manage the put and get pointers.
+class CommandBuffer : public DispatchedNPObject {
+ public:
+ explicit CommandBuffer(NPP npp);
+ virtual ~CommandBuffer();
+
+ // Create a shared memory buffer of the given size.
+ virtual bool Initialize(int32 size);
+
+ // Gets the shared memory object for the command buffer.
+ virtual NPObjectPointer<NPObject> GetBuffer();
+
+ // The client calls this to update its put offset.
+ virtual void SetPutOffset(int32 offset);
+
+ // The client calls this to get the servers current get offset.
+ virtual int32 GetGetOffset();
+
+ protected:
+ NP_UTILS_BEGIN_DISPATCHER_CHAIN(CommandBuffer, DispatchedNPObject)
+ NP_UTILS_DISPATCHER(Initialize, bool(int32))
+ NP_UTILS_DISPATCHER(SetPutOffset, void(int32))
+ NP_UTILS_DISPATCHER(GetGetOffset, int32())
+ NP_UTILS_DISPATCHER(GetBuffer, NPObjectPointer<NPObject>())
+ NP_UTILS_END_DISPATCHER_CHAIN
+
+ private:
+ NPObjectPointer<NPObject> buffer_object_;
+ NPSharedMemory* shared_memory_;
+};
+
+} // namespace gpu_plugin
+} // namespace o3d
+
+#endif // O3D_GPU_PLUGIN_COMMAND_BUFFER_H_