Compare commits

...

1 Commits

Author SHA1 Message Date
Benjamin Doherty
a57c1e6a79 Add OpenGL with Metal sample project 2022-03-15 12:10:45 -07:00
26 changed files with 1932 additions and 0 deletions

View File

@@ -0,0 +1,205 @@
---
Language: ObjC
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: DontAlign
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignOperands: DontAlign
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 8
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: true
DisableFormat: false
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
StatementAttributeLikeMacros:
- Q_EMIT
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 3
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PenaltyIndentedWhitespace: 0
PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
- ParseTestProto
- ParsePartialTestProto
CanonicalDelimiter: pb
BasedOnStyle: google
ReflowComments: true
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Auto
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...

View File

@@ -0,0 +1,4 @@
## User settings
xcuserdata/
/generated/

View File

@@ -0,0 +1,21 @@
material {
name : SampleExternalTexture,
requires : [
color
],
parameters : [
{
type : samplerExternal,
name : texture
}
],
shadingModel : unlit,
culling : none
}
fragment {
void material(inout MaterialInputs material) {
prepareMaterial(material);
material.baseColor.rgb = texture(materialParams_texture, getColor().rg).rgb;
}
}

View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -e
# Compile SampleExternalTexture material.
HOST_TOOLS_PATH="${HOST_TOOLS_PATH:-../../../out/release/filament/bin}"
matc_path=`find ${HOST_TOOLS_PATH} -name matc -type f | head -n 1`
if [[ ! -e "${matc_path}" ]]; then
echo "error: No matc binary could be found in ${HOST_TOOLS_PATH}."
echo "error: Ensure Filament has been built/installed before building this app."
exit 1
fi
mkdir -p "${PROJECT_DIR}/generated/"
"${matc_path}" \
--api all \
-f header \
-o "${PROJECT_DIR}/generated/SampleExternalTexture.inc" \
"${PROJECT_DIR}/Materials/SampleExternalTexture.mat"
# FilamentView.mm includes the material, so touch it to force Xcode to recompile it.
touch "${PROJECT_DIR}/opengl-with-metal/FilamentView.mm"

View File

@@ -0,0 +1,626 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objects = {
/* Begin PBXBuildFile section */
037381A6D6D13AA13D79563D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 043060C4DDB4C47C75EF968B /* main.m */; };
0AB8534CB26606AA32916007 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1125C700035D85226683BA8B /* LaunchScreen.storyboard */; };
17F46E446C53C4FC74B03678 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 35349C2A02D7529C9C4BCF6B /* ViewController.m */; };
281DC60C812C87E85F2CE221 /* OpenGLRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = CCA67E7698F0B56AD9A58A48 /* OpenGLRenderer.m */; };
85405FFC40B21CF740624319 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 706A1DC52266EF64E14FF640 /* Main.storyboard */; };
C89FD0AED426B0ACD72D60EA /* FilamentView.mm in Sources */ = {isa = PBXBuildFile; fileRef = CB6C5FD88C436000DD965ADC /* FilamentView.mm */; };
C934369EA0A94C164389D173 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ED4585D5DADDFE0F6A4D062A /* AppDelegate.m */; };
CDB6574385173B1ED32A378A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 98FC2E89E9A22E81B48E07F1 /* Assets.xcassets */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
043060C4DDB4C47C75EF968B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
13E13F807CB56F3012F2754A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
35349C2A02D7529C9C4BCF6B /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
41CD4384CEA9A27EAD1F4E78 /* OpenGLRenderer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenGLRenderer.h; sourceTree = "<group>"; };
41D5A62743118906B18CE880 /* FilamentView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilamentView.h; sourceTree = "<group>"; };
50812F7C66F0097C3B943196 /* SampleExternalTexture.mat */ = {isa = PBXFileReference; path = SampleExternalTexture.mat; sourceTree = "<group>"; };
8EF3BD853AAF0BBF9C91E2D1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
98FC2E89E9A22E81B48E07F1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
ACC14CCCD1CA04F4149A01DC /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
C259E1FF8EB7FA3967CDF382 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
CB6C5FD88C436000DD965ADC /* FilamentView.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FilamentView.mm; sourceTree = "<group>"; };
CCA67E7698F0B56AD9A58A48 /* OpenGLRenderer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OpenGLRenderer.m; sourceTree = "<group>"; };
E8488AEBE47D01C1113CE9A7 /* opengl-with-metal.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = "opengl-with-metal.app"; sourceTree = BUILT_PRODUCTS_DIR; };
ED4585D5DADDFE0F6A4D062A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
F19281C87D7C0055DA3B529E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
45D2C566E5728D79A7DC3D51 /* opengl-with-metal */ = {
isa = PBXGroup;
children = (
8EF3BD853AAF0BBF9C91E2D1 /* AppDelegate.h */,
ED4585D5DADDFE0F6A4D062A /* AppDelegate.m */,
98FC2E89E9A22E81B48E07F1 /* Assets.xcassets */,
41D5A62743118906B18CE880 /* FilamentView.h */,
CB6C5FD88C436000DD965ADC /* FilamentView.mm */,
C259E1FF8EB7FA3967CDF382 /* Info.plist */,
1125C700035D85226683BA8B /* LaunchScreen.storyboard */,
043060C4DDB4C47C75EF968B /* main.m */,
706A1DC52266EF64E14FF640 /* Main.storyboard */,
41CD4384CEA9A27EAD1F4E78 /* OpenGLRenderer.h */,
CCA67E7698F0B56AD9A58A48 /* OpenGLRenderer.m */,
ACC14CCCD1CA04F4149A01DC /* ViewController.h */,
35349C2A02D7529C9C4BCF6B /* ViewController.m */,
);
path = "opengl-with-metal";
sourceTree = "<group>";
};
60AE3AE6BBC783E012B39C42 = {
isa = PBXGroup;
children = (
8B665C7F795FAFD5DC243AB4 /* Materials */,
45D2C566E5728D79A7DC3D51 /* opengl-with-metal */,
A9B12968D94EB2DAA0D1AE8F /* Products */,
);
sourceTree = "<group>";
};
8B665C7F795FAFD5DC243AB4 /* Materials */ = {
isa = PBXGroup;
children = (
50812F7C66F0097C3B943196 /* SampleExternalTexture.mat */,
);
path = Materials;
sourceTree = "<group>";
};
A9B12968D94EB2DAA0D1AE8F /* Products */ = {
isa = PBXGroup;
children = (
E8488AEBE47D01C1113CE9A7 /* opengl-with-metal.app */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
B0E1B421425E498202D23DDC /* opengl-with-metal */ = {
isa = PBXNativeTarget;
buildConfigurationList = 7E2F6625D421C5BF994E927A /* Build configuration list for PBXNativeTarget "opengl-with-metal" */;
buildPhases = (
01344766CBA21ABB00EAE5C6 /* Build Materials */,
E8415BEF9B975206B207CBE9 /* Sources */,
DB41346C969215BF2FE36E29 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "opengl-with-metal";
productName = "opengl-with-metal";
productReference = E8488AEBE47D01C1113CE9A7 /* opengl-with-metal.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
7EE573B8758F17CB9E2909BC /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1200;
TargetAttributes = {
};
};
buildConfigurationList = 8A2E8E30287A1D946C1876A1 /* Build configuration list for PBXProject "opengl-with-metal" */;
compatibilityVersion = "Xcode 10.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Base,
en,
);
mainGroup = 60AE3AE6BBC783E012B39C42;
projectDirPath = "";
projectRoot = "";
targets = (
B0E1B421425E498202D23DDC /* opengl-with-metal */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
DB41346C969215BF2FE36E29 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
CDB6574385173B1ED32A378A /* Assets.xcassets in Resources */,
0AB8534CB26606AA32916007 /* LaunchScreen.storyboard in Resources */,
85405FFC40B21CF740624319 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
01344766CBA21ABB00EAE5C6 /* Build Materials */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"$(SRCROOT)/Materials/SampleExternalTexture.mat",
);
name = "Build Materials";
outputFileListPaths = (
);
outputPaths = (
"$(SRCROOT)/generated/SampleExternalTexture.inc",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/usr/bin/env bash\n\nset -e\n\n# Compile SampleExternalTexture material.\n\nHOST_TOOLS_PATH=\"${HOST_TOOLS_PATH:-../../../out/release/filament/bin}\"\nmatc_path=`find ${HOST_TOOLS_PATH} -name matc -type f | head -n 1`\n\nif [[ ! -e \"${matc_path}\" ]]; then\n echo \"error: No matc binary could be found in ${HOST_TOOLS_PATH}.\"\n echo \"error: Ensure Filament has been built/installed before building this app.\"\n exit 1\nfi\n\nmkdir -p \"${PROJECT_DIR}/generated/\"\n\"${matc_path}\" \\\n --api all \\\n -f header \\\n -o \"${PROJECT_DIR}/generated/SampleExternalTexture.inc\" \\\n \"${PROJECT_DIR}/Materials/SampleExternalTexture.mat\"\n\n# FilamentView.mm includes the material, so touch it to force Xcode to recompile it.\ntouch \"${PROJECT_DIR}/opengl-with-metal/FilamentView.mm\"\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
E8415BEF9B975206B207CBE9 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C934369EA0A94C164389D173 /* AppDelegate.m in Sources */,
C89FD0AED426B0ACD72D60EA /* FilamentView.mm in Sources */,
281DC60C812C87E85F2CE221 /* OpenGLRenderer.m in Sources */,
17F46E446C53C4FC74B03678 /* ViewController.m in Sources */,
037381A6D6D13AA13D79563D /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
1125C700035D85226683BA8B /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
F19281C87D7C0055DA3B529E /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
706A1DC52266EF64E14FF640 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
13E13F807CB56F3012F2754A /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
0697750BEA3FED3189ABC522 /* OpenGL Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
"FILAMENT_APP_USE_OPENGL=1",
"$(inherited)",
);
HEADER_SEARCH_PATHS = (
"../../../out/ios-debug/filament/include",
generated,
);
INFOPLIST_FILE = "opengl-with-metal/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"../../../out/ios-debug/filament/lib/$(CURRENT_ARCH)",
"../../../out/ios-debug/filament/lib/universal",
);
OTHER_LDFLAGS = (
"-lfilament",
"-lbackend",
"-lfilaflat",
"-lfilabridge",
"-lutils",
"-lsmol-v",
"-lgeometry",
"-libl",
);
PRODUCT_BUNDLE_IDENTIFIER = "${DEVELOPMENT_TEAM}.google.filament.opengl-with-metal";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "OpenGL Debug";
};
1CA256248CDBE5DFCD5C1C9E /* Metal Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
"FILAMENT_APP_USE_METAL=1",
"$(inherited)",
GLES_SILENCE_DEPRECATION,
);
HEADER_SEARCH_PATHS = (
"../../../out/ios-release/filament/include",
generated,
);
INFOPLIST_FILE = "opengl-with-metal/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"../../../out/ios-release/filament/lib/$(CURRENT_ARCH)",
"../../../out/ios-release/filament/lib/universal",
);
OTHER_LDFLAGS = (
"-lfilament",
"-lbackend",
"-lfilaflat",
"-lfilabridge",
"-lutils",
"-lsmol-v",
"-lgeometry",
"-libl",
);
PRODUCT_BUNDLE_IDENTIFIER = "${DEVELOPMENT_TEAM}.google.filament.opengl-with-metal";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Metal Release";
};
26B8BCC486630D414875157F /* Metal Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
};
name = "Metal Release";
};
51E0FD64D0A2B4B9074746FC /* Metal Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
"FILAMENT_APP_USE_METAL=1",
"$(inherited)",
GLES_SILENCE_DEPRECATION,
);
HEADER_SEARCH_PATHS = (
"../../../out/ios-debug/filament/include",
generated,
);
INFOPLIST_FILE = "opengl-with-metal/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"../../../out/ios-debug/filament/lib/$(CURRENT_ARCH)",
"../../../out/ios-debug/filament/lib/universal",
);
OTHER_LDFLAGS = (
"-lfilament",
"-lbackend",
"-lfilaflat",
"-lfilabridge",
"-lutils",
"-lsmol-v",
"-lgeometry",
"-libl",
);
PRODUCT_BUNDLE_IDENTIFIER = "${DEVELOPMENT_TEAM}.google.filament.opengl-with-metal";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Metal Debug";
};
746FA6C1260C45AA617BD733 /* OpenGL Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
};
name = "OpenGL Release";
};
7A2F8F7B6BC29576543AD605 /* Metal Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"DEBUG=1",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = "Metal Debug";
};
AAC44D4C5B652A94F9C06395 /* OpenGL Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
"FILAMENT_APP_USE_OPENGL=1",
"$(inherited)",
);
HEADER_SEARCH_PATHS = (
"../../../out/ios-release/filament/include",
generated,
);
INFOPLIST_FILE = "opengl-with-metal/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"../../../out/ios-release/filament/lib/$(CURRENT_ARCH)",
"../../../out/ios-release/filament/lib/universal",
);
OTHER_LDFLAGS = (
"-lfilament",
"-lbackend",
"-lfilaflat",
"-lfilabridge",
"-lutils",
"-lsmol-v",
"-lgeometry",
"-libl",
);
PRODUCT_BUNDLE_IDENTIFIER = "${DEVELOPMENT_TEAM}.google.filament.opengl-with-metal";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "OpenGL Release";
};
EED35A5981E8518C155F7C0D /* OpenGL Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"DEBUG=1",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = "OpenGL Debug";
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
7E2F6625D421C5BF994E927A /* Build configuration list for PBXNativeTarget "opengl-with-metal" */ = {
isa = XCConfigurationList;
buildConfigurations = (
51E0FD64D0A2B4B9074746FC /* Metal Debug */,
1CA256248CDBE5DFCD5C1C9E /* Metal Release */,
0697750BEA3FED3189ABC522 /* OpenGL Debug */,
AAC44D4C5B652A94F9C06395 /* OpenGL Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "Metal Debug";
};
8A2E8E30287A1D946C1876A1 /* Build configuration list for PBXProject "opengl-with-metal" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7A2F8F7B6BC29576543AD605 /* Metal Debug */,
26B8BCC486630D414875157F /* Metal Release */,
EED35A5981E8518C155F7C0D /* OpenGL Debug */,
746FA6C1260C45AA617BD733 /* OpenGL Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "Metal Debug";
};
/* End XCConfigurationList section */
};
rootObject = 7EE573B8758F17CB9E2909BC /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:opengl-with-metal.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B0E1B421425E498202D23DDC"
BuildableName = "opengl-with-metal.app"
BlueprintName = "opengl-with-metal"
ReferencedContainer = "container:opengl-with-metal.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Metal Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
onlyGenerateCoverageForSpecifiedTargets = "NO"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B0E1B421425E498202D23DDC"
BuildableName = "opengl-with-metal.app"
BlueprintName = "opengl-with-metal"
ReferencedContainer = "container:opengl-with-metal.xcodeproj">
</BuildableReference>
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
</TestAction>
<LaunchAction
buildConfiguration = "Metal Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B0E1B421425E498202D23DDC"
BuildableName = "opengl-with-metal.app"
BlueprintName = "opengl-with-metal"
ReferencedContainer = "container:opengl-with-metal.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
</CommandLineArguments>
</LaunchAction>
<ProfileAction
buildConfiguration = "Metal Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B0E1B421425E498202D23DDC"
BuildableName = "opengl-with-metal.app"
BlueprintName = "opengl-with-metal"
ReferencedContainer = "container:opengl-with-metal.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
</CommandLineArguments>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Metal Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Metal Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B0E1B421425E498202D23DDC"
BuildableName = "opengl-with-metal.app"
BlueprintName = "opengl-with-metal"
ReferencedContainer = "container:opengl-with-metal.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "OpenGL Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
onlyGenerateCoverageForSpecifiedTargets = "NO"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B0E1B421425E498202D23DDC"
BuildableName = "opengl-with-metal.app"
BlueprintName = "opengl-with-metal"
ReferencedContainer = "container:opengl-with-metal.xcodeproj">
</BuildableReference>
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
</TestAction>
<LaunchAction
buildConfiguration = "OpenGL Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B0E1B421425E498202D23DDC"
BuildableName = "opengl-with-metal.app"
BlueprintName = "opengl-with-metal"
ReferencedContainer = "container:opengl-with-metal.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
</CommandLineArguments>
</LaunchAction>
<ProfileAction
buildConfiguration = "OpenGL Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B0E1B421425E498202D23DDC"
BuildableName = "opengl-with-metal.app"
BlueprintName = "opengl-with-metal"
ReferencedContainer = "container:opengl-with-metal.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
</CommandLineArguments>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "OpenGL Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "OpenGL Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property(strong, nonatomic) UIWindow* window;
@end

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
@end

View File

@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC" customClass="FilamentView">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

View File

@@ -0,0 +1,21 @@
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <UIKit/UIKit.h>
@interface FilamentView : UIView
@end

View File

@@ -0,0 +1,330 @@
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "FilamentView.h"
#include <filament/Camera.h>
#include <filament/Engine.h>
#include <filament/IndexBuffer.h>
#include <filament/Material.h>
#include <filament/RenderableManager.h>
#include <filament/Renderer.h>
#include <filament/Scene.h>
#include <filament/Texture.h>
#include <filament/TextureSampler.h>
#include <filament/TransformManager.h>
#include <filament/VertexBuffer.h>
#include <filament/View.h>
#include <filament/Viewport.h>
#include <utils/EntityManager.h>
#include <CoreVideo/CoreVideo.h>
#import "OpenGLRenderer.h"
// These defines are set in the "Preprocessor Macros" build setting for each scheme.
#if !FILAMENT_APP_USE_METAL && !FILAMENT_APP_USE_OPENGL
#error A valid FILAMENT_APP_USE_ backend define must be set.
#endif
using namespace filament;
using utils::Entity;
using utils::EntityManager;
struct App {
VertexBuffer* vb;
IndexBuffer* ib;
Material* mat;
Texture* tex;
Entity renderable;
CVPixelBufferRef img;
};
struct Vertex {
filament::math::float2 position;
uint32_t color;
};
static const Vertex TRIANGLE_VERTICES[3] = {
{{1, 0}, 0xffff0000u},
{{cos(M_PI * 2 / 3), sin(M_PI * 2 / 3)}, 0xff00ff00u},
{{cos(M_PI * 4 / 3), sin(M_PI * 4 / 3)}, 0xff0000ffu},
};
static constexpr uint16_t TRIANGLE_INDICES[3] = {0, 1, 2};
// This file is compiled via the matc tool. See the "Run Script" build phase.
static constexpr uint8_t SAMPLE_EXTERNAL_TEXTURE_PACKAGE[] = {
#include "SampleExternalTexture.inc"
};
@implementation FilamentView {
Engine* engine;
Renderer* renderer;
Scene* scene;
View* filaView;
Camera* camera;
SwapChain* swapChain;
App app;
CADisplayLink* displayLink;
// The amount of rotation to apply to the camera to offset the device's rotation (in radians)
float deviceRotation;
float desiredRotation;
OpenGLRenderer* openglRenderer;
}
- (instancetype)initWithCoder:(NSCoder*)coder {
if (self = [super initWithCoder:coder]) {
#if FILAMENT_APP_USE_OPENGL
[self initializeGLLayer];
#elif FILAMENT_APP_USE_METAL
[self initializeMetalLayer];
#endif
openglRenderer = [OpenGLRenderer new];
[self initializeFilament];
self.contentScaleFactor = UIScreen.mainScreen.nativeScale;
}
// Call renderloop 60 times a second.
displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(renderloop)];
displayLink.preferredFramesPerSecond = 60;
[displayLink addToRunLoop:NSRunLoop.currentRunLoop forMode:NSDefaultRunLoopMode];
// Call didRotate when the device orientation changes.
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didRotate:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
return self;
}
- (void)dealloc {
engine->destroy(renderer);
engine->destroy(scene);
engine->destroy(filaView);
Entity c = camera->getEntity();
engine->destroyCameraComponent(c);
EntityManager::get().destroy(c);
engine->destroy(swapChain);
engine->destroy(&engine);
}
- (void)initializeMetalLayer {
#if METAL_AVAILABLE
CAMetalLayer* metalLayer = (CAMetalLayer*)self.layer;
metalLayer.pixelFormat = MTLPixelFormatBGRA8Unorm;
CGRect nativeBounds = [UIScreen mainScreen].nativeBounds;
metalLayer.drawableSize = nativeBounds.size;
#endif
}
- (void)initializeGLLayer {
CAEAGLLayer* glLayer = (CAEAGLLayer*)self.layer;
glLayer.opaque = YES;
}
- (void)initializeFilament {
#if FILAMENT_APP_USE_OPENGL
engine = Engine::create(filament::Engine::Backend::OPENGL);
#elif FILAMENT_APP_USE_METAL
engine = Engine::create(filament::Engine::Backend::METAL);
#endif
swapChain = engine->createSwapChain((__bridge void*)self.layer);
renderer = engine->createRenderer();
scene = engine->createScene();
Entity c = EntityManager::get().create();
camera = engine->createCamera(c);
renderer->setClearOptions({.clearColor = {0.1, 0.125, 0.25, 1.0}, .clear = true});
filaView = engine->createView();
filaView->setPostProcessingEnabled(false);
app.vb = VertexBuffer::Builder()
.vertexCount(3)
.bufferCount(1)
.attribute(VertexAttribute::POSITION, 0, VertexBuffer::AttributeType::FLOAT2,
0, 12)
.attribute(
VertexAttribute::COLOR, 0, VertexBuffer::AttributeType::UBYTE4, 8, 12)
.normalized(VertexAttribute::COLOR)
.build(*engine);
app.vb->setBufferAt(*engine, 0, VertexBuffer::BufferDescriptor(TRIANGLE_VERTICES, 36, nullptr));
app.ib = IndexBuffer::Builder()
.indexCount(3)
.bufferType(IndexBuffer::IndexType::USHORT)
.build(*engine);
app.ib->setBuffer(*engine, IndexBuffer::BufferDescriptor(TRIANGLE_INDICES, 6, nullptr));
app.mat = Material::Builder()
.package((void*)SAMPLE_EXTERNAL_TEXTURE_PACKAGE,
sizeof(SAMPLE_EXTERNAL_TEXTURE_PACKAGE))
.build(*engine);
app.renderable = EntityManager::get().create();
RenderableManager::Builder(1)
.boundingBox({{-1, -1, -1}, {1, 1, 1}})
.material(0, app.mat->getDefaultInstance())
.geometry(0, RenderableManager::PrimitiveType::TRIANGLES, app.vb, app.ib, 0, 3)
.culling(false)
.receiveShadows(false)
.castShadows(false)
.build(*engine, app.renderable);
scene->addEntity(app.renderable);
NSDictionary* cvBufferProperties = @{
(__bridge NSString*)kCVPixelBufferOpenGLCompatibilityKey : @YES,
(__bridge NSString*)kCVPixelBufferMetalCompatibilityKey : @YES,
};
CVReturn cvret = CVPixelBufferCreate(kCFAllocatorDefault, 1024, 1024, kCVPixelFormatType_32BGRA,
(__bridge CFDictionaryRef)cvBufferProperties, &app.img);
assert(cvret == kCVReturnSuccess);
[openglRenderer setPixelBuffer:app.img];
app.tex = Texture::Builder()
.width(1024)
.height(1024)
.sampler(Texture::Sampler::SAMPLER_EXTERNAL)
.usage(Texture::Usage::SAMPLEABLE)
.build(*engine);
app.tex->setExternalImage(*engine, app.img);
TextureSampler s{};
app.mat->getDefaultInstance()->setParameter("texture", app.tex, s);
filaView->setScene(scene);
filaView->setCamera(camera);
CGRect nativeBounds = [UIScreen mainScreen].nativeBounds;
filaView->setViewport(Viewport(0, 0, nativeBounds.size.width, nativeBounds.size.height));
}
- (void)renderloop {
[self update];
const Color3 RED{1.0, 0.0, 0.0};
const Color3 GREEN{0.0, 1.0, 0.0};
const Color3 BLUE{0.0, 0.0, 1.0};
const Color3 YELLOW{1.0, 1.0, 0.0};
const Color3 CYAN{0.0, 1.0, 1.0};
const Color3 PURPLE{1.0, 0.0, 1.0};
const Color3 WHITE{1.0, 1.0, 1.0};
const Color3 BLACK{0.0, 0.0, 0.0};
// WARNING: Fast color strobing!
// Sync mode will clear the OpenGL Scene and Filament Scene to the same color, cycling through a
// list of colors frame-by-frame. This can be used to ensure that OpenGL rendering stays in sync
// with Filament. With this mode enabled, the triangle should "disappear" and the entire screen
// should always be a continuous color.
#define TEST_SYNC 0
#if TEST_SYNC
const Color3 colors[] = {RED, GREEN, BLUE, YELLOW, CYAN, PURPLE, WHITE, BLACK};
static size_t frameId = 0;
const Color3 filamentColor = colors[frameId++ % (sizeof(colors) / sizeof(Color3))];
const Color3 openGLColor = filamentColor;
#else
const Color3 filamentColor = BLACK;
const Color3 openGLColor = GREEN;
#endif
renderer->setClearOptions(
{.clearColor = {filamentColor.r, filamentColor.g, filamentColor.b, 1.0},
.clear = true});
if (self->renderer->beginFrame(self->swapChain)) {
// Render OpenGL
// TODO: more synchronization might be necessary.
// Occasionally, when running in TEST_SYNC mode, the triangle is one color "ahead" of
// Filament.
[openglRenderer renderWithColor:openGLColor];
// Render Filament.
self->renderer->render(self->filaView);
self->renderer->endFrame();
// This line fixes the synchronization issues, but is highly inefficient:
// self->engine->flushAndWait();
}
}
- (void)update {
constexpr float ZOOM = 1.5f;
const uint32_t w = filaView->getViewport().width;
const uint32_t h = filaView->getViewport().height;
const float aspect = (float)w / h;
camera->setProjection(
Camera::Projection::ORTHO, -aspect * ZOOM, aspect * ZOOM, -ZOOM, ZOOM, 0, 1);
auto& tcm = engine->getTransformManager();
[self updateRotation];
tcm.setTransform(tcm.getInstance(app.renderable),
filament::math::mat4f::rotation(CACurrentMediaTime(), filament::math::float3{0, 0, 1}) *
filament::math::mat4f::rotation(
deviceRotation, filament::math::float3{0, 0, 1}));
}
- (void)didRotate:(NSNotification*)notification {
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
desiredRotation = [self rotationForDeviceOrientation:orientation];
}
- (void)updateRotation {
static const float ROTATION_SPEED = 0.1;
float diff = abs(desiredRotation - deviceRotation);
if (diff > FLT_EPSILON) {
if (desiredRotation > deviceRotation) {
deviceRotation += fmin(ROTATION_SPEED, diff);
}
if (desiredRotation < deviceRotation) {
deviceRotation -= fmin(ROTATION_SPEED, diff);
}
}
}
+ (Class)layerClass {
#if FILAMENT_APP_USE_OPENGL
return [CAEAGLLayer class];
#elif FILAMENT_APP_USE_METAL
return [CAMetalLayer class];
#endif
}
- (float)rotationForDeviceOrientation:(UIDeviceOrientation)orientation {
switch (orientation) {
default:
case UIDeviceOrientationPortrait:
return 0.0f;
case UIDeviceOrientationLandscapeRight:
return M_PI_2;
case UIDeviceOrientationLandscapeLeft:
return -M_PI_2;
case UIDeviceOrientationPortraitUpsideDown:
return M_PI;
}
}
@end

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,31 @@
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <CoreVideo/CoreVideo.h>
#import <Foundation/Foundation.h>
typedef struct {
float r;
float g;
float b;
} Color3;
@interface OpenGLRenderer : NSObject
- (void)setPixelBuffer:(CVPixelBufferRef)pixelBuffer;
- (void)renderWithColor:(Color3)color;
@end

View File

@@ -0,0 +1,119 @@
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import "OpenGLRenderer.h"
#import <QuartzCore/QuartzCore.h>
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
@interface OpenGLRenderer ()
- (void)setupContext;
- (void)destroyFramebuffer;
@end
#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
@implementation OpenGLRenderer {
EAGLContext* _context;
GLuint _frameBuffer;
CVOpenGLESTextureCacheRef _textureCache;
CVOpenGLESTextureRef _texture;
}
- (instancetype)init {
self = [super init];
if (self) {
[self setupContext];
_frameBuffer = 0;
_texture = nil;
}
return self;
}
- (void)setPixelBuffer:(CVPixelBufferRef)pixelBuffer {
[EAGLContext setCurrentContext:_context];
[self destroyFramebuffer];
if (_texture) {
CFRelease(_texture);
_texture = nil;
}
if (!pixelBuffer) {
return;
}
const size_t width = CVPixelBufferGetWidth(pixelBuffer);
const size_t height = CVPixelBufferGetHeight(pixelBuffer);
CVReturn cvret = CVOpenGLESTextureCacheCreateTextureFromImage(kCFAllocatorDefault,
_textureCache, pixelBuffer, nil, GL_TEXTURE_2D, GL_RGBA, (GLsizei)width,
(GLsizei)height, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, 0, &_texture);
assert(cvret == kCVReturnSuccess);
glGenFramebuffers(1, &_frameBuffer);
glBindFramebuffer(GL_FRAMEBUFFER, _frameBuffer);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
CVOpenGLESTextureGetName(_texture), 0);
assert(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
}
- (void)setupContext {
EAGLRenderingAPI api = kEAGLRenderingAPIOpenGLES2;
_context = [[EAGLContext alloc] initWithAPI:api];
assert(_context);
BOOL result = [EAGLContext setCurrentContext:_context];
assert(result);
CVReturn cvret =
CVOpenGLESTextureCacheCreate(kCFAllocatorDefault, nil, _context, nil, &_textureCache);
assert(cvret == kCVReturnSuccess);
}
- (void)destroyFramebuffer {
if (_frameBuffer == 0) {
return;
}
glDeleteFramebuffers(1, &_frameBuffer);
_frameBuffer = 0;
}
- (void)renderWithColor:(Color3)color {
[EAGLContext setCurrentContext:_context];
glBindFramebuffer(GL_FRAMEBUFFER, _frameBuffer);
glClearColor(color.r, color.g, color.b, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
// From Apple's "OpenGLMetalInteroperability" sample:
// When rendering to a CVPixelBuffer with OpenGL, call glFlush to ensure OpenGL commands are
// excuted on the pixel buffer before Metal reads the buffer.
glFlush();
}
- (void)dealloc {
[self setPixelBuffer:nil];
CFRelease(_textureCache);
}
@end

View File

@@ -0,0 +1,21 @@
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (BOOL)shouldAutorotate {
return NO;
}
@end

View File

@@ -0,0 +1,24 @@
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char* argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

View File

@@ -0,0 +1,19 @@
name: opengl-with-metal
options:
bundleIdPrefix: ${DEVELOPMENT_TEAM}.google.filament
include: ../app-template.yml
targets:
opengl-with-metal:
templates:
- FilamentApp
preBuildScripts:
- path: build-materials.sh
name: Build Materials
inputFiles:
- $(SRCROOT)/Materials/SampleExternalTexture.mat
outputFiles:
- $(SRCROOT)/generated/SampleExternalTexture.inc
settings:
configs:
metal:
GCC_PREPROCESSOR_DEFINITIONS: ["GLES_SILENCE_DEPRECATION"]

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -e
clang-format -style=file -i opengl-with-metal/*.h opengl-with-metal/*.m opengl-with-metal/*.mm

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB