Skip to content

Model.setParameters() triggers program relinking when parameters object alternates between empty and non-empty #22

@kahole

Description

@kahole

While profiling the particle layer, I noticed continuous shader relinking (gl.getProgramParameter, etc) every frame.

After investigation, seems the cause is calling

model.setParameters({
...model.parameters,
cullMode: 'front', // enable culling to avoid rendering on both sides of the globe; front-face culling because it seems deck.gl uses a wrong winding order and setting frontFace: 'cw' throws "GL_INVALID_ENUM: Enum 0x0000 is currently not supported."
...this.props.parameters,
});

inside draw().

This leads to deck.gl's rendering loop, which also calls model.setParameters with the layer parameters, to recreate the render pipeline for the model back and forth constantly.

If you set the parameters on the layer itself to exactly match the ones inside particle-line-layer.ts, the issue goes away. Since the equality check prevents re-creation of the render pipeline.

      new WeatherLayers.ParticleLayer({
        ...
        parameters: {
          depthCompare: 'always',
          cullMode: 'front',
        },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions