From 42d77fbea16566dacc7dcbef75c45dcaa7c36f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Tue, 19 May 2020 22:41:04 +0200 Subject: [PATCH 1/4] UI: Make timeline vertical bars thickness work on OSX Make use of Polyline shader. --- source/blender/editors/interface/view2d_draw.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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); From 20c30534aafc4a97803d9e72ae765b5415fb1359 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 19 May 2020 16:40:40 -0400 Subject: [PATCH 2/4] Fix T75383:Bevel weird behaviour when using bevel weights Don't use the cube corner special case when the offsets are different for the three edges involved. The generic VMesh for this situation isn't perfect, but it's much better than a failed cube corner VMesh. Tests pass. --- source/blender/bmesh/tools/bmesh_bevel.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index bc127243836..0891070ce77 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -4167,6 +4167,10 @@ static int tri_corner_test(BevelParams *bp, BevVert *bv) if (bv->vmesh->count != 3) { return 0; } + + /* Only use the tri-corner special case if the offset is the same for every edge. */ + float offset = bv->edges[0].offset_l; + totang = 0.0f; for (i = 0; i < bv->edgecount; i++) { e = &bv->edges[i]; @@ -4178,6 +4182,11 @@ static int tri_corner_test(BevelParams *bp, BevVert *bv) else if (absang >= 3.0f * (float)M_PI_4) { return -1; } + + if (e->is_bev && !compare_ff(e->offset_l, offset, BEVEL_EPSILON)) { + return -1; + } + totang += ang; } if (in_plane_e != bv->edgecount - 3) { From 8d63d7337cec3b2dea06b3a520af467d9fc3e66d Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 19 May 2020 21:27:10 +0200 Subject: [PATCH 3/4] Fix unnecessary buffer reallocation in sculpt mode, causing an assert Probably did not cause an actual, the assert is a performance warning. Ref T76858 --- source/blender/gpu/intern/gpu_buffers.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 5221cc09ad9..cef90d57ef5 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -151,7 +151,10 @@ static bool gpu_pbvh_vert_buf_data_set(GPU_PBVH_Buffers *buffers, uint vert_len) /* Initialize vertex buffer (match 'VertexBufferFormat'). */ buffers->vert_buf = GPU_vertbuf_create_with_format_ex(&g_vbo_id.format, GPU_USAGE_STATIC); } - GPU_vertbuf_data_alloc(buffers->vert_buf, vert_len); + if (buffers->vert_buf->data == NULL || buffers->vert_buf->vertex_len != vert_len) { + /* Allocate buffer if not allocated yet or size changed. */ + GPU_vertbuf_data_alloc(buffers->vert_buf, vert_len); + } #endif return buffers->vert_buf->data != NULL; From 59cfb20fa112e636a6ae85cb6fdc048f16af5637 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 19 May 2020 22:44:51 +0200 Subject: [PATCH 4/4] Fix PBVH parallel range not initializing user data correctly in some cases This was already changed for the TBB-based BLI_task_parallel_range in master. This task local storage should always be initialized from the template, not copied from another task which may be executing at the time the copy happens. This may not fix any actual bug, we only use this user data for parallel reduce and it's not clear that TBB ever calls the copy constructor for that case. Ref T76858 --- source/blender/blenkernel/intern/pbvh_parallel.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/pbvh_parallel.cc b/source/blender/blenkernel/intern/pbvh_parallel.cc index 2534fdea3ee..adacbd13b61 100644 --- a/source/blender/blenkernel/intern/pbvh_parallel.cc +++ b/source/blender/blenkernel/intern/pbvh_parallel.cc @@ -49,7 +49,7 @@ struct PBVHTask { PBVHTask(const PBVHTask &other) : func(other.func), userdata(other.userdata), settings(other.settings) { - init_chunk(other.userdata_chunk); + init_chunk(settings->userdata_chunk); } /* Splitting constructor for parallel reduce. */