Update Converter.swift
This commit is contained in:
parent
4399c39bae
commit
9011a279b3
|
@ -212,13 +212,19 @@ public class MetalViewRenderer: NSObject, MTKViewDelegate {
|
||||||
offset: 0,
|
offset: 0,
|
||||||
at: 2)
|
at: 2)
|
||||||
|
|
||||||
let threadGroupCount = MTLSizeMake(8, 8, 1)
|
// Use the max # of threads available for parallel processing.
|
||||||
let threadGroups = MTLSizeMake(texture.width / threadGroupCount.width,
|
let w = cps.threadExecutionWidth
|
||||||
texture.height / threadGroupCount.height,
|
let h = cps.maxTotalThreadsPerThreadgroup / w
|
||||||
1)
|
let threadsPerThreadgroup = MTLSizeMake(w, h, 1)
|
||||||
|
let threadgroupsPerGrid = MTLSizeMake((texture.width + w - 1) / w,
|
||||||
|
(texture.height + h - 1) / h,
|
||||||
|
1)
|
||||||
// Execute the kernel function
|
// Execute the kernel function
|
||||||
commandComputeEncoder.dispatchThreadgroups(threadGroups,
|
// Note: boundary checks are necessary in the compute shader
|
||||||
threadsPerThreadgroup: threadGroupCount)
|
// unless we use the alternative method
|
||||||
|
// dispatchThreads:threadsPerThreadgroup:
|
||||||
|
commandComputeEncoder.dispatchThreadgroups(threadgroupsPerGrid,
|
||||||
|
threadsPerThreadgroup: threadsPerThreadgroup)
|
||||||
commandComputeEncoder.endEncoding()
|
commandComputeEncoder.endEncoding()
|
||||||
commandBuffer.commit()
|
commandBuffer.commit()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue