GPU: Ensure Absolute Ratio During SDF-Widget Drawing
In the GPU_SHADER_2D_WIDGET_BASE the deriviates were assumed to be positive. This is not always the case. In Vulkan this leads to incorrect rendering of the widgets due to incorrect SDF values. This change will ensure that the shader make the ratio variable absolute. Pull Request: https://projects.blender.org/blender/blender/pulls/107327
This commit is contained in:
@@ -8,7 +8,7 @@ vec3 compute_masks(vec2 uv)
|
||||
|
||||
/* Correct aspect ratio for 2D views not using uniform scaling.
|
||||
* 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;
|
||||
float ratio = (butCo != -2.0) ? abs(dFdy(uv.y) / dFdx(uv.x)) : 1.0;
|
||||
vec2 uv_sdf = uv;
|
||||
uv_sdf.x *= ratio;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user