MacOs Metal antialiasing

I'm making an app for MacOs, but I'm having problems with the antialiasing implementation in Metal.

When compiling I get the following error:

validateAttachmentOnDevice:540: failed assertion MTLRenderPassDescriptor render targets have inconsistent sample counts.'

This is the code I use to implement the textures:

- (void)makeTextures
{
    if ([depthTexture width] != drawableSize.width || [depthTexture height] != drawableSize.height)
    {

        MTLTextureDescriptor *colorDescriptor = [MTLTextureDescriptor new];
        colorDescriptor.textureType = MTLTextureType2DMultisample;
        colorDescriptor.sampleCount = 4;
        colorDescriptor.pixelFormat = vista.colorPixelFormat;
        colorDescriptor.width = drawableSize.width;
        colorDescriptor.height = drawableSize.height;
        colorDescriptor.usage = MTLTextureUsageRenderTarget;
        colorDescriptor.storageMode = MTLStorageModePrivate;

        msaaColorTexture = [view.device newTextureWithDescriptor:colorDescriptor];

        MTLTextureDescriptor *resolveDescriptor = [MTLTextureDescriptor new];
        resolveDescriptor.textureType = MTLTextureType2D;
        resolveDescriptor.pixelFormat = vista.colorPixelFormat;
        resolveDescriptor.width = drawableSize.width;
        resolveDescriptor.height = drawableSize.height;
        resolveDescriptor.storageMode = MTLStorageModePrivate;

        msaaResolveColorTexture = [view.device newTextureWithDescriptor:resolveDescriptor];

        MTLTextureDescriptor *desc = [MTLTextureDescriptor new];
        desc.textureType = MTLTextureType2DMultisample;
        desc.sampleCount = 4;
        desc.pixelFormat = MTLPixelFormatDepth32Float;
        desc.width = drawableSize.width;
        desc.height = drawableSize.height;
        desc.usage = MTLTextureUsageRenderTarget;
        desc.storageMode = MTLStorageModePrivate;

        depthTexture = [view.device newTextureWithDescriptor:desc];
    }
}

If at the time of creating the MTLRenderPipelineDescriptor I add .samplecount = 4;, the error disappears, but nothing is drawing in the view.

This are de PipelineDescriptor creation:

MTLRenderPipelineDescriptor *pipelineStateDescriptor = [MTLRenderPipelineDescriptor new];
    pipelineStateDescriptor.label = @"Simple Pipeline";
    pipelineStateDescriptor.vertexFunction = vertexFunction;
    pipelineStateDescriptor.fragmentFunction = fragmentFunction;
    pipelineStateDescriptor.colorAttachments[0].pixelFormat = vista.colorPixelFormat;
    pipelineStateDescriptor.depthAttachmentPixelFormat = MTLPixelFormatDepth32Float;

    // No error but black view.
    //pipelineStateDescriptor.sampleCount = 4;

    NSError *error;

    pipelineState = [view.device newRenderPipelineStateWithDescriptor:pipelineStateDescriptor error:&error];

    // Depth stencil.

    MTLDepthStencilDescriptor *depthStencilDescriptor = [MTLDepthStencilDescriptor new];
    depthStencilDescriptor.depthCompareFunction = MTLCompareFunctionLess;
    depthStencilDescriptor.depthWriteEnabled = YES;
    depthStencilState = [view.device newDepthStencilStateWithDescriptor:depthStencilDescriptor];

And passDescriptor:

if (passDescriptor != nil) {

        passDescriptor.colorAttachments[0].texture = msaaColorTexture;
        passDescriptor.colorAttachments[0].resolveTexture = msaaResolveColorTexture;
        passDescriptor.colorAttachments[0].clearColor = MTLClearColorMake(1.0f, 1.0f, 1.0f, 1.0f);
        passDescriptor.colorAttachments[0].storeAction = MTLStoreActionMultisampleResolve;
        passDescriptor.colorAttachments[0].loadAction = MTLLoadActionClear;

        passDescriptor.depthAttachment.texture = depthTexture;
        passDescriptor.depthAttachment.clearDepth = 1.0;
        passDescriptor.depthAttachment.loadAction = MTLLoadActionClear;
        passDescriptor.depthAttachment.storeAction = MTLStoreActionStore;
    .
    .
    .

Any suggestion.

Thanks by advice. Manuel C.

MacOs Metal antialiasing
 
 
Q