Skip to content

Commit 84eee26

Browse files
chinmaygardednfield
authored andcommitted
Fix iOS compilation issues.
1 parent 4ca5af4 commit 84eee26

File tree

6 files changed

+38
-15
lines changed

6 files changed

+38
-15
lines changed

impeller/BUILD.gn

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,23 @@ config("impeller_public_config") {
66
include_dirs = [ ".." ]
77
}
88

9+
is_host = is_mac || is_linux || is_win
10+
911
group("impeller") {
1012
public_deps = [
1113
"aiks",
1214
"archivist",
1315
"base",
14-
"compiler",
1516
"display_list",
1617
"entity",
1718
"geometry",
1819
"image",
1920
"renderer",
2021
]
22+
23+
if (is_host) {
24+
public_deps += [ "compiler" ]
25+
}
2126
}
2227

2328
executable("impeller_unittests") {

impeller/archivist/BUILD.gn

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
import("../tools/impeller.gni")
66

77
impeller_component("archivist") {
8-
# Only the umbrella header is public since all other TU's are implementation
9-
# detail that will be compiled away in release modes.
10-
# Because they are implementation details, they may expose dependency headers.
11-
public = [ "archive.h" ]
8+
public = [
9+
"archivable.h",
10+
"archive.h",
11+
"archive_location.h",
12+
]
1213

1314
sources = [
1415
"archivable.cc",
@@ -20,7 +21,6 @@ impeller_component("archivist") {
2021
"archive_database.cc",
2122
"archive_database.h",
2223
"archive_location.cc",
23-
"archive_location.h",
2424
"archive_statement.cc",
2525
"archive_statement.h",
2626
"archive_transaction.cc",

impeller/entity/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ impeller_component("entity") {
3636
deps = [ ":entity_shaders" ]
3737

3838
public_deps = [
39+
"../archivist",
3940
"../image",
4041
"../renderer",
4142
]

impeller/renderer/backend/metal/allocator_mtl.mm

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ static MTLResourceOptions ToMTLResourceOptions(StorageMode type) {
4141
return MTLResourceStorageModePrivate;
4242
case StorageMode::kDeviceTransient:
4343
#if OS_IOS
44-
return MTLResourceStorageModeMemoryless;
44+
if (@available(iOS 10.0, *)) {
45+
return MTLResourceStorageModeMemoryless;
46+
} else {
47+
return MTLResourceStorageModePrivate;
48+
}
4549
#else
4650
return MTLResourceStorageModePrivate;
4751
#endif
@@ -62,7 +66,11 @@ static MTLStorageMode ToMTLStorageMode(StorageMode mode) {
6266
return MTLStorageModePrivate;
6367
case StorageMode::kDeviceTransient:
6468
#if OS_IOS
65-
return MTLStorageModeMemoryless;
69+
if (@available(iOS 10.0, *)) {
70+
return MTLStorageModeMemoryless;
71+
} else {
72+
return MTLStorageModePrivate;
73+
}
6674
#else
6775
return MTLStorageModePrivate;
6876
#endif

impeller/renderer/backend/metal/device_buffer_mtl.mm

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,18 @@
7272
::memmove(dest + offset, source + source_range.offset, source_range.length);
7373
}
7474

75+
// |RequiresExplicitHostSynchronization| always returns false on iOS. But the
76+
// compiler is mad that `didModifyRange:` appears in a TU meant for iOS. So,
77+
// just compile it away.
78+
//
79+
// Making this call is never necessary on iOS because there is no
80+
// MTLResourceStorageModeManaged mode. Only the MTLStorageModeShared mode is
81+
// available.
82+
#if !OS_IOS
7583
if (Allocator::RequiresExplicitHostSynchronization(mode_)) {
7684
[buffer_ didModifyRange:NSMakeRange(offset, source_range.length)];
7785
}
86+
#endif
7887

7988
return true;
8089
}
@@ -97,7 +106,7 @@
97106
if (label.empty()) {
98107
return false;
99108
}
100-
if (@available(macOS 10.12, *)) {
109+
if (@available(macOS 10.12, iOS 10.0, *)) {
101110
[buffer_ addDebugMarker:@(label.c_str())
102111
range:NSMakeRange(range.offset, range.length)];
103112
}

impeller/renderer/backend/metal/vertex_descriptor_mtl.mm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
3939
if (input.bit_width == 8 * sizeof(float) / 2) {
4040
switch (input.vec_size) {
4141
case 1:
42-
if (@available(macOS 10.13, *)) {
42+
if (@available(macOS 10.13, iOS 11.0, *)) {
4343
return MTLVertexFormatHalf;
4444
} else {
4545
return MTLVertexFormatInvalid;
@@ -60,7 +60,7 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
6060
}
6161
case ShaderType::kBoolean: {
6262
if (input.bit_width == 8 * sizeof(bool) && input.vec_size == 1) {
63-
if (@available(macOS 10.13, *)) {
63+
if (@available(macOS 10.13, iOS 11.0, *)) {
6464
return MTLVertexFormatChar;
6565
} else {
6666
return MTLVertexFormatInvalid;
@@ -72,7 +72,7 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
7272
if (input.bit_width == 8 * sizeof(char)) {
7373
switch (input.vec_size) {
7474
case 1:
75-
if (@available(macOS 10.13, *)) {
75+
if (@available(macOS 10.13, iOS 11.0, *)) {
7676
return MTLVertexFormatChar;
7777
} else {
7878
return MTLVertexFormatInvalid;
@@ -91,7 +91,7 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
9191
if (input.bit_width == 8 * sizeof(char)) {
9292
switch (input.vec_size) {
9393
case 1:
94-
if (@available(macOS 10.13, *)) {
94+
if (@available(macOS 10.13, iOS 11.0, *)) {
9595
return MTLVertexFormatUChar;
9696
} else {
9797
return MTLVertexFormatInvalid;
@@ -110,7 +110,7 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
110110
if (input.bit_width == 8 * sizeof(short)) {
111111
switch (input.vec_size) {
112112
case 1:
113-
if (@available(macOS 10.13, *)) {
113+
if (@available(macOS 10.13, iOS 11.0, *)) {
114114
return MTLVertexFormatShort;
115115
} else {
116116
return MTLVertexFormatInvalid;
@@ -129,7 +129,7 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
129129
if (input.bit_width == 8 * sizeof(ushort)) {
130130
switch (input.vec_size) {
131131
case 1:
132-
if (@available(macOS 10.13, *)) {
132+
if (@available(macOS 10.13, iOS 11.0, *)) {
133133
return MTLVertexFormatUShort;
134134
} else {
135135
return MTLVertexFormatInvalid;

0 commit comments

Comments
 (0)