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 +++++++++ source/blender/gpu/shaders/gpu_shader_3D_polyline_frag.glsl | 5 ++++- source/blender/gpu/shaders/gpu_shader_3D_polyline_geom.glsl | 7 ++++--- 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'source') 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); diff --git a/source/blender/gpu/shaders/gpu_shader_3D_polyline_frag.glsl b/source/blender/gpu/shaders/gpu_shader_3D_polyline_frag.glsl index 9c6b109d659..3ea8f7dbfbe 100644 --- a/source/blender/gpu/shaders/gpu_shader_3D_polyline_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_3D_polyline_frag.glsl @@ -1,5 +1,6 @@ uniform float lineWidth; +uniform bool lineSmooth = true; in vec4 finalColor; noperspective in float smoothline; @@ -19,6 +20,8 @@ void main() } #endif fragColor = finalColor; - fragColor.a *= clamp((lineWidth + SMOOTH_WIDTH) * 0.5 - abs(smoothline), 0.0, 1.0); + if (lineSmooth) { + fragColor.a *= clamp((lineWidth + SMOOTH_WIDTH) * 0.5 - abs(smoothline), 0.0, 1.0); + } fragColor = blender_srgb_to_framebuffer_space(fragColor); } diff --git a/source/blender/gpu/shaders/gpu_shader_3D_polyline_geom.glsl b/source/blender/gpu/shaders/gpu_shader_3D_polyline_geom.glsl index fd9b7e221e6..70026398937 100644 --- a/source/blender/gpu/shaders/gpu_shader_3D_polyline_geom.glsl +++ b/source/blender/gpu/shaders/gpu_shader_3D_polyline_geom.glsl @@ -5,6 +5,7 @@ layout(triangle_strip, max_vertices = 4) out; uniform vec4 color; uniform vec2 viewportSize; uniform float lineWidth; +uniform bool lineSmooth = true; #if !defined(UNIFORM) in vec4 finalColor_g[]; @@ -53,12 +54,12 @@ void do_vertex(const int i, vec4 pos, vec2 ofs) clip = clip_g[i]; #endif - smoothline = (lineWidth + SMOOTH_WIDTH) * 0.5; + smoothline = (lineWidth + SMOOTH_WIDTH * float(lineSmooth)) * 0.5; gl_Position = pos; gl_Position.xy += ofs * pos.w; EmitVertex(); - smoothline = -(lineWidth + SMOOTH_WIDTH) * 0.5; + smoothline = -(lineWidth + SMOOTH_WIDTH * float(lineSmooth)) * 0.5; gl_Position = pos; gl_Position.xy -= ofs * pos.w; EmitVertex(); @@ -77,7 +78,7 @@ void main(void) vec2 ofs = vec2(-e.y, e.x); #endif ofs /= viewportSize.xy; - ofs *= lineWidth + SMOOTH_WIDTH; + ofs *= lineWidth + SMOOTH_WIDTH * float(lineSmooth); do_vertex(0, p0, ofs); do_vertex(1, p1, ofs); -- cgit v1.2.3 From 55be1dde5c4cf208fbb1f0aa51bebb5a132f2802 Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Tue, 17 Nov 2020 03:47:02 +0100 Subject: Fix incorrect text size with downscaled preview Use either scene render size or fixed preview scale factor. Previously scene render size was used as baseline value for text size correction. This is incorrect. Reviewed By: sergey Differential Revision: https://developer.blender.org/D9563 --- source/blender/sequencer/intern/effects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/sequencer/intern/effects.c b/source/blender/sequencer/intern/effects.c index b4bc2d25155..dd7634a10eb 100644 --- a/source/blender/sequencer/intern/effects.c +++ b/source/blender/sequencer/intern/effects.c @@ -3902,7 +3902,7 @@ static ImBuf *do_text_effect(const SeqRenderData *context, /* Compensate text size for preview render size. */ proxy_size_comp = context->scene->r.size / 100.0; if (context->preview_render_size != SEQ_RENDER_SIZE_SCENE) { - proxy_size_comp *= BKE_sequencer_rendersize_to_scale_factor(context->preview_render_size); + proxy_size_comp = BKE_sequencer_rendersize_to_scale_factor(context->preview_render_size); } /* set before return */ -- cgit v1.2.3 From 75bd286813eb5e3c227696b4cfd5616b17166641 Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Tue, 17 Nov 2020 03:56:53 +0100 Subject: Fix T82703: Image not scaled when rendering This is was caused by incorrectly set preview_render_size in VSE rendering context. Value was set to SEQ_PROXY_RENDER_SIZE_FULL, but it should be SEQ_PROXY_RENDER_SIZE_SCENE as scene render size is being used. This is same fix as 0d7036b40e68, but I did not checked openGL render pipeline. Reviewed By: sergey Differential Revision: https://developer.blender.org/D9562 --- source/blender/editors/render/render_opengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 8d410e36ca6..8cad3b94fe9 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -493,7 +493,7 @@ static void screen_opengl_render_apply(const bContext *C, OGLRender *oglrender) scene, oglrender->sizex, oglrender->sizey, - 100, + SEQ_RENDER_SIZE_SCENE, false, &context); -- cgit v1.2.3