diff options
| author | Felix Dick <felix.dick@web.de> | 2022-09-30 01:51:40 +0200 |
|---|---|---|
| committer | Felix Dick <felix.dick@web.de> | 2022-10-01 01:35:13 +0200 |
| commit | 71733f68eff805f78a73ada389064d23f1bb0d79 (patch) | |
| tree | b61d5ed5c8d2e04985ad8454900882ca931f436b /src/render/shaders | |
| parent | 09268d756fafe7d726b660739b57f9c9c18b9c6c (diff) | |
| parent | d867d4236666b3c9e3a2fe03337d57ffd9104360 (diff) | |
Merge branch 'fix_rounding_in_size_changing_windows' into rework_rounding_shader
Diffstat (limited to 'src/render/shaders')
| -rw-r--r-- | src/render/shaders/Textures.hpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/render/shaders/Textures.hpp b/src/render/shaders/Textures.hpp index a541ec0a..1e8281d0 100644 --- a/src/render/shaders/Textures.hpp +++ b/src/render/shaders/Textures.hpp @@ -6,9 +6,10 @@ inline static constexpr auto ROUNDED_SHADER_FUNC = [](const std::string colorVar return R"#( // branchless baby! - vec2 pixCoord = v_texcoord - vec2(0.5); - pixCoord *= (vec2(lessThan(pixCoord, vec2(0.0))) * vec2(-2.0) + vec2(1.0)) * fullSize; - pixCoord -= (bottomRight - topLeft) * vec2(0.5); + highp vec2 pixCoord = vec2(gl_FragCoord); + pixCoord -= topLeft + fullSize / vec2(2.0); + pixCoord *= vec2(lessThan(pixCoord, vec2(0.0))) * vec2(-2.0) + vec2(1.0); + pixCoord -= fullSize * vec2(0.5) - vec2(radius); if (all(greaterThan(pixCoord, vec2(0.0)))) { @@ -59,7 +60,6 @@ varying vec4 v_color; varying vec2 v_texcoord; uniform vec2 topLeft; -uniform vec2 bottomRight; uniform vec2 fullSize; uniform float radius; @@ -88,7 +88,6 @@ void main() { v_texcoord = texcoord; })#"; -// this is texture rendering!! inline const std::string TEXFRAGSRCRGBA = R"#( precision mediump float; varying vec2 v_texcoord; // is in 0-1 @@ -96,7 +95,6 @@ uniform sampler2D tex; uniform float alpha; uniform vec2 topLeft; -uniform vec2 bottomRight; uniform vec2 fullSize; uniform float radius; @@ -134,7 +132,6 @@ uniform sampler2D tex; uniform float alpha; uniform vec2 topLeft; -uniform vec2 bottomRight; uniform vec2 fullSize; uniform float radius; @@ -221,7 +218,6 @@ uniform samplerExternalOES texture0; uniform float alpha; uniform vec2 topLeft; -uniform vec2 bottomRight; uniform vec2 fullSize; uniform float radius; |
