diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-22 15:06:09 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-22 15:06:09 +0100 |
commit | 9bd0075cb57a0e08fff45a2b9967de287533aa44 (patch) | |
tree | f9c4db9ba5e6d3ccf2d9a116f78fed50cef43deb /main/draw.cpp | |
parent | d33fb4adbfc5b43d90a3d0a541579d7724dce027 (diff) |
main: kill msaa
Diffstat (limited to 'main/draw.cpp')
-rw-r--r-- | main/draw.cpp | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/main/draw.cpp b/main/draw.cpp index 18d64675..6b6c39a4 100644 --- a/main/draw.cpp +++ b/main/draw.cpp @@ -15,28 +15,6 @@ void main_impl::recalc_viewport(Vector2i size) noexcept update_window_state(); _shader.set_scale(Vector2{size}); GL::defaultFramebuffer.setViewport({{}, size }); - if (_msaa_color.id()) - _msaa_framebuffer.detach(GL::Framebuffer::ColorAttachment{0}); - if (_msaa_depth.id()) - _msaa_framebuffer.detach(GL::Framebuffer::BufferAttachment::DepthStencil); - if (_msaa_framebuffer.id()) - _msaa_framebuffer.setViewport({{}, size}); - else - _msaa_framebuffer = GL::Framebuffer{{{}, size}}; - - const int samples = std::min(_msaa_color.maxSamples(), (int)s.msaa_samples); - if (samples != s.msaa_samples) - fm_warn_once("using only %d MSAA samples (instead of %hhu)", samples, s.msaa_samples); - if (s.msaa_samples > 0) { - // color - _msaa_color = Magnum::GL::Renderbuffer{}; - _msaa_color.setStorageMultisample(samples, GL::RenderbufferFormat::RGBA8, size); - _msaa_framebuffer.attachRenderbuffer(GL::Framebuffer::ColorAttachment{0}, _msaa_color); - // depth - _msaa_depth = Magnum::GL::Renderbuffer{}; - _msaa_depth.setStorageMultisample(samples, GL::RenderbufferFormat::DepthStencil, size); - _msaa_framebuffer.attachRenderbuffer(GL::Framebuffer::BufferAttachment::DepthStencil, _msaa_depth); - } // -- state --- using R = GL::Renderer; @@ -100,10 +78,7 @@ void main_impl::draw_world() noexcept GL::Renderer::enable(GL::Renderer::Feature::DepthTest); constexpr float clear_depth = 0; - if (s.msaa_samples == 0) - GL::defaultFramebuffer.clearDepthStencil(clear_depth, 0); - else - _msaa_framebuffer.clearDepthStencil(clear_depth, 0); + GL::defaultFramebuffer.clearDepthStencil(clear_depth, 0); for (std::int16_t y = miny; y <= maxy; y++) for (std::int16_t x = minx; x <= maxx; x++) { @@ -208,24 +183,9 @@ void main_impl::drawEvent() { const auto clear_color = 0x222222ff_rgbaf; - if (s.msaa_samples == 0) - GL::defaultFramebuffer.clearColor(clear_color); - else - { - _msaa_framebuffer.clearColor(0, clear_color); - _msaa_framebuffer.bind(); - } + GL::defaultFramebuffer.clearColor(clear_color); draw_world(); - app.draw_msaa(); - - if (s.msaa_samples > 0) - { - GL::defaultFramebuffer.bind(); - using Blit = GL::FramebufferBlit; - constexpr auto blit_mask = Blit::Color | Blit::Depth | Blit::Stencil; - GL::Framebuffer::blit(_msaa_framebuffer, GL::defaultFramebuffer, {{}, windowSize()}, blit_mask); - } _shader.set_tint({1, 1, 1, 1}); draw_anim(); } |