1.渲染到纹理
滤镜链
Metal的标准坐标系NDC、帧缓存坐标系FrameBuffer Coordinate (也叫Viewport Coorninate)以及纹理坐标系(Texture Coordinate)的原点不一致,还会分别对他们进行介绍和解析。
在Metal中要渲染到纹理有如下步骤:
1.创建空纹理
+ (nullable id<MTLTexture>)createEmptyTexture: (id<MTLDevice>)device
WithWidth: (size_t)width
withHeight: (size_t)height
usage: (MTLTextureUsage)usage {
MTLTextureDescriptor *texDescriptor = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat: MTLPixelFormatRGBA8Unorm width: width height: height mipmapped: false];
texDescriptor.usage = usage;
id<MTLTexture> texture = [device newTextureWithDescriptor