Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove use of @available() directive as it can cause issues in some build environments. #914

Merged
merged 4 commits into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Common/MVKOSExtensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@

#pragma once

#include "MVKCommonEnvironment.h"
#include <dispatch/dispatch.h>
#include <string>
#include <limits>


typedef float MVKOSVersion;

/*** Constant indicating unsupported functionality in an OS. */
static const MVKOSVersion kMVKOSVersionUnsupported = std::numeric_limits<MVKOSVersion>::max();

/**
* Returns the operating system version as an MVKOSVersion, which is a float in which the
* whole number portion indicates the major version, and the fractional portion indicates
Expand All @@ -33,9 +38,29 @@ typedef float MVKOSVersion;
*/
MVKOSVersion mvkOSVersion();

/** Returns a MVKOSVersion built from the version components. */
inline MVKOSVersion mvkMakeOSVersion(uint32_t major, uint32_t minor, uint32_t patch) {
return (float)major + ((float)minor / 100.0f) + ((float)patch / 10000.0f);
}

/** Returns whether the operating system version is at least minVer. */
inline bool mvkOSVersionIsAtLeast(MVKOSVersion minVer) { return mvkOSVersion() >= minVer; }

/**
* Returns whether the operating system version is at least the appropriate min version.
* The constant kMVKOSVersionUnsupported can be used for either value to cause the test
* to always fail on that OS, which is useful for indidicating functionalty guarded by
* this test is not supported on that OS.
*/
inline bool mvkOSVersionIsAtLeast(MVKOSVersion macOSMinVer, MVKOSVersion iOSMinVer) {
#if MVK_MACOS
return mvkOSVersionIsAtLeast(macOSMinVer);
#endif
#if MVK_IOS
return mvkOSVersionIsAtLeast(iOSMinVer);
#endif
}

/**
* Returns a monotonic timestamp value for use in Vulkan and performance timestamping.
*
Expand Down
16 changes: 6 additions & 10 deletions Common/MVKOSExtensions.mm
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,13 @@

using namespace std;

static const MVKOSVersion kMVKOSVersionUnknown = 0.0f;
static MVKOSVersion _mvkOSVersion = kMVKOSVersionUnknown;
MVKOSVersion mvkOSVersion() {
if (_mvkOSVersion == kMVKOSVersionUnknown) {
NSOperatingSystemVersion osVer = [[NSProcessInfo processInfo] operatingSystemVersion];
float maj = osVer.majorVersion;
float min = osVer.minorVersion;
float pat = osVer.patchVersion;
_mvkOSVersion = maj + (min / 100.0f) + + (pat / 10000.0f);
}
return _mvkOSVersion;
static MVKOSVersion _mvkOSVersion = 0;
if ( !_mvkOSVersion ) {
NSOperatingSystemVersion osVer = [[NSProcessInfo processInfo] operatingSystemVersion];
_mvkOSVersion = mvkMakeOSVersion((uint32_t)osVer.majorVersion, (uint32_t)osVer.minorVersion, (uint32_t)osVer.patchVersion);
}
return _mvkOSVersion;
}

static uint64_t _mvkTimestampBase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,6 @@
PRODUCT_NAME = "API-Samples";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = arm64;
};
name = Debug;
};
Expand All @@ -681,7 +680,6 @@
PRODUCT_NAME = "API-Samples";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = arm64;
};
name = Release;
};
Expand Down Expand Up @@ -738,6 +736,7 @@
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -768,6 +767,7 @@
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down
17 changes: 2 additions & 15 deletions Demos/LunarG-VulkanSamples/API-Samples/generateSPIRVShaders
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,14 @@
set -e

echo
echo ========== Building MoltenVKShaderConverter tool ==========
echo ========== Converting API-Samples shader files ==========
echo

cd "../../.."

XC_PROJ="MoltenVKPackaging.xcodeproj"
XC_SCHEME="MVKShaderConverterTool Package"

xcodebuild \
-project "MoltenVKPackaging.xcodeproj" \
-scheme "MVKShaderConverterTool Package" \
-quiet \
build

echo
echo ========== Converting API-Samples shader files ==========
echo

"Package/Latest/MoltenVKShaderConverter/Tools/MoltenVKShaderConverter" \
-r -gi -so -oh -xs . -q \
-d "Demos/LunarG-VulkanSamples/VulkanSamples/API-Samples"
-d "Demos/LunarG-VulkanSamples/VulkanSamples/API-Samples" > /dev/null

cd - > /dev/null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@
PRODUCT_NAME = Cube;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = arm64;
};
name = Debug;
};
Expand All @@ -380,13 +379,13 @@
PRODUCT_NAME = Cube;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = arm64;
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -417,6 +416,7 @@
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@
LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../../../MoltenVK/iOS/static\"";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = arm64;
};
name = Debug;
};
Expand All @@ -375,7 +374,6 @@
LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../../../MoltenVK/iOS/static\"";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = arm64;
};
name = Release;
};
Expand Down Expand Up @@ -416,6 +414,7 @@
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -448,6 +447,7 @@
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down
10 changes: 10 additions & 0 deletions Docs/Whats_New.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ For best results, use a Markdown reader.*



MoltenVK 1.0.44
---------------

Released TBD

- Remove use of `@available()` directive as it was causing issues in some build environments
- Refactor **MoltenVK** *Xcode* build architectures
- Demo `API-Samples generateSPIRVShaders` no longer builds `MoltenVKShaderController` tool.


MoltenVK 1.0.43
---------------

Expand Down
32 changes: 2 additions & 30 deletions ExternalDependencies.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3720,34 +3720,24 @@
A90FD89D21CC4EAB00B92BB2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = arm64;
BITCODE_GENERATION_MODE = bitcode;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"SPIRV_CROSS_NAMESPACE_OVERRIDE=MVK_spirv_cross",
);
PRODUCT_NAME = SPIRVCross;
SDKROOT = iphoneos;
VALID_ARCHS = arm64;
};
name = Debug;
};
A90FD89E21CC4EAB00B92BB2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = arm64;
BITCODE_GENERATION_MODE = bitcode;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"SPIRV_CROSS_NAMESPACE_OVERRIDE=MVK_spirv_cross",
);
PRODUCT_NAME = SPIRVCross;
SDKROOT = iphoneos;
VALID_ARCHS = arm64;
};
name = Release;
};
Expand Down Expand Up @@ -3826,10 +3816,6 @@
A972A80D21CECBBF0013AB25 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = arm64;
BITCODE_GENERATION_MODE = bitcode;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEPLOYMENT_POSTPROCESSING = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
HEADER_SEARCH_PATHS = (
Expand All @@ -3841,17 +3827,12 @@
);
PRODUCT_NAME = SPIRVTools;
SDKROOT = iphoneos;
VALID_ARCHS = arm64;
};
name = Debug;
};
A972A80E21CECBBF0013AB25 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = arm64;
BITCODE_GENERATION_MODE = bitcode;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEPLOYMENT_POSTPROCESSING = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
HEADER_SEARCH_PATHS = (
Expand All @@ -3863,7 +3844,6 @@
);
PRODUCT_NAME = SPIRVTools;
SDKROOT = iphoneos;
VALID_ARCHS = arm64;
};
name = Release;
};
Expand Down Expand Up @@ -3904,11 +3884,7 @@
A972ABDA21CED7BC0013AB25 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = arm64;
BITCODE_GENERATION_MODE = bitcode;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = NO;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"AMD_EXTENSIONS=1",
Expand All @@ -3924,18 +3900,13 @@
);
PRODUCT_NAME = glslang;
SDKROOT = iphoneos;
VALID_ARCHS = arm64;
};
name = Debug;
};
A972ABDB21CED7BC0013AB25 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = arm64;
BITCODE_GENERATION_MODE = bitcode;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = NO;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"AMD_EXTENSIONS=1",
Expand All @@ -3951,7 +3922,6 @@
);
PRODUCT_NAME = glslang;
SDKROOT = iphoneos;
VALID_ARCHS = arm64;
};
name = Release;
};
Expand Down Expand Up @@ -4003,6 +3973,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = NO;
Expand Down Expand Up @@ -4050,6 +4021,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = NO;
Expand Down
10 changes: 2 additions & 8 deletions MoltenVK/MoltenVK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1146,24 +1146,18 @@
A9B8EE1E1A98D796009C5A02 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = arm64;
BITCODE_GENERATION_MODE = bitcode;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = arm64;
};
name = Debug;
};
A9B8EE1F1A98D796009C5A02 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = arm64;
BITCODE_GENERATION_MODE = bitcode;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = arm64;
};
name = Release;
};
Expand All @@ -1172,7 +1166,6 @@
buildSettings = {
MACOSX_DEPLOYMENT_TARGET = 10.11;
SDKROOT = macosx;
VALID_ARCHS = x86_64;
};
name = Debug;
};
Expand All @@ -1181,14 +1174,14 @@
buildSettings = {
MACOSX_DEPLOYMENT_TARGET = 10.11;
SDKROOT = macosx;
VALID_ARCHS = x86_64;
};
name = Release;
};
A9F55D3F198BE6A8004EC31B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = NO;
Expand Down Expand Up @@ -1249,6 +1242,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = NO;
Expand Down
Loading