summaryrefslogtreecommitdiff
path: root/include/sway/desktop/shaders.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sway/desktop/shaders.h')
-rw-r--r--include/sway/desktop/shaders.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/include/sway/desktop/shaders.h b/include/sway/desktop/shaders.h
index 4ff9ca42..6a9f8863 100644
--- a/include/sway/desktop/shaders.h
+++ b/include/sway/desktop/shaders.h
@@ -45,16 +45,15 @@ const GLchar tex_fragment_src_rgba[] =
"uniform sampler2D tex;\n"
"uniform float alpha;\n"
"\n"
-"uniform float width;\n"
-"uniform float height;\n"
+"uniform vec2 size;\n"
"uniform vec2 position;\n"
"uniform float radius;\n"
"\n"
"void main() {\n"
" gl_FragColor = texture2D(tex, v_texcoord) * alpha;\n"
-" vec2 corner_distance = min(gl_FragCoord.xy - position, position + vec2(width, height) - gl_FragCoord.xy);\n"
+" vec2 corner_distance = min(gl_FragCoord.xy - position, size + position - gl_FragCoord.xy);\n"
" if (max(corner_distance.x, corner_distance.y) < radius) {\n"
-" float d = radius - distance(corner_distance, vec2(radius, radius));\n"
+" float d = radius - distance(corner_distance, vec2(radius));\n"
" float smooth = smoothstep(-1.0f, 0.5f, d);\n"
" gl_FragColor = mix(vec4(0), gl_FragColor, smooth);\n"
" }\n"
@@ -66,38 +65,37 @@ const GLchar tex_fragment_src_rgbx[] =
"uniform sampler2D tex;\n"
"uniform float alpha;\n"
"\n"
-"uniform float width;\n"
-"uniform float height;\n"
+"uniform vec2 size;\n"
"uniform vec2 position;\n"
"uniform float radius;\n"
"\n"
"void main() {\n"
" gl_FragColor = vec4(texture2D(tex, v_texcoord).rgb, 1.0) * alpha;\n"
-" vec2 corner_distance = min(gl_FragCoord.xy - position, position + vec2(width, height) - gl_FragCoord.xy);\n"
+" vec2 corner_distance = min(gl_FragCoord.xy - position, position + size - gl_FragCoord.xy);\n"
" if (max(corner_distance.x, corner_distance.y) < radius) {\n"
-" float d = radius - distance(corner_distance, vec2(radius, radius));\n"
+" float d = radius - distance(corner_distance, vec2(radius));\n"
" float smooth = smoothstep(-1.0f, 0.5f, d);\n"
" gl_FragColor = mix(vec4(0), gl_FragColor, smooth);\n"
" }\n"
"}\n";
const GLchar tex_fragment_src_external[] =
-"#extension GL_OES_EGL_image_external : require\n\n"
+"#extension GL_OES_EGL_image_external : require\n"
+"\n"
"precision mediump float;\n"
"varying vec2 v_texcoord;\n"
"uniform samplerExternalOES texture0;\n"
"uniform float alpha;\n"
"\n"
-"uniform float width;\n"
-"uniform float height;\n"
+"uniform vec2 size;\n"
"uniform vec2 position;\n"
"uniform float radius;\n"
"\n"
"void main() {\n"
" gl_FragColor = texture2D(texture0, v_texcoord) * alpha;\n"
-" vec2 corner_distance = min(gl_FragCoord.xy - position, position + vec2(width, height) - gl_FragCoord.xy);\n"
+" vec2 corner_distance = min(gl_FragCoord.xy - position, position + size - gl_FragCoord.xy);\n"
" if (max(corner_distance.x, corner_distance.y) < radius) {\n"
-" float d = radius - distance(corner_distance, vec2(radius, radius));\n"
+" float d = radius - distance(corner_distance, vec2(radius));\n"
" float smooth = smoothstep(-1.0f, 0.5f, d);\n"
" gl_FragColor = mix(vec4(0), gl_FragColor, smooth);\n"
" }\n"