diff options
Diffstat (limited to 'o3d/gpu_plugin/gpu_processor.h')
-rw-r--r-- | o3d/gpu_plugin/gpu_processor.h | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/o3d/gpu_plugin/gpu_processor.h b/o3d/gpu_plugin/gpu_processor.h index 9c3641b..fd87b98 100644 --- a/o3d/gpu_plugin/gpu_processor.h +++ b/o3d/gpu_plugin/gpu_processor.h @@ -5,18 +5,40 @@ #ifndef O3D_GPU_PLUGIN_GPU_PROCESSOR_H_ #define O3D_GPU_PLUGIN_GPU_PROCESSOR_H_ -#include "base/ref_counted.h" +#include "o3d/command_buffer/service/cross/cmd_buffer_engine.h" +#include "o3d/command_buffer/service/cross/cmd_parser.h" +#include "o3d/command_buffer/service/cross/gapi_decoder.h" #include "o3d/gpu_plugin/command_buffer.h" #include "o3d/gpu_plugin/np_utils/np_object_pointer.h" +#if defined(OS_WIN) +#include "o3d/command_buffer/service/win/d3d9/gapi_d3d9.h" +#endif + namespace o3d { namespace gpu_plugin { // This class processes commands in a command buffer. It is event driven and // posts tasks to the current message loop to do additional work. -class GPUProcessor : public base::RefCountedThreadSafe<GPUProcessor> { +class GPUProcessor : public base::RefCountedThreadSafe<GPUProcessor>, + public command_buffer::CommandBufferUpcallInterface { public: - explicit GPUProcessor(const NPObjectPointer<CommandBuffer>& command_buffer); + GPUProcessor(NPP npp, + const NPObjectPointer<CommandBuffer>& command_buffer); + +#if defined(OS_WIN) + // This constructor is for unit tests. + GPUProcessor(NPP npp, + const NPObjectPointer<CommandBuffer>& command_buffer, + command_buffer::GAPID3D9* gapi, + command_buffer::GAPIDecoder* decoder, + command_buffer::CommandParser* parser, + int commands_per_update); + + bool Initialize(HWND hwnd); +#endif // OS_WIN + + void Destroy(); void ProcessCommands(); @@ -24,15 +46,30 @@ class GPUProcessor : public base::RefCountedThreadSafe<GPUProcessor> { void SetWindow(HWND handle, int width, int height); #endif - void DrawRectangle(uint32 color, int left, int top, int right, int bottom); + // Implementation of 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); + + // 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); + + // Sets the token value. + virtual void set_token(unsigned int token); private: + NPP npp_; NPObjectPointer<CommandBuffer> command_buffer_; + int commands_per_update_; #if defined(OS_WIN) - HWND window_handle_; - int window_width_; - int window_height_; + scoped_ptr<command_buffer::GAPID3D9> gapi_; + scoped_ptr<command_buffer::GAPIDecoder> decoder_; + scoped_ptr<command_buffer::CommandParser> parser_; #endif }; |