mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 19:20:46 +00:00
- prevent crash on invalid textures.
This commit is contained in:
parent
7131fe6c6e
commit
50e6d364be
1 changed files with 17 additions and 12 deletions
|
@ -744,6 +744,7 @@ void FlipNonSquareBlock(T* dst, const T* src, int x, int y, int srcpitch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TArray<uint8_t> emptiness;
|
||||||
static void gloadtile_art_indexed(int32_t dapic, int32_t dameth, pthtyp* pth, int32_t doalloc)
|
static void gloadtile_art_indexed(int32_t dapic, int32_t dameth, pthtyp* pth, int32_t doalloc)
|
||||||
{
|
{
|
||||||
vec2_16_t const& tsizart = tilesiz[dapic];
|
vec2_16_t const& tsizart = tilesiz[dapic];
|
||||||
|
@ -753,7 +754,14 @@ static void gloadtile_art_indexed(int32_t dapic, int32_t dameth, pthtyp *pth, in
|
||||||
|
|
||||||
//POGOTODO: if !glinfo.texnpot, then we could allocate a texture of the pow2 size, and then populate the subportion using buffersubdata func
|
//POGOTODO: if !glinfo.texnpot, then we could allocate a texture of the pow2 size, and then populate the subportion using buffersubdata func
|
||||||
|
|
||||||
if (waloff[dapic])
|
uint8_t *p = (uint8_t*)waloff[dapic];
|
||||||
|
if (!waloff[dapic])
|
||||||
|
{
|
||||||
|
emptiness.Resize(siz.x*siz.y);
|
||||||
|
memset(emptiness.Data(), 255, siz.x * siz.y);
|
||||||
|
p = emptiness.Data();
|
||||||
|
|
||||||
|
}
|
||||||
{
|
{
|
||||||
if (doalloc)
|
if (doalloc)
|
||||||
{
|
{
|
||||||
|
@ -764,14 +772,11 @@ static void gloadtile_art_indexed(int32_t dapic, int32_t dameth, pthtyp *pth, in
|
||||||
polymost_setuptexture(pth->glpic, dameth, 0);
|
polymost_setuptexture(pth->glpic, dameth, 0);
|
||||||
}
|
}
|
||||||
TArray<uint8_t> flipped(siz.x*siz.y, true);
|
TArray<uint8_t> flipped(siz.x*siz.y, true);
|
||||||
FlipNonSquareBlock(flipped.Data(), (uint8_t*)waloff[dapic], siz.y, siz.x, siz.y);
|
FlipNonSquareBlock(flipped.Data(), p, siz.y, siz.x, siz.y);
|
||||||
|
|
||||||
pth->glpic->LoadTexture(flipped.Data());
|
pth->glpic->LoadTexture(flipped.Data());
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
pth->picnum = dapic;
|
pth->picnum = dapic;
|
||||||
pth->palnum = 0;
|
pth->palnum = 0;
|
||||||
|
|
Loading…
Reference in a new issue