From 65fb526d5c3ef0bfab83f6fdc2e69270c4522448 Mon Sep 17 00:00:00 2001 From: Felix Dick Date: Thu, 29 Sep 2022 06:56:17 +0200 Subject: [PATCH] Even less branching (taken more or less from the border shader). --- src/render/shaders/Textures.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/render/shaders/Textures.hpp b/src/render/shaders/Textures.hpp index 50a68e02..a541ec0a 100644 --- a/src/render/shaders/Textures.hpp +++ b/src/render/shaders/Textures.hpp @@ -22,15 +22,15 @@ inline static constexpr auto ROUNDED_SHADER_FUNC = [](const std::string colorVar if (primitiveMultisample == 1 && dist > radius - 1.0) { float distances = 0.0; - if (length(pixCoord + vec2(0.25, 0.25)) < radius) { distances = distances + 1.0; } - if (length(pixCoord + vec2(0.75, 0.25)) < radius) { distances = distances + 1.0; } - if (length(pixCoord + vec2(0.25, 0.75)) < radius) { distances = distances + 1.0; } - if (length(pixCoord + vec2(0.75, 0.75)) < radius) { distances = distances + 1.0; } + distances += float(length(pixCoord + vec2(0.25, 0.25)) < radius); + distances += float(length(pixCoord + vec2(0.75, 0.25)) < radius); + distances += float(length(pixCoord + vec2(0.25, 0.75)) < radius); + distances += float(length(pixCoord + vec2(0.75, 0.75)) < radius); if (distances == 0.0) discard; - distances = distances / 4.0; + distances /= 4.0; )#" + colorVarName + R"#( = )#" + colorVarName + R"#( * distances; }