1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_SERVICE_UTILS_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_SERVICE_UTILS_H_
7 
8 #include "base/command_line.h"
9 #include "gpu/config/gpu_preferences.h"
10 #include "gpu/gpu_gles2_export.h"
11 #include "ui/gl/gl_context.h"
12 
13 namespace gpu {
14 struct ContextCreationAttribs;
15 
16 namespace gles2 {
17 class ContextGroup;
18 
19 GPU_GLES2_EXPORT gl::GLContextAttribs GenerateGLContextAttribs(
20     const ContextCreationAttribs& attribs_helper,
21     const ContextGroup* context_group);
22 
23 GPU_GLES2_EXPORT gl::GLContextAttribs GenerateGLContextAttribs(
24     const ContextCreationAttribs& attribs_helper,
25     bool use_passthrough_cmd_decoder);
26 
27 // Returns true if the passthrough command decoder has been requested
28 GPU_GLES2_EXPORT bool UsePassthroughCommandDecoder(
29     const base::CommandLine* command_line);
30 
31 // Returns true if the driver supports creating passthrough command decoders
32 GPU_GLES2_EXPORT bool PassthroughCommandDecoderSupported();
33 
34 GPU_GLES2_EXPORT GpuPreferences
35 ParseGpuPreferences(const base::CommandLine* command_line);
36 
37 // Determine which Skia GrContext backend will be used for GPU compositing and
38 // rasterization (if enabled) by checking the feature flags for Vulkan and
39 // Metal. If they are not enabled, default to GL.
40 GPU_GLES2_EXPORT GrContextType ParseGrContextType();
41 
42 // Parse the value of --use-vulkan from the command line. If unspecified and
43 // a Vulkan GrContext is going to be used, default to the native implementation.
44 GPU_GLES2_EXPORT VulkanImplementationName
45 ParseVulkanImplementationName(const base::CommandLine* command_line,
46                               GrContextType gr_context_type);
47 
48 }  // namespace gles2
49 }  // namespace gpu
50 
51 #endif  // GPU_COMMAND_BUFFER_SERVICE_SERVICE_UTILS_H_
52