/// <summary> /// Initialize new instance of <see cref="RenderPassRenderTargetDescription"/> struct. /// </summary> /// <param name="cpuDescriptor">The CPU <see cref="CpuDescriptorHandle"/> handle corresponding to the render target view(s) (RTVs).</param> /// <param name="beginningAccess">The access to the RTV(s) requested at the transition into a render pass.</param> /// <param name="endingAccess">The access to the RTV(s) requested at the transition out of a render pass.</param> public RenderPassRenderTargetDescription( CpuDescriptorHandle cpuDescriptor, RenderPassBeginningAccess beginningAccess, RenderPassEndingAccess endingAccess) { CpuDescriptor = cpuDescriptor; BeginningAccess = beginningAccess; EndingAccess = endingAccess; }
/// <summary> /// Initialize new instance of <see cref="RenderPassDepthStencilDescription"/> struct. /// </summary> /// <param name="cpuDescriptor">The CPU <see cref="CpuDescriptorHandle"/> handle corresponding to the depth stencil view (DSV).</param> /// <param name="depthBeginningAccess">The access to the depth buffer requested at the transition into a render pass.</param> /// <param name="depthEndingAccess">The access to the depth buffer requested at the transition out of a render pass.</param> public RenderPassDepthStencilDescription( CpuDescriptorHandle cpuDescriptor, RenderPassBeginningAccess depthBeginningAccess, RenderPassEndingAccess depthEndingAccess) { CpuDescriptor = cpuDescriptor; DepthBeginningAccess = depthBeginningAccess; StencilBeginningAccess = new RenderPassBeginningAccess(RenderPassBeginningAccessType.NoAccess); DepthEndingAccess = depthEndingAccess; StencilEndingAccess = new RenderPassEndingAccess(RenderPassEndingAccessType.NoAccess); }
/// <summary> /// Initialize new instance of <see cref="RenderPassDepthStencilDescription"/> struct. /// </summary> /// <param name="cpuDescriptor">The CPU <see cref="CpuDescriptorHandle"/> handle corresponding to the depth stencil view (DSV).</param> /// <param name="depthBeginningAccess">The access to the depth buffer requested at the transition into a render pass.</param> /// <param name="stencilBeginningAccess">The access to the stencil buffer requested at the transition into a render pass.</param> /// <param name="depthEndingAccess">The access to the depth buffer requested at the transition out of a render pass.</param> /// <param name="stencilEndingAccess">The access to the stencil buffer requested at the transition out of a render pass.</param> public RenderPassDepthStencilDescription( CpuDescriptorHandle cpuDescriptor, RenderPassBeginningAccess depthBeginningAccess, RenderPassBeginningAccess stencilBeginningAccess, RenderPassEndingAccess depthEndingAccess, RenderPassEndingAccess stencilEndingAccess) { CpuDescriptor = cpuDescriptor; DepthBeginningAccess = depthBeginningAccess; StencilBeginningAccess = stencilBeginningAccess; DepthEndingAccess = depthEndingAccess; StencilEndingAccess = stencilEndingAccess; }
public void BeginRenderPass(Texture?depthStencilView, params GraphicsResource[] renderTargetViews) { RenderPassRenderTargetDescription[] renderPassRenderTargetDescriptions = new RenderPassRenderTargetDescription[renderTargetViews.Length]; RenderPassBeginningAccess renderPassBeginningAccessPreserve = new RenderPassBeginningAccess { Type = RenderPassBeginningAccessType.Preserve }; RenderPassEndingAccess renderPassEndingAccessPreserve = new RenderPassEndingAccess { Type = RenderPassEndingAccessType.Preserve }; for (int i = 0; i < renderTargetViews.Length; i++) { RenderPassRenderTargetDescription renderPassRenderTargetDescription = new RenderPassRenderTargetDescription { BeginningAccess = renderPassBeginningAccessPreserve, EndingAccess = renderPassEndingAccessPreserve, CpuDescriptor = renderTargetViews[i].NativeRenderTargetView }; renderPassRenderTargetDescriptions[i] = renderPassRenderTargetDescription; } RenderPassBeginningAccess renderPassBeginningAccessNoAccess = new RenderPassBeginningAccess { Type = RenderPassBeginningAccessType.NoAccess }; RenderPassEndingAccess renderPassEndingAccessNoAccess = new RenderPassEndingAccess { Type = RenderPassEndingAccessType.NoAccess }; RenderPassDepthStencilDescription?renderPassDepthStencilDescription = null; if (depthStencilView != null) { renderPassDepthStencilDescription = new RenderPassDepthStencilDescription { DepthBeginningAccess = renderPassBeginningAccessNoAccess, DepthEndingAccess = renderPassEndingAccessNoAccess, StencilBeginningAccess = renderPassBeginningAccessNoAccess, StencilEndingAccess = renderPassEndingAccessNoAccess, CpuDescriptor = depthStencilView.NativeDepthStencilView }; } BeginRenderPass(renderTargetViews.Length, renderPassRenderTargetDescriptions, renderPassDepthStencilDescription, RenderPassFlags.None); }