OLD | NEW |
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/tests/gl_manager.h" | 5 #include "gpu/command_buffer/tests/gl_manager.h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
9 #include <GLES2/gl2extchromium.h> | 9 #include <GLES2/gl2extchromium.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 272 |
273 gl::GLContext* real_gl_context = NULL; | 273 gl::GLContext* real_gl_context = NULL; |
274 if (options.virtual_manager) { | 274 if (options.virtual_manager) { |
275 real_gl_context = options.virtual_manager->context(); | 275 real_gl_context = options.virtual_manager->context(); |
276 } | 276 } |
277 | 277 |
278 mailbox_manager_ = | 278 mailbox_manager_ = |
279 mailbox_manager ? mailbox_manager : new gles2::MailboxManagerImpl; | 279 mailbox_manager ? mailbox_manager : new gles2::MailboxManagerImpl; |
280 share_group_ = share_group ? share_group : new gl::GLShareGroup; | 280 share_group_ = share_group ? share_group : new gl::GLShareGroup; |
281 | 281 |
282 gl::GpuPreference gpu_preference(gl::PreferDiscreteGpu); | |
283 gles2::ContextCreationAttribHelper attribs; | 282 gles2::ContextCreationAttribHelper attribs; |
284 attribs.red_size = 8; | 283 attribs.red_size = 8; |
285 attribs.green_size = 8; | 284 attribs.green_size = 8; |
286 attribs.blue_size = 8; | 285 attribs.blue_size = 8; |
287 attribs.alpha_size = 8; | 286 attribs.alpha_size = 8; |
288 attribs.depth_size = 16; | 287 attribs.depth_size = 16; |
289 attribs.stencil_size = 8; | 288 attribs.stencil_size = 8; |
290 attribs.context_type = options.context_type; | 289 attribs.context_type = options.context_type; |
291 attribs.samples = options.multisampled ? 4 : 0; | 290 attribs.samples = options.multisampled ? 4 : 0; |
292 attribs.sample_buffers = options.multisampled ? 1 : 0; | 291 attribs.sample_buffers = options.multisampled ? 1 : 0; |
293 attribs.alpha_size = options.backbuffer_alpha ? 8 : 0; | 292 attribs.alpha_size = options.backbuffer_alpha ? 8 : 0; |
294 attribs.should_use_native_gmb_for_backbuffer = | 293 attribs.should_use_native_gmb_for_backbuffer = |
295 options.image_factory != nullptr; | 294 options.image_factory != nullptr; |
| 295 attribs.offscreen_framebuffer_size = options.size; |
296 | 296 |
297 if (!context_group) { | 297 if (!context_group) { |
298 GpuDriverBugWorkarounds gpu_driver_bug_workaround(&command_line); | 298 GpuDriverBugWorkarounds gpu_driver_bug_workaround(&command_line); |
299 scoped_refptr<gles2::FeatureInfo> feature_info = | 299 scoped_refptr<gles2::FeatureInfo> feature_info = |
300 new gles2::FeatureInfo(command_line, gpu_driver_bug_workaround); | 300 new gles2::FeatureInfo(command_line, gpu_driver_bug_workaround); |
301 if (options.enable_arb_texture_rectangle) { | 301 if (options.enable_arb_texture_rectangle) { |
302 gles2::FeatureInfo::FeatureFlags& flags = | 302 gles2::FeatureInfo::FeatureFlags& flags = |
303 const_cast<gles2::FeatureInfo::FeatureFlags&>( | 303 const_cast<gles2::FeatureInfo::FeatureFlags&>( |
304 feature_info->feature_flags()); | 304 feature_info->feature_flags()); |
305 flags.arb_texture_rectangle = true; | 305 flags.arb_texture_rectangle = true; |
(...skipping 16 matching lines...) Expand all Loading... |
322 decoder_.get())); | 322 decoder_.get())); |
323 | 323 |
324 decoder_->set_engine(executor_.get()); | 324 decoder_->set_engine(executor_.get()); |
325 | 325 |
326 surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size()); | 326 surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size()); |
327 ASSERT_TRUE(surface_.get() != NULL) << "could not create offscreen surface"; | 327 ASSERT_TRUE(surface_.get() != NULL) << "could not create offscreen surface"; |
328 | 328 |
329 if (base_context_) { | 329 if (base_context_) { |
330 context_ = scoped_refptr<gl::GLContext>(new gpu::GLContextVirtual( | 330 context_ = scoped_refptr<gl::GLContext>(new gpu::GLContextVirtual( |
331 share_group_.get(), base_context_->get(), decoder_->AsWeakPtr())); | 331 share_group_.get(), base_context_->get(), decoder_->AsWeakPtr())); |
332 ASSERT_TRUE(context_->Initialize(surface_.get(), gl::PreferIntegratedGpu)); | 332 ASSERT_TRUE(context_->Initialize(surface_.get(), attribs.gpu_preference)); |
333 } else { | 333 } else { |
334 if (real_gl_context) { | 334 if (real_gl_context) { |
335 context_ = scoped_refptr<gl::GLContext>(new gpu::GLContextVirtual( | 335 context_ = scoped_refptr<gl::GLContext>(new gpu::GLContextVirtual( |
336 share_group_.get(), real_gl_context, decoder_->AsWeakPtr())); | 336 share_group_.get(), real_gl_context, decoder_->AsWeakPtr())); |
337 ASSERT_TRUE( | 337 ASSERT_TRUE( |
338 context_->Initialize(surface_.get(), gl::PreferIntegratedGpu)); | 338 context_->Initialize(surface_.get(), attribs.gpu_preference)); |
339 } else { | 339 } else { |
340 context_ = gl::init::CreateGLContext(share_group_.get(), surface_.get(), | 340 context_ = gl::init::CreateGLContext(share_group_.get(), surface_.get(), |
341 gpu_preference); | 341 attribs.gpu_preference); |
342 } | 342 } |
343 } | 343 } |
344 ASSERT_TRUE(context_.get() != NULL) << "could not create GL context"; | 344 ASSERT_TRUE(context_.get() != NULL) << "could not create GL context"; |
345 | 345 |
346 ASSERT_TRUE(context_->MakeCurrent(surface_.get())); | 346 ASSERT_TRUE(context_->MakeCurrent(surface_.get())); |
347 | 347 |
348 if (!decoder_->Initialize(surface_.get(), context_.get(), true, options.size, | 348 if (!decoder_->Initialize(surface_.get(), context_.get(), true, |
349 ::gpu::gles2::DisallowedFeatures(), attribs)) { | 349 ::gpu::gles2::DisallowedFeatures(), attribs)) { |
350 return; | 350 return; |
351 } | 351 } |
352 | 352 |
353 if (options.sync_point_manager) { | 353 if (options.sync_point_manager) { |
354 sync_point_manager_ = options.sync_point_manager; | 354 sync_point_manager_ = options.sync_point_manager; |
355 sync_point_order_data_ = SyncPointOrderData::Create(); | 355 sync_point_order_data_ = SyncPointOrderData::Create(); |
356 sync_point_client_ = sync_point_manager_->CreateSyncPointClient( | 356 sync_point_client_ = sync_point_manager_->CreateSyncPointClient( |
357 sync_point_order_data_, GetNamespaceID(), GetCommandBufferID()); | 357 sync_point_order_data_, GetNamespaceID(), GetCommandBufferID()); |
358 | 358 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 653 |
654 // Something went wrong, just run the callback now. | 654 // Something went wrong, just run the callback now. |
655 callback.Run(); | 655 callback.Run(); |
656 } | 656 } |
657 | 657 |
658 bool GLManager::CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) { | 658 bool GLManager::CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) { |
659 return false; | 659 return false; |
660 } | 660 } |
661 | 661 |
662 } // namespace gpu | 662 } // namespace gpu |
OLD | NEW |