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."); } } }
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())))); }