diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 461c3ec8c..c1176d615 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -1423,6 +1423,7 @@ static void gloadtile_art_indexed(int32_t dapic, int32_t dameth, pthtyp *pth, in pth->effects = 0; pth->flags = TO_PTH_CLAMPED(dameth) | TO_PTH_NOTRANSFIX(dameth) | (PTH_HASALPHA|PTH_ONEBITALPHA) | (npoty*PTH_NPOTWALL) | PTH_INDEXED; pth->hicr = NULL; + pth->siz = siz; } void gloadtile_art(int32_t dapic, int32_t dapal, int32_t tintpalnum, int32_t dashade, int32_t dameth, pthtyp *pth, int32_t doalloc) @@ -1595,6 +1596,28 @@ void gloadtile_art(int32_t dapic, int32_t dapal, int32_t tintpalnum, int32_t das npoty = 1; } + if (!doalloc) + { + vec2_t pthSiz2 = pth->siz; + if (!glinfo.texnpot) + { + for (pthSiz2.x = 1; pthSiz2.x < pth->siz.x; pthSiz2.x += pthSiz2.x) { } + for (pthSiz2.y = 1; pthSiz2.y < pth->siz.y; pthSiz2.y += pthSiz2.y) { } + } + else + { + if ((pthSiz2.x|pthSiz2.y) == 0) + pthSiz2.x = pthSiz2.y = 1; + else + pthSiz2 = pth->siz; + } + if (siz.x > pthSiz2.x || + siz.y > pthSiz2.y) + { + //POGO: grow our texture to hold the tile data + doalloc = true; + } + } uploadtexture(pth->glpic, doalloc, siz, GL_BGRA, pic, tsiz, dameth | DAMETH_ARTIMMUNITY | (dapic >= MAXUSERTILES ? (DAMETH_NOTEXCOMPRESS|DAMETH_NODOWNSIZE) : 0) | /* never process these short-lived tiles */ @@ -1613,6 +1636,7 @@ void gloadtile_art(int32_t dapic, int32_t dapal, int32_t tintpalnum, int32_t das pth->effects = 0; pth->flags = TO_PTH_CLAMPED(dameth) | TO_PTH_NOTRANSFIX(dameth) | (hasalpha*(PTH_HASALPHA|PTH_ONEBITALPHA)) | (npoty*PTH_NPOTWALL); pth->hicr = NULL; + pth->siz = tsiz; if (hasfullbright && !fullbrightloadingpass) { @@ -1698,8 +1722,6 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp isart = 1; } - pth->siz = tsiz; - if (!glinfo.texnpot) { for (siz.x=1; siz.xsiz; + if (!glinfo.texnpot) + { + for (pthSiz2.x=1; pthSiz2.x < pth->siz.x; pthSiz2.x+=pthSiz2.x) { } + for (pthSiz2.y=1; pthSiz2.y < pth->siz.y; pthSiz2.y+=pthSiz2.y) { } + } + else + pthSiz2 = tsiz; + if (siz.x > pthSiz2.x || + siz.y > pthSiz2.y) + { + //POGO: grow our texture to hold the tile data + doalloc = true; + } + } uploadtexture(pth->glpic, doalloc,siz,texfmt,pic,tsiz, dameth | DAMETH_HI | DAMETH_NOFIX | TO_DAMETH_NODOWNSIZE(hicr->flags) | @@ -1901,6 +1940,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp ((hicr->flags & HICR_FORCEFILTER) ? PTH_FORCEFILTER : 0); pth->skyface = facen; pth->hicr = hicr; + pth->siz = tsiz; if (willprint)