diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-06-26 02:27:24 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-06-26 02:27:36 +0300 |
commit | 46815753cf0d8045b8a160b46de5f97013c2e32f (patch) | |
tree | 5b160bd376f774a765ee3cc7e80d17cf028b7ea5 /source/blender/gpu | |
parent | 62aa103d485fd6e0b15100c1928695c4fb3ce039 (diff) |
Fix T78237 UI: NLA colors black and broken
This was caused by missing GL blend. This patch also fix the broken
strip appearance under timeline zoom.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl | 9 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl index 05fbae53e18..21c7f79a57c 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl @@ -19,9 +19,14 @@ vec3 compute_masks(vec2 uv) bool right_half = uv.x > outRectSize.x * 0.5; float corner_rad; + /* Correct aspect ratio for 2D views not using uniform scalling. + * uv is already in pixel space so a uniform scale should give us a ratio of 1. */ + float ratio = (butCo != -2.0) ? (dFdy(uv.y) / dFdx(uv.x)) : 1.0; vec2 uv_sdf = uv; + uv_sdf.x *= ratio; + if (right_half) { - uv_sdf.x = outRectSize.x - uv_sdf.x; + uv_sdf.x = outRectSize.x * ratio - uv_sdf.x; } if (upper_half) { uv_sdf.y = outRectSize.y - uv_sdf.y; @@ -43,7 +48,7 @@ vec3 compute_masks(vec2 uv) /* Clamp line width to be at least 1px wide. This can happen if the projection matrix * has been scaled (i.e: Node editor)... */ - float line_width = (lineWidth > 0.0) ? max(fwidth(uv.x), lineWidth) : 0.0; + float line_width = (lineWidth > 0.0) ? max(fwidth(uv.y), lineWidth) : 0.0; const float aa_radius = 0.5; vec3 masks; diff --git a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl index 30d0cd05926..2fd5effccce 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl @@ -163,7 +163,7 @@ vec2 do_tria() borderColor = vec4(0.0); embossColor = vec4(0.0); - butCo = -1.0; + butCo = -2.0; return pos; } |