Skip to content

Commit

Permalink
- add post processing support to the software renderer and softpoly
Browse files Browse the repository at this point in the history
  • Loading branch information
dpjudas committed Aug 4, 2018
1 parent 1e11ce3 commit 48c83d3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/gl/system/gl_framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,3 +479,8 @@ void OpenGLFrameBuffer::Draw2D()
{
if (GLRenderer != nullptr) GLRenderer->Draw2D(&m2DDrawer);
}

void OpenGLFrameBuffer::PostProcessScene(int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D)
{
GLRenderer->PostProcessScene(fixedcm, afterBloomDrawEndScene2D);
}
2 changes: 1 addition & 1 deletion src/gl/system/gl_framebuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class OpenGLFrameBuffer : public SystemGLFrameBuffer
IUniformBuffer *CreateUniformBuffer(size_t size, bool staticuse = false) override;
IShaderProgram *CreateShaderProgram() override;


// Retrieves a buffer containing image data for a screenshot.
// Hint: Pitch can be negative for upside-down images, in which case buffer
// points to the last row in the buffer, which will be the first row output.
Expand All @@ -60,6 +59,7 @@ class OpenGLFrameBuffer : public SystemGLFrameBuffer
void SetVSync(bool vsync);

void Draw2D() override;
void PostProcessScene(int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D) override;

bool HWGammaActive = false; // Are we using hardware or software gamma?
std::shared_ptr<FGLDebug> mDebug; // Debug API
Expand Down
9 changes: 8 additions & 1 deletion src/swrenderer/r_swscene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ sector_t *SWSceneDrawer::RenderView(player_t *player)

auto map = swrenderer::CameraLight::Instance()->ShaderColormap();
screen->DrawTexture(fbtex.get(), 0, 0, DTA_SpecialColormap, map, TAG_DONE);
SWRenderer->DrawRemainingPlayerSprites();
screen->Draw2D();
screen->Clear2D();
screen->PostProcessScene(CM_DEFAULT, [&]() {
SWRenderer->DrawRemainingPlayerSprites();
screen->Draw2D();
screen->Clear2D();
});

return r_viewpoint.sector;
}
3 changes: 3 additions & 0 deletions src/v_video.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "c_cvars.h"
#include "v_colortables.h"
#include "v_2ddrawer.h"
#include <functional>

struct sector_t;
class IShaderProgram;
Expand Down Expand Up @@ -464,6 +465,8 @@ class DFrameBuffer
virtual bool WipeDo(int ticks);
virtual void WipeCleanup();

virtual void PostProcessScene(int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D) { if (afterBloomDrawEndScene2D) afterBloomDrawEndScene2D(); }

void ScaleCoordsFromWindow(int16_t &x, int16_t &y);

uint64_t GetLastFPS() const { return LastCount; }
Expand Down

4 comments on commit 48c83d3

@drfrag666
Copy link
Contributor

@drfrag666 drfrag666 commented on 48c83d3 Aug 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this about the old postprocessing or just the new one? Becouse i have merged this in the legacy branch but i didn't merge the hw_postprocess branch. The engine compiles and runs. How could i test this?

@dpjudas
Copy link
Contributor Author

@dpjudas dpjudas commented on 48c83d3 Aug 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this works without the hw_postprocess changes. You can try, though. If it doesn't work you'll either get a crash or a black screen. Easiest way to test it would be to toggle FXAA on and off. If you see anti-aliasing appearing then it works.

@coelckers
Copy link
Member

@coelckers coelckers commented on 48c83d3 Aug 4, 2018 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drfrag666
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried the gamma2 shader and it doesn't work (no output). I've reverted the commit.
I was not sure that's why i asked, i had to try i guess. :)

Please sign in to comment.