private void Update(EvaluationContext context) { RasterizerState.Value?.Dispose(); var rasterizerDesc = new RasterizerStateDescription() { CullMode = CullMode.GetValue(context), DepthBias = DepthBias.GetValue(context), DepthBiasClamp = DepthBiasClamp.GetValue(context), FillMode = FillMode.GetValue(context), IsAntialiasedLineEnabled = AntialiasedLineEnabled.GetValue(context), IsDepthClipEnabled = DepthClipEnabled.GetValue(context), IsFrontCounterClockwise = FrontCounterClockwise.GetValue(context), IsMultisampleEnabled = MultiSampleEnabled.GetValue(context), IsScissorEnabled = ScissorEnabled.GetValue(context), SlopeScaledDepthBias = SlopeScaledDepthBias.GetValue(context) }; try { RasterizerState.Value = new RasterizerState(ResourceManager.Instance().Device, rasterizerDesc); // todo: put into resource manager } catch (Exception e) { Log.Error("Failed to create rasterizer state: " + e.Message); } }
/// <summary>Indicates whether the current object is equal to another object of the same type.</summary> /// <returns>true if the current object is equal to the <paramref name="state" /> parameter; otherwise, false.</returns> /// <param name="state">An object to compare with this object.</param> public bool Equals(GorgonRasterState state) => (this == state) || ((state != null) && (IsAntialiasedLineEnabled == state.IsAntialiasedLineEnabled) && (CullMode == state.CullMode) && (DepthBias == state.DepthBias) && (DepthBiasClamp.EqualsEpsilon(state.DepthBiasClamp)) && (IsDepthClippingEnabled == state.IsDepthClippingEnabled) && (FillMode == state.FillMode) && (ForcedReadWriteViewSampleCount == state.ForcedReadWriteViewSampleCount) && (IsFrontCounterClockwise == state.IsFrontCounterClockwise) && (IsMultisamplingEnabled == state.IsMultisamplingEnabled) && (HasScissors == state.HasScissors) && (SlopeScaledDepthBias.EqualsEpsilon(state.SlopeScaledDepthBias)) && (UseConservativeRasterization == state.UseConservativeRasterization));