+void R_Mesh_ClearBindingsForTexture(int texnum)
+{
+ gltextureunit_t *unit;
+ unsigned int unitnum;
+ // this doesn't really unbind the texture, but it does prevent a mistaken "do nothing" behavior on the next time this same texnum is bound on the same unit as the same type (this mainly affects r_shadow_bouncegrid because 3D textures are so rarely used)
+ for (unitnum = 0;unitnum < vid.teximageunits;unitnum++)
+ {
+ unit = gl_state.units + unitnum;
+ if (unit->t2d == texnum)
+ unit->t2d = -1;
+ if (unit->t3d == texnum)
+ unit->t3d = -1;
+ if (unit->tcubemap == texnum)
+ unit->tcubemap = -1;
+ }
+}
+