-
Notifications
You must be signed in to change notification settings - Fork 415
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
Add Mac Catalyst Support #116
Open
tiagomartinho
wants to merge
4
commits into
libobjc:master
Choose a base branch
from
tiagomartinho:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9428cf3
Updated build scripts for Mac Catalyst & added satellite TV codecs
steventroughtonsmith 727d71d
Remove Xcode Beta path from build scripts
tiagomartinho 4757263
Add missing files
tiagomartinho adf6f3a
Use same info plist for catalyst target
tiagomartinho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
67 changes: 67 additions & 0 deletions
67
SGPlayer.xcodeproj/xcshareddata/xcschemes/SGPlayer Catalyst.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1100" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "B0198738231AAB3900EC1C47" | ||
BuildableName = "SGPlayer.framework" | ||
BlueprintName = "SGPlayer Catalyst" | ||
ReferencedContainer = "container:SGPlayer.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "B0198738231AAB3900EC1C47" | ||
BuildableName = "SGPlayer.framework" | ||
BlueprintName = "SGPlayer Catalyst" | ||
ReferencedContainer = "container:SGPlayer.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
// | ||
// Catalyst.h | ||
// SGPlayer | ||
// | ||
// Created by Steven Troughton-Smith on 31/08/2019. | ||
// Copyright © 2019 single. All rights reserved. | ||
// | ||
|
||
#ifndef Catalyst_h | ||
#define Catalyst_h | ||
|
||
#define GLK_INLINE static __inline__ | ||
|
||
#if defined(__STRICT_ANSI__) | ||
struct _GLKMatrix4 | ||
{ | ||
float m[16]; | ||
} __attribute__((aligned(16))); | ||
typedef struct _GLKMatrix4 GLKMatrix4; | ||
#else | ||
union _GLKMatrix4 | ||
{ | ||
struct | ||
{ | ||
float m00, m01, m02, m03; | ||
float m10, m11, m12, m13; | ||
float m20, m21, m22, m23; | ||
float m30, m31, m32, m33; | ||
}; | ||
float m[16]; | ||
} __attribute__((aligned(16))); | ||
typedef union _GLKMatrix4 GLKMatrix4; | ||
#endif | ||
|
||
GLK_INLINE GLKMatrix4 GLKMatrix4Multiply(GLKMatrix4 matrixLeft, GLKMatrix4 matrixRight) | ||
{ | ||
#if defined(GLK_SSE3_INTRINSICS) | ||
|
||
const __m128 l0 = _mm_load_ps(&matrixLeft.m[0]); | ||
const __m128 l1 = _mm_load_ps(&matrixLeft.m[4]); | ||
const __m128 l2 = _mm_load_ps(&matrixLeft.m[8]); | ||
const __m128 l3 = _mm_load_ps(&matrixLeft.m[12]); | ||
|
||
const __m128 r0 = _mm_load_ps(&matrixRight.m[0]); | ||
const __m128 r1 = _mm_load_ps(&matrixRight.m[4]); | ||
const __m128 r2 = _mm_load_ps(&matrixRight.m[8]); | ||
const __m128 r3 = _mm_load_ps(&matrixRight.m[12]); | ||
|
||
const __m128 m0 = l0 * _mm_shuffle_ps(r0, r0, _MM_SHUFFLE(0, 0, 0, 0)) | ||
+ l1 * _mm_shuffle_ps(r0, r0, _MM_SHUFFLE(1, 1, 1, 1)) | ||
+ l2 * _mm_shuffle_ps(r0, r0, _MM_SHUFFLE(2, 2, 2, 2)) | ||
+ l3 * _mm_shuffle_ps(r0, r0, _MM_SHUFFLE(3, 3, 3, 3)); | ||
|
||
const __m128 m1 = l0 * _mm_shuffle_ps(r1, r1, _MM_SHUFFLE(0, 0, 0, 0)) | ||
+ l1 * _mm_shuffle_ps(r1, r1, _MM_SHUFFLE(1, 1, 1, 1)) | ||
+ l2 * _mm_shuffle_ps(r1, r1, _MM_SHUFFLE(2, 2, 2, 2)) | ||
+ l3 * _mm_shuffle_ps(r1, r1, _MM_SHUFFLE(3, 3, 3, 3)); | ||
|
||
const __m128 m2 = l0 * _mm_shuffle_ps(r2, r2, _MM_SHUFFLE(0, 0, 0, 0)) | ||
+ l1 * _mm_shuffle_ps(r2, r2, _MM_SHUFFLE(1, 1, 1, 1)) | ||
+ l2 * _mm_shuffle_ps(r2, r2, _MM_SHUFFLE(2, 2, 2, 2)) | ||
+ l3 * _mm_shuffle_ps(r2, r2, _MM_SHUFFLE(3, 3, 3, 3)); | ||
|
||
const __m128 m3 = l0 * _mm_shuffle_ps(r3, r3, _MM_SHUFFLE(0, 0, 0, 0)) | ||
+ l1 * _mm_shuffle_ps(r3, r3, _MM_SHUFFLE(1, 1, 1, 1)) | ||
+ l2 * _mm_shuffle_ps(r3, r3, _MM_SHUFFLE(2, 2, 2, 2)) | ||
+ l3 * _mm_shuffle_ps(r3, r3, _MM_SHUFFLE(3, 3, 3, 3)); | ||
|
||
GLKMatrix4 m; | ||
_mm_store_ps(&m.m[0], m0); | ||
_mm_store_ps(&m.m[4], m1); | ||
_mm_store_ps(&m.m[8], m2); | ||
_mm_store_ps(&m.m[12], m3); | ||
return m; | ||
|
||
#else | ||
GLKMatrix4 m; | ||
|
||
m.m[0] = matrixLeft.m[0] * matrixRight.m[0] + matrixLeft.m[4] * matrixRight.m[1] + matrixLeft.m[8] * matrixRight.m[2] + matrixLeft.m[12] * matrixRight.m[3]; | ||
m.m[4] = matrixLeft.m[0] * matrixRight.m[4] + matrixLeft.m[4] * matrixRight.m[5] + matrixLeft.m[8] * matrixRight.m[6] + matrixLeft.m[12] * matrixRight.m[7]; | ||
m.m[8] = matrixLeft.m[0] * matrixRight.m[8] + matrixLeft.m[4] * matrixRight.m[9] + matrixLeft.m[8] * matrixRight.m[10] + matrixLeft.m[12] * matrixRight.m[11]; | ||
m.m[12] = matrixLeft.m[0] * matrixRight.m[12] + matrixLeft.m[4] * matrixRight.m[13] + matrixLeft.m[8] * matrixRight.m[14] + matrixLeft.m[12] * matrixRight.m[15]; | ||
|
||
m.m[1] = matrixLeft.m[1] * matrixRight.m[0] + matrixLeft.m[5] * matrixRight.m[1] + matrixLeft.m[9] * matrixRight.m[2] + matrixLeft.m[13] * matrixRight.m[3]; | ||
m.m[5] = matrixLeft.m[1] * matrixRight.m[4] + matrixLeft.m[5] * matrixRight.m[5] + matrixLeft.m[9] * matrixRight.m[6] + matrixLeft.m[13] * matrixRight.m[7]; | ||
m.m[9] = matrixLeft.m[1] * matrixRight.m[8] + matrixLeft.m[5] * matrixRight.m[9] + matrixLeft.m[9] * matrixRight.m[10] + matrixLeft.m[13] * matrixRight.m[11]; | ||
m.m[13] = matrixLeft.m[1] * matrixRight.m[12] + matrixLeft.m[5] * matrixRight.m[13] + matrixLeft.m[9] * matrixRight.m[14] + matrixLeft.m[13] * matrixRight.m[15]; | ||
|
||
m.m[2] = matrixLeft.m[2] * matrixRight.m[0] + matrixLeft.m[6] * matrixRight.m[1] + matrixLeft.m[10] * matrixRight.m[2] + matrixLeft.m[14] * matrixRight.m[3]; | ||
m.m[6] = matrixLeft.m[2] * matrixRight.m[4] + matrixLeft.m[6] * matrixRight.m[5] + matrixLeft.m[10] * matrixRight.m[6] + matrixLeft.m[14] * matrixRight.m[7]; | ||
m.m[10] = matrixLeft.m[2] * matrixRight.m[8] + matrixLeft.m[6] * matrixRight.m[9] + matrixLeft.m[10] * matrixRight.m[10] + matrixLeft.m[14] * matrixRight.m[11]; | ||
m.m[14] = matrixLeft.m[2] * matrixRight.m[12] + matrixLeft.m[6] * matrixRight.m[13] + matrixLeft.m[10] * matrixRight.m[14] + matrixLeft.m[14] * matrixRight.m[15]; | ||
|
||
m.m[3] = matrixLeft.m[3] * matrixRight.m[0] + matrixLeft.m[7] * matrixRight.m[1] + matrixLeft.m[11] * matrixRight.m[2] + matrixLeft.m[15] * matrixRight.m[3]; | ||
m.m[7] = matrixLeft.m[3] * matrixRight.m[4] + matrixLeft.m[7] * matrixRight.m[5] + matrixLeft.m[11] * matrixRight.m[6] + matrixLeft.m[15] * matrixRight.m[7]; | ||
m.m[11] = matrixLeft.m[3] * matrixRight.m[8] + matrixLeft.m[7] * matrixRight.m[9] + matrixLeft.m[11] * matrixRight.m[10] + matrixLeft.m[15] * matrixRight.m[11]; | ||
m.m[15] = matrixLeft.m[3] * matrixRight.m[12] + matrixLeft.m[7] * matrixRight.m[13] + matrixLeft.m[11] * matrixRight.m[14] + matrixLeft.m[15] * matrixRight.m[15]; | ||
|
||
return m; | ||
#endif | ||
} | ||
|
||
|
||
extern const GLKMatrix4 GLKMatrix4Identity; | ||
|
||
GLK_INLINE GLKMatrix4 GLKMatrix4MakeZRotation(float radians) | ||
{ | ||
float cos = cosf(radians); | ||
float sin = sinf(radians); | ||
|
||
GLKMatrix4 m = { cos, sin, 0.0f, 0.0f, | ||
-sin, cos, 0.0f, 0.0f, | ||
0.0f, 0.0f, 1.0f, 0.0f, | ||
0.0f, 0.0f, 0.0f, 1.0f }; | ||
|
||
return m; | ||
} | ||
|
||
GLK_INLINE GLKMatrix4 GLKMatrix4RotateZ(GLKMatrix4 matrix, float radians); | ||
GLK_INLINE GLKMatrix4 GLKMatrix4RotateZ(GLKMatrix4 matrix, float radians) | ||
{ | ||
GLKMatrix4 rm = GLKMatrix4MakeZRotation(radians); | ||
return GLKMatrix4Multiply(matrix, rm); | ||
} | ||
|
||
|
||
GLK_INLINE GLKMatrix4 GLKMatrix4Transpose(GLKMatrix4 matrix) | ||
{ | ||
GLKMatrix4 m = { matrix.m[0], matrix.m[4], matrix.m[8], matrix.m[12], | ||
matrix.m[1], matrix.m[5], matrix.m[9], matrix.m[13], | ||
matrix.m[2], matrix.m[6], matrix.m[10], matrix.m[14], | ||
matrix.m[3], matrix.m[7], matrix.m[11], matrix.m[15] }; | ||
return m; | ||
} | ||
|
||
|
||
GLK_INLINE GLKMatrix4 GLKMatrix4MakeYRotation(float radians) | ||
{ | ||
float cos = cosf(radians); | ||
float sin = sinf(radians); | ||
|
||
GLKMatrix4 m = { cos, 0.0f, -sin, 0.0f, | ||
0.0f, 1.0f, 0.0f, 0.0f, | ||
sin, 0.0f, cos, 0.0f, | ||
0.0f, 0.0f, 0.0f, 1.0f }; | ||
|
||
return m; | ||
} | ||
|
||
GLK_INLINE GLKMatrix4 GLKMatrix4RotateY(GLKMatrix4 matrix, float radians) | ||
{ | ||
GLKMatrix4 rm = GLKMatrix4MakeYRotation(radians); | ||
return GLKMatrix4Multiply(matrix, rm); | ||
} | ||
|
||
GLK_INLINE float GLKMathDegreesToRadians(float degrees) { return degrees * (M_PI / 180); }; | ||
|
||
|
||
#endif /* Catalyst_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my fork, I migrated to
simd_float4x4
found insimd/simd.h
. Granted, I had to re-write some of the functions used, but it should be able to use vector instructions on any architecture supported by LLVM.