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 PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ | |
6 #define PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "ppapi/c/pp_completion_callback.h" | |
11 #include "ppapi/shared_impl/ppapi_shared_export.h" | |
12 #include "ppapi/thunk/ppb_graphics_3d_api.h" | |
13 | |
14 namespace gpu { | |
15 class CommandBuffer; | |
16 namespace gles2 { | |
17 class GLES2CmdHelper; | |
18 class GLES2Implementation; | |
19 } // namespace gles2 | |
20 } // namespace gpu. | |
21 | |
22 namespace ppapi { | |
23 | |
24 class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared | |
25 : public thunk::PPB_Graphics3D_API { | |
26 public: | |
27 // PPB_Graphics3D_API implementation. | |
28 virtual int32_t GetAttribs(int32_t* attrib_list) OVERRIDE; | |
29 virtual int32_t SetAttribs(int32_t* attrib_list) OVERRIDE; | |
30 virtual int32_t GetError() OVERRIDE; | |
31 virtual int32_t ResizeBuffers(int32_t width, int32_t height) OVERRIDE; | |
32 virtual int32_t SwapBuffers(PP_CompletionCallback callback) OVERRIDE; | |
33 virtual void* MapTexSubImage2DCHROMIUM(GLenum target, | |
34 GLint level, | |
35 GLint xoffset, | |
36 GLint yoffset, | |
37 GLsizei width, | |
38 GLsizei height, | |
39 GLenum format, | |
40 GLenum type, | |
41 GLenum access) OVERRIDE; | |
42 virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE; | |
43 | |
44 gpu::gles2::GLES2Implementation* gles2_impl() { | |
45 return gles2_impl_.get(); | |
46 } | |
47 | |
48 // Sends swap-buffers notification to the plugin. | |
49 void SwapBuffersACK(int32_t pp_error); | |
50 | |
51 protected: | |
52 PPB_Graphics3D_Shared(); | |
53 virtual ~PPB_Graphics3D_Shared(); | |
54 | |
55 virtual gpu::CommandBuffer* GetCommandBuffer() = 0; | |
56 virtual int32 DoSwapBuffers() = 0; | |
57 | |
58 bool HasPendingSwap() { return swap_callback_.func != NULL; } | |
59 bool CreateGLES2Impl(int32 command_buffer_size, | |
60 int32 transfer_buffer_size); | |
61 void DestroyGLES2Impl(); | |
62 | |
63 private: | |
64 int32 transfer_buffer_id_; | |
65 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | |
66 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; | |
67 | |
68 // Callback that needs to be executed when swap-buffers is completed. | |
69 PP_CompletionCallback swap_callback_; | |
70 | |
71 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Shared); | |
72 }; | |
73 | |
74 } // namespace ppapi | |
75 | |
76 #endif // PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ | |
77 | |
OLD | NEW |