forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevice_capabilities.cc
More file actions
88 lines (69 loc) · 2.68 KB
/
device_capabilities.cc
File metadata and controls
88 lines (69 loc) · 2.68 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Copyright 2013 The Flutter 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 "impeller/renderer/device_capabilities.h"
namespace impeller {
IDeviceCapabilities::IDeviceCapabilities(bool threading_restrictions,
bool offscreen_msaa,
bool supports_ssbo,
PixelFormat default_color_format,
PixelFormat default_stencil_format)
: threading_restrictions_(threading_restrictions),
offscreen_msaa_(offscreen_msaa),
supports_ssbo_(supports_ssbo),
default_color_format_(default_color_format),
default_stencil_format_(default_stencil_format) {}
IDeviceCapabilities::~IDeviceCapabilities() = default;
bool IDeviceCapabilities::HasThreadingRestrictions() const {
return threading_restrictions_;
}
bool IDeviceCapabilities::SupportsOffscreenMSAA() const {
return offscreen_msaa_;
}
bool IDeviceCapabilities::SupportsSSBO() const {
return supports_ssbo_;
}
PixelFormat IDeviceCapabilities::GetDefaultColorFormat() const {
return default_color_format_;
}
PixelFormat IDeviceCapabilities::GetDefaultStencilFormat() const {
return default_stencil_format_;
}
DeviceCapabilitiesBuilder::DeviceCapabilitiesBuilder() = default;
DeviceCapabilitiesBuilder::~DeviceCapabilitiesBuilder() = default;
DeviceCapabilitiesBuilder&
DeviceCapabilitiesBuilder::SetHasThreadingRestrictions(bool value) {
threading_restrictions_ = value;
return *this;
}
DeviceCapabilitiesBuilder& DeviceCapabilitiesBuilder::SetSupportsOffscreenMSAA(
bool value) {
offscreen_msaa_ = value;
return *this;
}
DeviceCapabilitiesBuilder& DeviceCapabilitiesBuilder::SetSupportsSSBO(
bool value) {
supports_ssbo_ = value;
return *this;
}
DeviceCapabilitiesBuilder& DeviceCapabilitiesBuilder::SetDefaultColorFormat(
PixelFormat value) {
default_color_format_ = value;
return *this;
}
DeviceCapabilitiesBuilder& DeviceCapabilitiesBuilder::SetDefaultStencilFormat(
PixelFormat value) {
default_stencil_format_ = value;
return *this;
}
std::unique_ptr<IDeviceCapabilities> DeviceCapabilitiesBuilder::Build() {
FML_CHECK(default_color_format_.has_value())
<< "Default color format not set";
FML_CHECK(default_stencil_format_.has_value())
<< "Default stencil format not set";
IDeviceCapabilities* capabilities = new IDeviceCapabilities(
threading_restrictions_, offscreen_msaa_, supports_ssbo_,
*default_color_format_, *default_stencil_format_);
return std::unique_ptr<IDeviceCapabilities>(capabilities);
}
} // namespace impeller