From 82b8c156841f7202a4ca806968a782e517201d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Tue, 17 Nov 2020 01:28:33 +0100 Subject: Fix T81827: MacOS lines that should be thick are green instead The issue was the use of alpha values of 0 when there were no blending enabled. This patch just disables the smoothing of the wires in this case. --- source/blender/gpu/intern/gpu_immediate.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/blender/gpu/intern') diff --git a/source/blender/gpu/intern/gpu_immediate.cc b/source/blender/gpu/intern/gpu_immediate.cc index 44c6cac02ca..979b3cbb557 100644 --- a/source/blender/gpu/intern/gpu_immediate.cc +++ b/source/blender/gpu/intern/gpu_immediate.cc @@ -180,6 +180,11 @@ static void wide_line_workaround_start(GPUPrimType prim_type) immUniform2fv("viewportSize", &viewport[2]); immUniform1f("lineWidth", line_width); + if (GPU_blend_get() == GPU_BLEND_NONE) { + /* Disable line smoothing when blending is disabled (see T81827). */ + immUniform1i("lineSmooth", 0); + } + if (ELEM(polyline_sh, GPU_SHADER_3D_POLYLINE_CLIPPED_UNIFORM_COLOR, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR)) { @@ -190,6 +195,10 @@ static void wide_line_workaround_start(GPUPrimType prim_type) static void wide_line_workaround_end(void) { if (imm->prev_shader) { + if (GPU_blend_get() == GPU_BLEND_NONE) { + /* Restore default. */ + immUniform1i("lineSmooth", 1); + } immUnbindProgram(); immBindShader(imm->prev_shader); -- cgit v1.2.3