softrend/gltex: Fix non-windows builds

_mm* are windows only, and so is softrend for now
This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis 2015-08-11 15:58:45 +02:00 committed by Stefanos Kornilios Mitsis Poiitidis
parent dfc341a5fe
commit 91039911ce
1 changed files with 32 additions and 26 deletions

View File

@ -308,28 +308,32 @@ struct TextureCacheData
glGenerateMipmap(GL_TEXTURE_2D);
}
else {
if (textype == GL_UNSIGNED_SHORT_5_6_5)
tex_type = 0;
else if (textype == GL_UNSIGNED_SHORT_5_5_5_1)
tex_type = 1;
else if (textype == GL_UNSIGNED_SHORT_4_4_4_4)
tex_type = 2;
if (pData) {
_mm_free(pData);
}
pData = (u16*)_mm_malloc(w * h * 16, 16);
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
u32* data = (u32*)&pData[(x + y*w) * 8];
data[0] = decoded_colors[tex_type][temp_tex_buffer[(x + 1) % w + (y + 1) % h * w]];
data[1] = decoded_colors[tex_type][temp_tex_buffer[(x + 0) % w + (y + 1) % h * w]];
data[2] = decoded_colors[tex_type][temp_tex_buffer[(x + 1) % w + (y + 0) % h * w]];
data[3] = decoded_colors[tex_type][temp_tex_buffer[(x + 0) % w + (y + 0) % h * w]];
#if HOST_OS == OS_WINDOWS
if (textype == GL_UNSIGNED_SHORT_5_6_5)
tex_type = 0;
else if (textype == GL_UNSIGNED_SHORT_5_5_5_1)
tex_type = 1;
else if (textype == GL_UNSIGNED_SHORT_4_4_4_4)
tex_type = 2;
if (pData) {
_mm_free(pData);
}
}
pData = (u16*)_mm_malloc(w * h * 16, 16);
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
u32* data = (u32*)&pData[(x + y*w) * 8];
data[0] = decoded_colors[tex_type][temp_tex_buffer[(x + 1) % w + (y + 1) % h * w]];
data[1] = decoded_colors[tex_type][temp_tex_buffer[(x + 0) % w + (y + 1) % h * w]];
data[2] = decoded_colors[tex_type][temp_tex_buffer[(x + 1) % w + (y + 0) % h * w]];
data[3] = decoded_colors[tex_type][temp_tex_buffer[(x + 0) % w + (y + 0) % h * w]];
}
}
#else
die("Softrend only works for windows");
#endif
}
}
@ -338,10 +342,12 @@ struct TextureCacheData
void Delete()
{
if (pData) {
_mm_free(pData);
pData = 0;
}
#if HOST_OS == OS_WINDOWS
if (pData) {
_mm_free(pData);
pData = 0;
}
#endif
if (texID) {
glDeleteTextures(1, &texID);
}
@ -561,4 +567,4 @@ void rend_text_invl(vram_block* bl)
tcd->lock_block=0;
libCore_vramlock_Unlock_block_wb(bl);
}
}