Example #1
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);
                }
            }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="passDescription"></param>
        /// <param name="manager"></param>
        public ShaderPass(ShaderPassDescription passDescription, IEffectsManager manager)
        {
            Name = passDescription.Name;

            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?
                         Collect(manager.StateManager.Register((BlendStateDescription)passDescription.BlendStateDescription)) : BlendStateProxy.Empty;

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

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

            BlendFactor = passDescription.BlendFactor;

            StencilRef = passDescription.StencilRef;

            SampleMask = passDescription.SampleMask;

            Topology = passDescription.Topology;
        }
Example #3
0
 /// <summary>
 /// Adds the pass.
 /// </summary>
 /// <param name="description">The description.</param>
 /// <returns></returns>
 public bool AddPass(ShaderPassDescription description)
 {
     if (passDict.ContainsKey(description.Name))
     {
         return false;
     }
     var pass = new Lazy<ShaderPass>(() => { return new ShaderPass(description, EffectsManager); }, true);
     passDict.Add(description.Name, pass);
     passList.Add(pass);
     return true;
 }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="passDescription"></param>
        /// <param name="manager"></param>
        public ShaderPass(ShaderPassDescription passDescription, IEffectsManager manager)
        {
            Name = passDescription.Name;

            if (passDescription.ShaderList != null)
            {
                foreach (var shader in passDescription.ShaderList)
                {
                    shaders[shader.ShaderType.ToIndex()] = manager.ShaderManager.RegisterShader(shader);
                }
            }
            for (int i = 0; i < shaders.Length; ++i)
            {
                if (shaders[i] == null)
                {
                    var type = i.ToShaderStage();
                    switch (type)
                    {
                    case ShaderStage.Vertex:
                        shaders[i] = NullShader.VertexNull;
                        break;

                    case ShaderStage.Hull:
                        shaders[i] = NullShader.HullNull;
                        break;

                    case ShaderStage.Domain:
                        shaders[i] = NullShader.DomainNull;
                        break;

                    case ShaderStage.Geometry:
                        shaders[i] = NullShader.GeometryNull;
                        break;

                    case ShaderStage.Pixel:
                        shaders[i] = NullShader.PixelNull;
                        break;

                    case ShaderStage.Compute:
                        shaders[i] = NullShader.ComputeNull;
                        break;
                    }
                }
            }

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

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

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