diff options
author | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-24 19:19:25 +0000 |
---|---|---|
committer | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-24 19:19:25 +0000 |
commit | 2331a49ecb27f38888bf4f60f24e054cbb8a8890 (patch) | |
tree | de3d03558bd82742292cebb81f1ed68ba1626342 /o3d/command_buffer | |
parent | dfb5a4cc453d4a78e655d6f4cb5e11e8ced54c1b (diff) | |
download | chromium_src-2331a49ecb27f38888bf4f60f24e054cbb8a8890.zip chromium_src-2331a49ecb27f38888bf4f60f24e054cbb8a8890.tar.gz chromium_src-2331a49ecb27f38888bf4f60f24e054cbb8a8890.tar.bz2 |
GPUProcessor uses O3D command buffer service to render to a window.
Added libraries that contain a subset of the O3D command buffer code independent on NaCl.
Extracted Upcall interface from CommandBufferEngine.
Now this works in JavaScript to clear the GPU plugin element to a random color:
// BEGIN_FRAME
sharedMemory.setInt32(putOffset++, 0x00000201);
// CLEAR
sharedMemory.setInt32(putOffset++, 0x00000408);
sharedMemory.setInt32(putOffset++, 7);
sharedMemory.setFloat(putOffset++, Math.random());
sharedMemory.setFloat(putOffset++, Math.random());
sharedMemory.setFloat(putOffset++, Math.random());
sharedMemory.setFloat(putOffset++, 1);
sharedMemory.setFloat(putOffset++, 0.5);
sharedMemory.setInt32(putOffset++, 0);
// END_FRAME
sharedMemory.setInt32(putOffset++, 0x00000301);
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/234001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27098 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/command_buffer')
-rw-r--r-- | o3d/command_buffer/service/cross/cmd_buffer_engine.h | 28 | ||||
-rw-r--r-- | o3d/command_buffer/service/cross/gapi_decoder.h | 6 | ||||
-rw-r--r-- | o3d/command_buffer/service/win/d3d9/gapi_d3d9.h | 1 |
3 files changed, 31 insertions, 4 deletions
diff --git a/o3d/command_buffer/service/cross/cmd_buffer_engine.h b/o3d/command_buffer/service/cross/cmd_buffer_engine.h index 572d98f..479c267 100644 --- a/o3d/command_buffer/service/cross/cmd_buffer_engine.h +++ b/o3d/command_buffer/service/cross/cmd_buffer_engine.h @@ -46,7 +46,33 @@ namespace command_buffer { class BufferRPCImpl; -class CommandBufferEngine : public BufferSyncInterface { +class CommandBufferUpcallInterface { + public: + CommandBufferUpcallInterface() { + } + + virtual ~CommandBufferUpcallInterface() { + } + + // Gets the base address of a registered shared memory buffer. + // Parameters: + // shm_id: the identifier for the shared memory buffer. + virtual void *GetSharedMemoryAddress(unsigned int shm_id) = 0; + + // Gets the size of a registered shared memory buffer. + // Parameters: + // shm_id: the identifier for the shared memory buffer. + virtual size_t GetSharedMemorySize(unsigned int shm_id) = 0; + + // Sets the token value. + virtual void set_token(unsigned int token) = 0; + + private: + DISALLOW_COPY_AND_ASSIGN(CommandBufferUpcallInterface); +}; + +class CommandBufferEngine : public BufferSyncInterface, + public CommandBufferUpcallInterface { public: explicit CommandBufferEngine(AsyncAPIInterface *handler); virtual ~CommandBufferEngine(); diff --git a/o3d/command_buffer/service/cross/gapi_decoder.h b/o3d/command_buffer/service/cross/gapi_decoder.h index a9af75c..e75376c 100644 --- a/o3d/command_buffer/service/cross/gapi_decoder.h +++ b/o3d/command_buffer/service/cross/gapi_decoder.h @@ -42,7 +42,7 @@ namespace o3d { namespace command_buffer { class GAPIInterface; -class CommandBufferEngine; +class CommandBufferUpcallInterface; // This class implements the AsyncAPIInterface interface, decoding GAPI // commands and sending them to a GAPI interface. @@ -60,7 +60,7 @@ class GAPIDecoder : public AsyncAPIInterface { // Sets the engine, to get shared memory buffers from, and to set the token // to. - void set_engine(CommandBufferEngine *engine) { engine_ = engine; } + void set_engine(CommandBufferUpcallInterface *engine) { engine_ = engine; } private: // Gets the address of shared memory data, given a shared memory ID and an // offset. Also checks that the size is consistent with the shared memory @@ -88,7 +88,7 @@ class GAPIDecoder : public AsyncAPIInterface { #undef O3D_COMMAND_BUFFER_CMD_OP GAPIInterface *gapi_; - CommandBufferEngine *engine_; + CommandBufferUpcallInterface *engine_; }; } // namespace command_buffer diff --git a/o3d/command_buffer/service/win/d3d9/gapi_d3d9.h b/o3d/command_buffer/service/win/d3d9/gapi_d3d9.h index eb301ba..f4a9b4a 100644 --- a/o3d/command_buffer/service/win/d3d9/gapi_d3d9.h +++ b/o3d/command_buffer/service/win/d3d9/gapi_d3d9.h @@ -54,6 +54,7 @@ class GAPID3D9 : public GAPIInterface { virtual ~GAPID3D9();
void set_hwnd(HWND hwnd) { hwnd_ = hwnd; }
+ HWND hwnd() const { return hwnd_; }
// Initializes the graphics context, bound to a window.
// Returns:
|