From d55c269dd197288c30ca2881136330931bf05f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sat, 1 Dec 2018 19:49:31 +0100 Subject: UI: Simplify the area border drawing Instead of doing a lot of alpha blended drawing with jittering, use the fragment shader to do the masking using a circle mask. This is much simpler and requires much less resources. Hopefully this may solve the issue we have with the Intels UHD Graphics 620 on linux. --- .../shaders/gpu_shader_2D_area_borders_vert.glsl | 31 +++++++++------------- 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl') diff --git a/source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl index 5326076e269..816e12342a1 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl @@ -7,35 +7,30 @@ uniform float scale; in vec2 pos; -const vec2 jitter_ofs[8] = vec2[8]( - vec2( 0.468813, -0.481430), vec2(-0.155755, -0.352820), - vec2( 0.219306, -0.238501), vec2(-0.393286, -0.110949), - vec2(-0.024699, 0.013908), vec2( 0.343805, 0.147431), - vec2(-0.272855, 0.269918), vec2( 0.095909, 0.388710) -); +out vec2 uv; + void main() { int corner_id = (gl_VertexID / cornerLen) % 4; - int jitter_id = gl_VertexID / (cornerLen * 4) % 8; vec2 final_pos = pos * scale; - if (corner_id == 0) + if (corner_id == 0) { + uv = pos + vec2(1.0, 1.0); final_pos += rect.yw; /* top right */ - else if (corner_id == 1) + } + else if (corner_id == 1) { + uv = pos + vec2(-1.0, 1.0); final_pos += rect.xw; /* top left */ - else if (corner_id == 2) + } + else if (corner_id == 2) { + uv = pos + vec2(-1.0, -1.0); final_pos += rect.xz; /* bottom left */ - else + } + else { + uv = pos + vec2(1.0, -1.0); final_pos += rect.yz; /* bottom right */ - - /* Only jitter verts inside the corner (not the one shared with the edges). */ - if ((gl_VertexID % cornerLen) % (cornerLen - 2) != 0) { - /* Only jitter intern verts not boundaries. */ - if ((gl_VertexID % 2) == 0) { - final_pos += jitter_ofs[jitter_id]; - } } gl_Position = (ModelViewProjectionMatrix * vec4(final_pos, 0.0, 1.0)); -- cgit v1.2.3