Ejemplo n.º 1
0
        /// <summary>
        /// Function to copy the contents of a pipeline state to another pipeline state.
        /// </summary>
        /// <param name="pipelineState">The pipeline state to copy.</param>
        internal void CopyTo(GorgonPipelineState pipelineState)
        {
            if (RasterState != null)
            {
                if (pipelineState.RasterState == null)
                {
                    pipelineState.RasterState = new GorgonRasterState();
                }

                pipelineState.RasterState.IsAntialiasedLineEnabled = RasterState.IsAntialiasedLineEnabled;
                pipelineState.RasterState.CullMode                       = RasterState.CullMode;
                pipelineState.RasterState.DepthBias                      = RasterState.DepthBias;
                pipelineState.RasterState.DepthBiasClamp                 = RasterState.DepthBiasClamp;
                pipelineState.RasterState.IsDepthClippingEnabled         = RasterState.IsDepthClippingEnabled;
                pipelineState.RasterState.FillMode                       = RasterState.FillMode;
                pipelineState.RasterState.ForcedReadWriteViewSampleCount = RasterState.ForcedReadWriteViewSampleCount;
                pipelineState.RasterState.IsFrontCounterClockwise        = RasterState.IsFrontCounterClockwise;
                pipelineState.RasterState.IsMultisamplingEnabled         = RasterState.IsMultisamplingEnabled;
                pipelineState.RasterState.RwScissorRectangles.AddRange(RasterState.RwScissorRectangles);
                pipelineState.RasterState.SlopeScaledDepthBias         = RasterState.SlopeScaledDepthBias;
                pipelineState.RasterState.UseConservativeRasterization = RasterState.UseConservativeRasterization;
            }

            if (DepthStencilState != null)
            {
                if (pipelineState.DepthStencilState == null)
                {
                    pipelineState.DepthStencilState = new GorgonDepthStencilState();
                }

                pipelineState.DepthStencilState.BackFaceStencilOp.Comparison         = DepthStencilState.BackFaceStencilOp.Comparison;
                pipelineState.DepthStencilState.BackFaceStencilOp.DepthFailOperation = DepthStencilState.BackFaceStencilOp.DepthFailOperation;
                pipelineState.DepthStencilState.BackFaceStencilOp.FailOperation      = DepthStencilState.BackFaceStencilOp.FailOperation;
                pipelineState.DepthStencilState.BackFaceStencilOp.PassOperation      = DepthStencilState.BackFaceStencilOp.PassOperation;

                pipelineState.DepthStencilState.FrontFaceStencilOp.Comparison         = DepthStencilState.FrontFaceStencilOp.Comparison;
                pipelineState.DepthStencilState.FrontFaceStencilOp.DepthFailOperation = DepthStencilState.FrontFaceStencilOp.DepthFailOperation;
                pipelineState.DepthStencilState.FrontFaceStencilOp.FailOperation      = DepthStencilState.FrontFaceStencilOp.FailOperation;
                pipelineState.DepthStencilState.FrontFaceStencilOp.PassOperation      = DepthStencilState.FrontFaceStencilOp.PassOperation;

                pipelineState.DepthStencilState.DepthComparison     = DepthStencilState.DepthComparison;
                pipelineState.DepthStencilState.IsDepthWriteEnabled = DepthStencilState.IsDepthWriteEnabled;
                pipelineState.DepthStencilState.IsDepthEnabled      = DepthStencilState.IsDepthEnabled;
                pipelineState.DepthStencilState.IsStencilEnabled    = DepthStencilState.IsStencilEnabled;
                pipelineState.DepthStencilState.StencilReadMask     = DepthStencilState.StencilReadMask;
                pipelineState.DepthStencilState.StencilWriteMask    = DepthStencilState.StencilWriteMask;
            }

            pipelineState.IsIndependentBlendingEnabled = IsIndependentBlendingEnabled;
            pipelineState.IsAlphaToCoverageEnabled     = IsAlphaToCoverageEnabled;
            pipelineState.PixelShader    = PixelShader;
            pipelineState.VertexShader   = VertexShader;
            pipelineState.GeometryShader = GeometryShader;
            pipelineState.DomainShader   = DomainShader;
            pipelineState.HullShader     = HullShader;
            pipelineState.PrimitiveType  = PrimitiveType;
            RwBlendStates.CopyTo(pipelineState.RwBlendStates);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GorgonPipelineState"/> class.
 /// </summary>
 /// <param name="state">The state copy.</param>
 internal GorgonPipelineState(GorgonPipelineState state)
 {
     RasterState                  = state.RasterState;
     DepthStencilState            = state.DepthStencilState;
     IsIndependentBlendingEnabled = state.IsIndependentBlendingEnabled;
     IsAlphaToCoverageEnabled     = state.IsAlphaToCoverageEnabled;
     PixelShader                  = state.PixelShader;
     VertexShader                 = state.VertexShader;
     GeometryShader               = state.GeometryShader;
     DomainShader                 = state.DomainShader;
     HullShader    = state.HullShader;
     PrimitiveType = state.PrimitiveType;
     state.RwBlendStates.CopyTo(RwBlendStates);
 }
 /// <summary>
 /// Function to set the pipeline state for this draw call.
 /// </summary>
 /// <param name="pipelineState">The pipeline state to assign.</param>
 /// <returns>The fluent builder interface.</returns>
 /// <exception cref="ArgumentNullException">Thrown when the <paramref name="pipelineState"/> parameter is <b>null</b>.</exception>
 public TB PipelineState(GorgonPipelineState pipelineState)
 {
     DrawCall.D3DState.PipelineState = pipelineState ?? throw new ArgumentNullException(nameof(pipelineState));
     return((TB)this);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GorgonStreamOutPipelineState"/> class.
 /// </summary>
 /// <param name="pipelineState">State of the pipeline.</param>
 internal GorgonStreamOutPipelineState(GorgonPipelineState pipelineState) => PipelineState = pipelineState;