public AmtRenderPassSubpassInfo(MgRenderPassCreateInfo createInfo, uint subpassIndex) { Subpass = subpassIndex; // check subpass description for correct values var subpass = createInfo.Subpasses[subpassIndex]; ColorAttachments = new AmtRenderPassClearAttachment[subpass.ColorAttachmentCount]; for (var j = 0; j < subpass.ColorAttachmentCount; ++j) { var color = subpass.ColorAttachments[j]; var attachment = createInfo.Attachments[color.Attachment]; ColorAttachments[j] = new AmtRenderPassClearAttachment { Index = color.Attachment, Format = attachment.Format, ClearValueType = GetClearValueType(attachment.Format), Divisor = GetAttachmentDivisor(attachment.Format), Destination = AmtRenderPassAttachmentDestination.COLOR, StoreAction = TranslateStoreOp(attachment.StoreOp), LoadAction = TranslateLoadOp(attachment.LoadOp), StencilLoadAction = TranslateLoadOp(attachment.StencilLoadOp), StencilStoreAction = TranslateStoreOp(attachment.StencilStoreOp), }; } var depthStencil = subpass.DepthStencilAttachment; if (depthStencil != null) { var attachment = createInfo.Attachments[depthStencil.Attachment]; DepthStencil = new AmtRenderPassClearAttachment { Index = depthStencil.Attachment, Format = attachment.Format, ClearValueType = GetClearValueType(attachment.Format), Divisor = GetAttachmentDivisor(attachment.Format), Destination = AmtRenderPassAttachmentDestination.DEPTH_AND_STENCIL, StoreAction = TranslateStoreOp(attachment.StoreOp), LoadAction = TranslateLoadOp(attachment.LoadOp), StencilLoadAction = TranslateLoadOp(attachment.StencilLoadOp), StencilStoreAction = TranslateStoreOp(attachment.StencilStoreOp), }; } }
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); }
void CreateRenderpass(MgGraphicsDeviceCreateInfo createInfo) { bool isStencilFormat = AmtFormatExtensions.IsStencilFormat(createInfo.DepthStencil); var attachments = new[] { // Color attachment[0] new MgAttachmentDescription { Format = createInfo.Color, // TODO : multisampling Samples = createInfo.Samples, LoadOp = MgAttachmentLoadOp.CLEAR, StoreOp = MgAttachmentStoreOp.STORE, StencilLoadOp = MgAttachmentLoadOp.DONT_CARE, StencilStoreOp = MgAttachmentStoreOp.DONT_CARE, InitialLayout = MgImageLayout.COLOR_ATTACHMENT_OPTIMAL, FinalLayout = MgImageLayout.COLOR_ATTACHMENT_OPTIMAL, }, // Depth attachment[1] new MgAttachmentDescription { Format = createInfo.DepthStencil, // TODO : multisampling Samples = createInfo.Samples, LoadOp = MgAttachmentLoadOp.CLEAR, StoreOp = MgAttachmentStoreOp.STORE, // activate stencil if needed StencilLoadOp = isStencilFormat ? MgAttachmentLoadOp.CLEAR : MgAttachmentLoadOp.DONT_CARE, StencilStoreOp = isStencilFormat ? MgAttachmentStoreOp.STORE : MgAttachmentStoreOp.DONT_CARE, InitialLayout = MgImageLayout.DEPTH_STENCIL_ATTACHMENT_OPTIMAL, FinalLayout = MgImageLayout.DEPTH_STENCIL_ATTACHMENT_OPTIMAL, } }; var colorReference = new MgAttachmentReference { Attachment = 0, Layout = MgImageLayout.COLOR_ATTACHMENT_OPTIMAL, }; var depthReference = new MgAttachmentReference { Attachment = 1, Layout = MgImageLayout.DEPTH_STENCIL_ATTACHMENT_OPTIMAL, }; var subpass = new MgSubpassDescription { PipelineBindPoint = MgPipelineBindPoint.GRAPHICS, Flags = 0, InputAttachments = null, ColorAttachmentCount = 1, ColorAttachments = new[] { colorReference }, ResolveAttachments = null, DepthStencilAttachment = depthReference, PreserveAttachments = null, }; var renderPassInfo = new MgRenderPassCreateInfo { Attachments = attachments, Subpasses = new[] { subpass }, Dependencies = null, }; Result err; IMgRenderPass renderPass; err = mConfiguration.Device.CreateRenderPass(renderPassInfo, null, out renderPass); Debug.Assert(err == Result.SUCCESS, err + " != Result.SUCCESS"); mRenderpass = renderPass; }
public Result CreateRenderPass(MgRenderPassCreateInfo pCreateInfo, IMgAllocationCallbacks allocator, out IMgRenderPass pRenderPass) { pRenderPass = new AmtRenderPass(pCreateInfo); return(Result.SUCCESS); }
public Result CreateRenderPass(MgRenderPassCreateInfo pCreateInfo, IMgAllocationCallbacks allocator, out IMgRenderPass pRenderPass) { throw new NotImplementedException(); }