Exemplo n.º 1
0
        public static BlendId CreateBlendState(BlendStateDescription description)
        {
            BlendId id = new BlendId();

            CreateBlendState(ref id, description);
            return(id);
        }
Exemplo n.º 2
0
 private static void InitBlendState(BlendId id)
 {
     if (BlendObjects[id.Index] == null)
     {
         BlendObjects[id.Index] = new BlendState(MyRender11.Device, BlendStates.Data[id.Index]);
     }
 }
Exemplo n.º 3
0
 internal static void InitBlendState(BlendId id)
 {
     try
     {
         BlendObjects[id.Index] = new BlendState(MyRender11.Device, BlendStates.Data[id.Index]);
     }
     catch
     {
         MyRender11.ProcessDebugOutput();
         throw;
     }
 }
Exemplo n.º 4
0
        internal static BlendId CreateBlendState(BlendStateDescription description)
        {
            var id = new BlendId {
                Index = BlendStates.Allocate()
            };

            MyArrayHelpers.Reserve(ref BlendObjects, id.Index + 1);

            BlendStates.Data[id.Index] = description.Clone();

            InitBlendState(id);
            BlendIndices.Add(id);

            return(id);
        }
Exemplo n.º 5
0
        public static void CreateBlendState(ref BlendId id, BlendStateDescription description)
        {
            if (id == BlendId.NULL)
            {
                id = new BlendId(BlendStates.Allocate());
                MyArrayHelpers.Reserve(ref BlendObjects, id.Index + 1);
                BlendIndices.Add(id);
            }
            else
            {
                BlendObjects[id.Index].Dispose();
            }

            BlendStates.Data[id.Index] = description.Clone();
            InitBlendState(id);
        }
Exemplo n.º 6
0
        static void InitializeBlendStates()
        {
            BlendStateDescription desc = new BlendStateDescription();

            desc.RenderTarget[0].IsBlendEnabled        = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].SourceBlend           = BlendOption.SourceAlpha;
            desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.SourceAlpha;
            BlendGui = MyPipelineStates.CreateBlendState(desc);

            desc.RenderTarget[0].IsBlendEnabled        = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend      = BlendOption.One;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
            desc.RenderTarget[0].SourceBlend           = BlendOption.One;
            desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
            BlendAdditive = MyPipelineStates.CreateBlendState(desc);

            desc.RenderTarget[0].IsBlendEnabled        = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].SourceBlend           = BlendOption.SourceAlpha;
            desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
            BlendTransparent = MyPipelineStates.CreateBlendState(desc);

            desc.RenderTarget[0].IsBlendEnabled        = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].SourceBlend           = BlendOption.One;
            desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
            BlendAlphaPremult = MyPipelineStates.CreateBlendState(desc);
        }
        static void InitializeBlendStates()
        {
            BlendStateDescription desc = new BlendStateDescription();
            desc.RenderTarget[0].IsBlendEnabled = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].SourceBlend = BlendOption.SourceAlpha;
            desc.RenderTarget[0].SourceAlphaBlend = BlendOption.SourceAlpha;
            BlendGui = MyPipelineStates.CreateBlendState(desc);

            desc.RenderTarget[0].IsBlendEnabled = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend = BlendOption.One;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
            desc.RenderTarget[0].SourceBlend = BlendOption.One;
            desc.RenderTarget[0].SourceAlphaBlend = BlendOption.One;
            BlendAdditive = MyPipelineStates.CreateBlendState(desc);

            desc.RenderTarget[0].IsBlendEnabled = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].SourceBlend = BlendOption.SourceAlpha;
            desc.RenderTarget[0].SourceAlphaBlend = BlendOption.One;
            BlendTransparent = MyPipelineStates.CreateBlendState(desc);

            desc.RenderTarget[0].IsBlendEnabled = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].SourceBlend = BlendOption.One;
            desc.RenderTarget[0].SourceAlphaBlend = BlendOption.One;
            BlendAlphaPremult = MyPipelineStates.CreateBlendState(desc);
        }
Exemplo n.º 8
0
        public static void CreateBlendState(ref BlendId id, BlendStateDescription description)
        {
            if (id == BlendId.NULL)
            {
                id = new BlendId(BlendStates.Allocate());
                MyArrayHelpers.Reserve(ref BlendObjects, id.Index + 1);
                BlendIndices.Add(id);
            }
            else
            {
                BlendObjects[id.Index].Dispose();
            }

            BlendStates.Data[id.Index] = description.Clone();
            InitBlendState(id);
        }
Exemplo n.º 9
0
 public static BlendId CreateBlendState(BlendStateDescription description)
 {
     BlendId id = new BlendId();
     CreateBlendState(ref id, description);
     return id;
 }
Exemplo n.º 10
0
        static void InitializeBlendStates()
        {
            BlendStateDescription desc = new BlendStateDescription();

            desc.RenderTarget[0].IsBlendEnabled        = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].SourceBlend           = BlendOption.SourceAlpha;
            desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.SourceAlpha;
            BlendGui = MyPipelineStates.CreateBlendState(desc);

            desc.RenderTarget[0].IsBlendEnabled        = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend      = BlendOption.One;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
            desc.RenderTarget[0].SourceBlend           = BlendOption.One;
            desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
            BlendAdditive = MyPipelineStates.CreateBlendState(desc);

            desc.RenderTarget[0].IsBlendEnabled        = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].SourceBlend           = BlendOption.SourceAlpha;
            desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
            BlendTransparent = MyPipelineStates.CreateBlendState(desc);

            desc.RenderTarget[0].IsBlendEnabled        = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].SourceBlend           = BlendOption.One;
            desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
            BlendAlphaPremult = MyPipelineStates.CreateBlendState(desc);

            desc.RenderTarget[0].IsBlendEnabled        = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend      = BlendOption.SourceColor;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].SourceBlend           = BlendOption.Zero;
            desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
            BlendOutscatter = MyPipelineStates.CreateBlendState(desc);


            desc.IndependentBlendEnable = true;
            // color metal
            desc.RenderTarget[0].IsBlendEnabled        = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseBlendFactor;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseBlendFactor;
            desc.RenderTarget[0].SourceBlend           = BlendOption.BlendFactor;
            desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.BlendFactor;
            // normal gloss
            desc.RenderTarget[1].IsBlendEnabled        = true;
            desc.RenderTarget[1].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[1].BlendOperation        = BlendOperation.Add;
            desc.RenderTarget[1].AlphaBlendOperation   = BlendOperation.Add;
            desc.RenderTarget[1].DestinationBlend      = BlendOption.Zero;
            desc.RenderTarget[1].DestinationAlphaBlend = BlendOption.Zero;
            desc.RenderTarget[1].SourceBlend           = BlendOption.One;
            desc.RenderTarget[1].SourceAlphaBlend      = BlendOption.One;
            // ao
            desc.RenderTarget[2].IsBlendEnabled        = true;
            desc.RenderTarget[2].RenderTargetWriteMask = ColorWriteMaskFlags.Red;
            desc.RenderTarget[2].BlendOperation        = BlendOperation.Minimum;
            desc.RenderTarget[2].AlphaBlendOperation   = BlendOperation.Minimum;
            desc.RenderTarget[2].DestinationBlend      = BlendOption.One;
            desc.RenderTarget[2].DestinationAlphaBlend = BlendOption.One;
            desc.RenderTarget[2].SourceBlend           = BlendOption.InverseBlendFactor;
            desc.RenderTarget[2].SourceAlphaBlend      = BlendOption.InverseBlendFactor;

            BlendDecal = MyPipelineStates.CreateBlendState(desc);
        }
Exemplo n.º 11
0
 internal static void InitBlendState(BlendId id)
 {
     BlendObjects[id.Index] = new BlendState(MyRender11.Device, BlendStates.Data[id.Index]);
 }
Exemplo n.º 12
0
 internal static void InitBlendState(BlendId id)
 {
     BlendObjects[id.Index] = new BlendState(MyRender11.Device, BlendStates.Data[id.Index]);
 }
Exemplo n.º 13
0
        static void InitializeBlendStates()
        {
            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].SourceBlend           = BlendOption.SourceAlpha;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.SourceAlpha;
                BlendGui = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.One;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[0].SourceBlend           = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
                BlendAdditive = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.SourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[0].SourceBlend           = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
                BlendAtmosphere = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].SourceBlend           = BlendOption.SourceAlpha;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.SourceAlpha;
                BlendTransparent = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].SourceBlend           = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
                BlendAlphaPremult = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.SourceColor;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].SourceBlend           = BlendOption.Zero;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
                BlendOutscatter = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.SourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.SourceAlpha;
                desc.RenderTarget[0].SourceBlend           = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.InverseSourceAlpha;
                BlendInvTransparent = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                // color
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSecondarySourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.Zero;
                desc.RenderTarget[0].SourceBlend           = BlendOption.SecondarySourceAlpha;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
                BlendDecalColor = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.IndependentBlendEnable = true;

                // normal
                desc.RenderTarget[1].IsBlendEnabled        = true;
                desc.RenderTarget[1].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[1].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[1].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[1].DestinationBlend      = BlendOption.Zero;
                desc.RenderTarget[1].DestinationAlphaBlend = BlendOption.Zero;
                desc.RenderTarget[1].SourceBlend           = BlendOption.One;
                desc.RenderTarget[1].SourceAlphaBlend      = BlendOption.One;
                // ao
                desc.RenderTarget[2].IsBlendEnabled        = true;
                desc.RenderTarget[2].RenderTargetWriteMask = ColorWriteMaskFlags.Red;
                desc.RenderTarget[2].BlendOperation        = BlendOperation.Minimum;
                desc.RenderTarget[2].AlphaBlendOperation   = BlendOperation.Minimum;
                desc.RenderTarget[2].DestinationBlend      = BlendOption.One;
                desc.RenderTarget[2].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[2].SourceBlend           = BlendOption.InverseBlendFactor;
                desc.RenderTarget[2].SourceAlphaBlend      = BlendOption.InverseBlendFactor;

                BlendDecalNormal = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.IndependentBlendEnable = true;

                // color
                // NOTE: We skip metal as we can't use dual-source alpha when using multiple targets
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.Red | ColorWriteMaskFlags.Green | ColorWriteMaskFlags.Blue;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[0].SourceBlend           = BlendOption.SourceAlpha;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.Zero;
                // normal
                desc.RenderTarget[1].IsBlendEnabled        = true;
                desc.RenderTarget[1].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[1].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[1].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[1].DestinationBlend      = BlendOption.Zero;
                desc.RenderTarget[1].DestinationAlphaBlend = BlendOption.Zero;
                desc.RenderTarget[1].SourceBlend           = BlendOption.One;
                desc.RenderTarget[1].SourceAlphaBlend      = BlendOption.One;
                // ao
                desc.RenderTarget[2].IsBlendEnabled        = true;
                desc.RenderTarget[2].RenderTargetWriteMask = ColorWriteMaskFlags.Red;
                desc.RenderTarget[2].BlendOperation        = BlendOperation.Minimum;
                desc.RenderTarget[2].AlphaBlendOperation   = BlendOperation.Minimum;
                desc.RenderTarget[2].DestinationBlend      = BlendOption.One;
                desc.RenderTarget[2].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[2].SourceBlend           = BlendOption.InverseBlendFactor;
                desc.RenderTarget[2].SourceAlphaBlend      = BlendOption.InverseBlendFactor;

                BlendDecalNormalColor = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.IndependentBlendEnable = true;

                // accumulation target
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.One;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[0].SourceBlend           = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
                // coverage target
                desc.RenderTarget[1].IsBlendEnabled        = true;
                desc.RenderTarget[1].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[1].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[1].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[1].DestinationBlend      = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[1].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[1].SourceBlend           = BlendOption.Zero;
                desc.RenderTarget[1].SourceAlphaBlend      = BlendOption.Zero;
                BlendWeightedTransparency = MyPipelineStates.CreateBlendState(desc);
            }
        }
        static void InitializeBlendStates()
        {
            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].SourceBlend = BlendOption.SourceAlpha;
                desc.RenderTarget[0].SourceAlphaBlend = BlendOption.SourceAlpha;
                BlendGui = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend = BlendOption.One;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[0].SourceBlend = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend = BlendOption.One;
                BlendAdditive = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend = BlendOption.SourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[0].SourceBlend = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend = BlendOption.One;
                BlendAtmosphere = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].SourceBlend = BlendOption.SourceAlpha;
                desc.RenderTarget[0].SourceAlphaBlend = BlendOption.SourceAlpha;
                BlendTransparent = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].SourceBlend = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend = BlendOption.One;
                BlendAlphaPremult = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend = BlendOption.SourceColor;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].SourceBlend = BlendOption.Zero;
                desc.RenderTarget[0].SourceAlphaBlend = BlendOption.One;
                BlendOutscatter = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.IndependentBlendEnable = true;

                // color
                desc.RenderTarget[0].IsBlendEnabled = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.Red | ColorWriteMaskFlags.Green | ColorWriteMaskFlags.Blue;
                desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[0].SourceBlend = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend = BlendOption.Zero;
                // metal
                desc.RenderTarget[2].IsBlendEnabled = true;
                desc.RenderTarget[2].RenderTargetWriteMask = ColorWriteMaskFlags.Red;
                desc.RenderTarget[2].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[2].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[2].DestinationBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[2].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[2].SourceBlend = BlendOption.One;
                desc.RenderTarget[2].SourceAlphaBlend = BlendOption.Zero;

                BlendDecalColor = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.IndependentBlendEnable = true;

                // normal
                desc.RenderTarget[1].IsBlendEnabled = true;
                desc.RenderTarget[1].RenderTargetWriteMask = ColorWriteMaskFlags.Red | ColorWriteMaskFlags.Green | ColorWriteMaskFlags.Blue;
                desc.RenderTarget[1].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[1].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[1].DestinationBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[1].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[1].SourceBlend = BlendOption.SourceAlpha;
                desc.RenderTarget[1].SourceAlphaBlend = BlendOption.Zero;
                // gloss
                desc.RenderTarget[2].IsBlendEnabled = true;
                desc.RenderTarget[2].RenderTargetWriteMask = ColorWriteMaskFlags.Green;
                desc.RenderTarget[2].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[2].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[2].DestinationBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[2].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[2].SourceBlend = BlendOption.One;
                desc.RenderTarget[2].SourceAlphaBlend = BlendOption.Zero;

                BlendDecalNormal = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.IndependentBlendEnable = true;

                // color
                desc.RenderTarget[0].IsBlendEnabled = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.Red | ColorWriteMaskFlags.Green | ColorWriteMaskFlags.Blue;
                desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[0].SourceBlend = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend = BlendOption.Zero;
                // normal
                desc.RenderTarget[1].IsBlendEnabled = true;
                desc.RenderTarget[1].RenderTargetWriteMask = ColorWriteMaskFlags.Red | ColorWriteMaskFlags.Green | ColorWriteMaskFlags.Blue;
                desc.RenderTarget[1].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[1].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[1].DestinationBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[1].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[1].SourceBlend = BlendOption.SourceAlpha;
                desc.RenderTarget[1].SourceAlphaBlend = BlendOption.Zero;
                // metal/gloss
                desc.RenderTarget[2].IsBlendEnabled = true;
                desc.RenderTarget[2].RenderTargetWriteMask = ColorWriteMaskFlags.Red | ColorWriteMaskFlags.Green;
                desc.RenderTarget[2].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[2].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[2].DestinationBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[2].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[2].SourceBlend = BlendOption.One;
                desc.RenderTarget[2].SourceAlphaBlend = BlendOption.Zero;

                BlendDecalNormalColor = MyPipelineStates.CreateBlendState(desc);

                desc.RenderTarget[2].RenderTargetWriteMask = ColorWriteMaskFlags.Red | ColorWriteMaskFlags.Green | ColorWriteMaskFlags.Blue;
                BlendDecalNormalColorExt = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend = BlendOption.SourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.SourceAlpha;
                desc.RenderTarget[0].SourceBlend = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend = BlendOption.One;
                BlendWeightedTransparencyResolve = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.IndependentBlendEnable = true;

                // accumulation target
                desc.RenderTarget[0].IsBlendEnabled = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend = BlendOption.One;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[0].SourceBlend = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend = BlendOption.One;
                // coverage target
                desc.RenderTarget[1].IsBlendEnabled = true;
                desc.RenderTarget[1].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[1].BlendOperation = BlendOperation.Add;
                desc.RenderTarget[1].AlphaBlendOperation = BlendOperation.Add;
                desc.RenderTarget[1].DestinationBlend = BlendOption.InverseSourceColor;
                desc.RenderTarget[1].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[1].SourceBlend = BlendOption.Zero;
                desc.RenderTarget[1].SourceAlphaBlend = BlendOption.Zero;
                BlendWeightedTransparency = MyPipelineStates.CreateBlendState(desc);
            }
        }
        static void InitializeBlendStates()
        {
            BlendStateDescription desc = new BlendStateDescription();
            desc.RenderTarget[0].IsBlendEnabled = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].SourceBlend = BlendOption.SourceAlpha;
            desc.RenderTarget[0].SourceAlphaBlend = BlendOption.SourceAlpha;
            BlendGui = MyPipelineStates.CreateBlendState(desc);

            desc.RenderTarget[0].IsBlendEnabled = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend = BlendOption.One;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
            desc.RenderTarget[0].SourceBlend = BlendOption.One;
            desc.RenderTarget[0].SourceAlphaBlend = BlendOption.One;
            BlendAdditive = MyPipelineStates.CreateBlendState(desc);

            desc.RenderTarget[0].IsBlendEnabled = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].SourceBlend = BlendOption.SourceAlpha;
            desc.RenderTarget[0].SourceAlphaBlend = BlendOption.One;
            BlendTransparent = MyPipelineStates.CreateBlendState(desc);

            desc.RenderTarget[0].IsBlendEnabled = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
            desc.RenderTarget[0].SourceBlend = BlendOption.One;
            desc.RenderTarget[0].SourceAlphaBlend = BlendOption.One;
            BlendAlphaPremult = MyPipelineStates.CreateBlendState(desc);


            desc.IndependentBlendEnable = true;
            // color metal
            desc.RenderTarget[0].IsBlendEnabled = true;
            desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[0].BlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
            desc.RenderTarget[0].DestinationBlend = BlendOption.InverseBlendFactor;
            desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseBlendFactor;
            desc.RenderTarget[0].SourceBlend = BlendOption.BlendFactor;
            desc.RenderTarget[0].SourceAlphaBlend = BlendOption.BlendFactor;
            // normal gloss
            desc.RenderTarget[1].IsBlendEnabled = true;
            desc.RenderTarget[1].RenderTargetWriteMask = ColorWriteMaskFlags.All;
            desc.RenderTarget[1].BlendOperation = BlendOperation.Add;
            desc.RenderTarget[1].AlphaBlendOperation = BlendOperation.Add;
            desc.RenderTarget[1].DestinationBlend = BlendOption.Zero;
            desc.RenderTarget[1].DestinationAlphaBlend = BlendOption.Zero;
            desc.RenderTarget[1].SourceBlend = BlendOption.One;
            desc.RenderTarget[1].SourceAlphaBlend = BlendOption.One;
            // ao
            desc.RenderTarget[2].IsBlendEnabled = true;
            desc.RenderTarget[2].RenderTargetWriteMask = ColorWriteMaskFlags.Red;
            desc.RenderTarget[2].BlendOperation = BlendOperation.Minimum;
            desc.RenderTarget[2].AlphaBlendOperation = BlendOperation.Minimum;
            desc.RenderTarget[2].DestinationBlend = BlendOption.One;
            desc.RenderTarget[2].DestinationAlphaBlend = BlendOption.One;
            desc.RenderTarget[2].SourceBlend = BlendOption.InverseBlendFactor;
            desc.RenderTarget[2].SourceAlphaBlend = BlendOption.InverseBlendFactor;

            BlendDecal = MyPipelineStates.CreateBlendState(desc);
        }
Exemplo n.º 16
0
 private static void InitBlendState(BlendId id)
 {
     if (BlendObjects[id.Index] == null)
         BlendObjects[id.Index] = new BlendState(MyRender11.Device, BlendStates.Data[id.Index]);
 }
Exemplo n.º 17
0
        internal static BlendId CreateBlendState(BlendStateDescription description)
        {
            var id = new BlendId { Index = BlendStates.Allocate() };
            MyArrayHelpers.Reserve(ref BlendObjects, id.Index + 1);

            BlendStates.Data[id.Index] = description.Clone();

            InitBlendState(id);
            BlendIndices.Add(id);

            return id;
        }
Exemplo n.º 18
0
 internal static BlendState GetBlend(BlendId id)
 {
     return(BlendObjects[id.Index]);
 }
Exemplo n.º 19
0
 internal static BlendState GetBlend(BlendId id)
 {
     return BlendObjects[id.Index];
 }
        static void InitializeBlendStates()
        {
            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].SourceBlend           = BlendOption.SourceAlpha;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.SourceAlpha;
                BlendGui = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.One;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[0].SourceBlend           = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
                BlendAdditive = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.SourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[0].SourceBlend           = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
                BlendAtmosphere = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].SourceBlend           = BlendOption.SourceAlpha;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.SourceAlpha;
                BlendTransparent = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].SourceBlend           = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
                BlendAlphaPremult = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.SourceColor;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].SourceBlend           = BlendOption.Zero;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
                BlendOutscatter = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.IndependentBlendEnable = true;

                // color
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.Red | ColorWriteMaskFlags.Green | ColorWriteMaskFlags.Blue;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[0].SourceBlend           = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.Zero;
                // metal
                desc.RenderTarget[2].IsBlendEnabled        = true;
                desc.RenderTarget[2].RenderTargetWriteMask = ColorWriteMaskFlags.Red;
                desc.RenderTarget[2].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[2].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[2].DestinationBlend      = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[2].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[2].SourceBlend           = BlendOption.One;
                desc.RenderTarget[2].SourceAlphaBlend      = BlendOption.Zero;

                BlendDecalColor = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.IndependentBlendEnable = true;

                // normal
                desc.RenderTarget[1].IsBlendEnabled        = true;
                desc.RenderTarget[1].RenderTargetWriteMask = ColorWriteMaskFlags.Red | ColorWriteMaskFlags.Green | ColorWriteMaskFlags.Blue;
                desc.RenderTarget[1].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[1].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[1].DestinationBlend      = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[1].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[1].SourceBlend           = BlendOption.SourceAlpha;
                desc.RenderTarget[1].SourceAlphaBlend      = BlendOption.Zero;
                // gloss
                desc.RenderTarget[2].IsBlendEnabled        = true;
                desc.RenderTarget[2].RenderTargetWriteMask = ColorWriteMaskFlags.Green;
                desc.RenderTarget[2].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[2].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[2].DestinationBlend      = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[2].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[2].SourceBlend           = BlendOption.One;
                desc.RenderTarget[2].SourceAlphaBlend      = BlendOption.Zero;

                BlendDecalNormal = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.IndependentBlendEnable = true;

                // color
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.Red | ColorWriteMaskFlags.Green | ColorWriteMaskFlags.Blue;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[0].SourceBlend           = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.Zero;
                // normal
                desc.RenderTarget[1].IsBlendEnabled        = true;
                desc.RenderTarget[1].RenderTargetWriteMask = ColorWriteMaskFlags.Red | ColorWriteMaskFlags.Green | ColorWriteMaskFlags.Blue;
                desc.RenderTarget[1].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[1].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[1].DestinationBlend      = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[1].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[1].SourceBlend           = BlendOption.SourceAlpha;
                desc.RenderTarget[1].SourceAlphaBlend      = BlendOption.Zero;
                // metal/gloss
                desc.RenderTarget[2].IsBlendEnabled        = true;
                desc.RenderTarget[2].RenderTargetWriteMask = ColorWriteMaskFlags.Red | ColorWriteMaskFlags.Green;
                desc.RenderTarget[2].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[2].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[2].DestinationBlend      = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[2].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[2].SourceBlend           = BlendOption.One;
                desc.RenderTarget[2].SourceAlphaBlend      = BlendOption.Zero;

                BlendDecalNormalColor = MyPipelineStates.CreateBlendState(desc);

                desc.RenderTarget[2].RenderTargetWriteMask = ColorWriteMaskFlags.Red | ColorWriteMaskFlags.Green | ColorWriteMaskFlags.Blue;
                BlendDecalNormalColorExt = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.SourceAlpha;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.SourceAlpha;
                desc.RenderTarget[0].SourceBlend           = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
                BlendWeightedTransparencyResolve           = MyPipelineStates.CreateBlendState(desc);
            }

            {
                BlendStateDescription desc = new BlendStateDescription();
                desc.IndependentBlendEnable = true;

                // accumulation target
                desc.RenderTarget[0].IsBlendEnabled        = true;
                desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[0].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[0].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[0].DestinationBlend      = BlendOption.One;
                desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.One;
                desc.RenderTarget[0].SourceBlend           = BlendOption.One;
                desc.RenderTarget[0].SourceAlphaBlend      = BlendOption.One;
                // coverage target
                desc.RenderTarget[1].IsBlendEnabled        = true;
                desc.RenderTarget[1].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                desc.RenderTarget[1].BlendOperation        = BlendOperation.Add;
                desc.RenderTarget[1].AlphaBlendOperation   = BlendOperation.Add;
                desc.RenderTarget[1].DestinationBlend      = BlendOption.InverseSourceColor;
                desc.RenderTarget[1].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                desc.RenderTarget[1].SourceBlend           = BlendOption.Zero;
                desc.RenderTarget[1].SourceAlphaBlend      = BlendOption.Zero;
                BlendWeightedTransparency = MyPipelineStates.CreateBlendState(desc);
            }
        }