void Render() { // Create a new command buffer for each renderpass to the current drawable. IMTLCommandBuffer commandBuffer = commandQueue.CommandBuffer(); // Initialize MetalPerformanceShaders gaussianBlur with Sigma = 10.0f. var gaussianblur = new MPSImageGaussianBlur(metalView.Device, 10f); var drawable = ((CAMetalLayer)metalView.Layer).NextDrawable(); // Run MetalPerformanceShader gaussianblur. gaussianblur.EncodeToCommandBuffer(commandBuffer, sourceTexture, drawable.Texture); // Schedule a present using the current drawable. commandBuffer.PresentDrawable(drawable); // Finalize command buffer. commandBuffer.Commit(); commandBuffer.WaitUntilCompleted(); // To reuse a CAMetalDrawable object’s texture, you must deallocate the drawable after presenting it. drawable.Dispose(); }