support for VQ compressed paletted textures
This commit is contained in:
parent
cb35c80ee7
commit
60ec054b59
|
@ -608,10 +608,17 @@ template void texture_VQ<convBMP_TW<pp_565>, u16>(PixelBuffer<u16>* pb,u8* p_in,
|
|||
#define tex4444_VQ texture_VQ<conv4444_TW<pp_565>, u16>
|
||||
#define texYUV422_VQ texture_VQ<convYUV_TW<pp_8888>, u32>
|
||||
#define texBMP_VQ texture_VQ<convBMP_TW<pp_565>, u16>
|
||||
// According to the documentation, a texture cannot be compressed and use
|
||||
// a palette at the same time. However the hardware displays them
|
||||
// just fine.
|
||||
#define texPAL4_VQ texture_VQ<convPAL4_TW<pp_565, u16>, u16>
|
||||
#define texPAL8_VQ texture_VQ<convPAL8_TW<pp_565, u16>, u16>
|
||||
|
||||
#define tex565_VQ32 texture_VQ<conv565_TW32<pp_8888>, u32>
|
||||
#define tex1555_VQ32 texture_VQ<conv1555_TW32<pp_8888>, u32>
|
||||
#define tex4444_VQ32 texture_VQ<conv4444_TW32<pp_8888>, u32>
|
||||
#define texPAL4_VQ32 texture_VQ<convPAL4_TW<pp_8888, u32>, u32>
|
||||
#define texPAL8_VQ32 texture_VQ<convPAL8_TW<pp_8888, u32>, u32>
|
||||
|
||||
void DePosterize(u32* source, u32* dest, int width, int height);
|
||||
void UpscalexBRZ(int factor, u32* source, u32* dest, int width, int height, bool has_alpha);
|
||||
|
|
|
@ -269,11 +269,10 @@ struct TextureCacheData
|
|||
|
||||
u32 Updates;
|
||||
|
||||
u32 palette_index;
|
||||
//used for palette updates
|
||||
u32 palette_hash; // Palette hash at time of last update
|
||||
u32 indirect_color_ptr; //palette color table index for pal. tex
|
||||
//VQ quantizers table for VQ tex
|
||||
//a texture can't be both VQ and PAL at the same time
|
||||
u32 vq_codebook; // VQ quantizers table for compressed textures
|
||||
u32 texture_hash; // xxhash of texture data, used for custom textures
|
||||
u32 old_texture_hash; // legacy hash
|
||||
u8* volatile custom_image_data; // loaded custom image data
|
||||
|
|
|
@ -53,8 +53,8 @@ PvrTexInfo format[8]=
|
|||
{"4444", 16, GL_UNSIGNED_SHORT_4_4_4_4, tex4444_PL, tex4444_TW, tex4444_VQ, tex4444_PL32, tex4444_TW32, tex4444_VQ32 }, //4444
|
||||
{"yuv", 16, GL_UNSIGNED_BYTE, NULL, NULL, NULL, texYUV422_PL, texYUV422_TW, texYUV422_VQ }, //yuv
|
||||
{"bumpmap", 16, GL_UNSIGNED_SHORT_4_4_4_4, texBMP_PL, texBMP_TW, texBMP_VQ, NULL}, //bump map
|
||||
{"pal4", 4, 0, 0, texPAL4_TW, 0, NULL, texPAL4_TW32, NULL }, //pal4
|
||||
{"pal8", 8, 0, 0, texPAL8_TW, 0, NULL, texPAL8_TW32, NULL }, //pal8
|
||||
{"pal4", 4, 0, 0, texPAL4_TW, texPAL4_VQ, NULL, texPAL4_TW32, texPAL4_VQ32 }, //pal4
|
||||
{"pal8", 8, 0, 0, texPAL8_TW, texPAL8_VQ, NULL, texPAL8_TW32, texPAL8_VQ32 }, //pal8
|
||||
{"ns/1555", 0}, // Not supported (1555)
|
||||
};
|
||||
|
||||
|
@ -168,14 +168,14 @@ void TextureCacheData::Create(bool isGL)
|
|||
h=8<<tsp.TexV; //tex height
|
||||
|
||||
//PAL texture
|
||||
if (tex->bpp==4)
|
||||
indirect_color_ptr=tcw.PalSelect<<4;
|
||||
else if (tex->bpp==8)
|
||||
indirect_color_ptr=(tcw.PalSelect>>4)<<8;
|
||||
if (tex->bpp == 4)
|
||||
palette_index = tcw.PalSelect << 4;
|
||||
else if (tex->bpp == 8)
|
||||
palette_index = (tcw.PalSelect >> 4) << 8;
|
||||
|
||||
//VQ table (if VQ tex)
|
||||
if (tcw.VQ_Comp)
|
||||
indirect_color_ptr=sa;
|
||||
vq_codebook = sa;
|
||||
|
||||
//Convert a pvr texture into OpenGL
|
||||
switch (tcw.PixelFmt)
|
||||
|
@ -214,7 +214,7 @@ void TextureCacheData::Create(bool isGL)
|
|||
if (tcw.VQ_Comp)
|
||||
{
|
||||
verify(tex->VQ != NULL || tex->VQ32 != NULL);
|
||||
indirect_color_ptr=sa;
|
||||
vq_codebook = sa;
|
||||
if (tcw.MipMapped)
|
||||
sa+=MipPoint[tsp.TexU];
|
||||
texconv = tex->VQ;
|
||||
|
@ -271,8 +271,8 @@ void TextureCacheData::Update()
|
|||
palette_hash = pal_hash_256[tcw.PalSelect >> 4];
|
||||
}
|
||||
|
||||
palette_index=indirect_color_ptr; //might be used if pal. tex
|
||||
vq_codebook=(u8*)&vram[indirect_color_ptr]; //might be used if VQ tex
|
||||
::palette_index = this->palette_index; // might be used if pal. tex
|
||||
::vq_codebook = &vram[vq_codebook]; // might be used if VQ tex
|
||||
|
||||
//texture conversion work
|
||||
u32 stride=w;
|
||||
|
|
Loading…
Reference in New Issue