Slide 29
Slide 29 text
தͷ͋ΔίϚϯυʹ͢Δ
private func pushLabel(_ label: String) {
let textureLoader = MTKTextureLoader(device: device)
let srcTex = try! textureLoader.newTexture(name: “hoge”,
scaleFactor: 2.0,
bundle: nil)
let descriptor = MTLTextureDescriptor.texture2DDescriptor(
pixelFormat: srcTex.pixelFormat,
width: srcTex.width,
height: srcTex.height,
mipmapped: false)
let destTex = device.makeTexture(descriptor: descriptor)!
let commandBuffer = commandQueue.makeCommandBuffer()!
commandBuffer.label = label
let blitEncoder = commandBuffer.makeBlitCommandEncoder()!
blitEncoder.copy(
from: srcTex,
sourceSlice: 0,
sourceLevel: 0,
sourceOrigin: MTLOriginMake(0, 0, 0),
sourceSize: MTLSizeMake(srcTex.width, srcTex.height, srcTex.depth),
to: destTex,
destinationSlice: 0,
destinationLevel: 0,
destinationOrigin: MTLOriginMake(0, 0, 0))
blitEncoder.endEncoding()
commandBuffer.commit()
}
ຊʹཉ͍͠ͷ͚ͩ͜͜