Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: ppapi/proxy/ppb_context_3d_proxy.h

Issue 8676042: Remove Context3D/Surface3D (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppapi_messages.h ('k') | ppapi/proxy/ppb_context_3d_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 PPAPI_PROXY_PPB_CONTEXT_3D_PROXY_H_
6 #define PPAPI_PROXY_PPB_CONTEXT_3D_PROXY_H_
7
8 #include <vector>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/shared_memory.h"
12 #include "gpu/command_buffer/common/command_buffer.h"
13 #include "ppapi/c/pp_graphics_3d.h"
14 #include "ppapi/c/pp_instance.h"
15 #include "ppapi/proxy/interface_proxy.h"
16 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h"
17 #include "ppapi/shared_impl/resource.h"
18 #include "ppapi/thunk/ppb_context_3d_api.h"
19
20 namespace gpu {
21 class CommandBuffer;
22
23 namespace gles2 {
24 class GLES2CmdHelper;
25 class GLES2Implementation;
26 } // namespace gles2
27
28 } // namespace gpu
29
30 namespace ppapi {
31 namespace proxy {
32
33 class Surface3D;
34
35 class Context3D : public Resource, public thunk::PPB_Context3D_API {
36 public:
37 explicit Context3D(const HostResource& resource);
38 virtual ~Context3D();
39
40 // Resource overrides.
41 virtual thunk::PPB_Context3D_API* AsPPB_Context3D_API() OVERRIDE;
42
43 gpu::gles2::GLES2Implementation* gles2_impl() const {
44 return gles2_impl_.get();
45 }
46
47 // PPB_Context3D_API implementation.
48 virtual int32_t GetAttrib(int32_t attribute, int32_t* value) OVERRIDE;
49 virtual int32_t BindSurfaces(PP_Resource draw, PP_Resource read) OVERRIDE;
50 virtual int32_t GetBoundSurfaces(PP_Resource* draw,
51 PP_Resource* read) OVERRIDE;
52 virtual PP_Bool InitializeTrusted(int32_t size) OVERRIDE;
53 virtual PP_Bool GetRingBuffer(int* shm_handle,
54 uint32_t* shm_size) OVERRIDE;
55 virtual PP_Context3DTrustedState GetState() OVERRIDE;
56 virtual PP_Bool Flush(int32_t put_offset) OVERRIDE;
57 virtual PP_Context3DTrustedState FlushSync(int32_t put_offset) OVERRIDE;
58 virtual int32_t CreateTransferBuffer(uint32_t size) OVERRIDE;
59 virtual PP_Bool DestroyTransferBuffer(int32_t id) OVERRIDE;
60 virtual PP_Bool GetTransferBuffer(int32_t id,
61 int* shm_handle,
62 uint32_t* shm_size) OVERRIDE;
63 virtual PP_Context3DTrustedState FlushSyncFast(
64 int32_t put_offset,
65 int32_t last_known_get) OVERRIDE;
66 virtual void* MapTexSubImage2DCHROMIUM(GLenum target,
67 GLint level,
68 GLint xoffset,
69 GLint yoffset,
70 GLsizei width,
71 GLsizei height,
72 GLenum format,
73 GLenum type,
74 GLenum access) OVERRIDE;
75 virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE;
76 virtual gpu::gles2::GLES2Implementation* GetGLES2Impl() OVERRIDE;
77
78 bool CreateImplementation();
79
80 private:
81 Surface3D* draw_;
82 Surface3D* read_;
83
84 scoped_ptr<gpu::CommandBuffer> command_buffer_;
85 scoped_ptr<gpu::gles2::GLES2CmdHelper> helper_;
86 int32 transfer_buffer_id_;
87 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_;
88
89 DISALLOW_COPY_AND_ASSIGN(Context3D);
90 };
91
92 class PPB_Context3D_Proxy : public InterfaceProxy {
93 public:
94 explicit PPB_Context3D_Proxy(Dispatcher* dispatcher);
95 virtual ~PPB_Context3D_Proxy();
96
97 static PP_Resource Create(PP_Instance instance,
98 PP_Config3D_Dev config,
99 PP_Resource share_context,
100 const int32_t* attrib_list);
101
102 // InterfaceProxy implementation.
103 virtual bool OnMessageReceived(const IPC::Message& msg);
104
105 static const ApiID kApiID = API_ID_PPB_CONTEXT_3D;
106
107 private:
108 void OnMsgCreate(PP_Instance instance,
109 PP_Config3D_Dev config,
110 const std::vector<int32_t>& attribs,
111 HostResource* result);
112 void OnMsgBindSurfaces(const HostResource& context,
113 const HostResource& draw,
114 const HostResource& read,
115 int32_t* result);
116 void OnMsgInitialize(const HostResource& context,
117 int32 size,
118 base::SharedMemoryHandle* ring_buffer);
119 void OnMsgGetState(const HostResource& context,
120 gpu::CommandBuffer::State* state);
121 void OnMsgFlush(const HostResource& context,
122 int32 put_offset,
123 int32 last_known_get,
124 gpu::CommandBuffer::State* state);
125 void OnMsgAsyncFlush(const HostResource& context,
126 int32 put_offset);
127 void OnMsgCreateTransferBuffer(const HostResource& context,
128 int32 size,
129 int32* id);
130 void OnMsgDestroyTransferBuffer(const HostResource& context,
131 int32 id);
132 void OnMsgGetTransferBuffer(const HostResource& context,
133 int32 id,
134 base::SharedMemoryHandle* transfer_buffer,
135 uint32* size);
136 };
137
138 } // namespace proxy
139 } // namespace ppapi
140
141 #endif // PPAPI_PROXY_PPB_CONTEXT_3D_PROXY_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/ppapi_messages.h ('k') | ppapi/proxy/ppb_context_3d_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698