From ab7611d284678de5be34374f8799325c62bc16fe Mon Sep 17 00:00:00 2001 From: Ivan Bruel Date: Thu, 25 Aug 2016 11:32:07 +0100 Subject: [PATCH 1/3] Create GPUIImage2.podspec --- GPUIImage2.podspec | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 GPUIImage2.podspec diff --git a/GPUIImage2.podspec b/GPUIImage2.podspec new file mode 100644 index 00000000..0105b339 --- /dev/null +++ b/GPUIImage2.podspec @@ -0,0 +1,21 @@ +Pod::Spec.new do |s| + s.name = 'GPUImage2' + s.version = '0.1.0' + s.license = 'BSD' + s.summary = 'An open source iOS framework for GPU-based image and video processing.' + s.homepage = 'https://github.com/BradLarson/GPUImage2' + s.author = { 'Brad Larson' => 'contact@sunsetlakesoftware.com' } + s.source = { :git => 'https://github.com/BradLarson/GPUImage2.git', :branch => "master" } + + s.source_files = 'framework/Source/**/*.{swift}' + s.resources = 'framework/Source/Operations/Shaders/*.{fsh}' + s.requires_arc = true + s.xcconfig = { 'CLANG_MODULES_AUTOLINK' => 'YES', + 'OTHER_SWIFT_FLAGS' => "$(inherited) -DGLES"} + + s.ios.deployment_target = '8.0' + s.ios.exclude_files = 'framework/Source/Mac', 'framework/Source/Linux', 'framework/Source/Operations/Shaders/ConvertedShaders_GL.swift' + s.frameworks = ['OpenGLES', 'CoreMedia', 'QuartzCore', 'AVFoundation'] + + +end From 3fdc09ae07c502d2548194d6ea2f856c3ed40c3d Mon Sep 17 00:00:00 2001 From: Ivan Bruel Date: Tue, 30 Aug 2016 16:28:03 +0100 Subject: [PATCH 2/3] Compilation time improvements --- framework/Source/iOS/OpenGLContext.swift | 39 +++++++++++++----------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/framework/Source/iOS/OpenGLContext.swift b/framework/Source/iOS/OpenGLContext.swift index a740d7ac..39409db2 100755 --- a/framework/Source/iOS/OpenGLContext.swift +++ b/framework/Source/iOS/OpenGLContext.swift @@ -9,9 +9,9 @@ public class OpenGLContext: SerialDispatch { return FramebufferCache(context:self) }() var shaderCache:[String:ShaderProgram] = [:] - + let context:EAGLContext - + lazy var passthroughShader:ShaderProgram = { return crashOnShaderCompileFailure("OpenGLContext"){return try self.programForVertexShader(OneInputVertexShader, fragmentShader:PassthroughFragmentShader)} }() @@ -21,8 +21,8 @@ public class OpenGLContext: SerialDispatch { let err = CVOpenGLESTextureCacheCreate(kCFAllocatorDefault, nil, self.context, nil, &newTextureCache) return newTextureCache! }() - - + + public let serialDispatchQueue:dispatch_queue_t = dispatch_queue_create("com.sunsetlakesoftware.GPUImage.processingQueue", nil) var dispatchKey:Int = 1 public let dispatchQueueKey:UnsafePointer @@ -34,36 +34,36 @@ public class OpenGLContext: SerialDispatch { let context = UnsafeMutablePointer(Unmanaged.passUnretained(self.serialDispatchQueue).toOpaque()) dispatchQueueKey = UnsafePointer(bitPattern:dispatchKey) dispatch_queue_set_specific(serialDispatchQueue, dispatchQueueKey, context, nil) - + guard let generatedContext = EAGLContext(API:.OpenGLES2, sharegroup:imageProcessingShareGroup) else { fatalError("Unable to create an OpenGL ES 2.0 context. The GPUImage framework requires OpenGL ES 2.0 support to work.") } - + self.context = generatedContext self.makeCurrentContext() - + glDisable(GLenum(GL_DEPTH_TEST)) glEnable(GLenum(GL_TEXTURE_2D)) } - + // MARK: - // MARK: Rendering - + public func makeCurrentContext() { if (EAGLContext.currentContext() != self.context) { EAGLContext.setCurrentContext(self.context) } } - + func presentBufferForDisplay() { self.context.presentRenderbuffer(Int(GL_RENDERBUFFER)) } - - + + // MARK: - // MARK: Device capabilities - + func supportsTextureCaches() -> Bool { #if (arch(i386) || arch(x86_64)) && os(iOS) return false // Simulator glitches out on use of texture caches @@ -71,7 +71,7 @@ public class OpenGLContext: SerialDispatch { return true // Every iOS version and device that can run Swift can handle texture caches #endif } - + public var maximumTextureSizeForThisDevice:GLint {get { return _maximumTextureSizeForThisDevice } } private lazy var _maximumTextureSizeForThisDevice:GLint = { return self.openGLDeviceSettingForOption(GL_MAX_TEXTURE_SIZE) @@ -87,10 +87,13 @@ public class OpenGLContext: SerialDispatch { return self.openGLDeviceSettingForOption(GL_MAX_VARYING_VECTORS) }() - lazy var extensionString:String = { - return self.runOperationSynchronously{ + lazy var extensionString:String = self.createExtensionString() + + private func createExtensionString() -> String { + return self.runOperationSynchronously{ () -> String in self.makeCurrentContext() return String.fromCString(UnsafePointer(glGetString(GLenum(GL_EXTENSIONS))))! } - }() -} \ No newline at end of file + } + +} From e3bc79afd72302fd12c8e15a78cde136fecf93f6 Mon Sep 17 00:00:00 2001 From: Ivan Bruel Date: Tue, 30 Aug 2016 16:28:57 +0100 Subject: [PATCH 3/3] Removed podspec --- GPUIImage2.podspec | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 GPUIImage2.podspec diff --git a/GPUIImage2.podspec b/GPUIImage2.podspec deleted file mode 100644 index 0105b339..00000000 --- a/GPUIImage2.podspec +++ /dev/null @@ -1,21 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'GPUImage2' - s.version = '0.1.0' - s.license = 'BSD' - s.summary = 'An open source iOS framework for GPU-based image and video processing.' - s.homepage = 'https://github.com/BradLarson/GPUImage2' - s.author = { 'Brad Larson' => 'contact@sunsetlakesoftware.com' } - s.source = { :git => 'https://github.com/BradLarson/GPUImage2.git', :branch => "master" } - - s.source_files = 'framework/Source/**/*.{swift}' - s.resources = 'framework/Source/Operations/Shaders/*.{fsh}' - s.requires_arc = true - s.xcconfig = { 'CLANG_MODULES_AUTOLINK' => 'YES', - 'OTHER_SWIFT_FLAGS' => "$(inherited) -DGLES"} - - s.ios.deployment_target = '8.0' - s.ios.exclude_files = 'framework/Source/Mac', 'framework/Source/Linux', 'framework/Source/Operations/Shaders/ConvertedShaders_GL.swift' - s.frameworks = ['OpenGLES', 'CoreMedia', 'QuartzCore', 'AVFoundation'] - - -end