private static GraphicsPipelineStateDescription CreateGraphicsPipelineStateDescription(GraphicsDevice device, RootSignature rootSignature, InputElementDescription[] inputElements, byte[] vertexShader, byte[] pixelShader, byte[]?geometryShader, byte[]?hullShader, byte[]?domainShader) { RasterizerDescription rasterizerDescription = RasterizerDescription.CullNone; rasterizerDescription.FrontCounterClockwise = true; BlendDescription blendDescription = BlendDescription.AlphaBlend; InputLayoutDescription inputLayoutDescription = new InputLayoutDescription(inputElements.Select(i => Unsafe.As <InputElementDescription, Vortice.Direct3D12.InputElementDescription>(ref i)).ToArray()); GraphicsPipelineStateDescription pipelineStateDescription = new GraphicsPipelineStateDescription { InputLayout = inputLayoutDescription, RootSignature = rootSignature.NativeRootSignature, VertexShader = vertexShader, PixelShader = pixelShader, GeometryShader = geometryShader, HullShader = hullShader, DomainShader = domainShader, RasterizerState = rasterizerDescription, BlendState = blendDescription, PrimitiveTopologyType = PrimitiveTopologyType.Triangle, StreamOutput = new StreamOutputDescription() }; Texture?depthStencilBuffer = device.CommandList.DepthStencilBuffer; if (depthStencilBuffer != null) { pipelineStateDescription.DepthStencilFormat = (Format)depthStencilBuffer.Description.Format; } Format[] renderTargetFormats = new Format[device.CommandList.RenderTargets.Length]; for (int i = 0; i < renderTargetFormats.Length; i++) { renderTargetFormats[i] = (Format)((Texture)device.CommandList.RenderTargets[i]).Description.Format; } pipelineStateDescription.RenderTargetFormats = renderTargetFormats; return(pipelineStateDescription); }
internal PipelineState(GraphicsDevice device, RootSignature rootSignature, GraphicsPipelineStateDescription pipelineStateDescription) { IsCompute = false; RootSignature = rootSignature; NativePipelineState = device.NativeDevice.CreateGraphicsPipelineState(pipelineStateDescription); }
public PipelineState(GraphicsDevice device, RootSignature rootSignature, byte[] computeShader) : this(device, rootSignature, CreateComputePipelineStateDescription(rootSignature, computeShader)) { }
public PipelineState(GraphicsDevice device, RootSignature rootSignature, InputElementDescription[] inputElements, byte[] vertexShader, byte[] pixelShader, byte[]?geometryShader = default, byte[]?hullShader = default, byte[]?domainShader = default) : this(device, rootSignature, CreateGraphicsPipelineStateDescription(device, rootSignature, inputElements, vertexShader, pixelShader, geometryShader, hullShader, domainShader)) { }
public XamlSwapChainGraphicsPresenter(GraphicsDevice device, PresentationParameters presentationParameters, SwapChainPanel swapChainPanel) : base(device, presentationParameters, CreateSwapChain(device, presentationParameters, swapChainPanel)) { this.swapChainPanel = swapChainPanel; }