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>2020-05-19 23:41:04 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-05-19 23:43:42 +0300
commit42d77fbea16566dacc7dcbef75c45dcaa7c36f81 (patch)
tree5aa877e1bf72e027031fd22f2e5f9ccd64d80467 /source/blender/editors/interface/view2d_draw.c
parent13125e0948816f0debe6d298e9c7b436fb5a1db1 (diff)
UI: Make timeline vertical bars thickness work on OSX
Make use of Polyline shader.
Diffstat (limited to 'source/blender/editors/interface/view2d_draw.c')
-rw-r--r--source/blender/editors/interface/view2d_draw.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/editors/interface/view2d_draw.c b/source/blender/editors/interface/view2d_draw.c
index 17a95ba3fff..95fec2a10e9 100644
--- a/source/blender/editors/interface/view2d_draw.c
+++ b/source/blender/editors/interface/view2d_draw.c
@@ -40,6 +40,7 @@
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "WM_api.h"
@@ -196,7 +197,19 @@ static void draw_parallel_lines(const ParallelLinesSet *lines,
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
- immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+ if (U.pixelsize > 1.0f) {
+ float viewport[4];
+ GPU_viewport_size_get_f(viewport);
+
+ immBindBuiltinProgram(GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR);
+ immUniform2fv("viewportSize", &viewport[2]);
+ /* 0.5f factor here is because the line is too fat due to the builtin antialiasing.
+ * TODO make a variant or a uniform to toggle it off. */
+ immUniform1f("lineWidth", 0.5f * U.pixelsize);
+ }
+ else {
+ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+ }
immUniformColor3ubv(color);
immBegin(GPU_PRIM_LINES, steps * 2);