Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-12-01 21:49:31 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-12-01 22:38:52 +0300
commitd55c269dd197288c30ca2881136330931bf05f98 (patch)
tree62ca84ecfa630e10154092a5157613caa069478e /source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl
parent6a80a786f88c7b09c451e3c585224a392c3cd95c (diff)
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.
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl31
1 files changed, 13 insertions, 18 deletions
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));