1 // Copyright (c) 2013 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 #include "gpu/config/gpu_blocklist.h"
6 
7 #include "gpu/config/gpu_feature_type.h"
8 #include "gpu/config/software_rendering_list_autogen.h"
9 
10 namespace gpu {
11 
GpuBlocklist(const GpuControlListData & data)12 GpuBlocklist::GpuBlocklist(const GpuControlListData& data)
13     : GpuControlList(data) {}
14 
15 GpuBlocklist::~GpuBlocklist() = default;
16 
17 // static
Create()18 std::unique_ptr<GpuBlocklist> GpuBlocklist::Create() {
19   GpuControlListData data(kSoftwareRenderingListEntryCount,
20                           kSoftwareRenderingListEntries);
21   return Create(data);
22 }
23 
24 // static
Create(const GpuControlListData & data)25 std::unique_ptr<GpuBlocklist> GpuBlocklist::Create(
26     const GpuControlListData& data) {
27   std::unique_ptr<GpuBlocklist> list(new GpuBlocklist(data));
28   list->AddSupportedFeature("accelerated_2d_canvas",
29                             GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS);
30   list->AddSupportedFeature("accelerated_webgl",
31                             GPU_FEATURE_TYPE_ACCELERATED_WEBGL);
32   list->AddSupportedFeature("flash3d", GPU_FEATURE_TYPE_FLASH3D);
33   list->AddSupportedFeature("flash_stage3d", GPU_FEATURE_TYPE_FLASH_STAGE3D);
34   list->AddSupportedFeature("flash_stage3d_baseline",
35                             GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE);
36   list->AddSupportedFeature("accelerated_video_decode",
37                             GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE);
38   list->AddSupportedFeature("gpu_rasterization",
39                             GPU_FEATURE_TYPE_GPU_RASTERIZATION);
40   list->AddSupportedFeature("accelerated_webgl2",
41                             GPU_FEATURE_TYPE_ACCELERATED_WEBGL2);
42   list->AddSupportedFeature("protected_video_decode",
43                             GPU_FEATURE_TYPE_PROTECTED_VIDEO_DECODE);
44   list->AddSupportedFeature("oop_rasterization",
45                             GPU_FEATURE_TYPE_OOP_RASTERIZATION);
46   list->AddSupportedFeature("android_surface_control",
47                             GPU_FEATURE_TYPE_ANDROID_SURFACE_CONTROL);
48   list->AddSupportedFeature("accelerated_gl", GPU_FEATURE_TYPE_ACCELERATED_GL);
49   list->AddSupportedFeature("metal", GPU_FEATURE_TYPE_METAL);
50   list->AddSupportedFeature("vulkan", GPU_FEATURE_TYPE_VULKAN);
51   return list;
52 }
53 
54 // static
AreEntryIndicesValid(const std::vector<uint32_t> & entry_indices)55 bool GpuBlocklist::AreEntryIndicesValid(
56     const std::vector<uint32_t>& entry_indices) {
57   return GpuControlList::AreEntryIndicesValid(entry_indices,
58                                               kSoftwareRenderingListEntryCount);
59 }
60 
61 }  // namespace gpu
62