gl raster fixes

This commit is contained in:
aap 2021-08-17 23:20:56 +02:00
parent dfe8d1f115
commit 8f1321f194
3 changed files with 17 additions and 1 deletions

View File

@ -500,7 +500,8 @@ readAsImage(Stream *stream, int32 width, int32 height, int32 depth, int32 format
line[0] = palette[*idx*4+0];
line[1] = palette[*idx*4+1];
line[2] = palette[*idx*4+2];
line[3] = palette[*idx*4+3];
if(img->bpp > 3)
line[3] = palette[*idx*4+3];
line += img->bpp;
idx++;
}

View File

@ -660,6 +660,18 @@ setRasterStage(uint32 stage, Raster *raster)
}
}
void
evictRaster(Raster *raster)
{
int i;
for(i = 0; i < MAXNUMSTAGES; i++){
//assert(rwStateCache.texstage[i].raster != raster);
if(rwStateCache.texstage[i].raster != raster)
continue;
setRasterStage(i, nil);
}
}
void
setTexture(int32 stage, Texture *tex)
{

View File

@ -818,12 +818,15 @@ createNativeRaster(void *object, int32 offset, int32)
return object;
}
void evictRaster(Raster *raster);
static void*
destroyNativeRaster(void *object, int32 offset, int32)
{
Raster *raster = (Raster*)object;
Gl3Raster *natras = PLUGINOFFSET(Gl3Raster, object, offset);
#ifdef RW_OPENGL
evictRaster(raster);
switch(raster->type){
case Raster::NORMAL:
case Raster::TEXTURE: