BsPostProcessing.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #include "BsPostProcessing.h"
  4. #include "BsRenderTexture.h"
  5. #include "BsRenderTexturePool.h"
  6. #include "BsRendererUtility.h"
  7. #include "BsTextureManager.h"
  8. #include "BsCamera.h"
  9. #include "BsGpuParamsSet.h"
  10. namespace bs
  11. {
  12. DownsampleParamDef gDownsampleParamDef;
  13. DownsampleMat::DownsampleMat()
  14. {
  15. mParamBuffer = gDownsampleParamDef.createBuffer();
  16. mParamsSet->setParamBlockBuffer("Input", mParamBuffer);
  17. mParamsSet->getGpuParams()->getTextureParam(GPT_FRAGMENT_PROGRAM, "gInputTex", mInputTexture);
  18. }
  19. void DownsampleMat::_initDefines(ShaderDefines& defines)
  20. {
  21. // Do nothing
  22. }
  23. void DownsampleMat::execute(const SPtr<RenderTextureCore>& target, PostProcessInfo& ppInfo)
  24. {
  25. // Set parameters
  26. SPtr<TextureCore> colorTexture = target->getColorTexture(0);
  27. mInputTexture.set(colorTexture);
  28. const RenderTextureProperties& rtProps = target->getProperties();
  29. Vector2 invTextureSize(1.0f / rtProps.getWidth(), 1.0f / rtProps.getHeight());
  30. gDownsampleParamDef.gInvTexSize.set(mParamBuffer, invTextureSize);
  31. // Set output
  32. const TextureProperties& colorProps = colorTexture->getProperties();
  33. UINT32 width = std::max(1, Math::ceilToInt(colorProps.getWidth() * 0.5f));
  34. UINT32 height = std::max(1, Math::ceilToInt(colorProps.getHeight() * 0.5f));
  35. mOutputDesc = POOLED_RENDER_TEXTURE_DESC::create2D(colorProps.getFormat(), width, height, TU_RENDERTARGET);
  36. // Render
  37. ppInfo.downsampledSceneTex = RenderTexturePool::instance().get(mOutputDesc);
  38. RenderAPICore& rapi = RenderAPICore::instance();
  39. rapi.setRenderTarget(ppInfo.downsampledSceneTex->renderTexture, true);
  40. gRendererUtility().setPass(mMaterial);
  41. gRendererUtility().setPassParams(mParamsSet);
  42. gRendererUtility().drawScreenQuad();
  43. rapi.setRenderTarget(nullptr);
  44. mOutput = ppInfo.downsampledSceneTex->renderTexture;
  45. }
  46. void DownsampleMat::release(PostProcessInfo& ppInfo)
  47. {
  48. RenderTexturePool::instance().release(ppInfo.downsampledSceneTex);
  49. mOutput = nullptr;
  50. }
  51. EyeAdaptHistogramParamDef gEyeAdaptHistogramParamDef;
  52. EyeAdaptHistogramMat::EyeAdaptHistogramMat()
  53. {
  54. mParamBuffer = gEyeAdaptHistogramParamDef.createBuffer();
  55. mParamsSet->setParamBlockBuffer("Input", mParamBuffer);
  56. SPtr<GpuParamsCore> params = mParamsSet->getGpuParams();
  57. params->getTextureParam(GPT_COMPUTE_PROGRAM, "gSceneColorTex", mSceneColor);
  58. params->getLoadStoreTextureParam(GPT_COMPUTE_PROGRAM, "gOutputTex", mOutputTex);
  59. }
  60. void EyeAdaptHistogramMat::_initDefines(ShaderDefines& defines)
  61. {
  62. defines.set("THREADGROUP_SIZE_X", THREAD_GROUP_SIZE_X);
  63. defines.set("THREADGROUP_SIZE_Y", THREAD_GROUP_SIZE_Y);
  64. defines.set("LOOP_COUNT_X", LOOP_COUNT_X);
  65. defines.set("LOOP_COUNT_Y", LOOP_COUNT_Y);
  66. }
  67. void EyeAdaptHistogramMat::execute(PostProcessInfo& ppInfo)
  68. {
  69. // Set parameters
  70. SPtr<RenderTextureCore> target = ppInfo.downsampledSceneTex->renderTexture;
  71. mSceneColor.set(ppInfo.downsampledSceneTex->texture);
  72. const RenderTextureProperties& props = target->getProperties();
  73. int offsetAndSize[4] = { 0, 0, (INT32)props.getWidth(), (INT32)props.getHeight() };
  74. gEyeAdaptHistogramParamDef.gHistogramParams.set(mParamBuffer, getHistogramScaleOffset(ppInfo));
  75. gEyeAdaptHistogramParamDef.gPixelOffsetAndSize.set(mParamBuffer, Vector4I(offsetAndSize));
  76. Vector2I threadGroupCount = getThreadGroupCount(target);
  77. gEyeAdaptHistogramParamDef.gThreadGroupCount.set(mParamBuffer, threadGroupCount);
  78. // Set output
  79. UINT32 numHistograms = threadGroupCount.x * threadGroupCount.y;
  80. mOutputDesc = POOLED_RENDER_TEXTURE_DESC::create2D(PF_FLOAT16_RGBA, HISTOGRAM_NUM_TEXELS, numHistograms,
  81. TU_LOADSTORE);
  82. // Dispatch
  83. ppInfo.histogramTex = RenderTexturePool::instance().get(mOutputDesc);
  84. mOutputTex.set(ppInfo.histogramTex->texture);
  85. RenderAPICore& rapi = RenderAPICore::instance();
  86. gRendererUtility().setComputePass(mMaterial);
  87. gRendererUtility().setPassParams(mParamsSet);
  88. rapi.dispatchCompute(threadGroupCount.x, threadGroupCount.y);
  89. mOutput = ppInfo.histogramTex->renderTexture;
  90. }
  91. void EyeAdaptHistogramMat::release(PostProcessInfo& ppInfo)
  92. {
  93. RenderTexturePool::instance().release(ppInfo.histogramTex);
  94. mOutput = nullptr;
  95. }
  96. Vector2I EyeAdaptHistogramMat::getThreadGroupCount(const SPtr<RenderTextureCore>& target)
  97. {
  98. const UINT32 texelsPerThreadGroupX = THREAD_GROUP_SIZE_X * LOOP_COUNT_X;
  99. const UINT32 texelsPerThreadGroupY = THREAD_GROUP_SIZE_Y * LOOP_COUNT_Y;
  100. const RenderTextureProperties& props = target->getProperties();
  101. Vector2I threadGroupCount;
  102. threadGroupCount.x = ((INT32)props.getWidth() + texelsPerThreadGroupX - 1) / texelsPerThreadGroupX;
  103. threadGroupCount.y = ((INT32)props.getHeight() + texelsPerThreadGroupY - 1) / texelsPerThreadGroupY;
  104. return threadGroupCount;
  105. }
  106. Vector2 EyeAdaptHistogramMat::getHistogramScaleOffset(const PostProcessInfo& ppInfo)
  107. {
  108. const StandardPostProcessSettings& settings = *ppInfo.settings;
  109. float diff = settings.autoExposure.histogramLog2Max - settings.autoExposure.histogramLog2Min;
  110. float scale = 1.0f / diff;
  111. float offset = -settings.autoExposure.histogramLog2Min * scale;
  112. return Vector2(scale, offset);
  113. }
  114. EyeAdaptHistogramReduceParamDef gEyeAdaptHistogramReduceParamDef;
  115. EyeAdaptHistogramReduceMat::EyeAdaptHistogramReduceMat()
  116. {
  117. mParamBuffer = gEyeAdaptHistogramReduceParamDef.createBuffer();
  118. mParamsSet->setParamBlockBuffer("Input", mParamBuffer);
  119. SPtr<GpuParamsCore> params = mParamsSet->getGpuParams();
  120. params->getTextureParam(GPT_FRAGMENT_PROGRAM, "gHistogramTex", mHistogramTex);
  121. params->getTextureParam(GPT_FRAGMENT_PROGRAM, "gEyeAdaptationTex", mEyeAdaptationTex);
  122. }
  123. void EyeAdaptHistogramReduceMat::_initDefines(ShaderDefines& defines)
  124. {
  125. // Do nothing
  126. }
  127. void EyeAdaptHistogramReduceMat::execute(PostProcessInfo& ppInfo)
  128. {
  129. // Set parameters
  130. mHistogramTex.set(ppInfo.histogramTex->texture);
  131. SPtr<PooledRenderTexture> eyeAdaptationRT = ppInfo.eyeAdaptationTex[ppInfo.lastEyeAdaptationTex];
  132. SPtr<TextureCore> eyeAdaptationTex;
  133. if (eyeAdaptationRT != nullptr) // Could be that this is the first run
  134. eyeAdaptationTex = eyeAdaptationRT->texture;
  135. else
  136. eyeAdaptationTex = TextureCore::WHITE;
  137. mEyeAdaptationTex.set(eyeAdaptationTex);
  138. Vector2I threadGroupCount = EyeAdaptHistogramMat::getThreadGroupCount(ppInfo.downsampledSceneTex->renderTexture);
  139. UINT32 numHistograms = threadGroupCount.x * threadGroupCount.y;
  140. gEyeAdaptHistogramReduceParamDef.gThreadGroupCount.set(mParamBuffer, numHistograms);
  141. // Set output
  142. mOutputDesc = POOLED_RENDER_TEXTURE_DESC::create2D(PF_FLOAT16_RGBA, EyeAdaptHistogramMat::HISTOGRAM_NUM_TEXELS, 2,
  143. TU_RENDERTARGET);
  144. // Render
  145. ppInfo.histogramReduceTex = RenderTexturePool::instance().get(mOutputDesc);
  146. RenderAPICore& rapi = RenderAPICore::instance();
  147. rapi.setRenderTarget(ppInfo.histogramReduceTex->renderTexture, true);
  148. gRendererUtility().setPass(mMaterial);
  149. gRendererUtility().setPassParams(mParamsSet);
  150. Rect2 drawUV(0.0f, 0.0f, (float)EyeAdaptHistogramMat::HISTOGRAM_NUM_TEXELS, 2.0f);
  151. gRendererUtility().drawScreenQuad(drawUV);
  152. rapi.setRenderTarget(nullptr);
  153. mOutput = ppInfo.histogramReduceTex->renderTexture;
  154. }
  155. void EyeAdaptHistogramReduceMat::release(PostProcessInfo& ppInfo)
  156. {
  157. RenderTexturePool::instance().release(ppInfo.histogramReduceTex);
  158. mOutput = nullptr;
  159. }
  160. EyeAdaptationParamDef gEyeAdaptationParamDef;
  161. EyeAdaptationMat::EyeAdaptationMat()
  162. {
  163. mParamBuffer = gEyeAdaptationParamDef.createBuffer();
  164. mParamsSet->setParamBlockBuffer("Input", mParamBuffer);
  165. mParamsSet->getGpuParams()->getTextureParam(GPT_FRAGMENT_PROGRAM, "gHistogramTex", mReducedHistogramTex);
  166. }
  167. void EyeAdaptationMat::_initDefines(ShaderDefines& defines)
  168. {
  169. defines.set("THREADGROUP_SIZE_X", EyeAdaptHistogramMat::THREAD_GROUP_SIZE_X);
  170. defines.set("THREADGROUP_SIZE_Y", EyeAdaptHistogramMat::THREAD_GROUP_SIZE_Y);
  171. }
  172. void EyeAdaptationMat::execute(PostProcessInfo& ppInfo, float frameDelta)
  173. {
  174. bool texturesInitialized = ppInfo.eyeAdaptationTex[0] != nullptr && ppInfo.eyeAdaptationTex[1] != nullptr;
  175. if(!texturesInitialized)
  176. {
  177. POOLED_RENDER_TEXTURE_DESC outputDesc = POOLED_RENDER_TEXTURE_DESC::create2D(PF_FLOAT32_R, 1, 1, TU_RENDERTARGET);
  178. ppInfo.eyeAdaptationTex[0] = RenderTexturePool::instance().get(outputDesc);
  179. ppInfo.eyeAdaptationTex[1] = RenderTexturePool::instance().get(outputDesc);
  180. }
  181. ppInfo.lastEyeAdaptationTex = (ppInfo.lastEyeAdaptationTex + 1) % 2; // TODO - Do I really need two targets?
  182. // Set parameters
  183. mReducedHistogramTex.set(ppInfo.histogramReduceTex->texture);
  184. Vector2 histogramScaleAndOffset = EyeAdaptHistogramMat::getHistogramScaleOffset(ppInfo);
  185. const StandardPostProcessSettings& settings = *ppInfo.settings;
  186. Vector4 eyeAdaptationParams[3];
  187. eyeAdaptationParams[0].x = histogramScaleAndOffset.x;
  188. eyeAdaptationParams[0].y = histogramScaleAndOffset.y;
  189. float histogramPctHigh = Math::clamp01(settings.autoExposure.histogramPctHigh);
  190. eyeAdaptationParams[0].z = std::min(Math::clamp01(settings.autoExposure.histogramPctLow), histogramPctHigh);
  191. eyeAdaptationParams[0].w = histogramPctHigh;
  192. eyeAdaptationParams[1].x = std::min(settings.autoExposure.minEyeAdaptation, settings.autoExposure.maxEyeAdaptation);
  193. eyeAdaptationParams[1].y = settings.autoExposure.maxEyeAdaptation;
  194. eyeAdaptationParams[1].z = settings.autoExposure.eyeAdaptationSpeedUp;
  195. eyeAdaptationParams[1].w = settings.autoExposure.eyeAdaptationSpeedDown;
  196. eyeAdaptationParams[2].x = Math::pow(2.0f, settings.exposureScale);
  197. eyeAdaptationParams[2].y = frameDelta;
  198. eyeAdaptationParams[2].z = 0.0f; // Unused
  199. eyeAdaptationParams[2].w = 0.0f; // Unused
  200. gEyeAdaptationParamDef.gEyeAdaptationParams.set(mParamBuffer, eyeAdaptationParams[0], 0);
  201. gEyeAdaptationParamDef.gEyeAdaptationParams.set(mParamBuffer, eyeAdaptationParams[1], 1);
  202. gEyeAdaptationParamDef.gEyeAdaptationParams.set(mParamBuffer, eyeAdaptationParams[2], 2);
  203. // Render
  204. SPtr<PooledRenderTexture> eyeAdaptationRT = ppInfo.eyeAdaptationTex[ppInfo.lastEyeAdaptationTex];
  205. RenderAPICore& rapi = RenderAPICore::instance();
  206. rapi.setRenderTarget(eyeAdaptationRT->renderTexture, true);
  207. gRendererUtility().setPass(mMaterial);
  208. gRendererUtility().setPassParams(mParamsSet);
  209. gRendererUtility().drawScreenQuad();
  210. rapi.setRenderTarget(nullptr);
  211. }
  212. CreateTonemapLUTParamDef gCreateTonemapLUTParamDef;
  213. WhiteBalanceParamDef gWhiteBalanceParamDef;
  214. CreateTonemapLUTMat::CreateTonemapLUTMat()
  215. {
  216. mParamBuffer = gCreateTonemapLUTParamDef.createBuffer();
  217. mWhiteBalanceParamBuffer = gWhiteBalanceParamDef.createBuffer();
  218. mParamsSet->setParamBlockBuffer("Input", mParamBuffer);
  219. mParamsSet->setParamBlockBuffer("WhiteBalanceInput", mWhiteBalanceParamBuffer);
  220. }
  221. void CreateTonemapLUTMat::_initDefines(ShaderDefines& defines)
  222. {
  223. defines.set("LUT_SIZE", LUT_SIZE);
  224. }
  225. void CreateTonemapLUTMat::execute(PostProcessInfo& ppInfo)
  226. {
  227. const StandardPostProcessSettings& settings = *ppInfo.settings;
  228. // Set parameters
  229. gCreateTonemapLUTParamDef.gGammaAdjustment.set(mParamBuffer, 2.2f / settings.gamma);
  230. // Note: Assuming sRGB (PC monitor) for now, change to Rec.709 when running on console (value 1), or to raw 2.2
  231. // gamma when running on Mac (value 2)
  232. gCreateTonemapLUTParamDef.gGammaCorrectionType.set(mParamBuffer, 0);
  233. Vector4 tonemapParams[2];
  234. tonemapParams[0].x = settings.tonemapping.filmicCurveShoulderStrength;
  235. tonemapParams[0].y = settings.tonemapping.filmicCurveLinearStrength;
  236. tonemapParams[0].z = settings.tonemapping.filmicCurveLinearAngle;
  237. tonemapParams[0].w = settings.tonemapping.filmicCurveToeStrength;
  238. tonemapParams[1].x = settings.tonemapping.filmicCurveToeNumerator;
  239. tonemapParams[1].y = settings.tonemapping.filmicCurveToeDenominator;
  240. tonemapParams[1].z = settings.tonemapping.filmicCurveLinearWhitePoint;
  241. tonemapParams[1].w = 0.0f; // Unused
  242. gCreateTonemapLUTParamDef.gTonemapParams.set(mParamBuffer, tonemapParams[0], 0);
  243. gCreateTonemapLUTParamDef.gTonemapParams.set(mParamBuffer, tonemapParams[1], 1);
  244. // Set color grading params
  245. gCreateTonemapLUTParamDef.gSaturation.set(mParamBuffer, settings.colorGrading.saturation);
  246. gCreateTonemapLUTParamDef.gContrast.set(mParamBuffer, settings.colorGrading.contrast);
  247. gCreateTonemapLUTParamDef.gGain.set(mParamBuffer, settings.colorGrading.gain);
  248. gCreateTonemapLUTParamDef.gOffset.set(mParamBuffer, settings.colorGrading.offset);
  249. // Set white balance params
  250. gWhiteBalanceParamDef.gWhiteTemp.set(mWhiteBalanceParamBuffer, settings.whiteBalance.temperature);
  251. gWhiteBalanceParamDef.gWhiteOffset.set(mWhiteBalanceParamBuffer, settings.whiteBalance.tint);
  252. // Set output
  253. POOLED_RENDER_TEXTURE_DESC outputDesc = POOLED_RENDER_TEXTURE_DESC::create3D(PF_B8G8R8X8,
  254. LUT_SIZE, LUT_SIZE, LUT_SIZE, TU_RENDERTARGET);
  255. // Render
  256. ppInfo.colorLUT = RenderTexturePool::instance().get(outputDesc);
  257. RenderAPICore& rapi = RenderAPICore::instance();
  258. rapi.setRenderTarget(ppInfo.colorLUT->renderTexture);
  259. gRendererUtility().setPass(mMaterial);
  260. gRendererUtility().setPassParams(mParamsSet);
  261. gRendererUtility().drawScreenQuad(LUT_SIZE);
  262. }
  263. void CreateTonemapLUTMat::release(PostProcessInfo& ppInfo)
  264. {
  265. RenderTexturePool::instance().release(ppInfo.colorLUT);
  266. }
  267. TonemappingParamDef gTonemappingParamDef;
  268. template<bool GammaOnly, bool AutoExposure>
  269. TonemappingMat<GammaOnly, AutoExposure>::TonemappingMat()
  270. {
  271. mParamBuffer = gTonemappingParamDef.createBuffer();
  272. mParamsSet->setParamBlockBuffer("Input", mParamBuffer);
  273. SPtr<GpuParamsCore> params = mParamsSet->getGpuParams();
  274. params->getTextureParam(GPT_VERTEX_PROGRAM, "gEyeAdaptationTex", mEyeAdaptationTex);
  275. params->getTextureParam(GPT_FRAGMENT_PROGRAM, "gInputTex", mInputTex);
  276. if(!GammaOnly)
  277. params->getTextureParam(GPT_FRAGMENT_PROGRAM, "gColorLUT", mColorLUT);
  278. }
  279. template<bool GammaOnly, bool AutoExposure>
  280. void TonemappingMat<GammaOnly, AutoExposure>::_initDefines(ShaderDefines& defines)
  281. {
  282. if(GammaOnly)
  283. defines.set("GAMMA_ONLY", 1);
  284. if (AutoExposure)
  285. defines.set("AUTO_EXPOSURE", 1);
  286. defines.set("LUT_SIZE", CreateTonemapLUTMat::LUT_SIZE);
  287. }
  288. template<bool GammaOnly, bool AutoExposure>
  289. void TonemappingMat<GammaOnly, AutoExposure>::execute(const SPtr<RenderTextureCore>& sceneColor, const SPtr<ViewportCore>& outputViewport,
  290. PostProcessInfo& ppInfo)
  291. {
  292. gTonemappingParamDef.gRawGamma.set(mParamBuffer, 1.0f / ppInfo.settings->gamma);
  293. gTonemappingParamDef.gManualExposureScale.set(mParamBuffer, Math::pow(2.0f, ppInfo.settings->exposureScale));
  294. // Set parameters
  295. SPtr<TextureCore> colorTexture = sceneColor->getColorTexture(0);
  296. mInputTex.set(colorTexture);
  297. SPtr<TextureCore> colorLUT;
  298. if(ppInfo.colorLUT != nullptr)
  299. colorLUT = ppInfo.colorLUT->texture;
  300. mColorLUT.set(colorLUT);
  301. SPtr<TextureCore> eyeAdaptationTexture;
  302. if(ppInfo.eyeAdaptationTex[ppInfo.lastEyeAdaptationTex] != nullptr)
  303. eyeAdaptationTexture = ppInfo.eyeAdaptationTex[ppInfo.lastEyeAdaptationTex]->texture;
  304. mEyeAdaptationTex.set(eyeAdaptationTexture);
  305. // Render
  306. RenderAPICore& rapi = RenderAPICore::instance();
  307. SPtr<RenderTargetCore> target = outputViewport->getTarget();
  308. rapi.setRenderTarget(target);
  309. rapi.setViewport(outputViewport->getNormArea());
  310. gRendererUtility().setPass(mMaterial);
  311. gRendererUtility().setPassParams(mParamsSet);
  312. gRendererUtility().drawScreenQuad();
  313. }
  314. template class TonemappingMat<true, true>;
  315. template class TonemappingMat<false, true>;
  316. template class TonemappingMat<true, false>;
  317. template class TonemappingMat<false, false>;
  318. void PostProcessing::postProcess(const SPtr<RenderTextureCore>& sceneColor, const CameraCore* camera,
  319. PostProcessInfo& ppInfo, float frameDelta)
  320. {
  321. const StandardPostProcessSettings& settings = *ppInfo.settings;
  322. SPtr<ViewportCore> outputViewport = camera->getViewport();
  323. bool hdr = camera->getFlags().isSet(CameraFlag::HDR);
  324. if(hdr && settings.enableAutoExposure)
  325. {
  326. mDownsample.execute(sceneColor, ppInfo);
  327. mEyeAdaptHistogram.execute(ppInfo);
  328. mDownsample.release(ppInfo);
  329. mEyeAdaptHistogramReduce.execute(ppInfo);
  330. mEyeAdaptHistogram.release(ppInfo);
  331. mEyeAdaptation.execute(ppInfo, frameDelta);
  332. mEyeAdaptHistogramReduce.release(ppInfo);
  333. }
  334. if (hdr && settings.enableTonemapping)
  335. {
  336. if (ppInfo.settingDirty) // Rebuild LUT if PP settings changed
  337. mCreateLUT.execute(ppInfo);
  338. if (settings.enableAutoExposure)
  339. mTonemapping_AE.execute(sceneColor, outputViewport, ppInfo);
  340. else
  341. mTonemapping.execute(sceneColor, outputViewport, ppInfo);
  342. }
  343. else
  344. {
  345. if (hdr && settings.enableAutoExposure)
  346. mTonemapping_AE_GO.execute(sceneColor, outputViewport, ppInfo);
  347. else
  348. mTonemapping_GO.execute(sceneColor, outputViewport, ppInfo);
  349. }
  350. if (ppInfo.settingDirty)
  351. ppInfo.settingDirty = false;
  352. // TODO - External code depends on the main RT being bound when this exits, make this clearer
  353. }
  354. }