
1. NDC This coordinates is used by developers to construct their geometries and transform the geometries in vertex shader via model and view matrices. 2. Framebuffer Coordinate (Viewport Coordinate) When we write into attachment or read from attachment or copy/blit between attachments, we use framebuffer coordiante to specify the location. 3. Texture Coordinate when we upload texture into memory..

Texture 매핑 var depthTexture: MTLTexture! = nil let depthTextureDescriptor = MTLTextureDescriptor.texture2DDescriptor( pixelFormat: .depth32Float, width: Int(layerSize.width), height: Int(layerSize.height), mipmapped: false) depthTexture = device.makeTexture(descriptor: depthTextureDescriptor) ※ Texel : Texture의 조각 Mipmapping MTLBitCommandEncoder func generateMipmaps(for texture: MTLTexture) Samp..

Metal Resources MTLBuffer : 모든 데이터 타입을 포함하 ㄹ수 있는 unformatted 메모리 할당 MTLTexture : formatted 이미지 데이터 할당 Argument Table Shader Parameters와 Resources 사이의 매핑 (Encoder와 Shader 사이의 연결) Buffers Textures Sampler states Buffer Buffer 생성 makeBuffer(length:options:) makeBuffer(bytes:length:options:) makeBuffer(bytesNoCopy:length:options:deallocator:) MTLVertexDescriptor vertexDescriptor.attributes[0].offset..

MSL은 Vector와 Matrix에 대한 데이터 타입을 갖고 있다. ex) float3, float4, float4x4 Argument Table Shader 작성 방법 shaderType returnType shaderName(parameter1, parameter2, etc....) { .. } shaderType : vertex, fragment, kernel Vertex Shader 셋팅 // generate a large enough buffer to allow streaming vertices for 3 // semaphore controlled frames vertexBuffer = device.makeBuffer(length: ConstantBufferSize, options: []) v..
let options = [CIImageOption.colorSpace: CGColorSpaceCreateDeviceRGB()] as [CIImageOption: Any] let image = CIImage.init(mtlTexture: texture, options: options) option에 CGColorSpaceCreateDeviceRGB()를 추가한다. https://stackoverflow.com/questions/51792808/ios-color-space-metal-texture-to-ui-image-iphone-vs-ipad-camera