Mapbox-gl-js: Exception while rendering: this.binders[l].setUniform is not a function

Created on 26 Mar 2020  路  4Comments  路  Source: mapbox/mapbox-gl-js

I upgraded from v1.7.0 to 1.8.1, but had to roll back because of elevated exceptions across all browsers that looked like:

this.binders[l].setUniform is not a function TypeError: this.binders[l].setUniform is not a function
   at SourceExpressionBinder.setUniforms (src/data/program_configuration.js:519)
   at Program.draw (src/render/program.js:135)
   at drawSymbolElements (src/render/draw_symbols.js:389)
   at drawLayerSymbols (src/render/draw_symbols.js:378)
   at drawSymbols (src/render/draw_symbols.js:74)
   at Painter.renderLayer (src/render/painter.js:495)
   at Painter.render (src/render/painter.js:453)
   at Map._render (src/ui/map.js:2195)
   at Map.triggerRepaint (src/ui/map.js:2317)

I can only see that these exceptions started getting thrown, but I do not know exactly what triggers them or if they result in any incorrect behavior.

mapbox-gl-js version: 1.8.1

browser: Chrome (Mac, Windows, Linux, Android), Safari (iOS, Mac), Edge, IE11

Steps to Trigger Behavior: unknown

bug

Most helpful comment

Thanks for the detailed repro @msbarry. It was super helpful in figuring out the fix! Its going out withe the 1.9.1 release.

All 4 comments

Sorry I don't have too much detail here, hopefully this is easy to track down as it looks like @mourner made a recent change in this area (d85afadd994d93fa7bb42bb614de02217030ee94) - let me know if you need more details and I can do some more testing.

@msbarry Can you provide a minimal test case that can reproduce this. We aren't seeing any other reports of this issue. Knowing what triggers it would speed up a fix.

@asheemmamoowala this appears to trigger it with 1.9.0:

var map = window.map = new mapboxgl.Map({
    container: 'map',
    zoom: 14.13,
    center: [-77.03191, 38.88825],
    style: 'mapbox://styles/mapbox/streets-v10',
    hash: true
});

map.on('load', () => {
    map.setPaintProperty('poi-parks-scalerank1', 'text-color', ["match", ["get", "type"], "Park", "red", "black"]);
});

looks like in this function:

    setUniforms<Properties: Object>(context: Context, binderUniforms: Array<BinderUniform>, properties: PossiblyEvaluated<Properties>, globals: GlobalProperties) {
        // Uniform state bindings are owned by the Program, but we set them
        // from within the ProgramConfiguraton's binder members.
        for (const {name, property, binding} of binderUniforms) {
            (this.binders[property]: any).setUniform(binding, globals, properties.get(property), name);
        }
    }

name is "u_fill_color", property is "text-color" and this.binders['text-color'] is an instance of SourceExpressionBinder which doesn't appear to have a setUniform method

Thanks for the detailed repro @msbarry. It was super helpful in figuring out the fix! Its going out withe the 1.9.1 release.

Was this page helpful?
0 / 5 - 0 ratings