Skip to content

Commit

Permalink
* stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
adamnemecek committed Sep 11, 2017
1 parent aefd164 commit 299d52e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
1 change: 0 additions & 1 deletion Sources/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ extension MTLVertexFormat {

default: fatalError("cannot construct a vertex format for type \(t)")
}

}
}

Expand Down
7 changes: 6 additions & 1 deletion Sources/GPUDevice.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,20 @@ final class GPUDevice {
return d
}

func makeCommandBuffer() -> MTLCommandBuffer {
return commandQueue.makeCommandBuffer()!
}

func computePipeline(name : String) -> MTLComputePipelineState {
let f = library.makeFunction(name: name)!
return try! device.makeComputePipelineState(function: f)
}

func makeBuffer<T>(for content: [T]) -> MTLBuffer {
let length = content.count * MemoryLayout<T>.size
var cpy = content
guard let buffer = device.makeBuffer(bytes: &cpy,
length: content.count * MemoryLayout<T>.size,
length: length,
options: []) else { fatalError() }
return buffer
}
Expand Down
19 changes: 19 additions & 0 deletions main/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// main.swift
// main
//
// Created by Adam Nemecek on 9/11/17.
//

import Foundation

import MetalKit

struct A {
let a : Int32 = 5
let b : Int32 = 10
}

let q = MTLVertexDescriptor(reflecting: A())


0 comments on commit 299d52e

Please sign in to comment.