diff options
author | Jeroen Bakker <jeroen@blender.org> | 2022-01-19 13:32:34 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-01-19 13:32:34 +0300 |
commit | 952a4fa4561986da467c16a04b1b23530df26b8d (patch) | |
tree | 3c72eff4d9f6da0f3266296e919163393aac9263 /source/blender/gpu | |
parent | 71386c08f110d402a7b4f5fbd5a7629829d8364f (diff) |
Fix T94987: Dragged node links are invisible.
Route cause was data alignment mismatch between GPU and CPU. This
mismatch would not allow us to bind the UBO where data wasn't available
on the GPU.
Fixed by using float4 in stead of float2. This could eventually be
packed, but that would lead to less readable code.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/GPU_shader_shared.h | 4 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/gpu/GPU_shader_shared.h b/source/blender/gpu/GPU_shader_shared.h index f400e151487..334b974acd8 100644 --- a/source/blender/gpu/GPU_shader_shared.h +++ b/source/blender/gpu/GPU_shader_shared.h @@ -34,7 +34,9 @@ using blender::float4x4; struct NodeLinkData { float4 colors[3]; - float2 bezierPts[4]; + /* bezierPts Is actually a float2, but due to std140 each element needs to be aligned to 16 + * bytes. */ + float4 bezierPts[4]; bool1 doArrow; bool1 doMuted; float dim_factor; diff --git a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl index 3d3a042de65..b83ea59a692 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl @@ -64,10 +64,10 @@ flat out int isMainLine; # define doMuted (domuted[0] != 0) #else -# define P0 node_link_data.bezierPts[0] -# define P1 node_link_data.bezierPts[1] -# define P2 node_link_data.bezierPts[2] -# define P3 node_link_data.bezierPts[3] +# define P0 node_link_data.bezierPts[0].xy +# define P1 node_link_data.bezierPts[1].xy +# define P2 node_link_data.bezierPts[2].xy +# define P3 node_link_data.bezierPts[3].xy # define cols node_link_data.colors # define doArrow node_link_data.doArrow # define doMuted node_link_data.doMuted |