Beispiel #1
0
            private void OnBlendStateChanged()
            {
                var newState = EffectTechnique.EffectsManager.StateManager.Register(blendDesc);

                RemoveAndDispose(ref blendState);
                blendState = Collect(newState);
            }
Beispiel #2
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="passDescription"></param>
            /// <param name="manager"></param>
            public ShaderPass(ShaderPassDescription passDescription, IEffectsManager manager)
            {
                Name           = passDescription.Name;
                effectsManager = manager;
                if (passDescription.ShaderList != null)
                {
                    foreach (var shader in passDescription.ShaderList)
                    {
                        var s = manager.ShaderManager.RegisterShader(shader);
                        switch (shader.ShaderType)
                        {
                        case ShaderStage.Vertex:
                            vertexShader = s as VertexShader;
                            break;

                        case ShaderStage.Domain:
                            domainShader = s as DomainShader;
                            break;

                        case ShaderStage.Hull:
                            hullShader = s as HullShader;
                            break;

                        case ShaderStage.Geometry:
                            geometryShader = s as GeometryShader;
                            break;

                        case ShaderStage.Pixel:
                            pixelShader = s as PixelShader;
                            break;

                        case ShaderStage.Compute:
                            computeShader = s as ComputeShader;
                            break;
                        }
                    }
                }

                blendState = passDescription.BlendStateDescription != null?
                             manager.StateManager.Register((BlendStateDescription)passDescription.BlendStateDescription) : BlendStateProxy.Empty;

                depthStencilState = passDescription.DepthStencilStateDescription != null?
                                    manager.StateManager.Register((DepthStencilStateDescription)passDescription.DepthStencilStateDescription) : DepthStencilStateProxy.Empty;

                rasterState = passDescription.RasterStateDescription != null?
                              manager.StateManager.Register((RasterizerStateDescription)passDescription.RasterStateDescription) : RasterizerStateProxy.Empty;

                BlendFactor = passDescription.BlendFactor;

                StencilRef = passDescription.StencilRef;

                SampleMask = passDescription.SampleMask;

                Topology = passDescription.Topology;
                if (passDescription.InputLayoutDescription != null)
                {
                    layout = manager.ShaderManager.RegisterInputLayout(passDescription.InputLayoutDescription);
                }
            }
 /// <summary>
 /// Called when [detach].
 /// </summary>
 protected override void OnDetach()
 {
     DisposeBuffers();
     textureSampler = null;
     blendState     = null;
     textureView    = null;
     base.OnDetach();
 }
 /// <summary>
 /// Called when [detach].
 /// </summary>
 protected override void OnDetach()
 {
     DisposeBuffers();
     isInitialParticleChanged = true;
     textureSampler           = null;
     blendState  = null;
     textureView = null;
     base.OnDetach();
 }
 public void Reset()
 {
     CurrShaderPass        = null;
     currRasterState       = null;
     currBlendState        = null;
     currDepthStencilState = null;
     currBlendFactor       = null;
     currSampleMask        = uint.MaxValue;
     currStencilRef        = 0;
 }
 public void SetBlendState(BlendStateProxy blendState, Color4?blendFactor = null, uint sampleMask = uint.MaxValue)
 {
     if (AutoSkipRedundantStateSetting && currBlendState == blendState && blendFactor == currBlendFactor && currSampleMask == sampleMask)
     {
         return;
     }
     deviceContext.OutputMerger.SetBlendState(blendState, blendFactor, sampleMask);
     currBlendState  = blendState;
     currBlendFactor = blendFactor;
     currSampleMask  = sampleMask;
 }
 public void Reset()
 {
     CurrShaderPass        = null;
     currRasterState       = null;
     currBlendState        = null;
     currDepthStencilState = null;
     currBlendFactor       = null;
     currSampleMask        = uint.MaxValue;
     currStencilRef        = 0;
     currInputLayout       = null;
     currPrimitiveTopology = PrimitiveTopology.Undefined;
 }
Beispiel #8
0
 /// <summary>
 /// Sets the state.
 /// </summary>
 /// <param name="blendStateDesc">The blend state desc.</param>
 public void SetState(BlendStateDescription?blendStateDesc)
 {
     if (IsNULL)
     {
         return;
     }
     if (BlendState != BlendStateProxy.Empty)
     {
         RemoveAndDispose(ref blendState);
     }
     blendState = blendStateDesc != null?
                  effectsManager.StateManager.Register(blendStateDesc.Value) : BlendStateProxy.Empty;
 }
Beispiel #9
0
 public void Reset()
 {
     currRasterState       = null;
     currBlendState        = null;
     currDepthStencilState = null;
     currBlendFactor       = null;
     currSampleMask        = uint.MaxValue;
     currStencilRef        = 0;
     currInputLayout       = null;
     currPrimitiveTopology = PrimitiveTopology.Undefined;
     for (int i = 0; i < ConstantBufferCheck.Length; ++i)
     {
         ConstantBufferCheck[i] = null;
     }
     for (int i = 0; i < SamplerStateCheck.Length; ++i)
     {
         SamplerStateCheck[i] = null;
     }
 }
Beispiel #10
0
 /// <summary>
 /// Sets the state of the blend.
 /// </summary>
 /// <param name="blendState">State of the blend.</param>
 /// <param name="blendFactor">The blend factor.</param>
 /// <param name="sampleMask">The sample mask.</param>
 public void SetBlendState(BlendStateProxy blendState, Color4?blendFactor, uint sampleMask)
 {
     DeviceContext.OutputMerger.SetBlendState(blendState, blendFactor, sampleMask);
 }
Beispiel #11
0
 /// <summary>
 /// Sets the state of the blend.
 /// </summary>
 /// <param name="blendState">State of the blend.</param>
 public void SetBlendState(BlendStateProxy blendState)
 {
     DeviceContext.OutputMerger.SetBlendState(blendState);
 }