# How many textures can usually I bind at once?

I'm developing a game engine, and it's only going to work on modern (Shader model 4+) hardware. I figure that, by the time I'm done with it, that won't be such an unreasonable requirement.

My question is: how many textures can I bind at once on a modern graphics card? 16 would be sufficient. Can I expect most modern graphics cards to support that number of textures?

My GTX 460 appears to support 32, but I have no idea if that's representative of most modern video cards.

• Which rendering API are you using?
Jun 3 '12 at 11:41
• OpenGL of course :) Jun 3 '12 at 23:49

The number of textures that can be bound to OpenGL is not 32 or 16. It is not what you get with glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &texture_units);. That function retrieves the number of textures that can be accessed by the fragment shader.

See, each shader has its own limit of the number of textures it can use. However, there is also a total number of textures that can be used, period. This is defined (in OpenGL) by GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS.

So there are two limits: the textures-per-stage, and the textures-total-bound.

OpenGL 3.x defines the minimum number for the per-stage limit to be 16, so hardware cannot have fewer than 16 textures-per-stage. It can have a higher limit, but you know you get at least 16. 3.x defines the minimum number for the textures-total-bound as 48. AKA: 16 * 3 stages. Similarly, GL 4.x defines the numbers to be 16 textures-per-stage, and 96 textures-total-bound (ie: 16 * 6 stages, including compute shaders).

Again, these are the minimum numbers. Hardware can (and does) vary.

As for specific hardware, you can expect any DX10-class hardware to match these numbers. DX11 class hardware has some variance; NVIDIA (GeForce 4xx+) and higher-end AMD chips (aka: GCN-cores) may have more than the 16-per-stage.

• I wish this was the accepted answer. It would have saved me 5 minutes of pointless reading. Mar 24 '18 at 18:27

I believe 32 is the maximum number of textures that can be bound currently. As far as I can tell even the 8800 series had 32 texture units.

As far as I know, for openGL 4.x support you will need a Fermi or newer nvidia card(or corresponding amd card), the higher end models all seem to have 32 units, while the lowest end cards (GT 430, for example) have 16. However, looking at AMD spec sheets they list numbers like 80 or 128 texture units, but list 32 color ROP units which seem to have remained constant through generations.

The GTX 480 on the other hand is listed with 60 texture units and 48 ROP units, while lower end cards like the 430 reportedly only have 16 texture units and 4 ROP inits. So on the whole I'm not really convinced either of those is the number you are actually looking for.

You can check the number of texture units available for non-fixed function pipeline rendering with glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &texture_units);, though, so if you have access to some diverse hardware you could check yourself.

EDIT: this site lets you compare the reported openGL capabilities of all sorts of video cards, that should give you the numbers you need: http://feedback.wildfiregames.com/report/opengl/device/GeForce%20GTX%20580

PS: AMD and nvidia have recently introduced "bindless textures", (amd has a different name for it) which allows you to use large numbers of textures without binding them to textutre units, at the moment this is only available in openGL.

• Following that, the real answer is something like 'you have as much as the hw can offer'. Or, wording it differently, everything should run as fast as it can. (and in OpenGL that covers almost every field). Jun 3 '12 at 12:13
• @Darkwings I suppose so, binding more textures than the hardware can handle will usually lead to an error or the driver timing out though. I also misread, he said shader model 4+ not opengl 4+. Looking at the first DX10 cards (X2900 and 8800 families of cards) they all seem tu have at least 16 texture units.
– user13213
Jun 3 '12 at 12:29
• I was just underlining the fact that since it can be parameterized, it should be. Even if the game were to crawl on older cards, it shouldn't be something hard-coded but a 'suggested requirement'. Jun 3 '12 at 14:14
• -1: This answer is wrong. See my answer for why (it's too long to explain here). Jun 4 '12 at 16:49
• What may not be immediately obvious. Almost nobody uses the GL_TEXTUREn GLenums; instead use GL_TEXTURE0 + n, where n is the slot to bind. The GLenums only go up to 32 slots but that doesn't mean OpenGL restricts you to 32. The spec guarantees they will be sequential. Also, if you're not using DSA you may wish to reserve a slot for bind-to-create/modify, so that state used for create/modify has less interaction with state used for drawing. Aug 29 '16 at 18:32