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 | |
| parent | d33fb4adbfc5b43d90a3d0a541579d7724dce027 (diff) | |
main: kill msaa
| -rw-r--r-- | editor/app.cpp | 9 | ||||
| -rw-r--r-- | editor/app.hpp | 1 | ||||
| -rw-r--r-- | editor/draw.cpp | 6 | ||||
| -rw-r--r-- | floormat/app.hpp | 3 | ||||
| -rw-r--r-- | floormat/settings.hpp | 1 | ||||
| -rw-r--r-- | main/draw.cpp | 44 | ||||
| -rw-r--r-- | main/main-impl.hpp | 4 |
7 files changed, 3 insertions, 65 deletions
diff --git a/editor/app.cpp b/editor/app.cpp index 75895ec2..bd7748fb 100644 --- a/editor/app.cpp +++ b/editor/app.cpp @@ -79,7 +79,6 @@ fm_settings app::parse_cmdline(int argc, const char* const* argv) Corrade::Utility::Arguments args{}; args.addOption("vsync", "1") .addOption("gpu-debug", "1") - .addOption("msaa", "") .parse(argc, argv); opts.vsync = parse_bool("vsync", args, opts.vsync); if (auto str = args.value<StringView>("gpu-debug"); str == "no-error" || str == "none") @@ -90,14 +89,6 @@ fm_settings app::parse_cmdline(int argc, const char* const* argv) opts.gpu_debug = parse_bool("gpu-debug", args, opts.gpu_debug > fm_gpu_debug::off) ? fm_gpu_debug::on : fm_gpu_debug::off; - - if (auto str = args.value<StringView>("msaa"); !str.isEmpty()) - { - if (int n = atoi_(str.data()); (unsigned)n > 32 || (n & (n - 1)) != 0) - fm_warn("invalid '--msaa' argument '%s': must be a power of two between 0 and 128", str.data()); - else - opts.msaa_samples = (std::uint8_t)n; - } return opts; } diff --git a/editor/app.hpp b/editor/app.hpp index 20cf4698..5bf87552 100644 --- a/editor/app.hpp +++ b/editor/app.hpp @@ -55,7 +55,6 @@ private: void maybe_initialize_chunk(const chunk_coords& pos, chunk& c) override; void maybe_initialize_chunk_(const chunk_coords& pos, chunk& c); - void draw_msaa() override; void draw() override; void on_mouse_move(const mouse_move_event& event) noexcept override; diff --git a/editor/draw.cpp b/editor/draw.cpp index 8273fc44..af4fbdcb 100644 --- a/editor/draw.cpp +++ b/editor/draw.cpp @@ -31,13 +31,9 @@ void app::draw_cursor() } } -void app::draw_msaa() -{ - draw_cursor(); -} - void app::draw() { + draw_cursor(); draw_ui(); render_menu(); } diff --git a/floormat/app.hpp b/floormat/app.hpp index c7c40d78..f0222e7f 100644 --- a/floormat/app.hpp +++ b/floormat/app.hpp @@ -27,7 +27,6 @@ struct floormat_app virtual void update(float dt) = 0; virtual void maybe_initialize_chunk(const chunk_coords& pos, chunk& c) = 0; - virtual void draw_msaa(); virtual void draw() = 0; virtual void on_mouse_move(const mouse_move_event& event) noexcept = 0; @@ -44,6 +43,4 @@ struct floormat_app virtual void on_mouse_enter() noexcept = 0; }; -inline void floormat_app::draw_msaa() {} - } // namespace floormat diff --git a/floormat/settings.hpp b/floormat/settings.hpp index bfc057ed..f90e1c97 100644 --- a/floormat/settings.hpp +++ b/floormat/settings.hpp @@ -28,7 +28,6 @@ struct fm_settings fullscreen_desktop : 1 = false, borderless : 1 = false, maximized : 1 = false; - std::uint8_t msaa_samples = 16; }; } // namespace floormat 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(); } diff --git a/main/main-impl.hpp b/main/main-impl.hpp index 63239a74..d54b7f92 100644 --- a/main/main-impl.hpp +++ b/main/main-impl.hpp @@ -87,10 +87,6 @@ private: struct draw_bounds final { std::int16_t minx, maxx, miny, maxy; }; - GL::Framebuffer _msaa_framebuffer{NoCreate}; - GL::Renderbuffer _msaa_depth{NoCreate}; - GL::Renderbuffer _msaa_color{NoCreate}; - void recalc_viewport(Vector2i size) noexcept; void draw_world() noexcept; void draw_anim() noexcept; |
