From a2554cb65612522c6ab9b674f8f02a01931c46f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 16 Oct 2023 19:57:35 +0200 Subject: [PATCH] TextureTools: don't clear the output in DistanceField. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test passes now. This made the benchmark run significantly faster. ~200 µs instead of 670. Are clears really taking up more time than all those texture fetches? Strange. --- src/Magnum/TextureTools/DistanceField.cpp | 1 - src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Magnum/TextureTools/DistanceField.cpp b/src/Magnum/TextureTools/DistanceField.cpp index c533e91db..6801f74b5 100644 --- a/src/Magnum/TextureTools/DistanceField.cpp +++ b/src/Magnum/TextureTools/DistanceField.cpp @@ -205,7 +205,6 @@ void DistanceField::operator()(GL::Texture2D& input, GL::Framebuffer& output, co output .setViewport(rectangle) - .clear(GL::FramebufferClear::Color) .bind(); _state->shader diff --git a/src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp b/src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp index 1d3719904..15e99a343 100644 --- a/src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp +++ b/src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp @@ -107,7 +107,7 @@ DistanceFieldGLTest::DistanceFieldGLTest() { &DistanceFieldGLTest::sizeRatioNotMultipleOfTwo}); #ifndef MAGNUM_TARGET_WEBGL - addBenchmarks({&DistanceFieldGLTest::benchmark}, 5, BenchmarkType::GpuTime); + addBenchmarks({&DistanceFieldGLTest::benchmark}, 10, BenchmarkType::GpuTime); #endif /* Load the plugin directly from the build tree. Otherwise it's either @@ -595,7 +595,7 @@ void DistanceFieldGLTest::benchmark() { DistanceField distanceField{32}; - CORRADE_BENCHMARK(25) { + CORRADE_BENCHMARK(50) { distanceField(input, framebuffer, {{}, Vector2i{64}} #ifdef MAGNUM_TARGET_GLES , inputImage->size()