mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 14:01:45 +00:00
- consolidated postprocessing code a bit.
The code that determines the order of effects should not be duplicated between renderers.
This commit is contained in:
parent
4722720f4b
commit
3d3f364874
4 changed files with 25 additions and 20 deletions
|
@ -68,18 +68,10 @@ void FGLRenderer::PostProcessScene(int fixedcm, const std::function<void()> &aft
|
||||||
|
|
||||||
GLPPRenderState renderstate(mBuffers);
|
GLPPRenderState renderstate(mBuffers);
|
||||||
|
|
||||||
hw_postprocess.exposure.Render(&renderstate, sceneWidth, sceneHeight);
|
hw_postprocess.Pass1(&renderstate, fixedcm, sceneWidth, sceneHeight);
|
||||||
hw_postprocess.customShaders.Run(&renderstate, "beforebloom");
|
|
||||||
hw_postprocess.bloom.RenderBloom(&renderstate, sceneWidth, sceneHeight, fixedcm);
|
|
||||||
|
|
||||||
mBuffers->BindCurrentFB();
|
mBuffers->BindCurrentFB();
|
||||||
afterBloomDrawEndScene2D();
|
afterBloomDrawEndScene2D();
|
||||||
|
hw_postprocess.Pass2(&renderstate, fixedcm, sceneWidth, sceneHeight);
|
||||||
hw_postprocess.tonemap.Render(&renderstate);
|
|
||||||
hw_postprocess.colormap.Render(&renderstate, fixedcm);
|
|
||||||
hw_postprocess.lens.Render(&renderstate);
|
|
||||||
hw_postprocess.fxaa.Render(&renderstate);
|
|
||||||
hw_postprocess.customShaders.Run(&renderstate, "scene");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -1081,3 +1081,20 @@ void PPCustomShaderInstance::AddUniformField(size_t &offset, const FString &name
|
||||||
offset += alignment - fieldsize;
|
offset += alignment - fieldsize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Postprocess::Pass1(PPRenderState* state, int fixedcm, int sceneWidth, int sceneHeight)
|
||||||
|
{
|
||||||
|
exposure.Render(state, sceneWidth, sceneHeight);
|
||||||
|
customShaders.Run(state, "beforebloom");
|
||||||
|
bloom.RenderBloom(state, sceneWidth, sceneHeight, fixedcm);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Postprocess::Pass2(PPRenderState* state, int fixedcm, int sceneWidth, int sceneHeight)
|
||||||
|
{
|
||||||
|
tonemap.Render(state);
|
||||||
|
colormap.Render(state, fixedcm);
|
||||||
|
lens.Render(state);
|
||||||
|
fxaa.Render(state);
|
||||||
|
customShaders.Run(state, "scene");
|
||||||
|
}
|
||||||
|
|
|
@ -834,6 +834,10 @@ public:
|
||||||
PPPresent present;
|
PPPresent present;
|
||||||
PPShadowMap shadowmap;
|
PPShadowMap shadowmap;
|
||||||
PPCustomShaders customShaders;
|
PPCustomShaders customShaders;
|
||||||
|
|
||||||
|
|
||||||
|
void Pass1(PPRenderState *state, int fixedcm, int sceneWidth, int sceneHeight);
|
||||||
|
void Pass2(PPRenderState* state, int fixedcm, int sceneWidth, int sceneHeight);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Postprocess hw_postprocess;
|
extern Postprocess hw_postprocess;
|
||||||
|
|
|
@ -46,18 +46,10 @@ void VkPostprocess::PostProcessScene(int fixedcm, const std::function<void()> &a
|
||||||
|
|
||||||
VkPPRenderState renderstate;
|
VkPPRenderState renderstate;
|
||||||
|
|
||||||
hw_postprocess.exposure.Render(&renderstate, sceneWidth, sceneHeight);
|
hw_postprocess.Pass1(&renderstate, fixedcm, sceneWidth, sceneHeight);
|
||||||
hw_postprocess.customShaders.Run(&renderstate, "beforebloom");
|
|
||||||
hw_postprocess.bloom.RenderBloom(&renderstate, sceneWidth, sceneHeight, fixedcm);
|
|
||||||
|
|
||||||
SetActiveRenderTarget();
|
SetActiveRenderTarget();
|
||||||
afterBloomDrawEndScene2D();
|
afterBloomDrawEndScene2D();
|
||||||
|
hw_postprocess.Pass2(&renderstate, fixedcm, sceneWidth, sceneHeight);
|
||||||
hw_postprocess.tonemap.Render(&renderstate);
|
|
||||||
hw_postprocess.colormap.Render(&renderstate, fixedcm);
|
|
||||||
hw_postprocess.lens.Render(&renderstate);
|
|
||||||
hw_postprocess.fxaa.Render(&renderstate);
|
|
||||||
hw_postprocess.customShaders.Run(&renderstate, "scene");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VkPostprocess::BlitSceneToPostprocess()
|
void VkPostprocess::BlitSceneToPostprocess()
|
||||||
|
|
Loading…
Reference in a new issue