Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc

Issue 455783002: GPU context creation code duplication cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fix even more build dependencies Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 5 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
6 6
7 #include "third_party/khronos/GLES2/gl2.h" 7 #include "third_party/khronos/GLES2/gl2.h"
8 #ifndef GL_GLEXT_PROTOTYPES 8 #ifndef GL_GLEXT_PROTOTYPES
9 #define GL_GLEXT_PROTOTYPES 1 9 #define GL_GLEXT_PROTOTYPES 1
10 #endif 10 #endif
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 bool onscreen, WebGraphicsContext3DCommandBufferImpl* share_context) { 178 bool onscreen, WebGraphicsContext3DCommandBufferImpl* share_context) {
179 if (!host_.get()) 179 if (!host_.get())
180 return false; 180 return false;
181 181
182 CommandBufferProxyImpl* share_group_command_buffer = NULL; 182 CommandBufferProxyImpl* share_group_command_buffer = NULL;
183 183
184 if (share_context) { 184 if (share_context) {
185 share_group_command_buffer = share_context->command_buffer_.get(); 185 share_group_command_buffer = share_context->command_buffer_.get();
186 } 186 }
187 187
188 ::gpu::gles2::ContextCreationAttribHelper attribs_for_gles2;
189 ConvertAttributes(attributes_, &attribs_for_gles2);
190 attribs_for_gles2.lose_context_when_out_of_memory =
191 lose_context_when_out_of_memory_;
192 DCHECK(attribs_for_gles2.buffer_preserved);
188 std::vector<int32> attribs; 193 std::vector<int32> attribs;
189 attribs.push_back(ALPHA_SIZE); 194 attribs_for_gles2.Serialize(&attribs);
190 attribs.push_back(attributes_.alpha ? 8 : 0);
191 attribs.push_back(DEPTH_SIZE);
192 attribs.push_back(attributes_.depth ? 24 : 0);
193 attribs.push_back(STENCIL_SIZE);
194 attribs.push_back(attributes_.stencil ? 8 : 0);
195 attribs.push_back(SAMPLES);
196 attribs.push_back(attributes_.antialias ? 4 : 0);
197 attribs.push_back(SAMPLE_BUFFERS);
198 attribs.push_back(attributes_.antialias ? 1 : 0);
199 attribs.push_back(FAIL_IF_MAJOR_PERF_CAVEAT);
200 attribs.push_back(attributes_.failIfMajorPerformanceCaveat ? 1 : 0);
201 attribs.push_back(LOSE_CONTEXT_WHEN_OUT_OF_MEMORY);
202 attribs.push_back(lose_context_when_out_of_memory_ ? 1 : 0);
203 attribs.push_back(BIND_GENERATES_RESOURCES);
204 attribs.push_back(0);
205 attribs.push_back(NONE);
206 195
207 // Create a proxy to a command buffer in the GPU process. 196 // Create a proxy to a command buffer in the GPU process.
208 if (onscreen) { 197 if (onscreen) {
209 command_buffer_.reset(host_->CreateViewCommandBuffer( 198 command_buffer_.reset(host_->CreateViewCommandBuffer(
210 surface_id_, 199 surface_id_,
211 share_group_command_buffer, 200 share_group_command_buffer,
212 attribs, 201 attribs,
213 active_url_, 202 active_url_,
214 gpu_preference_)); 203 gpu_preference_));
215 } else { 204 } else {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 share_group_->RemoveAllContexts(); 422 share_group_->RemoveAllContexts();
434 423
435 DCHECK(host_.get()); 424 DCHECK(host_.get());
436 { 425 {
437 base::AutoLock lock(g_default_share_groups_lock.Get()); 426 base::AutoLock lock(g_default_share_groups_lock.Get());
438 g_default_share_groups.Get().erase(host_.get()); 427 g_default_share_groups.Get().erase(host_.get());
439 } 428 }
440 } 429 }
441 430
442 } // namespace content 431 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h ('k') | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698