Con_Printf("glDrawRangeElements detected (max vertices %i, max indices %i)\n", gl_maxdrawrangeelementsvertices, gl_maxdrawrangeelementsindices);
}
- backendunits = min(MAX_TEXTUREUNITS, gl_textureunits);
+ backendunits = bound(1, gl_textureunits, MAX_TEXTUREUNITS);
backendimageunits = backendunits;
backendarrayunits = backendunits;
if (gl_support_fragment_shader)
qglGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, (int *)&backendarrayunits);
CHECKGLERROR
Con_Printf("GLSL shader support detected: texture units = %i texenv, %i image, %i array\n", backendunits, backendimageunits, backendarrayunits);
+ backendimageunits = bound(1, backendimageunits, MAX_TEXTUREUNITS);
+ backendarrayunits = bound(1, backendarrayunits, MAX_TEXTUREUNITS);
}
else if (backendunits > 1)
Con_Printf("multitexture detected: texture units = %i\n", backendunits);
#ifndef GL_BACKEND_H
#define GL_BACKEND_H
-#define MAX_TEXTUREUNITS 16
+// how many texture units to track state on (backendunits/backendimageunits/backendarrayunits are limited to this value)
+#define MAX_TEXTUREUNITS 64
#define POLYGONELEMENTS_MAXPOINTS 258
extern int polygonelements[(POLYGONELEMENTS_MAXPOINTS-2)*3];