Nvdsosd rendering order (z-index)

I am experimenting with the nvdsosd gstreamer plugin under DeepStream 5.0 DP. I would like to know in which order will be rendered the elements specified in the display metadata. Display metadata allows us to add up to 16 rectangles, 16 labels and 16 lines to be rendered, and they have a well defined order in the metadata:

display_meta->num_rects = 2
rect0 = display_meta->rect_params[0]
// set up rect0
rect1 = display_meta->rect_params[1]
// set up rect1

So my question is: in which order rect0 and rect1 will be rendered? If they both have a background color and they overlap, how can I control which will be drawn over the other? I would expect that they will be drawn in the same order as they are placed in the rect_params array. However I tried to change the position of rectangles in the rect_params array but could not figure out a consistent behavior.

rectangles drawn in CPU and GPU mode should be in order but VIC maybe out of order.
but need to confirm, will get back to you.

1 Like

confirmed above comment.