About shader LINK_STATUS


I’ve got a few questions.

Is material.setShader() still a thing? I can’t find any documentation on this.

Is pc.Shader(device, definition) supposed to link the shaders after compilation?

What may cause the LINK_STATUS to remain 0 whereas the shaders have compiled successfully? (webgl inspector) I am not entirely sure whether this is detrimental at this stage, but the shader value assigned to the model remains null

Just wondering if there is an additional step required, if these can be answered I’m able to provide a minimal example.

Many thanks

Probably depends on material object you are using. If it is StandardMaterial, then it will override shader using own logic based on parameters.

So looking at the sources, pc.Shader does not call its own link method, but on device when setShader is called it will link shader if it is not linked already: https://github.com/playcanvas/engine/blob/master/src/graphics/device.js#L2561

This means, shaders will be linked only at the moment before they about to be used. This reduces number of unnecessary re-compilations.

Seems like if you just call shader.link() then it should force compile it, and if definition has not changed since it, device will not re-compile it when will be using.

1 Like