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);
        }
        public virtual void Clear()
        {
            ConstantBufferViewRegisterCount  = 0;
            ShaderResourceViewRegisterCount  = 0;
            UnorderedAccessViewRegisterCount = 0;
            SamplerRegisterCount             = 0;

            RootParameters.Clear();
            ConstantBufferViews.Clear();
            ShaderResourceViews.Clear();
            UnorderedAccessViews.Clear();
            Samplers.Clear();
        }
示例#3
0
        public MaterialPass?PopPass()
        {
            PassIndex++;

            MaterialPass?materialPass = MaterialPass;

            MaterialPass = null;

            ConstantBufferViews.Clear();
            ShaderResourceViews.Clear();
            UnorderedAccessViews.Clear();

            return(materialPass);
        }