Backports big texture support for voodoo4/5 to mesa-3.4.2 from mesa5/6.
NOT applied yet.

diff -urNp Mesa-3.4.2/src/FX/fxdd.c Mesa-3.4.2x/src/FX/fxdd.c
--- Mesa-3.4.2/src/FX/fxdd.c	2015-10-15 10:01:10.000000000 +0300
+++ Mesa-3.4.2x/src/FX/fxdd.c	2015-10-24 11:01:10.000000000 +0300
@@ -845,8 +845,20 @@ int fxDDInitFxMesaContext( fxMesaContext
 #endif
 
    fxMesa->textureAlign=FX_grGetInteger(FX_TEXTURE_ALIGN);
+#ifndef FX_GLIDE3
    fxMesa->glCtx->Const.MaxTextureLevels=9;
    fxMesa->glCtx->Const.MaxTextureSize=256;
+#else
+   {
+     int textureLevels = 0;
+     int textureSize = FX_grGetInteger(GR_MAX_TEXTURE_SIZE);
+     fxMesa->glCtx->Const.MaxTextureSize = textureSize;
+     do {
+       textureLevels++;
+     } while ((textureSize >>= 0x1) & 0x7ff);
+     fxMesa->glCtx->Const.MaxTextureLevels = textureLevels;
+   }
+#endif
    fxMesa->glCtx->Const.MaxTextureUnits=fxMesa->emulateTwoTMUs ? 2 : 1;
    fxMesa->glCtx->NewState|=NEW_DRVSTATE1;
    fxMesa->new_state = NEW_ALL;
diff -urNp Mesa-3.4.2/src/FX/fxddtex.c Mesa-3.4.2x/src/FX/fxddtex.c
--- Mesa-3.4.2/src/FX/fxddtex.c	2015-10-15 10:02:10.000000000 +0300
+++ Mesa-3.4.2x/src/FX/fxddtex.c	2015-10-24 11:01:10.000000000 +0300
@@ -672,7 +672,8 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
                  int *wscale, int *hscale)
 {
 
-  static GrLOD_t lod[9]={GR_LOD_256,GR_LOD_128,GR_LOD_64,GR_LOD_32,
+  static GrLOD_t lod[12]={GR_LOD_2048, GR_LOD_1024, GR_LOD_512,
+                         GR_LOD_256,GR_LOD_128,GR_LOD_64,GR_LOD_32,
                          GR_LOD_16,GR_LOD_8,GR_LOD_4,GR_LOD_2,GR_LOD_1};
 
   int logw,logh,ws,hs;
@@ -687,14 +688,14 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
   switch(logw-logh) {
   case 0:
     aspectratio=GR_ASPECT_1x1;
-    l=lod[8-logw];
+    l=lod[11-logw];
     s=t=256.0f;
     is=it=INT_TRICK(8);
     ws=hs=1;
     break;
   case 1:
     aspectratio=GR_ASPECT_2x1;
-    l=lod[8-logw];
+    l=lod[11-logw];
     s=256.0f;
     t=128.0f;
     is=INT_TRICK(8);it=INT_TRICK(7);
@@ -703,7 +704,7 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
     break;
   case 2:
     aspectratio=GR_ASPECT_4x1;
-    l=lod[8-logw];
+    l=lod[11-logw];
     s=256.0f;
     t=64.0f;
     is=INT_TRICK(8);it=INT_TRICK(6);
@@ -712,7 +713,7 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
     break;
   case 3:
     aspectratio=GR_ASPECT_8x1;
-    l=lod[8-logw];
+    l=lod[11-logw];
     s=256.0f;
     t=32.0f;
     is=INT_TRICK(8);it=INT_TRICK(5);
@@ -721,7 +722,7 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
     break;
   case 4:
     aspectratio=GR_ASPECT_8x1;
-    l=lod[8-logw];
+    l=lod[11-logw];
     s=256.0f;
     t=32.0f;
     is=INT_TRICK(8);it=INT_TRICK(5);
@@ -730,7 +731,7 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
     break;
   case 5:
     aspectratio=GR_ASPECT_8x1;
-    l=lod[8-logw];
+    l=lod[11-logw];
     s=256.0f;
     t=32.0f;
     is=INT_TRICK(8);it=INT_TRICK(5);
@@ -739,7 +740,7 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
     break;
   case 6:
     aspectratio=GR_ASPECT_8x1;
-    l=lod[8-logw];
+    l=lod[11-logw];
     s=256.0f;
     t=32.0f;
     is=INT_TRICK(8);it=INT_TRICK(5);
@@ -748,7 +749,7 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
     break;
   case 7:
     aspectratio=GR_ASPECT_8x1;
-    l=lod[8-logw];
+    l=lod[11-logw];
     s=256.0f;
     t=32.0f;
     is=INT_TRICK(8);it=INT_TRICK(5);
@@ -757,16 +758,43 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
     break;
   case 8:
     aspectratio=GR_ASPECT_8x1;
-    l=lod[8-logw];
+    l=lod[11-logw];
     s=256.0f;
     t=32.0f;
     is=INT_TRICK(8);it=INT_TRICK(5);
     ws=1;
     hs=32;
     break;
+  case 9:
+    aspectratio=GR_ASPECT_8x1;
+    l=lod[11-logw];
+    s=256.0f;
+    t=32.0f;
+    is=INT_TRICK(8);it=INT_TRICK(5);
+    ws=1;
+    hs=64;
+    break;
+  case 10:
+    aspectratio=GR_ASPECT_8x1;
+    l=lod[11-logw];
+    s=256.0f;
+    t=32.0f;
+    is=INT_TRICK(8);it=INT_TRICK(5);
+    ws=1;
+    hs=128;
+    break;
+  case 11:
+    aspectratio=GR_ASPECT_8x1;
+    l=lod[11-logw];
+    s=256.0f;
+    t=32.0f;
+    is=INT_TRICK(8);it=INT_TRICK(5);
+    ws=1;
+    hs=256;
+    break;
   case -1:
     aspectratio=GR_ASPECT_1x2;
-    l=lod[8-logh];
+    l=lod[11-logh];
     s=128.0f;
     t=256.0f;
     is=INT_TRICK(7);it=INT_TRICK(8);
@@ -775,7 +803,7 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
     break;
   case -2:
     aspectratio=GR_ASPECT_1x4;
-    l=lod[8-logh];
+    l=lod[11-logh];
     s=64.0f;
     t=256.0f;
     is=INT_TRICK(6);it=INT_TRICK(8);
@@ -784,7 +812,7 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
     break;
   case -3:
     aspectratio=GR_ASPECT_1x8;
-    l=lod[8-logh];
+    l=lod[11-logh];
     s=32.0f;
     t=256.0f;
     is=INT_TRICK(5);it=INT_TRICK(8);
@@ -793,7 +821,7 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
     break;
   case -4:
     aspectratio=GR_ASPECT_1x8;
-    l=lod[8-logh];
+    l=lod[11-logh];
     s=32.0f;
     t=256.0f;
     is=INT_TRICK(5);it=INT_TRICK(8);
@@ -802,7 +830,7 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
     break;
   case -5:
     aspectratio=GR_ASPECT_1x8;
-    l=lod[8-logh];
+    l=lod[11-logh];
     s=32.0f;
     t=256.0f;
     is=INT_TRICK(5);it=INT_TRICK(8);
@@ -811,7 +839,7 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
     break;
   case -6:
     aspectratio=GR_ASPECT_1x8;
-    l=lod[8-logh];
+    l=lod[11-logh];
     s=32.0f;
     t=256.0f;
     is=INT_TRICK(5);it=INT_TRICK(8);
@@ -820,7 +848,7 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
     break;
   case -7:
     aspectratio=GR_ASPECT_1x8;
-    l=lod[8-logh];
+    l=lod[11-logh];
     s=32.0f;
     t=256.0f;
     is=INT_TRICK(5);it=INT_TRICK(8);
@@ -829,13 +857,40 @@ int fxTexGetInfo(int w, int h, GrLOD_t *
     break;
   case -8:
     aspectratio=GR_ASPECT_1x8;
-    l=lod[8-logh];
+    l=lod[11-logh];
     s=32.0f;
     t=256.0f;
     is=INT_TRICK(5);it=INT_TRICK(8);
     ws=32;
     hs=1;
     break;
+  case -9:
+    aspectratio=GR_ASPECT_1x8;
+    l=lod[11-logh];
+    s=32.0f;
+    t=256.0f;
+    is=INT_TRICK(5);it=INT_TRICK(8);
+    ws=64;
+    hs=1;
+    break;
+  case -10:
+    aspectratio=GR_ASPECT_1x8;
+    l=lod[11-logh];
+    s=32.0f;
+    t=256.0f;
+    is=INT_TRICK(5);it=INT_TRICK(8);
+    ws=128;
+    hs=1;
+    break;
+  case -11:
+    aspectratio=GR_ASPECT_1x8;
+    l=lod[11-logh];
+    s=32.0f;
+    t=256.0f;
+    is=INT_TRICK(5);it=INT_TRICK(8);
+    ws=256;
+    hs=1;
+    break;
   default:
     return 0;
     break;
diff -urNp Mesa-3.4.2/src/FX/fxglidew.c Mesa-3.4.2x/src/FX/fxglidew.c
--- Mesa-3.4.2/src/FX/fxglidew.c	2015-10-05 05:50:00.000000000 +0300
+++ Mesa-3.4.2x/src/FX/fxglidew.c	2015-10-24 11:01:10.000000000 +0300
@@ -88,6 +88,7 @@ FxI32 FX_grGetInteger_NoLock(FxU32 pname
      case FX_LFB_PIXEL_PIPE:
      case FX_PENDING_BUFFERSWAPS:
      case FX_TEXTURE_ALIGN:
+     case GR_MAX_TEXTURE_SIZE:
        grname = pname;
        break;
      default:
diff -urNp Mesa-3.4.2/src/FX/fxglidew.h Mesa-3.4.2x/src/FX/fxglidew.h
--- Mesa-3.4.2/src/FX/fxglidew.h	2000-04-16 02:04:11.000000000 +0300
+++ Mesa-3.4.2x/src/FX/fxglidew.h	2015-10-24 11:01:10.000000000 +0300
@@ -84,6 +84,17 @@ extern FxI32 FX_grGetInteger_NoLock(FxU3
 /*
  * Glide2 emulation on Glide3:
  */
+
+#ifndef GR_LOD_LOG2_2048 /* g3ext.h */
+/* Napalm extensions to GrLOD_t */
+#define GR_LOD_LOG2_2048        0xb
+#define GR_LOD_LOG2_1024        0xa
+#define GR_LOD_LOG2_512         0x9
+#endif
+#define GR_LOD_2048	GR_LOD_LOG2_2048 /* [koolsmoky] big texture support for napalm */
+#define GR_LOD_1024	GR_LOD_LOG2_1024
+#define GR_LOD_512	GR_LOD_LOG2_512
+
 #if defined(FX_GLIDE3)
 
 #define GR_ASPECT_1x1 GR_ASPECT_LOG2_1x1
