Stops vs Literal value: Icon size is different for same value.
Symbol layer with
"icon-size": 0.27,
"icon-size": {
type: 'interval',
default: iconSize,
property: "__resize_by__",
stops: [[0, iconSize]]
},
are rendering images at different size.
~~jsfiddle~~ jsfiddle explaining the issue. In the fiddle I render a icon at size 0.27 and then after 2 seconds I set the same size using stops.
Expected Behavior
It should render with the same size
Actual Behavior
When using stops, it is rendering smaller than when given a literal value
Your JSFiddle doesn't seem to work — I see no icons on the map there.
@mourner New jsfiddle with a large png, showing the issue.
https://jsfiddle.net/bewithjonam/Lf1prz26/12/
If I am not wrong, the issue happens only on decimal icon-sizes. And the previous image that i used from the sprite was very small.
I think the same problem causes my issue: https://github.com/mapbox/mapbox-gl-js/issues/7017
Yes, this has the same underlying cause as #7017: to minimize vertex buffer memory, data-driven icon-size values are packed into a Uint16 vertex attribute component with a precision limit of 0.1 (the floating point value is multiplied by 10 when populating the vertex array, converted to an integer, and divided by 10 in the shader).
@ChrisLoer @ansis Should we just switch a_data to use Float32?
Float32 is an option but we could also just multiply and divide by 256 instead if we don't want to use more bytes per vertex. We don't really have any memory benchmarks right now so this is hard to measure how significant the change would be
I removed the jsfiddle accidently. Here is an equivalent one: http://jsfiddle.net/bewithjonam/41g8jwco/
Is it possible to use 256 instead of 10?