polymost.cpp: Fix issue where tiles whose dimensions had grown would not have their sizes updated in GL and could fail to update their texture data

git-svn-id: https://svn.eduke32.com/eduke32@7888 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/build/src/polymost.cpp
This commit is contained in:
pogokeen 2019-08-05 02:14:19 +00:00 committed by Christoph Oelckers
parent e1f4800e3a
commit a844fd4b13

View file

@ -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.x<tsiz.x; siz.x+=siz.x) { }
@ -1870,6 +1892,23 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
int32_t const texfmt = glinfo.bgra ? GL_BGRA : GL_RGBA;
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
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)