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

Side by Side Diff: gpu/command_buffer/client/gl_in_process_context.cc

Issue 79123004: Implemented failIfMajorPerformanceCaveat WebGL context creation attribute. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More comments, logging updates Created 7 years 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 | Annotate | Revision Log
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 "gpu/command_buffer/client/gl_in_process_context.h" 5 #include "gpu/command_buffer/client/gl_in_process_context.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 bool GLInProcessContextImpl::Initialize( 121 bool GLInProcessContextImpl::Initialize(
122 scoped_refptr<gfx::GLSurface> surface, 122 scoped_refptr<gfx::GLSurface> surface,
123 bool is_offscreen, 123 bool is_offscreen,
124 bool share_resources, 124 bool share_resources,
125 gfx::AcceleratedWidget window, 125 gfx::AcceleratedWidget window,
126 const gfx::Size& size, 126 const gfx::Size& size,
127 const GLInProcessContextAttribs& attribs, 127 const GLInProcessContextAttribs& attribs,
128 gfx::GpuPreference gpu_preference) { 128 gfx::GpuPreference gpu_preference) {
129 DCHECK(size.width() >= 0 && size.height() >= 0); 129 DCHECK(size.width() >= 0 && size.height() >= 0);
130 130
131 // Changes to these values should also be copied to
132 // gpu/command_buffer/client/gl_in_process_context.cc and to
133 // content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h
131 const int32 ALPHA_SIZE = 0x3021; 134 const int32 ALPHA_SIZE = 0x3021;
132 const int32 BLUE_SIZE = 0x3022; 135 const int32 BLUE_SIZE = 0x3022;
133 const int32 GREEN_SIZE = 0x3023; 136 const int32 GREEN_SIZE = 0x3023;
134 const int32 RED_SIZE = 0x3024; 137 const int32 RED_SIZE = 0x3024;
135 const int32 DEPTH_SIZE = 0x3025; 138 const int32 DEPTH_SIZE = 0x3025;
136 const int32 STENCIL_SIZE = 0x3026; 139 const int32 STENCIL_SIZE = 0x3026;
137 const int32 SAMPLES = 0x3031; 140 const int32 SAMPLES = 0x3031;
138 const int32 SAMPLE_BUFFERS = 0x3032; 141 const int32 SAMPLE_BUFFERS = 0x3032;
139 const int32 NONE = 0x3038; 142 const int32 NONE = 0x3038;
140 143
144 // Chromium-specific attributes
145 const int32 FAIL_IF_MAJOR_PERF_CAVEAT = 0x10002;
146
141 std::vector<int32> attrib_vector; 147 std::vector<int32> attrib_vector;
142 if (attribs.alpha_size >= 0) { 148 if (attribs.alpha_size >= 0) {
143 attrib_vector.push_back(ALPHA_SIZE); 149 attrib_vector.push_back(ALPHA_SIZE);
144 attrib_vector.push_back(attribs.alpha_size); 150 attrib_vector.push_back(attribs.alpha_size);
145 } 151 }
146 if (attribs.blue_size >= 0) { 152 if (attribs.blue_size >= 0) {
147 attrib_vector.push_back(BLUE_SIZE); 153 attrib_vector.push_back(BLUE_SIZE);
148 attrib_vector.push_back(attribs.blue_size); 154 attrib_vector.push_back(attribs.blue_size);
149 } 155 }
150 if (attribs.green_size >= 0) { 156 if (attribs.green_size >= 0) {
(...skipping 13 matching lines...) Expand all
164 attrib_vector.push_back(attribs.stencil_size); 170 attrib_vector.push_back(attribs.stencil_size);
165 } 171 }
166 if (attribs.samples >= 0) { 172 if (attribs.samples >= 0) {
167 attrib_vector.push_back(SAMPLES); 173 attrib_vector.push_back(SAMPLES);
168 attrib_vector.push_back(attribs.samples); 174 attrib_vector.push_back(attribs.samples);
169 } 175 }
170 if (attribs.sample_buffers >= 0) { 176 if (attribs.sample_buffers >= 0) {
171 attrib_vector.push_back(SAMPLE_BUFFERS); 177 attrib_vector.push_back(SAMPLE_BUFFERS);
172 attrib_vector.push_back(attribs.sample_buffers); 178 attrib_vector.push_back(attribs.sample_buffers);
173 } 179 }
180 if (attribs.fail_if_major_perf_caveat > 0) {
181 attrib_vector.push_back(FAIL_IF_MAJOR_PERF_CAVEAT);
182 attrib_vector.push_back(attribs.fail_if_major_perf_caveat);
183 }
174 attrib_vector.push_back(NONE); 184 attrib_vector.push_back(NONE);
175 185
176 base::Closure wrapped_callback = 186 base::Closure wrapped_callback =
177 base::Bind(&GLInProcessContextImpl::OnContextLost, AsWeakPtr()); 187 base::Bind(&GLInProcessContextImpl::OnContextLost, AsWeakPtr());
178 command_buffer_.reset(new InProcessCommandBuffer()); 188 command_buffer_.reset(new InProcessCommandBuffer());
179 189
180 scoped_ptr<base::AutoLock> scoped_shared_context_lock; 190 scoped_ptr<base::AutoLock> scoped_shared_context_lock;
181 scoped_refptr<gles2::ShareGroup> share_group; 191 scoped_refptr<gles2::ShareGroup> share_group;
182 if (share_resources) { 192 if (share_resources) {
183 scoped_shared_context_lock.reset( 193 scoped_shared_context_lock.reset(
(...skipping 16 matching lines...) Expand all
200 } 210 }
201 if (!command_buffer_->Initialize(surface, 211 if (!command_buffer_->Initialize(surface,
202 is_offscreen, 212 is_offscreen,
203 share_resources, 213 share_resources,
204 window, 214 window,
205 size, 215 size,
206 attrib_vector, 216 attrib_vector,
207 gpu_preference, 217 gpu_preference,
208 wrapped_callback, 218 wrapped_callback,
209 share_group_id_)) { 219 share_group_id_)) {
210 LOG(INFO) << "Failed to initialize InProcessCommmandBuffer"; 220 LOG(ERROR) << "Failed to initialize InProcessCommmandBuffer";
211 return false; 221 return false;
212 } 222 }
213 223
214 // Create the GLES2 helper, which writes the command buffer protocol. 224 // Create the GLES2 helper, which writes the command buffer protocol.
215 gles2_helper_.reset(new gles2::GLES2CmdHelper(command_buffer_.get())); 225 gles2_helper_.reset(new gles2::GLES2CmdHelper(command_buffer_.get()));
216 if (!gles2_helper_->Initialize(kCommandBufferSize)) { 226 if (!gles2_helper_->Initialize(kCommandBufferSize)) {
217 LOG(INFO) << "Failed to initialize GLES2CmdHelper"; 227 LOG(ERROR) << "Failed to initialize GLES2CmdHelper";
218 Destroy(); 228 Destroy();
219 return false; 229 return false;
220 } 230 }
221 231
222 // Create a transfer buffer. 232 // Create a transfer buffer.
223 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get())); 233 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get()));
224 234
225 // Create the object exposing the OpenGL API. 235 // Create the object exposing the OpenGL API.
226 gles2_implementation_.reset(new gles2::GLES2Implementation( 236 gles2_implementation_.reset(new gles2::GLES2Implementation(
227 gles2_helper_.get(), 237 gles2_helper_.get(),
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 gfx::kNullAcceleratedWidget, 330 gfx::kNullAcceleratedWidget,
321 surface->GetSize(), 331 surface->GetSize(),
322 attribs, 332 attribs,
323 gpu_preference)) 333 gpu_preference))
324 return NULL; 334 return NULL;
325 335
326 return context.release(); 336 return context.release();
327 } 337 }
328 338
329 } // namespace gpu 339 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gl_in_process_context.h ('k') | gpu/command_buffer/common/gles2_cmd_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698