Exemplo n.º 1
0
        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);
        }