# Program failed to link

**URL:** <https://community.cesium.com/t/program-failed-to-link/1186>\
**Category:** CesiumJS\
**Created:** [May 5, 2014, 12:40pm UTC](https://community.cesium.com/t/program-failed-to-link/1186 "2014-05-05T12:40:19Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://community.cesium.com/u/11155)\
**Post date:** [May 5, 2014, 12:40pm UTC](https://community.cesium.com/t/program-failed-to-link/1186/1 "2014-05-05T12:40:19Z")

</div>

Hello,I’m trying to use Cesium to display more than two image layers.The code is as follows:

_var layers = cesiumWidget.centralBody.imageryLayerCollection;_

_var layer = new ImageryLayer(new OpenStreetMapImageryProvider({_

_url :“[http://202.197.18.12/hiart2/15225/](http://202.197.18.12/hiart2/15225/)”_

_}));_

_layers.add(layer);_

But when I added more than three layers continiously in this way, the system went wrong, the error Cesium provide is as follows:

_An error occurred while rendering. Rendering has stopped._

_RuntimeError: Program failed to link. Link log: error X4510: maximum number of samplers exceeded. ps\_3\_0 target can have a maximum of 16 samplers_

_Warning: D3D shader compilation failed with default flags. Retrying with avoid flow control._

_error X4510: maximum number of samplers exceeded. ps\_3\_0 target can have a maximum of 16 samplers_

_Warning: D3D shader compilation failed with avoid flow control flags. Retrying with prefer flow control._

_error X4510: maximum number of samplers exceeded. ps\_3\_0 target can have a maximum of 16 samplers_

_Warning: D3D shader compilation failed with prefer flow control flags._

_Error_

_at new RuntimeError ([http://202.197.18.14:8081/online3/pages/earth/js/Source/Core/RuntimeError.js:40:19](http://202.197.18.14:8081/online3/pages/earth/js/Source/Core/RuntimeError.js:40:19))_

_at createAndLinkProgram ([http://202.197.18.14:8081/online3/pages/earth/js/Source/Renderer/ShaderProgram.js:914:19](http://202.197.18.14:8081/online3/pages/earth/js/Source/Renderer/ShaderProgram.js:914:19))_

_at new ShaderProgram ([http://202.197.18.14:8081/online3/pages/earth/js/Source/Renderer/ShaderProgram.js:612:23](http://202.197.18.14:8081/online3/pages/earth/js/Source/Renderer/ShaderProgram.js:612:23))_

_at Context.createShaderProgram ([http://202.197.18.14:8081/online3/pages/earth/js/Source/Renderer/Context.js:1171:16](http://202.197.18.14:8081/online3/pages/earth/js/Source/Renderer/Context.js:1171:16))_

_at ShaderCache.getShaderProgram ([http://202.197.18.14:8081/online3/pages/earth/js/Source/Renderer/ShaderCache.js:75:36](http://202.197.18.14:8081/online3/pages/earth/js/Source/Renderer/ShaderCache.js:75:36))_

_at CentralBodySurfaceShaderSet.getShaderProgram ([http://202.197.18.14:8081/online3/pages/earth/js/Source/Scene/CentralBodySurfaceShaderSet.js:103:47](http://202.197.18.14:8081/online3/pages/earth/js/Source/Scene/CentralBodySurfaceShaderSet.js:103:47))_

_at createRenderCommandsForSelectedTiles ([http://202.197.18.14:8081/online3/pages/earth/js/Source/Scene/CentralBodySurface.js:994:55](http://202.197.18.14:8081/online3/pages/earth/js/Source/Scene/CentralBodySurface.js:994:55))_

_at CentralBodySurface.update ([http://202.197.18.14:8081/online3/pages/earth/js/Source/Scene/CentralBodySurface.js:132:9](http://202.197.18.14:8081/online3/pages/earth/js/Source/Scene/CentralBodySurface.js:132:9))_

_at CentralBody.update ([http://202.197.18.14:8081/online3/pages/earth/js/Source/Scene/CentralBody.js:779:27](http://202.197.18.14:8081/online3/pages/earth/js/Source/Scene/CentralBody.js:779:27))_

_at CompositePrimitive.update ([http://202.197.18.14:8081/online3/pages/earth/js/Source/Scene/CompositePrimitive.js:384:31](http://202.197.18.14:8081/online3/pages/earth/js/Source/Scene/CompositePrimitive.js:384:31))_

_at updatePrimitives ([http://202.197.18.14:8081/online3/pages/earth/js/Source/Scene/Scene.js:873:27](http://202.197.18.14:8081/online3/pages/earth/js/Source/Scene/Scene.js:873:27))_

_at Scene.render ([http://202.197.18.14:8081/online3/pages/earth/js/Source/Scene/Scene.js:929:9](http://202.197.18.14:8081/online3/pages/earth/js/Source/Scene/Scene.js:929:9))_

So could you help me with this problems?

Thanks!

-ZhangFan

---

<div class="post-metadata">

**Author:** ![patrick](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/patrick/32/2045_2.png) [@patrick](https://community.cesium.com/u/patrick)\
**Post date:** [May 6, 2014, 12:45am UTC](https://community.cesium.com/t/program-failed-to-link/1186/2 "2014-05-06T00:45:21Z")

</div>

Hi,

It looks like this exceeds your hardware limitation. Is this an older machine? What does [webglreport.com](http://webglreport.com) report for “Max Texture Image Units” under “Fragment Shader?” Cesium tries to draw all the image layers at once, but this can exceed hardware-dependent limitations when several layers are used (two is quite low though). We plan to draw the layers in multiple passes to overcome this at some point.

Patrick

---

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://community.cesium.com/u/11155)\
**Post date:** [May 7, 2014, 2:47am UTC](https://community.cesium.com/t/program-failed-to-link/1186/3 "2014-05-07T02:47:12Z")

</div>

Thank you!

So the only thing I can do is to replace the machine with a higher configuration computer??

在 2014年5月6日星期二UTC+8上午8时45分21秒，Patrick Cozzi写道：

---

<div class="post-metadata">

**Author:** ![patrick](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/patrick/32/2045_2.png) [@patrick](https://community.cesium.com/u/patrick)\
**Post date:** [May 7, 2014, 11:56am UTC](https://community.cesium.com/t/program-failed-to-link/1186/4 "2014-05-07T11:56:39Z")

</div>

First time upgrading your video card drivers and browser.

Patrick

---

<div class="post-metadata">

**Author:** ![patrick](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/patrick/32/2045_2.png) [@patrick](https://community.cesium.com/u/patrick)\
**Post date:** [May 7, 2014, 11:57am UTC](https://community.cesium.com/t/program-failed-to-link/1186/5 "2014-05-07T11:57:02Z")

</div>

Sorry, I mean first _try_.

---

<div class="post-metadata">

**Author:** ![alegarreta](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@alegarreta](https://community.cesium.com/u/alegarreta)\
**Post date:** [June 4, 2014, 10:14am UTC](https://community.cesium.com/t/program-failed-to-link/1186/6 "2014-06-04T10:14:26Z")

</div>

Hello,

```
								I've the last video card drivers and the last browser version and I've the same problem but when I try to make zoom over two or more layers in the same area. I add this layers from WMS server and if I make zoom the rendering is stopped. In my case Fragment Shader Max Texture Image Units are

```

1. 

Apart of draw the layers in multiple passes, are there any option to fix this error?

I’m very interested in drawing the layers in multiple passes, I will watch for your progress in this way.

Thanks!!

Aritz

---

<div class="post-metadata">

**Author:** ![patrick](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/patrick/32/2045_2.png) [@patrick](https://community.cesium.com/u/patrick)\
**Post date:** [June 4, 2014, 11:04am UTC](https://community.cesium.com/t/program-failed-to-link/1186/7 "2014-06-04T11:04:22Z")

</div>

Try this branch, which now has the multipass fallback: [https://github.com/AnalyticalGraphicsInc/cesium/tree/quadtreePrimitive](https://github.com/AnalyticalGraphicsInc/cesium/tree/quadtreePrimitive)

Patrick

---

<div class="post-metadata">

**Author:** ![alegarreta](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@alegarreta](https://community.cesium.com/u/alegarreta)\
**Post date:** [June 4, 2014, 12:36pm UTC](https://community.cesium.com/t/program-failed-to-link/1186/8 "2014-06-04T12:36:29Z")

</div>

I try with this branch but the result is the same.

I have downloaded the zip file and uncompressed on my PC, after I have added Cesium b29 and my code. Do I make something else? modify something in the code?

Thanks!!

Aritz

---

<div class="post-metadata">

**Author:** ![patrick](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/patrick/32/2045_2.png) [@patrick](https://community.cesium.com/u/patrick)\
**Post date:** [June 4, 2014, 12:40pm UTC](https://community.cesium.com/t/program-failed-to-link/1186/9 "2014-06-04T12:40:36Z")

</div>

This is not in b29. It is in a branch on github. If you do not want to use the version from github, keep an eye on the pull requests to see when this makes it into an official Cesium release, perhaps 1.0 (July) or 1.01 (August).

Patrick

---

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://community.cesium.com/u/11155)\
**Post date:** [June 30, 2014, 1:31pm UTC](https://community.cesium.com/t/program-failed-to-link/1186/10 "2014-06-30T13:31:06Z")

</div>

I download the branch you said above, but it has errors when I run it.

The erros is as follows:

An error occurred while rendering. Rendering has stopped.  
This may indicate an incompatibility with your hardware or web browser, or it may indicate a bug in the application. Visit [http://get.webgl.org](http://get.webgl.org/)  
 to verify that your web browser and hardware support WebGL. Consider trying a different web browser or updating your video drivers. Detailed error information is below:  
RuntimeError: Fragment shader failed to compile. Compile log: ERROR: 0:237: ‘sampleAndBlend’ : no matching overloaded function found ERROR: 0:237: ‘assign’ : cannot convert from ‘const mediump float’ to ‘4-component vector of float’  
Error  
at new RuntimeError ([http://localhost:8000/Cesium-quadtreePrimitive/Source/Core/RuntimeError.js:42:19](http://localhost:8000/Cesium-quadtreePrimitive/Source/Core/RuntimeError.js) )  
at createAndLinkProgram ([http://localhost:8000/Cesium-quadtreePrimitive/Source/Renderer/ShaderProgram.js:675:23](http://localhost:8000/Cesium-quadtreePrimitive/Source/Renderer/ShaderProgram.js) )  
at initialize ([http://localhost:8000/Cesium-quadtreePrimitive/Source/Renderer/ShaderProgram.js:861:23](http://localhost:8000/Cesium-quadtreePrimitive/Source/Renderer/ShaderProgram.js) )  
at ShaderProgram.\_bind ([http://localhost:8000/Cesium-quadtreePrimitive/Source/Renderer/ShaderProgram.js:878:9](http://localhost:8000/Cesium-quadtreePrimitive/Source/Renderer/ShaderProgram.js) )  
at beginDraw ([http://localhost:8000/Cesium-quadtreePrimitive/Source/Renderer/Context.js:1784:12](http://localhost:8000/Cesium-quadtreePrimitive/Source/Renderer/Context.js) )  
at Context.draw ([http://localhost:8000/Cesium-quadtreePrimitive/Source/Renderer/Context.js:1851:9](http://localhost:8000/Cesium-quadtreePrimitive/Source/Renderer/Context.js) )  
at DrawCommand.execute ([http://localhost:8000/Cesium-quadtreePrimitive/Source/Renderer/DrawCommand.js:185:17](http://localhost:8000/Cesium-quadtreePrimitive/Source/Renderer/DrawCommand.js) )  
at executeCommand ([http://localhost:8000/Cesium-quadtreePrimitive/Source/Scene/Scene.js:988:21](http://localhost:8000/Cesium-quadtreePrimitive/Source/Scene/Scene.js) )  
at executeCommands ([http://localhost:8000/Cesium-quadtreePrimitive/Source/Scene/Scene.js:1217:17](http://localhost:8000/Cesium-quadtreePrimitive/Source/Scene/Scene.js) )  
at render ([http://localhost:8000/Cesium-quadtreePrimitive/Source/Scene/Scene.js:1315:9](http://localhost:8000/Cesium-quadtreePrimitive/Source/Scene/Scene.js) )  
at Scene.render ([http://localhost:8000/Cesium-quadtreePrimitive/Source/Scene/Scene.js:1350:13](http://localhost:8000/Cesium-quadtreePrimitive/Source/Scene/Scene.js))

Can you help me with the problem.

在 2014年6月4日星期三UTC+8下午8时40分37秒，Patrick Cozzi写道：
