public void Draw(DeviceContextHolder holder, ShaderResourceView view, TargetResourceTexture temporary) {
// preparation
holder.SaveRenderTargetAndViewport();
holder.QuadBuffers.Prepare(holder.DeviceContext, _effect.LayoutPT);
// update those small texture
UpdateNewAverateColor(holder, view);
UpdateAdaptation(holder);
holder.RestoreRenderTargetAndViewport();
holder.DeviceContext.OutputMerger.SetTargets(temporary.TargetView);
holder.DeviceContext.ClearRenderTargetView(temporary.TargetView, BaseRenderer.ColorTransparent);
_effect.FxInputMap.SetResource(view);
_effect.FxBrightnessMap.SetResource(GetAdaptationTexture().View);
_effect.TechTonemap.DrawAllPasses(holder.DeviceContext, 6);
// update bloom texture (bright areas)
UpdateBloom(holder, temporary.View);
if (BloomDebug) {
holder.RestoreRenderTargetAndViewport();
_effect.FxInputMap.SetResource(_bloomTexture.View);
_effect.TechCopy.DrawAllPasses(holder.DeviceContext, 6);
return;
}
// reset viewport
holder.RestoreRenderTargetAndViewport();
_effect.FxInputMap.SetResource(temporary.View);
_effect.FxBloomMap.SetResource(_bloomTexture.View);
_effect.TechCombine.DrawAllPasses(holder.DeviceContext, 6);
}