OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "mojo/gles2/gles2_context.h" | 5 #include "mojo/gles2/gles2_context.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 12 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
13 #include "gpu/command_buffer/client/gles2_implementation.h" | 13 #include "gpu/command_buffer/client/gles2_implementation.h" |
14 #include "gpu/command_buffer/client/transfer_buffer.h" | 14 #include "gpu/command_buffer/client/transfer_buffer.h" |
15 #include "mojo/public/c/gles2/gles2.h" | 15 #include "mojo/public/c/gles2/gles2.h" |
16 #include "mojo/public/cpp/system/core.h" | 16 #include "mojo/public/cpp/system/core.h" |
17 | 17 |
18 namespace gles2 { | 18 namespace gles2 { |
19 | 19 |
20 namespace { | 20 namespace { |
21 const size_t kDefaultCommandBufferSize = 1024 * 1024; | 21 const size_t kDefaultCommandBufferSize = 1024 * 1024; |
22 const size_t kDefaultStartTransferBufferSize = 1 * 1024 * 1024; | 22 const size_t kDefaultStartTransferBufferSize = 1 * 1024 * 1024; |
23 const size_t kDefaultMinTransferBufferSize = 1 * 256 * 1024; | 23 const size_t kDefaultMinTransferBufferSize = 1 * 256 * 1024; |
24 const size_t kDefaultMaxTransferBufferSize = 16 * 1024 * 1024; | 24 const size_t kDefaultMaxTransferBufferSize = 16 * 1024 * 1024; |
25 } | 25 } |
26 | 26 |
27 GLES2Context::GLES2Context(const std::vector<int32_t>& attribs, | 27 GLES2Context::GLES2Context(const std::vector<int32_t>& attribs, |
28 const MojoAsyncWaiter* async_waiter, | |
29 mojo::ScopedMessagePipeHandle command_buffer_handle, | 28 mojo::ScopedMessagePipeHandle command_buffer_handle, |
30 MojoGLES2ContextLost lost_callback, | 29 MojoGLES2ContextLost lost_callback, |
31 void* closure) | 30 void* closure) |
32 : command_buffer_(this, | 31 : command_buffer_(this, attribs, std::move(command_buffer_handle)), |
33 attribs, | |
34 async_waiter, | |
35 std::move(command_buffer_handle)), | |
36 lost_callback_(lost_callback), | 32 lost_callback_(lost_callback), |
37 closure_(closure) {} | 33 closure_(closure) {} |
38 | 34 |
39 GLES2Context::~GLES2Context() {} | 35 GLES2Context::~GLES2Context() {} |
40 | 36 |
41 bool GLES2Context::Initialize() { | 37 bool GLES2Context::Initialize() { |
42 if (!command_buffer_.Initialize()) | 38 if (!command_buffer_.Initialize()) |
43 return false; | 39 return false; |
44 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(&command_buffer_)); | 40 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(&command_buffer_)); |
45 if (!gles2_helper_->Initialize(kDefaultCommandBufferSize)) | 41 if (!gles2_helper_->Initialize(kDefaultCommandBufferSize)) |
(...skipping 17 matching lines...) Expand all Loading... |
63 &command_buffer_)); | 59 &command_buffer_)); |
64 return implementation_->Initialize(kDefaultStartTransferBufferSize, | 60 return implementation_->Initialize(kDefaultStartTransferBufferSize, |
65 kDefaultMinTransferBufferSize, | 61 kDefaultMinTransferBufferSize, |
66 kDefaultMaxTransferBufferSize, | 62 kDefaultMaxTransferBufferSize, |
67 gpu::gles2::GLES2Implementation::kNoLimit); | 63 gpu::gles2::GLES2Implementation::kNoLimit); |
68 } | 64 } |
69 | 65 |
70 void GLES2Context::ContextLost() { lost_callback_(closure_); } | 66 void GLES2Context::ContextLost() { lost_callback_(closure_); } |
71 | 67 |
72 } // namespace gles2 | 68 } // namespace gles2 |
OLD | NEW |