| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef GPU_PGL_COMMAND_BUFFER_PEPPER_H | |
| 6 #define GPU_PGL_COMMAND_BUFFER_PEPPER_H | |
| 7 | |
| 8 #include "gpu/command_buffer/common/command_buffer.h" | |
| 9 #include "third_party/npapi/bindings/npapi.h" | |
| 10 #include "third_party/npapi/bindings/npruntime.h" | |
| 11 #include "third_party/npapi/bindings/npapi_extensions.h" | |
| 12 #ifdef __native_client__ | |
| 13 #include "native_client/src/third_party/npapi/files/include/npupp.h" | |
| 14 #else | |
| 15 #include "third_party/npapi/bindings/nphostapi.h" | |
| 16 #endif // __native_client__ | |
| 17 | |
| 18 namespace { | |
| 19 class SharedMemory; | |
| 20 } | |
| 21 | |
| 22 // A CommandBuffer proxy implementation that uses the Pepper API to access | |
| 23 // the command buffer. | |
| 24 | |
| 25 class CommandBufferPepper : public gpu::CommandBuffer { | |
| 26 public: | |
| 27 CommandBufferPepper(NPP npp, | |
| 28 NPDevice* device, | |
| 29 NPDeviceContext3D* device_context); | |
| 30 virtual ~CommandBufferPepper(); | |
| 31 | |
| 32 // CommandBuffer implementation. | |
| 33 virtual bool Initialize(int32 size); | |
| 34 virtual bool Initialize(base::SharedMemory* buffer, int32 size); | |
| 35 virtual gpu::Buffer GetRingBuffer(); | |
| 36 virtual State GetState(); | |
| 37 virtual void Flush(int32 put_offset); | |
| 38 virtual State FlushSync(int32 put_offset); | |
| 39 virtual void SetGetOffset(int32 get_offset); | |
| 40 virtual int32 CreateTransferBuffer(size_t size, int32 id_request); | |
| 41 virtual void DestroyTransferBuffer(int32 id); | |
| 42 virtual gpu::Buffer GetTransferBuffer(int32 handle); | |
| 43 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, | |
| 44 size_t size, | |
| 45 int32 id_request); | |
| 46 virtual void SetToken(int32 token); | |
| 47 virtual void SetParseError(gpu::error::Error error); | |
| 48 | |
| 49 gpu::error::Error GetCachedError(); | |
| 50 | |
| 51 private: | |
| 52 CommandBuffer::State ConvertState(); | |
| 53 | |
| 54 NPP npp_; | |
| 55 NPDevice* device_; | |
| 56 NPDeviceContext3D* context_; | |
| 57 }; | |
| 58 | |
| 59 #endif // GPU_PGL_COMMAND_BUFFER_PEPPER_H | |
| OLD | NEW |