Maximum number of texture references


I’m working on some bigger program consisting of multiple kernels and I’m running into some problems with texture references.
If I define more than 4 texture references in the whole project (several independend object files which are linked together) I get an “unspecified driver error” when running the program.
All the texture references are defined as static variables inside the modules since it doesn’t seem to be possible to define them locally and pass them as an argument to the kernel.

Is there any way to work around this?



I ran into a similar problem.

When I declare multiple texture references (global) and bind linear memory to it there seems to be a limit on how many textures can be bound at the same time.
All textures are bound to different memory locations which don’t overlap.

Somewhere between texture #18 and #33 the texture fetches inside the kernel code returned 0 for every address, without any error/warning given from kernel or at compile time.
The texture fetches from textures <=#18 worked without a flaw.

At the moment I’m working with 18 different texture references and bind the memory needed to that texture reference just before the kernel invocation.

If the number of texture references bound to memory are limited a note in the programming guide or a kernel/compiler error would be nice. Would have spared me a lot of debugging :/

Best regards


Just thought I’d let you know that I’m seeing very similar behaviour (thread here). At the moment I’m working on implementing the same work-around as you just described. Any ideas on whether this is a hardware limit or a compiler issue?


A given kernel can only address a set number of textures (32 maybe?) but globally you should be able to have as many as you want.

I haven’t run into this myself, but I think either you’re binding them all at once or the api has a problem. There are three different texturing apis, tho, and I think at least the Driver API will give you the proper control to manage your references. Consult the appendices D and E of the Programming Guide.