Merge pull request #197 from billhollings/master

Support IOSurface on iOS only if IPHONEOS_DEPLOYMENT_TARGET is at least iOS 11.0.
diff --git a/Common/MVKCommonEnvironment.h b/Common/MVKCommonEnvironment.h
index a30ef9e..27a6050 100644
--- a/Common/MVKCommonEnvironment.h
+++ b/Common/MVKCommonEnvironment.h
@@ -42,7 +42,7 @@
 #	endif	// DEBUG
 #endif	// MVK_DEBUG
 
-    /** Building for iOS. Use ifdef instead of defined() operator to allow MVK_IOS to be used in expansions */
+/** Building for iOS. Use ifdef instead of defined() operator to allow MVK_IOS to be used in expansions */
 #ifndef MVK_IOS
 #    ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
 #        define MVK_IOS            1
@@ -51,7 +51,7 @@
 #    endif
 #endif
 
-    /** Building for macOS. Use ifdef instead of defined() operator to allow MVK_MACOS to be used in expansions */
+/** Building for macOS. Use ifdef instead of defined() operator to allow MVK_MACOS to be used in expansions */
 #ifndef MVK_MACOS
 #    ifdef __MAC_OS_X_VERSION_MAX_ALLOWED
 #        define MVK_MACOS        1
diff --git a/Demos/LunarG-VulkanSamples/API-Samples/API-Samples.xcodeproj/project.pbxproj b/Demos/LunarG-VulkanSamples/API-Samples/API-Samples.xcodeproj/project.pbxproj
index e6f8994..855b942 100644
--- a/Demos/LunarG-VulkanSamples/API-Samples/API-Samples.xcodeproj/project.pbxproj
+++ b/Demos/LunarG-VulkanSamples/API-Samples/API-Samples.xcodeproj/project.pbxproj
@@ -7,7 +7,6 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
-		A9096E4F1F7EF10300DFBEA6 /* IOSurface.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9096E4E1F7EF10300DFBEA6 /* IOSurface.framework */; };
 		A95C050B1C98FC1100CC653D /* blue.ppm in Resources */ = {isa = PBXBuildFile; fileRef = A95C05021C98FC1100CC653D /* blue.ppm */; };
 		A95C050C1C98FC1100CC653D /* blue.ppm in Resources */ = {isa = PBXBuildFile; fileRef = A95C05021C98FC1100CC653D /* blue.ppm */; };
 		A95C050D1C98FC1100CC653D /* green.ppm in Resources */ = {isa = PBXBuildFile; fileRef = A95C05041C98FC1100CC653D /* green.ppm */; };
@@ -154,7 +153,6 @@
 			files = (
 				A9B5D0A21CF8835500D7CBDD /* MoltenVK.framework in Frameworks */,
 				A9B5D0A61CF8838E00D7CBDD /* MoltenVKGLSLToSPIRVConverter.framework in Frameworks */,
-				A9096E4F1F7EF10300DFBEA6 /* IOSurface.framework in Frameworks */,
 				A9B5D09E1CF8831400D7CBDD /* libc++.tbd in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
diff --git a/Demos/LunarG-VulkanSamples/Demos/Demos.xcodeproj/project.pbxproj b/Demos/LunarG-VulkanSamples/Demos/Demos.xcodeproj/project.pbxproj
index 7a39c51..914e26a 100644
--- a/Demos/LunarG-VulkanSamples/Demos/Demos.xcodeproj/project.pbxproj
+++ b/Demos/LunarG-VulkanSamples/Demos/Demos.xcodeproj/project.pbxproj
@@ -11,7 +11,6 @@
 		A904B5721C9A08C90008C013 /* cube-frag.spv in Resources */ = {isa = PBXBuildFile; fileRef = A904B52E1C9A08C90008C013 /* cube-frag.spv */; };
 		A904B5751C9A08C90008C013 /* cube-vert.spv in Resources */ = {isa = PBXBuildFile; fileRef = A904B52F1C9A08C90008C013 /* cube-vert.spv */; };
 		A904B5761C9A08C90008C013 /* cube-vert.spv in Resources */ = {isa = PBXBuildFile; fileRef = A904B52F1C9A08C90008C013 /* cube-vert.spv */; };
-		A9096E511F7EF11A00DFBEA6 /* IOSurface.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9096E501F7EF11A00DFBEA6 /* IOSurface.framework */; };
 		A91F43A01EDDD46B00733D01 /* libMoltenVK.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A91F439F1EDDD46B00733D01 /* libMoltenVK.dylib */; };
 		A91F43A51EDDD5CF00733D01 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = A91F43A41EDDD5CF00733D01 /* libc++.tbd */; };
 		A91F43A61EDDD61100733D01 /* libMoltenVK.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = A91F439F1EDDD46B00733D01 /* libMoltenVK.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
@@ -109,7 +108,6 @@
 			buildActionMask = 2147483647;
 			files = (
 				A91F43A01EDDD46B00733D01 /* libMoltenVK.dylib in Frameworks */,
-				A9096E511F7EF11A00DFBEA6 /* IOSurface.framework in Frameworks */,
 				A91F43A51EDDD5CF00733D01 /* libc++.tbd in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
diff --git a/Demos/LunarG-VulkanSamples/Hologram/Hologram.xcodeproj/project.pbxproj b/Demos/LunarG-VulkanSamples/Hologram/Hologram.xcodeproj/project.pbxproj
index 46288bd..d39cbae 100644
--- a/Demos/LunarG-VulkanSamples/Hologram/Hologram.xcodeproj/project.pbxproj
+++ b/Demos/LunarG-VulkanSamples/Hologram/Hologram.xcodeproj/project.pbxproj
@@ -7,7 +7,6 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
-		A9096E531F7EF13000DFBEA6 /* IOSurface.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9096E521F7EF13000DFBEA6 /* IOSurface.framework */; };
 		A99789AF1CD3D4E2005E7DAC /* Hologram.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A99789831CD3D4E2005E7DAC /* Hologram.cpp */; };
 		A99789B01CD3D4E2005E7DAC /* Hologram.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A99789831CD3D4E2005E7DAC /* Hologram.cpp */; };
 		A99789B11CD3D4E2005E7DAC /* Hologram.frag in Resources */ = {isa = PBXBuildFile; fileRef = A99789841CD3D4E2005E7DAC /* Hologram.frag */; };
@@ -130,7 +129,6 @@
 			files = (
 				A9F4FB4A1CF688A5003FA0C3 /* MoltenVK.framework in Frameworks */,
 				A9F4FB4F1CF68C79003FA0C3 /* MoltenVKGLSLToSPIRVConverter.framework in Frameworks */,
-				A9096E531F7EF13000DFBEA6 /* IOSurface.framework in Frameworks */,
 				A9F4FB481CF6882E003FA0C3 /* libc++.tbd in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
diff --git a/Docs/MoltenVK_Runtime_UserGuide.md b/Docs/MoltenVK_Runtime_UserGuide.md
index fcc6c62..f5ccf8f 100644
--- a/Docs/MoltenVK_Runtime_UserGuide.md
+++ b/Docs/MoltenVK_Runtime_UserGuide.md
@@ -112,8 +112,11 @@
       found in the **MoltenVK** distribution package.
     - If building for *macOS*, add an entry that points to the `MoltenVK/macOS` folder, 
       found in the **MoltenVK** distribution package.
-   
-3. On the *Build Phases* tab, open the *Link Binary With Libraries* list.
+
+3. If using `IOSurfaces` on *iOS*, in the *Build Settings* tab, open the **iOS Deployment Target** 
+   (aka `IPHONEOS_DEPLOYMENT_TARGET`) setting, and ensure it is set to a value of `iOS 11.0` or greater.
+
+4. On the *Build Phases* tab, open the *Link Binary With Libraries* list.
 
    1. Drag the `MoltenVK/iOS/MoltenVK.framework` or `MoltenVK/macOS/MoltenVK.framework` folder, 
       found  in the **MoltenVK** distribution package, to the *Link Binary With Libraries* list.
@@ -122,13 +125,13 @@
       **Enable Modules (C and Objective-C** (aka `CLANG_ENABLE_MODULES`) settings enabled, click the 
       **+** button, and (selecting from the list of system frameworks) add the following frameworks:
 		- `Metal.framework`
-		- `IOSurface.framework`
+		- `Foundation.framework`.
 		- `QuartzCore.framework`
 		- `IOKit.framework` (*macOS*)
 		- `UIKit.framework` (*iOS*)
-		- `Foundation.framework`.
+		- `IOSurface.framework` (*macOS*, or *iOS* if `IPHONEOS_DEPLOYMENT_TARGET` is at least `iOS 11.0`)
 
-4. When a *Metal* app is running from *Xcode*, the default ***Scheme*** settings reduce
+5. When a *Metal* app is running from *Xcode*, the default ***Scheme*** settings reduce
    performance. To improve performance and gain the benefits of *Metal*, perform the 
    following in *Xcode*:
    
@@ -172,7 +175,10 @@
         either `@executable_path` or `@loader_path`. The `libMoltenVK.dylib` library is internally 
         configured to be located at `@rpath/libMoltenVK.dylib`.
 
-3. On the *Build Phases* tab, open the *Link Binary With Libraries* list.
+3. If using `IOSurfaces` on *iOS*, in the *Build Settings* tab, open the **iOS Deployment Target** 
+   (aka `IPHONEOS_DEPLOYMENT_TARGET`) setting, and ensure it is set to a value of `iOS 11.0` or greater.
+
+4. On the *Build Phases* tab, open the *Link Binary With Libraries* list.
 
    1. Drag the `MoltenVK/iOS/libMoltenVK.dylib` or `MoltenVK/macOS/libMoltenVK.dylib` file, 
       found  in the **MoltenVK** distribution package, to the *Link Binary With Libraries* list.
@@ -181,13 +187,13 @@
       **Enable Modules (C and Objective-C** (aka `CLANG_ENABLE_MODULES`) settings enabled, click the 
       **+** button, and (selecting from the list of system frameworks) add the following frameworks:
 		- `Metal.framework`
-		- `IOSurface.framework`
+		- `Foundation.framework`.
 		- `QuartzCore.framework`
 		- `IOKit.framework` (*macOS*)
 		- `UIKit.framework` (*iOS*)
-		- `Foundation.framework`.
+		- `IOSurface.framework` (*macOS*, or *iOS* if `IPHONEOS_DEPLOYMENT_TARGET` is at least `iOS 11.0`)
 
-4. Arrange to install the `libMoltenVK.dylib` file in your application environment:
+5. Arrange to install the `libMoltenVK.dylib` file in your application environment:
 
    - To copy the `libMoltenVK.dylib` file into your application or component library:
         1. On the *Build Phases* tab, add a new *Copy Files* build phase.
diff --git a/ExternalRevisions/SPIRV-Cross_repo_revision b/ExternalRevisions/SPIRV-Cross_repo_revision
index 3c97b23..0b88db2 100644
--- a/ExternalRevisions/SPIRV-Cross_repo_revision
+++ b/ExternalRevisions/SPIRV-Cross_repo_revision
@@ -1 +1 @@
-a6814a405abe81545bd3b0a50d374735001173c1
+be7425ef70231ab82930331959ab487d605d0482
diff --git a/MoltenVK/MoltenVK.xcodeproj/project.pbxproj b/MoltenVK/MoltenVK.xcodeproj/project.pbxproj
index 0be64fb..29d0753 100644
--- a/MoltenVK/MoltenVK.xcodeproj/project.pbxproj
+++ b/MoltenVK/MoltenVK.xcodeproj/project.pbxproj
@@ -806,7 +806,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "set -e\n\nexport MVK_PROD_NAME=\"MoltenVK\"\nexport MVK_DYLIB_NAME=\"lib${MVK_PROD_NAME}.dylib\"\nexport MVK_BUILT_PROD_PATH=\"${BUILT_PRODUCTS_DIR}\"\nexport MVK_SYS_FWK_DIR=\"${SDK_DIR}/System/Library/Frameworks\"\nexport MVK_USR_LIB_DIR=\"${SDK_DIR}/usr/lib\"\n\nclang \\\n-dynamiclib \\\n-arch x86_64 \\\n-mmacosx-version-min=10.11 \\\n-compatibility_version 1.0.0 -current_version 1.0.0  \\\n-install_name \"@rpath/${MVK_DYLIB_NAME}\"  \\\n-Wno-incompatible-sysroot \\\n-isysroot ${SDK_DIR} \\\n-iframework ${MVK_SYS_FWK_DIR}  \\\n-framework Metal -framework IOSurface -framework IOKit -framework QuartzCore -framework Foundation \\\n--library-directory ${MVK_USR_LIB_DIR} \\\n-lSystem  -lc++ \\\n-o \"${MVK_BUILT_PROD_PATH}/${MVK_DYLIB_NAME}\" \\\n-force_load \"${MVK_BUILT_PROD_PATH}/${MVK_PROD_NAME}.framework/${MVK_PROD_NAME}\"\n";
+			shellScript = "set -e\n\nexport MVK_PROD_NAME=\"MoltenVK\"\nexport MVK_DYLIB_NAME=\"lib${MVK_PROD_NAME}.dylib\"\nexport MVK_BUILT_PROD_PATH=\"${BUILT_PRODUCTS_DIR}\"\nexport MVK_SYS_FWK_DIR=\"${SDK_DIR}/System/Library/Frameworks\"\nexport MVK_USR_LIB_DIR=\"${SDK_DIR}/usr/lib\"\n\nclang \\\n-dynamiclib \\\n-arch x86_64 \\\n-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET} \\\n-compatibility_version 1.0.0 -current_version 1.0.0  \\\n-install_name \"@rpath/${MVK_DYLIB_NAME}\"  \\\n-Wno-incompatible-sysroot \\\n-isysroot ${SDK_DIR} \\\n-iframework ${MVK_SYS_FWK_DIR}  \\\n-framework Metal -framework IOSurface -framework IOKit -framework QuartzCore -framework Foundation \\\n--library-directory ${MVK_USR_LIB_DIR} \\\n-lSystem  -lc++ \\\n-o \"${MVK_BUILT_PROD_PATH}/${MVK_DYLIB_NAME}\" \\\n-force_load \"${MVK_BUILT_PROD_PATH}/${MVK_PROD_NAME}.framework/${MVK_PROD_NAME}\"\n";
 		};
 		A9731FAD1EDDAE39006B7298 /* Create Dynamic Library */ = {
 			isa = PBXShellScriptBuildPhase;
@@ -820,7 +820,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "set -e\n\nexport MVK_PROD_NAME=\"MoltenVK\"\nexport MVK_DYLIB_NAME=\"lib${MVK_PROD_NAME}.dylib\"\nexport MVK_BUILT_PROD_PATH=\"${BUILT_PRODUCTS_DIR}\"\nexport MVK_SYS_FWK_DIR=\"${SDK_DIR}/System/Library/Frameworks\"\nexport MVK_USR_LIB_DIR=\"${SDK_DIR}/usr/lib\"\n\nclang \\\n-dynamiclib \\\n-arch arm64 \\\n-mios-version-min=9.0  \\\n-compatibility_version 1.0.0 -current_version 1.0.0  \\\n-install_name \"@rpath/${MVK_DYLIB_NAME}\"  \\\n-Wno-incompatible-sysroot \\\n-isysroot ${SDK_DIR} \\\n-iframework ${MVK_SYS_FWK_DIR}  \\\n-framework Metal -framework UIKit -framework QuartzCore -framework Foundation \\\n--library-directory ${MVK_USR_LIB_DIR} \\\n-lSystem  -lc++ \\\n-o \"${MVK_BUILT_PROD_PATH}/${MVK_DYLIB_NAME}\" \\\n-force_load \"${MVK_BUILT_PROD_PATH}/${MVK_PROD_NAME}.framework/${MVK_PROD_NAME}\"\n";
+			shellScript = "set -e\n\nexport MVK_PROD_NAME=\"MoltenVK\"\nexport MVK_DYLIB_NAME=\"lib${MVK_PROD_NAME}.dylib\"\nexport MVK_BUILT_PROD_PATH=\"${BUILT_PRODUCTS_DIR}\"\nexport MVK_SYS_FWK_DIR=\"${SDK_DIR}/System/Library/Frameworks\"\nexport MVK_USR_LIB_DIR=\"${SDK_DIR}/usr/lib\"\n\n# Do not link to IOSurface if deploying to iOS versions below 11.0, doing so will\n# link IOSurface as a private framework, which will trigger App Store rejection.\nif [ $(echo \"${IPHONEOS_DEPLOYMENT_TARGET} >= 11.0\" | bc) -eq 1 ]\nthen\n    export MVK_IOSURFACE_FWK=\"-framework IOSurface\"\nelse\n    export MVK_IOSURFACE_FWK=\"\"\nfi\n\nclang \\\n-dynamiclib \\\n-arch arm64 \\\n-mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET}  \\\n-compatibility_version 1.0.0 -current_version 1.0.0  \\\n-install_name \"@rpath/${MVK_DYLIB_NAME}\"  \\\n-Wno-incompatible-sysroot \\\n-isysroot ${SDK_DIR} \\\n-iframework ${MVK_SYS_FWK_DIR}  \\\n-framework Metal ${MVK_IOSURFACE_FWK} -framework UIKit -framework QuartzCore -framework Foundation \\\n--library-directory ${MVK_USR_LIB_DIR} \\\n-lSystem  -lc++ \\\n-o \"${MVK_BUILT_PROD_PATH}/${MVK_DYLIB_NAME}\" \\\n-force_load \"${MVK_BUILT_PROD_PATH}/${MVK_PROD_NAME}.framework/${MVK_PROD_NAME}\"\n";
 		};
 /* End PBXShellScriptBuildPhase section */
 
@@ -940,7 +940,9 @@
 		A9B8EE1E1A98D796009C5A02 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
 				SDKROOT = iphoneos;
+				TARGETED_DEVICE_FAMILY = "1,2";
 				VALID_ARCHS = arm64;
 			};
 			name = Debug;
@@ -948,7 +950,9 @@
 		A9B8EE1F1A98D796009C5A02 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
 				SDKROOT = iphoneos;
+				TARGETED_DEVICE_FAMILY = "1,2";
 				VALID_ARCHS = arm64;
 			};
 			name = Release;
@@ -956,6 +960,7 @@
 		A9CBEDFF1B6299D800E45FDC /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				MACOSX_DEPLOYMENT_TARGET = 10.11;
 				SDKROOT = macosx;
 				VALID_ARCHS = x86_64;
 			};
@@ -964,6 +969,7 @@
 		A9CBEE001B6299D800E45FDC /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				MACOSX_DEPLOYMENT_TARGET = 10.11;
 				SDKROOT = macosx;
 				VALID_ARCHS = x86_64;
 			};
@@ -1019,14 +1025,11 @@
 					"\"$(SRCROOT)/../MoltenVKShaderConverter\"",
 					"\"$(SRCROOT)/../External/cereal/include\"",
 				);
-				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
 				MACH_O_TYPE = staticlib;
-				MACOSX_DEPLOYMENT_TARGET = 10.11;
 				MTL_ENABLE_DEBUG_INFO = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				PRODUCT_NAME = MoltenVK;
 				SKIP_INSTALL = YES;
-				TARGETED_DEVICE_FAMILY = "1,2";
 			};
 			name = Debug;
 		};
@@ -1077,13 +1080,10 @@
 					"\"$(SRCROOT)/../MoltenVKShaderConverter\"",
 					"\"$(SRCROOT)/../External/cereal/include\"",
 				);
-				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
 				MACH_O_TYPE = staticlib;
-				MACOSX_DEPLOYMENT_TARGET = 10.11;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				PRODUCT_NAME = MoltenVK;
 				SKIP_INSTALL = YES;
-				TARGETED_DEVICE_FAMILY = "1,2";
 				VALIDATE_PRODUCT = YES;
 			};
 			name = Release;
diff --git a/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h b/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h
index 71496d4..c130a7c 100644
--- a/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h
+++ b/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h
@@ -48,7 +48,7 @@
  */
 #define MVK_VERSION_MAJOR   1
 #define MVK_VERSION_MINOR   0
-#define MVK_VERSION_PATCH   14
+#define MVK_VERSION_PATCH   15
 
 #define MVK_MAKE_VERSION(major, minor, patch)    (((major) * 10000) + ((minor) * 100) + (patch))
 #define MVK_VERSION     MVK_MAKE_VERSION(MVK_VERSION_MAJOR, MVK_VERSION_MINOR, MVK_VERSION_PATCH)
@@ -275,6 +275,14 @@
  *
  * If a MTLTexture has already been created for this image, it will be destroyed.
  *
+ * IOSurfaces are supported on the following platforms:
+ *   -  macOS 10.11 and above
+ *   -  iOS 11.0 and above
+ *
+ * To enable IOSurface support, ensure the Deployment Target build setting
+ * (MACOSX_DEPLOYMENT_TARGET or IPHONEOS_DEPLOYMENT_TARGET) is set to at least
+ * one of the values above when compiling MoltenVK, and any app that uses MoltenVK.
+ *
  * Returns:
  *   - VK_SUCCESS.
  *   - VK_ERROR_FEATURE_NOT_PRESENT if IOSurfaces are not supported on the platform.
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
index 10528b6..68fbf46 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
@@ -49,20 +49,6 @@
 #	define MVKViewClass		NSView
 #endif
 
-// To present surface using a command buffer, define the MVK_PRESENT_WITHOUT_COMMAND_BUFFER build setting.
-#ifdef MVK_PRESENT_WITHOUT_COMMAND_BUFFER
-#   define MVK_PRESENT_WITH_COMMAND_BUFFER_BOOL    0
-#else
-#   define MVK_PRESENT_WITH_COMMAND_BUFFER_BOOL    1
-#endif
-
-// To display the MoltenVK logo watermark by default, define the MVK_DISPLAY_WATERMARK build setting.
-#ifdef MVK_DISPLAY_WATERMARK
-#   define MVK_DISPLAY_WATERMARK_BOOL    1
-#else
-#   define MVK_DISPLAY_WATERMARK_BOOL    0
-#endif
-
 
 #pragma mark -
 #pragma mark MVKPhysicalDevice
@@ -322,6 +308,8 @@
     _metalFeatures.maxPerStageSamplerCount = 16;
     _metalFeatures.maxQueryBufferSize = (64 * KIBI);
 
+	_metalFeatures.ioSurfaces = MVK_SUPPORT_IOSURFACE_BOOL;
+
 #if MVK_IOS
     _metalFeatures.mslVersion = SPIRVToMSLConverterOptions::makeMSLVersion(1);
     _metalFeatures.maxPerStageTextureCount = 31;
@@ -329,7 +317,6 @@
 	_metalFeatures.mtlCopyBufferAlignment = 1;
     _metalFeatures.texelBuffers = true;
 	_metalFeatures.maxTextureDimension = (4 * KIBI);
-	_metalFeatures.ioSurfaces = false;
 
     if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily1_v2] ) {
         _metalFeatures.mslVersion = SPIRVToMSLConverterOptions::makeMSLVersion(1, 1);
@@ -362,7 +349,6 @@
 	_metalFeatures.mtlCopyBufferAlignment = 4;
 	_metalFeatures.indirectDrawing = true;
 	_metalFeatures.baseVertexInstanceDrawing = true;
-    _metalFeatures.ioSurfaces = true;
     _metalFeatures.depthClipMode = true;
 	_metalFeatures.maxTextureDimension = (16 * KIBI);
 
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm b/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm
index f0d7d32..001b856 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm
@@ -304,7 +304,7 @@
 
     if (!_device->_pMetalFeatures->ioSurfaces) { return mvkNotifyErrorWithText(VK_ERROR_FEATURE_NOT_PRESENT, "vkUseIOSurfaceMVK() : IOSurfaces are not supported on this platform."); }
 
-#if !MVK_IOS
+#if MVK_SUPPORT_IOSURFACE_BOOL
 
     resetMTLTexture();
     resetIOSurface();
@@ -334,7 +334,7 @@
     }
 
 #endif
-	
+
     return VK_SUCCESS;
 }
 
diff --git a/MoltenVK/MoltenVK/Utility/MVKEnvironment.h b/MoltenVK/MoltenVK/Utility/MVKEnvironment.h
index c18ac66..d322eb9 100644
--- a/MoltenVK/MoltenVK/Utility/MVKEnvironment.h
+++ b/MoltenVK/MoltenVK/Utility/MVKEnvironment.h
@@ -39,3 +39,32 @@
                                                                     VK_VERSION_MINOR(api_ver),	\
                                                                     0)
 
+/** To present surface using a command buffer, define the MVK_PRESENT_WITHOUT_COMMAND_BUFFER build setting. */
+#ifdef MVK_PRESENT_WITHOUT_COMMAND_BUFFER
+#   define MVK_PRESENT_WITH_COMMAND_BUFFER_BOOL    0
+#else
+#   define MVK_PRESENT_WITH_COMMAND_BUFFER_BOOL    1
+#endif
+
+/** To display the MoltenVK logo watermark by default, define the MVK_DISPLAY_WATERMARK build setting. */
+#ifdef MVK_DISPLAY_WATERMARK
+#   define MVK_DISPLAY_WATERMARK_BOOL    1
+#else
+#   define MVK_DISPLAY_WATERMARK_BOOL    0
+#endif
+
+
+/**
+ * IOSurfaces are supported on macOS, and on iOS starting with iOS 11.
+ *
+ * To enable IOSurface support on iOS in MoltenVK, set the iOS Deployment Target
+ * (IPHONEOS_DEPLOYMENT_TARGET) build setting to 11.0 or greater when building
+ * MoltenVK, and any app that uses IOSurfaces.
+ */
+#if MVK_MACOS
+#	define MVK_SUPPORT_IOSURFACE_BOOL    1
+#endif
+
+#if MVK_IOS
+#	define MVK_SUPPORT_IOSURFACE_BOOL	(__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_11_0)
+#endif
diff --git a/README.md b/README.md
index a103621..745514c 100644
--- a/README.md
+++ b/README.md
@@ -108,6 +108,10 @@
 - Information on compatible *iOS* devices that are compatible with *Metal* can be found in 
   [this article](https://developer.apple.com/library/content/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/HardwareGPUInformation/HardwareGPUInformation.html).
 
+>***Note:*** To support `IOSurfaces` on *iOS*, **MoltenVK**, and any app that uses **MoltenVK**, 
+must be built with a minimum **iOS Deployment Target** (aka `IPHONEOS_DEPLOYMENT_TARGET `) build 
+setting of `iOS 11.0` or greater.
+
 The `MoltenVKPackaging.xcodeproj` *Xcode* project contains targets and schemes to build 
 and package the entire **MoltenVK** runtime distribution package, or to build individual 
 **MoltenVK** or **MoltenVKShaderConverter** components.