Esempio n. 1
0
 public bool Equals(SamplerStateCacheKey other)
 {
     return(AddressU == other.AddressU && AddressV == other.AddressV && AddressW == other.AddressW &&
            Filter == other.Filter && MaximumAnisotropy == other.MaximumAnisotropy && BorderColor.Equals(other.BorderColor) &&
            Comparison == other.Comparison && MinimumLod.Equals(other.MinimumLod) && MaximumLod.Equals(other.MaximumLod) &&
            LodBias.Equals(other.LodBias));
 }
Esempio n. 2
0
        private void Update(EvaluationContext context)
        {
            var samplerDesc = new SamplerStateDescription()
            {
                Filter             = Filter.GetValue(context),
                AddressU           = AddressU.GetValue(context),
                AddressV           = AddressV.GetValue(context),
                AddressW           = AddressW.GetValue(context),
                MipLodBias         = MipLoadBias.GetValue(context),
                MaximumAnisotropy  = MaximumAnisotropy.GetValue(context),
                ComparisonFunction = ComparisonFunction.GetValue(context),
                // BorderColor = BorderColor.GetValue(context),
                MinimumLod = MinimumLod.GetValue(context),
                MaximumLod = MaximumLod.GetValue(context)
            };

            try
            {
                var samplerState = new SamplerState(ResourceManager.Instance().Device, samplerDesc); // todo: put into resource manager
                SamplerState.Value?.Dispose();
                SamplerState.Value = samplerState;
            }
            catch (SharpDXException e)
            {
                Log.Error($"{Parent.Symbol.Name}.SamplerStateOp: Invalid sampler state " + e.Message);
                if (SamplerState.Value == null)
                {
                    // there was no previous valid sampler state, so set default sampler state
                    SamplerState.Value = ResourceManager.Instance().DefaultSamplerState;
                    Log.Error("Using the default sampler state instead.");
                }
                else
                {
                    Log.Error("Using the last valid sampler state instead.");
                }
            }
        }
Esempio n. 3
0
 public override int GetHashCode()
 {
     return(HashHelper.Combine(AddressU.GetHashCode(), AddressV.GetHashCode(), AddressW.GetHashCode(),
                               HashHelper.Combine(Filter.GetHashCode(), MaximumAnisotropy.GetHashCode(), BorderColor.GetHashCode(),
                                                  HashHelper.Combine(Comparison.GetHashCode(), MinimumLod.GetHashCode(), MaximumLod.GetHashCode(), LodBias.GetHashCode()))));
 }