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 "gpu/command_buffer/service/in_process_command_buffer.h" | 5 #include "gpu/command_buffer/service/in_process_command_buffer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <queue> | 10 #include <queue> |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "gpu/command_buffer/service/memory_program_cache.h" | 37 #include "gpu/command_buffer/service/memory_program_cache.h" |
38 #include "gpu/command_buffer/service/memory_tracking.h" | 38 #include "gpu/command_buffer/service/memory_tracking.h" |
39 #include "gpu/command_buffer/service/query_manager.h" | 39 #include "gpu/command_buffer/service/query_manager.h" |
40 #include "gpu/command_buffer/service/sync_point_manager.h" | 40 #include "gpu/command_buffer/service/sync_point_manager.h" |
41 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 41 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
42 #include "ui/gfx/geometry/size.h" | 42 #include "ui/gfx/geometry/size.h" |
43 #include "ui/gl/gl_context.h" | 43 #include "ui/gl/gl_context.h" |
44 #include "ui/gl/gl_image.h" | 44 #include "ui/gl/gl_image.h" |
45 #include "ui/gl/gl_image_shared_memory.h" | 45 #include "ui/gl/gl_image_shared_memory.h" |
46 #include "ui/gl/gl_share_group.h" | 46 #include "ui/gl/gl_share_group.h" |
| 47 #include "ui/gl/init/gl_factory.h" |
47 | 48 |
48 #if defined(OS_WIN) | 49 #if defined(OS_WIN) |
49 #include <windows.h> | 50 #include <windows.h> |
50 #include "base/process/process_handle.h" | 51 #include "base/process/process_handle.h" |
51 #endif | 52 #endif |
52 | 53 |
53 namespace gpu { | 54 namespace gpu { |
54 | 55 |
55 namespace { | 56 namespace { |
56 | 57 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 executor_.reset(new CommandExecutor(command_buffer.get(), decoder_.get(), | 336 executor_.reset(new CommandExecutor(command_buffer.get(), decoder_.get(), |
336 decoder_.get())); | 337 decoder_.get())); |
337 command_buffer->SetGetBufferChangeCallback(base::Bind( | 338 command_buffer->SetGetBufferChangeCallback(base::Bind( |
338 &CommandExecutor::SetGetBuffer, base::Unretained(executor_.get()))); | 339 &CommandExecutor::SetGetBuffer, base::Unretained(executor_.get()))); |
339 command_buffer_ = std::move(command_buffer); | 340 command_buffer_ = std::move(command_buffer); |
340 | 341 |
341 decoder_->set_engine(executor_.get()); | 342 decoder_->set_engine(executor_.get()); |
342 | 343 |
343 if (!surface_.get()) { | 344 if (!surface_.get()) { |
344 if (params.is_offscreen) | 345 if (params.is_offscreen) |
345 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(params.size); | 346 surface_ = gl::init::CreateOffscreenGLSurface(params.size); |
346 else | 347 else |
347 surface_ = gfx::GLSurface::CreateViewGLSurface(params.window); | 348 surface_ = gl::init::CreateViewGLSurface(params.window); |
348 } | 349 } |
349 | 350 |
350 if (!surface_.get()) { | 351 if (!surface_.get()) { |
351 LOG(ERROR) << "Could not create GLSurface."; | 352 LOG(ERROR) << "Could not create GLSurface."; |
352 DestroyOnGpuThread(); | 353 DestroyOnGpuThread(); |
353 return false; | 354 return false; |
354 } | 355 } |
355 | 356 |
356 sync_point_order_data_ = SyncPointOrderData::Create(); | 357 sync_point_order_data_ = SyncPointOrderData::Create(); |
357 sync_point_client_ = service_->sync_point_manager()->CreateSyncPointClient( | 358 sync_point_client_ = service_->sync_point_manager()->CreateSyncPointClient( |
358 sync_point_order_data_, GetNamespaceID(), GetCommandBufferID()); | 359 sync_point_order_data_, GetNamespaceID(), GetCommandBufferID()); |
359 | 360 |
360 if (service_->UseVirtualizedGLContexts() || | 361 if (service_->UseVirtualizedGLContexts() || |
361 decoder_->GetContextGroup() | 362 decoder_->GetContextGroup() |
362 ->feature_info() | 363 ->feature_info() |
363 ->workarounds() | 364 ->workarounds() |
364 .use_virtualized_gl_contexts) { | 365 .use_virtualized_gl_contexts) { |
365 context_ = gl_share_group_->GetSharedContext(); | 366 context_ = gl_share_group_->GetSharedContext(); |
366 if (!context_.get()) { | 367 if (!context_.get()) { |
367 context_ = gfx::GLContext::CreateGLContext( | 368 context_ = gl::init::CreateGLContext( |
368 gl_share_group_.get(), surface_.get(), params.gpu_preference); | 369 gl_share_group_.get(), surface_.get(), params.gpu_preference); |
369 gl_share_group_->SetSharedContext(context_.get()); | 370 gl_share_group_->SetSharedContext(context_.get()); |
370 } | 371 } |
371 | 372 |
372 context_ = new GLContextVirtual( | 373 context_ = new GLContextVirtual( |
373 gl_share_group_.get(), context_.get(), decoder_->AsWeakPtr()); | 374 gl_share_group_.get(), context_.get(), decoder_->AsWeakPtr()); |
374 if (context_->Initialize(surface_.get(), params.gpu_preference)) { | 375 if (context_->Initialize(surface_.get(), params.gpu_preference)) { |
375 VLOG(1) << "Created virtual GL context."; | 376 VLOG(1) << "Created virtual GL context."; |
376 } else { | 377 } else { |
377 context_ = NULL; | 378 context_ = NULL; |
378 } | 379 } |
379 } else { | 380 } else { |
380 context_ = gfx::GLContext::CreateGLContext( | 381 context_ = gl::init::CreateGLContext(gl_share_group_.get(), surface_.get(), |
381 gl_share_group_.get(), surface_.get(), params.gpu_preference); | 382 params.gpu_preference); |
382 } | 383 } |
383 | 384 |
384 if (!context_.get()) { | 385 if (!context_.get()) { |
385 LOG(ERROR) << "Could not create GLContext."; | 386 LOG(ERROR) << "Could not create GLContext."; |
386 DestroyOnGpuThread(); | 387 DestroyOnGpuThread(); |
387 return false; | 388 return false; |
388 } | 389 } |
389 | 390 |
390 if (!context_->MakeCurrent(surface_.get())) { | 391 if (!context_->MakeCurrent(surface_.get())) { |
391 LOG(ERROR) << "Could not make context current."; | 392 LOG(ERROR) << "Could not make context current."; |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 framebuffer_completeness_cache_ = | 1045 framebuffer_completeness_cache_ = |
1045 new gpu::gles2::FramebufferCompletenessCache; | 1046 new gpu::gles2::FramebufferCompletenessCache; |
1046 return framebuffer_completeness_cache_; | 1047 return framebuffer_completeness_cache_; |
1047 } | 1048 } |
1048 | 1049 |
1049 SyncPointManager* GpuInProcessThread::sync_point_manager() { | 1050 SyncPointManager* GpuInProcessThread::sync_point_manager() { |
1050 return sync_point_manager_; | 1051 return sync_point_manager_; |
1051 } | 1052 } |
1052 | 1053 |
1053 } // namespace gpu | 1054 } // namespace gpu |
OLD | NEW |