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 "gpu/command_buffer/client/gles2_cmd_helper.h" | 7 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
8 #include "gpu/command_buffer/client/gles2_implementation.h" | 8 #include "gpu/command_buffer/client/gles2_implementation.h" |
9 #include "gpu/command_buffer/client/transfer_buffer.h" | 9 #include "gpu/command_buffer/client/transfer_buffer.h" |
10 #include "mojo/public/c/gles2/gles2.h" | 10 #include "mojo/public/c/gles2/gles2.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 GLES2Context::~GLES2Context() {} | 31 GLES2Context::~GLES2Context() {} |
32 | 32 |
33 bool GLES2Context::Initialize() { | 33 bool GLES2Context::Initialize() { |
34 if (!command_buffer_.Initialize()) | 34 if (!command_buffer_.Initialize()) |
35 return false; | 35 return false; |
36 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(&command_buffer_)); | 36 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(&command_buffer_)); |
37 if (!gles2_helper_->Initialize(kDefaultCommandBufferSize)) | 37 if (!gles2_helper_->Initialize(kDefaultCommandBufferSize)) |
38 return false; | 38 return false; |
39 gles2_helper_->SetAutomaticFlushes(false); | 39 gles2_helper_->SetAutomaticFlushes(false); |
40 transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get())); | 40 transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get())); |
41 bool bind_generates_resource = true; | 41 bool bind_generates_resource = false; |
42 // TODO(piman): Some contexts (such as compositor) want this to be true, so | 42 // TODO(piman): Some contexts (such as compositor) want this to be true, so |
43 // this needs to be a public parameter. | 43 // this needs to be a public parameter. |
44 bool lose_context_when_out_of_memory = false; | 44 bool lose_context_when_out_of_memory = false; |
45 bool support_client_side_arrays = false; | 45 bool support_client_side_arrays = false; |
46 implementation_.reset( | 46 implementation_.reset( |
47 new gpu::gles2::GLES2Implementation(gles2_helper_.get(), | 47 new gpu::gles2::GLES2Implementation(gles2_helper_.get(), |
48 NULL, | 48 NULL, |
49 transfer_buffer_.get(), | 49 transfer_buffer_.get(), |
50 bind_generates_resource, | 50 bind_generates_resource, |
51 lose_context_when_out_of_memory, | 51 lose_context_when_out_of_memory, |
52 support_client_side_arrays, | 52 support_client_side_arrays, |
53 &command_buffer_)); | 53 &command_buffer_)); |
54 return implementation_->Initialize(kDefaultStartTransferBufferSize, | 54 return implementation_->Initialize(kDefaultStartTransferBufferSize, |
55 kDefaultMinTransferBufferSize, | 55 kDefaultMinTransferBufferSize, |
56 kDefaultMaxTransferBufferSize, | 56 kDefaultMaxTransferBufferSize, |
57 gpu::gles2::GLES2Implementation::kNoLimit); | 57 gpu::gles2::GLES2Implementation::kNoLimit); |
58 } | 58 } |
59 | 59 |
60 void GLES2Context::ContextLost() { lost_callback_(closure_); } | 60 void GLES2Context::ContextLost() { lost_callback_(closure_); } |
61 | 61 |
62 } // namespace gles2 | 62 } // namespace gles2 |
63 } // namespace mojo | 63 } // namespace mojo |
OLD | NEW |