Fix iOS compilation issues.
This commit is contained in:
@@ -6,18 +6,23 @@ config("impeller_public_config") {
|
||||
include_dirs = [ ".." ]
|
||||
}
|
||||
|
||||
is_host = is_mac || is_linux || is_win
|
||||
|
||||
group("impeller") {
|
||||
public_deps = [
|
||||
"aiks",
|
||||
"archivist",
|
||||
"base",
|
||||
"compiler",
|
||||
"display_list",
|
||||
"entity",
|
||||
"geometry",
|
||||
"image",
|
||||
"renderer",
|
||||
]
|
||||
|
||||
if (is_host) {
|
||||
public_deps += [ "compiler" ]
|
||||
}
|
||||
}
|
||||
|
||||
executable("impeller_unittests") {
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
import("../tools/impeller.gni")
|
||||
|
||||
impeller_component("archivist") {
|
||||
# Only the umbrella header is public since all other TU's are implementation
|
||||
# detail that will be compiled away in release modes.
|
||||
# Because they are implementation details, they may expose dependency headers.
|
||||
public = [ "archive.h" ]
|
||||
public = [
|
||||
"archivable.h",
|
||||
"archive.h",
|
||||
"archive_location.h",
|
||||
]
|
||||
|
||||
sources = [
|
||||
"archivable.cc",
|
||||
@@ -20,7 +21,6 @@ impeller_component("archivist") {
|
||||
"archive_database.cc",
|
||||
"archive_database.h",
|
||||
"archive_location.cc",
|
||||
"archive_location.h",
|
||||
"archive_statement.cc",
|
||||
"archive_statement.h",
|
||||
"archive_transaction.cc",
|
||||
|
||||
@@ -36,6 +36,7 @@ impeller_component("entity") {
|
||||
deps = [ ":entity_shaders" ]
|
||||
|
||||
public_deps = [
|
||||
"../archivist",
|
||||
"../image",
|
||||
"../renderer",
|
||||
]
|
||||
|
||||
@@ -41,7 +41,11 @@ static MTLResourceOptions ToMTLResourceOptions(StorageMode type) {
|
||||
return MTLResourceStorageModePrivate;
|
||||
case StorageMode::kDeviceTransient:
|
||||
#if OS_IOS
|
||||
return MTLResourceStorageModeMemoryless;
|
||||
if (@available(iOS 10.0, *)) {
|
||||
return MTLResourceStorageModeMemoryless;
|
||||
} else {
|
||||
return MTLResourceStorageModePrivate;
|
||||
}
|
||||
#else
|
||||
return MTLResourceStorageModePrivate;
|
||||
#endif
|
||||
@@ -62,7 +66,11 @@ static MTLStorageMode ToMTLStorageMode(StorageMode mode) {
|
||||
return MTLStorageModePrivate;
|
||||
case StorageMode::kDeviceTransient:
|
||||
#if OS_IOS
|
||||
return MTLStorageModeMemoryless;
|
||||
if (@available(iOS 10.0, *)) {
|
||||
return MTLStorageModeMemoryless;
|
||||
} else {
|
||||
return MTLStorageModePrivate;
|
||||
}
|
||||
#else
|
||||
return MTLStorageModePrivate;
|
||||
#endif
|
||||
|
||||
@@ -72,9 +72,18 @@ std::shared_ptr<Texture> DeviceBufferMTL::MakeTexture(TextureDescriptor desc,
|
||||
::memmove(dest + offset, source + source_range.offset, source_range.length);
|
||||
}
|
||||
|
||||
// |RequiresExplicitHostSynchronization| always returns false on iOS. But the
|
||||
// compiler is mad that `didModifyRange:` appears in a TU meant for iOS. So,
|
||||
// just compile it away.
|
||||
//
|
||||
// Making this call is never necessary on iOS because there is no
|
||||
// MTLResourceStorageModeManaged mode. Only the MTLStorageModeShared mode is
|
||||
// available.
|
||||
#if !OS_IOS
|
||||
if (Allocator::RequiresExplicitHostSynchronization(mode_)) {
|
||||
[buffer_ didModifyRange:NSMakeRange(offset, source_range.length)];
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -97,7 +106,7 @@ bool DeviceBufferMTL::SetLabel(const std::string& label, Range range) {
|
||||
if (label.empty()) {
|
||||
return false;
|
||||
}
|
||||
if (@available(macOS 10.12, *)) {
|
||||
if (@available(macOS 10.12, iOS 10.0, *)) {
|
||||
[buffer_ addDebugMarker:@(label.c_str())
|
||||
range:NSMakeRange(range.offset, range.length)];
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
|
||||
if (input.bit_width == 8 * sizeof(float) / 2) {
|
||||
switch (input.vec_size) {
|
||||
case 1:
|
||||
if (@available(macOS 10.13, *)) {
|
||||
if (@available(macOS 10.13, iOS 11.0, *)) {
|
||||
return MTLVertexFormatHalf;
|
||||
} else {
|
||||
return MTLVertexFormatInvalid;
|
||||
@@ -60,7 +60,7 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
|
||||
}
|
||||
case ShaderType::kBoolean: {
|
||||
if (input.bit_width == 8 * sizeof(bool) && input.vec_size == 1) {
|
||||
if (@available(macOS 10.13, *)) {
|
||||
if (@available(macOS 10.13, iOS 11.0, *)) {
|
||||
return MTLVertexFormatChar;
|
||||
} else {
|
||||
return MTLVertexFormatInvalid;
|
||||
@@ -72,7 +72,7 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
|
||||
if (input.bit_width == 8 * sizeof(char)) {
|
||||
switch (input.vec_size) {
|
||||
case 1:
|
||||
if (@available(macOS 10.13, *)) {
|
||||
if (@available(macOS 10.13, iOS 11.0, *)) {
|
||||
return MTLVertexFormatChar;
|
||||
} else {
|
||||
return MTLVertexFormatInvalid;
|
||||
@@ -91,7 +91,7 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
|
||||
if (input.bit_width == 8 * sizeof(char)) {
|
||||
switch (input.vec_size) {
|
||||
case 1:
|
||||
if (@available(macOS 10.13, *)) {
|
||||
if (@available(macOS 10.13, iOS 11.0, *)) {
|
||||
return MTLVertexFormatUChar;
|
||||
} else {
|
||||
return MTLVertexFormatInvalid;
|
||||
@@ -110,7 +110,7 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
|
||||
if (input.bit_width == 8 * sizeof(short)) {
|
||||
switch (input.vec_size) {
|
||||
case 1:
|
||||
if (@available(macOS 10.13, *)) {
|
||||
if (@available(macOS 10.13, iOS 11.0, *)) {
|
||||
return MTLVertexFormatShort;
|
||||
} else {
|
||||
return MTLVertexFormatInvalid;
|
||||
@@ -129,7 +129,7 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
|
||||
if (input.bit_width == 8 * sizeof(ushort)) {
|
||||
switch (input.vec_size) {
|
||||
case 1:
|
||||
if (@available(macOS 10.13, *)) {
|
||||
if (@available(macOS 10.13, iOS 11.0, *)) {
|
||||
return MTLVertexFormatUShort;
|
||||
} else {
|
||||
return MTLVertexFormatInvalid;
|
||||
|
||||
Reference in New Issue
Block a user