private void Update(EvaluationContext context) { var resourceManager = ResourceManager.Instance(); var device = resourceManager.Device; var deviceContext = device.ImmediateContext; var outputMerger = deviceContext.OutputMerger; DepthStencilView.GetValue(context); DepthStencilReference.GetValue(context); BlendFactor.GetValue(context); BlendSampleMask.GetValue(context); RenderTargetViews.GetValues(ref _renderTargetViews, context); UnorderedAccessViews.GetValues(ref _unorderedAccessViews, context); _prevRenderTargetViews = outputMerger.GetRenderTargets(_renderTargetViews.Length); // if (_unorderedAccessViews.Length > 0) // _prevUnorderedAccessViews = outputMerger.GetUnorderedAccessViews(1, _unorderedAccessViews.Length); outputMerger.GetRenderTargets(out _prevDepthStencilView); outputMerger.SetDepthStencilState(DepthStencilState.GetValue(context)); _prevBlendState = outputMerger.GetBlendState(out _prevBlendFactor, out _prevSampleMask); if (_renderTargetViews.Length > 0) { outputMerger.SetRenderTargets(null, _renderTargetViews); } if (_unorderedAccessViews.Length > 0) { // Log.Debug($"num uavs: {_unorderedAccessViews.Length}"); outputMerger.SetUnorderedAccessViews(1, _unorderedAccessViews); } outputMerger.BlendState = BlendState.GetValue(context); }
private void Update(EvaluationContext context) { if (!_initialized) { if (Parent?.Symbol == null) { Log.Warning("Can't register Preset blending for undefined parent", this.SymbolChildId); return; } BlendSettingForCompositionIds[Parent.Symbol.Id] = _blendSetting; _initialized = true; } // Evaluate subtree SubTree.GetValue(context); var wasUpdated = false; var groupIndex = GroupIndex.GetValue(context); if (groupIndex != _blendSetting.GroupIndex) { wasUpdated = true; _blendSetting.GroupIndex = groupIndex; } var presetA = PresetA.GetValue(context); if (presetA != _blendSetting.PresetAIndex) { wasUpdated = true; _blendSetting.PresetAIndex = presetA; } var presetB = PresetB.GetValue(context); if (presetB != _blendSetting.PresetBIndex) { wasUpdated = true; _blendSetting.PresetBIndex = presetB; } var blendFactor = BlendFactor.GetValue(context); if (Math.Abs(blendFactor - _blendSetting.BlendFactor) > 0.001f) { wasUpdated = true; _blendSetting.BlendFactor = blendFactor; } _blendSetting.WasActivatedLastFrame = wasUpdated; }