build 210330. minor bug fixes

This commit is contained in:
tmj-fstate
2021-03-30 18:06:24 +02:00
parent 195b7cb17b
commit 893e7e9c44
13 changed files with 118 additions and 47 deletions

View File

@@ -401,7 +401,12 @@ bool opengl33_renderer::init_viewport(viewport_config &vp)
vp.main_texv = std::make_unique<opengl_texture>();
vp.main_texv->alloc_rendertarget(Global.gfx_postfx_motionblur_format, GL_RG, vp.width, vp.height);
vp.main_fb->attach(*vp.main_texv, GL_COLOR_ATTACHMENT1);
vp.main_fb->setup_drawing(2);
vp.main_texd = std::make_unique<opengl_texture>();
vp.main_texd->alloc_rendertarget( Global.gfx_format_depth, GL_DEPTH_COMPONENT, vp.width, vp.height, 1, 1, GL_CLAMP_TO_EDGE );
vp.main_fb->attach( *vp.main_texd, GL_DEPTH_ATTACHMENT );
vp.main_fb->setup_drawing(1);
WriteLog("motion blur enabled");
}
@@ -782,15 +787,18 @@ void opengl33_renderer::Render_pass(viewport_config &vp, rendermode const Mode)
if (Global.gfx_postfx_motionblur_enabled)
{
gl::program::unbind();
vp.main_fb->clear(GL_COLOR_BUFFER_BIT);
vp.msaa_fb->blit_to(vp.main_fb.get(), vp.width, vp.height, GL_COLOR_BUFFER_BIT, GL_COLOR_ATTACHMENT0);
vp.msaa_fb->blit_to(vp.main_fb.get(), vp.width, vp.height, GL_COLOR_BUFFER_BIT, GL_COLOR_ATTACHMENT1);
vp.msaa_fb->blit_to(vp.main_fb.get(), vp.width, vp.height, GL_DEPTH_BUFFER_BIT, GL_DEPTH_ATTACHMENT);
vp.main_fb->setup_drawing(1); // restore draw buffers after blit operation
model_ubs.param[0].x = m_framerate / (1.0 / Global.gfx_postfx_motionblur_shutter);
model_ubo->update(model_ubs);
m_pfx_motionblur->apply({vp.main_tex.get(), vp.main_texv.get()}, vp.main2_fb.get());
vp.main_fb->setup_drawing(1); // restore draw buffers after blit operation
m_pfx_motionblur->apply({vp.main_tex.get(), vp.main_texv.get(), vp.main_texd.get()}, vp.main2_fb.get());
}
else
{
@@ -804,7 +812,6 @@ void opengl33_renderer::Render_pass(viewport_config &vp, rendermode const Mode)
glViewport(0, 0, target_size.x, target_size.y);
if( Global.gfx_postfx_chromaticaberration_enabled ) {
// NOTE: for some unexplained reason need this setup_drawing() call here for the tonemapping effects to show up on the main_tex?
m_pfx_tonemapping->apply( *vp.main2_tex, vp.main_fb.get() );
m_pfx_chromaticaberration->apply( *vp.main_tex, nullptr );
}