summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/service/async_pixel_transfer_manager_linux.cc
blob: 4afe77c1a8b0213e133bcc89ab11cd28e0962a22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "gpu/command_buffer/service/async_pixel_transfer_manager.h"

#include "base/command_line.h"
#include "base/trace_event/trace_event.h"
#include "gpu/command_buffer/service/async_pixel_transfer_manager_idle.h"
#include "gpu/command_buffer/service/async_pixel_transfer_manager_share_group.h"
#include "gpu/command_buffer/service/async_pixel_transfer_manager_stub.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "ui/gl/gl_implementation.h"

namespace gpu {

AsyncPixelTransferManager* AsyncPixelTransferManager::Create(
    gfx::GLContext* context) {
  TRACE_EVENT0("gpu", "AsyncPixelTransferManager::Create");
  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
          switches::kEnableShareGroupAsyncTextureUpload)) {
    DCHECK(context);
    return static_cast<AsyncPixelTransferManager*> (
        new AsyncPixelTransferManagerShareGroup(context));
  }

  switch (gfx::GetGLImplementation()) {
    case gfx::kGLImplementationOSMesaGL:
    case gfx::kGLImplementationDesktopGL:
    case gfx::kGLImplementationDesktopGLCoreProfile:
    case gfx::kGLImplementationEGLGLES2:
      return new AsyncPixelTransferManagerIdle(true);
    case gfx::kGLImplementationMockGL:
      return new AsyncPixelTransferManagerStub;
    default:
      NOTREACHED();
      return NULL;
  }
}

}  // namespace gpu