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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 25 matching lines...) Expand all Loading... |
36 // Resource overrides. | 36 // Resource overrides. |
37 thunk::PPB_Graphics3D_API* AsPPB_Graphics3D_API() override; | 37 thunk::PPB_Graphics3D_API* AsPPB_Graphics3D_API() override; |
38 | 38 |
39 // PPB_Graphics3D_API implementation. | 39 // PPB_Graphics3D_API implementation. |
40 int32_t GetAttribs(int32_t attrib_list[]) override; | 40 int32_t GetAttribs(int32_t attrib_list[]) override; |
41 int32_t SetAttribs(const int32_t attrib_list[]) override; | 41 int32_t SetAttribs(const int32_t attrib_list[]) override; |
42 int32_t GetError() override; | 42 int32_t GetError() override; |
43 int32_t ResizeBuffers(int32_t width, int32_t height) override; | 43 int32_t ResizeBuffers(int32_t width, int32_t height) override; |
44 int32_t SwapBuffers(scoped_refptr<TrackedCallback> callback) override; | 44 int32_t SwapBuffers(scoped_refptr<TrackedCallback> callback) override; |
45 int32_t SwapBuffersWithSyncToken(scoped_refptr<TrackedCallback> callback, | 45 int32_t SwapBuffersWithSyncToken(scoped_refptr<TrackedCallback> callback, |
46 const gpu::SyncToken& sync_token) override; | 46 const gpu::SyncToken& sync_token, |
| 47 int32_t width, |
| 48 int32_t height) override; |
47 int32_t GetAttribMaxValue(int32_t attribute, int32_t* value) override; | 49 int32_t GetAttribMaxValue(int32_t attribute, int32_t* value) override; |
48 | 50 |
49 void* MapTexSubImage2DCHROMIUM(GLenum target, | 51 void* MapTexSubImage2DCHROMIUM(GLenum target, |
50 GLint level, | 52 GLint level, |
51 GLint xoffset, | 53 GLint xoffset, |
52 GLint yoffset, | 54 GLint yoffset, |
53 GLsizei width, | 55 GLsizei width, |
54 GLsizei height, | 56 GLsizei height, |
55 GLenum format, | 57 GLenum format, |
56 GLenum type, | 58 GLenum type, |
57 GLenum access) override; | 59 GLenum access) override; |
58 void UnmapTexSubImage2DCHROMIUM(const void* mem) override; | 60 void UnmapTexSubImage2DCHROMIUM(const void* mem) override; |
59 | 61 |
60 gpu::gles2::GLES2Implementation* gles2_impl() { return gles2_impl_.get(); } | 62 gpu::gles2::GLES2Implementation* gles2_impl() { return gles2_impl_.get(); } |
61 gpu::gles2::GLES2Interface* gles2_interface(); | 63 gpu::gles2::GLES2Interface* gles2_interface(); |
62 | 64 |
63 // Sends swap-buffers notification to the plugin. | 65 // Sends swap-buffers notification to the plugin. |
64 void SwapBuffersACK(int32_t pp_error); | 66 void SwapBuffersACK(int32_t pp_error); |
65 | 67 |
66 protected: | 68 protected: |
67 PPB_Graphics3D_Shared(PP_Instance instance); | 69 PPB_Graphics3D_Shared(PP_Instance instance); |
68 PPB_Graphics3D_Shared(const HostResource& host_resource); | 70 PPB_Graphics3D_Shared(const HostResource& host_resource); |
69 ~PPB_Graphics3D_Shared() override; | 71 ~PPB_Graphics3D_Shared() override; |
70 | 72 |
71 virtual gpu::CommandBuffer* GetCommandBuffer() = 0; | 73 virtual gpu::CommandBuffer* GetCommandBuffer() = 0; |
72 virtual gpu::GpuControl* GetGpuControl() = 0; | 74 virtual gpu::GpuControl* GetGpuControl() = 0; |
73 virtual int32_t DoSwapBuffers(const gpu::SyncToken& sync_token) = 0; | 75 virtual int32_t DoSwapBuffers(const gpu::SyncToken& sync_token, |
| 76 int32_t width, |
| 77 int32_t height) = 0; |
74 | 78 |
75 bool HasPendingSwap() const; | 79 bool HasPendingSwap() const; |
76 bool CreateGLES2Impl(int32_t command_buffer_size, | 80 bool CreateGLES2Impl(int32_t command_buffer_size, |
77 int32_t transfer_buffer_size, | 81 int32_t transfer_buffer_size, |
78 gpu::gles2::GLES2Implementation* share_gles2); | 82 gpu::gles2::GLES2Implementation* share_gles2); |
79 void DestroyGLES2Impl(); | 83 void DestroyGLES2Impl(); |
80 | 84 |
81 private: | 85 private: |
82 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 86 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; |
83 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_; | 87 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_; |
84 std::unique_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; | 88 std::unique_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; |
85 | 89 |
| 90 // A local cache of the size of the viewport. |
| 91 int32_t width_ = -1; |
| 92 int32_t height_ = -1; |
| 93 |
86 // Callback that needs to be executed when swap-buffers is completed. | 94 // Callback that needs to be executed when swap-buffers is completed. |
87 scoped_refptr<TrackedCallback> swap_callback_; | 95 scoped_refptr<TrackedCallback> swap_callback_; |
88 | 96 |
89 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Shared); | 97 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Shared); |
90 }; | 98 }; |
91 | 99 |
92 } // namespace ppapi | 100 } // namespace ppapi |
93 | 101 |
94 #endif // PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ | 102 #endif // PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ |
OLD | NEW |