mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-29 20:20:43 +00:00
tiny speedup to texture uploads
This commit is contained in:
parent
858bb55bcc
commit
168d3aa308
1 changed files with 5 additions and 8 deletions
|
@ -504,7 +504,7 @@ void
|
||||||
GL_Upload8 (byte * data, int width, int height, qboolean mipmap, qboolean alpha)
|
GL_Upload8 (byte * data, int width, int height, qboolean mipmap, qboolean alpha)
|
||||||
{
|
{
|
||||||
int i, s, p;
|
int i, s, p;
|
||||||
unsigned int *trans = NULL;
|
unsigned int *trans;
|
||||||
|
|
||||||
s = width * height;
|
s = width * height;
|
||||||
trans = malloc (s * sizeof (unsigned int));
|
trans = malloc (s * sizeof (unsigned int));
|
||||||
|
@ -522,13 +522,10 @@ GL_Upload8 (byte * data, int width, int height, qboolean mipmap, qboolean alpha)
|
||||||
trans[i] = d_8to24table[p];
|
trans[i] = d_8to24table[p];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (s & 3)
|
unsigned int *out = trans;
|
||||||
Sys_Error ("GL_Upload8: width*height divisible by 3");
|
byte *in = data;
|
||||||
for (i = 0; i < s; i += 4) {
|
for (i = 0; i < s; i++) {
|
||||||
trans[i] = d_8to24table[data[i]];
|
*out++ = d_8to24table[*in++];
|
||||||
trans[i + 1] = d_8to24table[data[i + 1]];
|
|
||||||
trans[i + 2] = d_8to24table[data[i + 2]];
|
|
||||||
trans[i + 3] = d_8to24table[data[i + 3]];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue