OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ | 5 #ifndef PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ |
6 #define PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ | 6 #define PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ppapi/c/pp_completion_callback.h" | 10 #include "ppapi/c/pp_completion_callback.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 } // namespace gles2 | 23 } // namespace gles2 |
24 } // namespace gpu. | 24 } // namespace gpu. |
25 | 25 |
26 namespace ppapi { | 26 namespace ppapi { |
27 | 27 |
28 class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared | 28 class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared |
29 : public Resource, | 29 : public Resource, |
30 public thunk::PPB_Graphics3D_API { | 30 public thunk::PPB_Graphics3D_API { |
31 public: | 31 public: |
32 // Resource overrides. | 32 // Resource overrides. |
33 virtual thunk::PPB_Graphics3D_API* AsPPB_Graphics3D_API() override; | 33 thunk::PPB_Graphics3D_API* AsPPB_Graphics3D_API() override; |
34 | 34 |
35 // PPB_Graphics3D_API implementation. | 35 // PPB_Graphics3D_API implementation. |
36 virtual int32_t GetAttribs(int32_t attrib_list[]) override; | 36 int32_t GetAttribs(int32_t attrib_list[]) override; |
37 virtual int32_t SetAttribs(const int32_t attrib_list[]) override; | 37 int32_t SetAttribs(const int32_t attrib_list[]) override; |
38 virtual int32_t GetError() override; | 38 int32_t GetError() override; |
39 virtual int32_t ResizeBuffers(int32_t width, int32_t height) override; | 39 int32_t ResizeBuffers(int32_t width, int32_t height) override; |
40 virtual int32_t SwapBuffers(scoped_refptr<TrackedCallback> callback) override; | 40 int32_t SwapBuffers(scoped_refptr<TrackedCallback> callback) override; |
41 virtual int32_t GetAttribMaxValue(int32_t attribute, int32_t* value) override; | 41 int32_t GetAttribMaxValue(int32_t attribute, int32_t* value) override; |
42 | 42 |
43 virtual void* MapTexSubImage2DCHROMIUM(GLenum target, | 43 void* MapTexSubImage2DCHROMIUM(GLenum target, |
44 GLint level, | 44 GLint level, |
45 GLint xoffset, | 45 GLint xoffset, |
46 GLint yoffset, | 46 GLint yoffset, |
47 GLsizei width, | 47 GLsizei width, |
48 GLsizei height, | 48 GLsizei height, |
49 GLenum format, | 49 GLenum format, |
50 GLenum type, | 50 GLenum type, |
51 GLenum access) override; | 51 GLenum access) override; |
52 virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) override; | 52 void UnmapTexSubImage2DCHROMIUM(const void* mem) override; |
53 | 53 |
54 gpu::gles2::GLES2Implementation* gles2_impl() { return gles2_impl_.get(); } | 54 gpu::gles2::GLES2Implementation* gles2_impl() { return gles2_impl_.get(); } |
55 | 55 |
56 // Sends swap-buffers notification to the plugin. | 56 // Sends swap-buffers notification to the plugin. |
57 void SwapBuffersACK(int32_t pp_error); | 57 void SwapBuffersACK(int32_t pp_error); |
58 | 58 |
59 protected: | 59 protected: |
60 PPB_Graphics3D_Shared(PP_Instance instance); | 60 PPB_Graphics3D_Shared(PP_Instance instance); |
61 PPB_Graphics3D_Shared(const HostResource& host_resource); | 61 PPB_Graphics3D_Shared(const HostResource& host_resource); |
62 virtual ~PPB_Graphics3D_Shared(); | 62 ~PPB_Graphics3D_Shared() override; |
63 | 63 |
64 virtual gpu::CommandBuffer* GetCommandBuffer() = 0; | 64 virtual gpu::CommandBuffer* GetCommandBuffer() = 0; |
65 virtual gpu::GpuControl* GetGpuControl() = 0; | 65 virtual gpu::GpuControl* GetGpuControl() = 0; |
66 virtual int32 DoSwapBuffers() = 0; | 66 virtual int32 DoSwapBuffers() = 0; |
67 | 67 |
68 bool HasPendingSwap() const; | 68 bool HasPendingSwap() const; |
69 bool CreateGLES2Impl(int32 command_buffer_size, | 69 bool CreateGLES2Impl(int32 command_buffer_size, |
70 int32 transfer_buffer_size, | 70 int32 transfer_buffer_size, |
71 gpu::gles2::GLES2Implementation* share_gles2); | 71 gpu::gles2::GLES2Implementation* share_gles2); |
72 void DestroyGLES2Impl(); | 72 void DestroyGLES2Impl(); |
73 | 73 |
74 private: | 74 private: |
75 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 75 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; |
76 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; | 76 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; |
77 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; | 77 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; |
78 | 78 |
79 // Callback that needs to be executed when swap-buffers is completed. | 79 // Callback that needs to be executed when swap-buffers is completed. |
80 scoped_refptr<TrackedCallback> swap_callback_; | 80 scoped_refptr<TrackedCallback> swap_callback_; |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Shared); | 82 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Shared); |
83 }; | 83 }; |
84 | 84 |
85 } // namespace ppapi | 85 } // namespace ppapi |
86 | 86 |
87 #endif // PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ | 87 #endif // PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ |
OLD | NEW |