Fix textures on VC4

This commit is contained in:
Shinovon 2026-04-29 13:17:43 +05:00
parent 3eb71f2cc5
commit d5a130fc29
5 changed files with 78 additions and 31 deletions

View file

@ -16,6 +16,10 @@
#define PLUGIN_ID ID_DRIVER
#ifdef __SYMBIAN32__
extern bool moreVram;
#endif
namespace rw {
namespace gl3 {
@ -202,7 +206,6 @@ rasterCreateCameraTexture(Raster *raster)
break;
}
// i don't remember why this was once here...
if(gl3Caps.gles){
natras->internalFormat = natras->format;
}
@ -609,8 +612,11 @@ rasterUnlock(Raster *raster, int32 level)
natras->backingStore->levels[level].size);
}
}else{
// glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if (raster->pixels != nil && natras->format == GL_RGBA && natras->type == GL_UNSIGNED_BYTE) {
if (raster->pixels != nil && natras->format == GL_RGBA && natras->type == GL_UNSIGNED_BYTE
#ifdef __SYMBIAN32__
&& !moreVram
#endif
) {
// convert to 16-bit
uint16_t* pixels16 = (uint16_t*)malloc(raster->width * raster->height * sizeof(uint16_t));
uint8_t* pixels8 = (uint8_t*)raster->pixels;
@ -625,14 +631,16 @@ rasterUnlock(Raster *raster, int32 level)
}
glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, raster->width, raster->height, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, pixels16);
free(pixels16);
} else {
} else
{
// glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, level, natras->internalFormat,
raster->width, raster->height,
0, natras->format, natras->type, raster->pixels);
}
}
if(level == 0 && natras->autogenMipmap)
glGenerateMipmap(GL_TEXTURE_2D);
// if(level == 0 && natras->autogenMipmap)
// glGenerateMipmap(GL_TEXTURE_2D);
bindTexture(prev);
}
break;