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.
This commit is contained in:
parent
71386c08f1
commit
952a4fa456
Notes:
blender-bot
2023-02-14 01:21:16 +01:00
Referenced by issue #94987, Dragged node links are invisible
|
@ -2073,7 +2073,7 @@ void node_draw_link_bezier(const bContext &C,
|
|||
copy_v2_v2(node_link_data.bezierPts[i], vec[i]);
|
||||
}
|
||||
for (int i = 0; i < 3; i++) {
|
||||
copy_v2_v2(node_link_data.colors[i], colors[i]);
|
||||
copy_v4_v4(node_link_data.colors[i], colors[i]);
|
||||
}
|
||||
node_link_data.doArrow = drawarrow;
|
||||
node_link_data.doMuted = drawmuted;
|
||||
|
@ -2086,7 +2086,7 @@ void node_draw_link_bezier(const bContext &C,
|
|||
|
||||
GPUBatch *batch = g_batch_link.batch_single;
|
||||
GPUUniformBuf *ubo = GPU_uniformbuf_create_ex(
|
||||
sizeof(node_link_data), &node_link_data, __func__);
|
||||
sizeof(NodeLinkData), &node_link_data, __func__);
|
||||
|
||||
GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_NODELINK);
|
||||
GPU_batch_uniformbuf_bind(batch, "node_link_data", ubo);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue