OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/mus/gles2/command_buffer_driver.h" | 5 #include "components/mus/gles2/command_buffer_driver.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 if (vsync_provider) { | 109 if (vsync_provider) { |
110 vsync_provider->GetVSyncParameters( | 110 vsync_provider->GetVSyncParameters( |
111 base::Bind(&CommandBufferDriver::OnUpdateVSyncParameters, | 111 base::Bind(&CommandBufferDriver::OnUpdateVSyncParameters, |
112 weak_factory_.GetWeakPtr())); | 112 weak_factory_.GetWeakPtr())); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 if (!surface_.get()) | 116 if (!surface_.get()) |
117 return false; | 117 return false; |
118 | 118 |
119 // TODO(piman): virtual contexts, gpu preference. | 119 // TODO(piman): virtual contexts, gpu preference. |
danakj
2016/06/29 18:25:54
can remove preference here :)
piman
2016/06/29 20:28:51
So, I wouldn't say it's handled yet, the client st
| |
120 context_ = gl::init::CreateGLContext(gpu_state_->share_group(), | 120 context_ = gl::init::CreateGLContext( |
121 surface_.get(), gl::PreferIntegratedGpu); | 121 gpu_state_->share_group(), surface_.get(), attrib_helper.gpu_preference); |
122 if (!context_.get()) | 122 if (!context_.get()) |
123 return false; | 123 return false; |
124 | 124 |
125 if (!context_->MakeCurrent(surface_.get())) | 125 if (!context_->MakeCurrent(surface_.get())) |
126 return false; | 126 return false; |
127 | 127 |
128 // TODO(piman): ShaderTranslatorCache is currently per-ContextGroup but | 128 // TODO(piman): ShaderTranslatorCache is currently per-ContextGroup but |
129 // only needs to be per-thread. | 129 // only needs to be per-thread. |
130 const bool bind_generates_resource = attrib_helper.bind_generates_resource; | 130 const bool bind_generates_resource = attrib_helper.bind_generates_resource; |
131 scoped_refptr<gpu::gles2::FeatureInfo> feature_info = | 131 scoped_refptr<gpu::gles2::FeatureInfo> feature_info = |
(...skipping 22 matching lines...) Expand all Loading... | |
154 &CommandBufferDriver::OnFenceSyncRelease, base::Unretained(this))); | 154 &CommandBufferDriver::OnFenceSyncRelease, base::Unretained(this))); |
155 decoder_->SetWaitFenceSyncCallback(base::Bind( | 155 decoder_->SetWaitFenceSyncCallback(base::Bind( |
156 &CommandBufferDriver::OnWaitFenceSync, base::Unretained(this))); | 156 &CommandBufferDriver::OnWaitFenceSync, base::Unretained(this))); |
157 decoder_->SetDescheduleUntilFinishedCallback(base::Bind( | 157 decoder_->SetDescheduleUntilFinishedCallback(base::Bind( |
158 &CommandBufferDriver::OnDescheduleUntilFinished, base::Unretained(this))); | 158 &CommandBufferDriver::OnDescheduleUntilFinished, base::Unretained(this))); |
159 decoder_->SetRescheduleAfterFinishedCallback(base::Bind( | 159 decoder_->SetRescheduleAfterFinishedCallback(base::Bind( |
160 &CommandBufferDriver::OnRescheduleAfterFinished, base::Unretained(this))); | 160 &CommandBufferDriver::OnRescheduleAfterFinished, base::Unretained(this))); |
161 | 161 |
162 gpu::gles2::DisallowedFeatures disallowed_features; | 162 gpu::gles2::DisallowedFeatures disallowed_features; |
163 | 163 |
164 if (!decoder_->Initialize(surface_, context_, offscreen, gfx::Size(1, 1), | 164 if (!decoder_->Initialize(surface_, context_, offscreen, disallowed_features, |
165 disallowed_features, attrib_helper)) | 165 attrib_helper)) |
166 return false; | 166 return false; |
167 | 167 |
168 command_buffer_->SetPutOffsetChangeCallback(base::Bind( | 168 command_buffer_->SetPutOffsetChangeCallback(base::Bind( |
169 &gpu::CommandExecutor::PutChanged, base::Unretained(executor_.get()))); | 169 &gpu::CommandExecutor::PutChanged, base::Unretained(executor_.get()))); |
170 command_buffer_->SetGetBufferChangeCallback(base::Bind( | 170 command_buffer_->SetGetBufferChangeCallback(base::Bind( |
171 &gpu::CommandExecutor::SetGetBuffer, base::Unretained(executor_.get()))); | 171 &gpu::CommandExecutor::SetGetBuffer, base::Unretained(executor_.get()))); |
172 command_buffer_->SetParseErrorCallback( | 172 command_buffer_->SetParseErrorCallback( |
173 base::Bind(&CommandBufferDriver::OnParseError, base::Unretained(this))); | 173 base::Bind(&CommandBufferDriver::OnParseError, base::Unretained(this))); |
174 | 174 |
175 // TODO(piman): other callbacks | 175 // TODO(piman): other callbacks |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
558 } | 558 } |
559 | 559 |
560 void CommandBufferDriver::OnGpuCompletedSwapBuffers(gfx::SwapResult result) { | 560 void CommandBufferDriver::OnGpuCompletedSwapBuffers(gfx::SwapResult result) { |
561 DCHECK(CalledOnValidThread()); | 561 DCHECK(CalledOnValidThread()); |
562 if (client_) { | 562 if (client_) { |
563 client_->OnGpuCompletedSwapBuffers(result); | 563 client_->OnGpuCompletedSwapBuffers(result); |
564 } | 564 } |
565 } | 565 } |
566 | 566 |
567 } // namespace mus | 567 } // namespace mus |
OLD | NEW |