public AmtFramebuffer(MgFramebufferCreateInfo createInfo) { if (createInfo == null) { throw new ArgumentNullException(nameof(createInfo)); } if (createInfo.RenderPass == null) { throw new ArgumentNullException(nameof(createInfo.RenderPass)); } Width = createInfo.Width; Height = createInfo.Height; Layers = createInfo.Layers; var bRenderpass = (AmtRenderPass)createInfo.RenderPass; CompatibilityProfile = bRenderpass.Profile; if (createInfo.Attachments != null) { var noOfSubpasses = bRenderpass.Subpasses.Length; Subpasses = new AmtFramebufferSubpassInfo[noOfSubpasses]; for (var i = 0; i < noOfSubpasses; i++) { var srcSubpass = bRenderpass.Subpasses[i]; Debug.Assert(srcSubpass.ColorAttachments != null); var noOfColorAttachments = srcSubpass.ColorAttachments.Length; var dstSubpass = new AmtFramebufferSubpassInfo { ColorAttachments = new IAmtImageView[noOfColorAttachments], DepthStencil = (srcSubpass.DepthStencil != null) ? (IAmtImageView)createInfo.Attachments[srcSubpass.DepthStencil.Index] : null, }; for (var j = 0; j < noOfColorAttachments; ++j) { var imageViewIndex = srcSubpass.ColorAttachments[j].Index; dstSubpass.ColorAttachments[j] = (IAmtImageView)createInfo.Attachments[imageViewIndex]; } Subpasses[i] = dstSubpass; } } else { Subpasses = new AmtFramebufferSubpassInfo[] { }; } }
public AmtGraphicsPipeline(IAmtMetalLibraryLoader generator, IMTLDevice device, MgGraphicsPipelineCreateInfo info) { var layout = (AmtPipelineLayout)info.Layout; if (layout == null) { throw new ArgumentException(nameof(info.Layout)); } Layout = layout; if (info.VertexInputState == null) { throw new ArgumentNullException(nameof(info.VertexInputState)); } if (info.InputAssemblyState == null) { throw new ArgumentNullException(nameof(info.InputAssemblyState)); } if (info.RasterizationState == null) { throw new ArgumentNullException(nameof(info.RasterizationState)); } // TODO : WHY DO I NEED RENDERPASS HERE if (info.RenderPass == null) { throw new ArgumentNullException(nameof(info.RenderPass)); } RenderPass = (AmtRenderPass)info.RenderPass; CompatibilityProfile = RenderPass.Profile; InitializeShaderFunctions(generator, device, info.Stages); InitializeVertexDescriptor(info.VertexInputState); InitiailizeDepthStateDescriptor(info.DepthStencilState); InitializeRasterization(info.RasterizationState); InitializationInputAssembly(info.InputAssemblyState); InitializeColorBlending(info.ColorBlendState); InitializeDynamicStates(info.DynamicState); InitializeResources(info.VertexInputState); InitializeViewportAndScissor(info.ViewportState); InitializeMultisampleInfo(info.MultisampleState); GeneratePipelineStates(device); }
public AmtRenderPass(MgRenderPassCreateInfo createInfo) { Debug.Assert(createInfo != null, nameof(createInfo) + " is null"); Debug.Assert(createInfo.Attachments != null, nameof(createInfo.Attachments) + "is null"); Debug.Assert(createInfo.Subpasses != null, nameof(createInfo.Subpasses) + " is null"); if (createInfo.Attachments.Length > 6) { throw new NotSupportedException(nameof(createInfo.Attachments.Length) + " must be <= 4"); } Subpasses = new AmtRenderPassSubpassInfo[createInfo.Subpasses.Length]; for (uint i = 0; i < Subpasses.Length; ++i) { Subpasses[i] = new AmtRenderPassSubpassInfo(createInfo, i); } Profile = new MgRenderPassProfile(createInfo); }