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,6 +500,7 @@ readAsImage(Stream *stream, int32 width, int32 height, int32 depth, int32 format
line[0] = palette[*idx*4+0]; line[0] = palette[*idx*4+0];
line[1] = palette[*idx*4+1]; line[1] = palette[*idx*4+1];
line[2] = palette[*idx*4+2]; line[2] = palette[*idx*4+2];
if(img->bpp > 3)
line[3] = palette[*idx*4+3]; line[3] = palette[*idx*4+3];
line += img->bpp; line += img->bpp;
idx++; 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 void
setTexture(int32 stage, Texture *tex) setTexture(int32 stage, Texture *tex)
{ {

View File

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