On this line I think sizeof(float)should be sizeof(T). Where sizeof(T) == sizeof(float), but the data type contains multiple values (e.g. in this case T is {int16_t, int16_T}), The function will do the wrong thing
N.B. This fix should also speed up rendering for other data types, which are currently taking a pessimistic route through IndexData()!
I think there is a bug when striding data that happens to have the same size as a float
To reproduce:
int16_t x,y;
https://github.com/epezent/implot/blob/6ee1559715fae9480fcaeb81f24d80a4d1e8c407/implot_demo.cpp#L48We would expect this change to have no effect, since where the structure is used, stride is passed in as sizeof(MyImPlot::Vector2f) https://github.com/epezent/implot/blob/6ee1559715fae9480fcaeb81f24d80a4d1e8c407/implot_demo.cpp#L1680
Root cause:
A few months ago IndexData() was introduced to speed up rendering. The bug seems to be on this line https://github.com/epezent/implot/blob/6ee1559715fae9480fcaeb81f24d80a4d1e8c407/implot_items.cpp#L290
On this line I think
sizeof(float)
should besizeof(T)
. Where sizeof(T) == sizeof(float), but the data type contains multiple values (e.g. in this case T is {int16_t, int16_T}), The function will do the wrong thingN.B. This fix should also speed up rendering for other data types, which are currently taking a pessimistic route through IndexData()!