Skip to content

Commit

Permalink
Updated for Xcode 8 beta 6.
Browse files Browse the repository at this point in the history
  • Loading branch information
BradLarson committed Aug 17, 2016
1 parent 6e5a777 commit c9326ae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions framework/Source/OpenGLRendering.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ extension String {
#if os(Linux)
// cStringUsingEncoding isn't yet defined in the Linux Foundation.
// This approach is roughly 35X slower than the cStringUsingEncoding one.
let bufferCString = UnsafeMutablePointer<UInt8>.alloc(self.characters.count+1)
let bufferCString = UnsafeMutablePointer<UInt8>.allocate(capacity:self.characters.count+1)
for (index, characterValue) in self.utf8.enumerate() {
bufferCString[index] = characterValue
}
bufferCString[self.characters.count] = 0 // Have to add a null termination

operation(UnsafePointer<GLchar>(bufferCString))

bufferCString.dealloc(self.characters.count)
bufferCString.deallocate(capacity:self.characters.count)
#else
if let value = self.cString(using:String.Encoding.utf8) {
operation(UnsafePointer<GLchar>(value))
Expand Down
8 changes: 2 additions & 6 deletions framework/Source/SerialDispatch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,15 @@ public let lowProcessingQueuePriority:DispatchQueue.GlobalQueuePriority = {
}()

func runAsynchronouslyOnMainQueue(_ mainThreadOperation:@escaping () -> ()) {
// FIXME: Xcode 8 beta 2
// if (Thread.isMainThread) {
if (Thread.isMainThread()) {
if (Thread.isMainThread) {
mainThreadOperation()
} else {
DispatchQueue.main.async(execute:mainThreadOperation)
}
}

func runOnMainQueue(_ mainThreadOperation:() -> ()) {
// FIXME: Xcode 8 beta 2
// if (Thread.isMainThread) {
if (Thread.isMainThread()) {
if (Thread.isMainThread) {
mainThreadOperation()
} else {
DispatchQueue.main.sync(execute:mainThreadOperation)
Expand Down
4 changes: 1 addition & 3 deletions framework/Source/ShaderProgram.swift
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,7 @@ public func crashOnShaderCompileFailure<T>(_ shaderName:String, _ operation:() t
public func shaderFromFile(_ file:URL) throws -> String {
// Note: this is a hack until Foundation's String initializers are fully functional
// let fragmentShaderString = String(contentsOfURL:fragmentShaderFile, encoding:NSASCIIStringEncoding)
// FIXME: Xcode 8 beta 2
guard (FileManager.default().fileExists(atPath: file.path)) else { throw ShaderCompileError(compileLog:"Shader file \(file) missing")}
// guard (FileManager.default().fileExists(atPath: file.path!)) else { throw ShaderCompileError(compileLog:"Shader file \(file) missing")}
guard (FileManager.default.fileExists(atPath: file.path)) else { throw ShaderCompileError(compileLog:"Shader file \(file) missing")}

let fragmentShaderString = try NSString(contentsOfFile:file.path, encoding:String.Encoding.ascii.rawValue)

Expand Down

0 comments on commit c9326ae

Please sign in to comment.