Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2010 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 PPAPI_PPB_CONTEXT_3D_PROXY_H_ | |
| 6 #define PPAPI_PPB_CONTEXT_3D_PROXY_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/shared_memory.h" | |
| 11 #include "gpu/command_buffer/common/command_buffer.h" | |
| 12 #include "ppapi/c/dev/pp_graphics_3d_dev.h" | |
| 13 #include "ppapi/c/pp_instance.h" | |
| 14 #include "ppapi/proxy/interface_proxy.h" | |
| 15 #include "ppapi/proxy/plugin_resource.h" | |
| 16 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" | |
| 17 | |
| 18 struct PPB_Context3D_Dev; | |
| 19 struct PPB_Context3DTrusted_Dev; | |
| 20 namespace gpu { | |
|
brettw
2011/01/31 18:51:29
Can you put blank lines above and below the namesp
piman
2011/01/31 19:34:29
Done.
| |
| 21 class CommandBuffer; | |
| 22 namespace gles2 { | |
| 23 class GLES2CmdHelper; | |
| 24 class GLES2Implementation; | |
| 25 } // namespace gles2 | |
| 26 } // namespace gpu | |
| 27 | |
| 28 namespace pp { | |
| 29 namespace proxy { | |
| 30 | |
| 31 class Surface3D; | |
|
brettw
2011/01/31 18:51:29
Can you put a blank line between these?
piman
2011/01/31 19:34:29
Done.
| |
| 32 class Context3D : public PluginResource { | |
| 33 public: | |
| 34 explicit Context3D(const HostResource& resource); | |
| 35 virtual ~Context3D(); | |
| 36 | |
| 37 // Resource overrides. | |
| 38 virtual Context3D* AsContext3D() { return this; } | |
| 39 | |
| 40 bool CreateImplementation(); | |
| 41 | |
| 42 void get_surfaces(Surface3D** draw, Surface3D** read) const { | |
|
brettw
2011/01/31 18:51:29
This would be more "normal" to my eye if there wer
piman
2011/01/31 19:34:29
Done.
| |
| 43 *draw = draw_; | |
| 44 *read = read_; | |
| 45 } | |
| 46 | |
| 47 void BindSurfaces(Surface3D* draw, Surface3D* read); | |
| 48 | |
| 49 gpu::gles2::GLES2Implementation* gles2_impl() const { | |
| 50 return gles2_impl_.get(); | |
| 51 } | |
| 52 | |
| 53 private: | |
| 54 Surface3D* draw_; | |
| 55 Surface3D* read_; | |
| 56 | |
| 57 scoped_ptr<gpu::CommandBuffer> command_buffer_; | |
| 58 scoped_ptr<gpu::gles2::GLES2CmdHelper> helper_; | |
| 59 int32 transfer_buffer_id_; | |
| 60 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(Context3D); | |
| 63 }; | |
| 64 | |
| 65 class PPB_Context3D_Proxy : public InterfaceProxy { | |
| 66 public: | |
| 67 PPB_Context3D_Proxy(Dispatcher* dispatcher, const void* target_interface); | |
| 68 virtual ~PPB_Context3D_Proxy(); | |
| 69 | |
| 70 const PPB_Context3D_Dev* ppb_context_3d_target() const { | |
| 71 return reinterpret_cast<const PPB_Context3D_Dev*>(target_interface()); | |
| 72 } | |
| 73 const PPB_Context3DTrusted_Dev* ppb_context_3d_trusted() const; | |
| 74 | |
| 75 // InterfaceProxy implementation. | |
| 76 virtual const void* GetSourceInterface() const; | |
| 77 virtual InterfaceID GetInterfaceId() const; | |
| 78 virtual bool OnMessageReceived(const IPC::Message& msg); | |
| 79 | |
| 80 private: | |
| 81 void OnMsgCreate(PP_Instance instance, | |
| 82 PP_Config3D_Dev config, | |
| 83 std::vector<int32_t> attribs, | |
| 84 HostResource* result); | |
| 85 void OnMsgBindSurfaces(const HostResource& context, | |
| 86 const HostResource& draw, | |
| 87 const HostResource& read, | |
| 88 int32_t* result); | |
| 89 void OnMsgInitialize(const HostResource& context, | |
| 90 int32 size, | |
| 91 base::SharedMemoryHandle* ring_buffer); | |
| 92 void OnMsgGetState(const HostResource& context, | |
| 93 gpu::CommandBuffer::State* state); | |
| 94 void OnMsgFlush(const HostResource& context, | |
| 95 int32 put_offset, | |
| 96 gpu::CommandBuffer::State* state); | |
| 97 void OnMsgAsyncFlush(const HostResource& context, | |
| 98 int32 put_offset); | |
| 99 void OnMsgCreateTransferBuffer(const HostResource& context, | |
| 100 int32 size, | |
| 101 int32* id); | |
| 102 void OnMsgDestroyTransferBuffer(const HostResource& context, | |
| 103 int32 id); | |
| 104 void OnMsgGetTransferBuffer(const HostResource& context, | |
| 105 int32 id, | |
| 106 base::SharedMemoryHandle* transfer_buffer, | |
| 107 uint32* size); | |
| 108 }; | |
| 109 | |
| 110 } // namespace proxy | |
| 111 } // namespace pp | |
| 112 | |
| 113 #endif // PPAPI_PPB_CONTEXT_3D_PROXY_H_ | |
| OLD | NEW |