final finishing touches. DEPRECRATE Reserve*List funcs
This commit is contained in:
parent
edbff32340
commit
b301f51bd9
@ -164,15 +164,15 @@ void APIENTRY glKosSwapBuffers() {
|
||||
|
||||
void APIENTRY glKosReserveOPList(unsigned int elements){
|
||||
aligned_vector_reserve(&OP_LIST.vector, elements);
|
||||
aligned_vector_reserve(_glKosINTERNALGetVertices(), elements/3);
|
||||
aligned_vector_reserve((AlignedVector*)_glKosINTERNALGetVertices(), elements/3);
|
||||
}
|
||||
|
||||
void APIENTRY glKosReservePTList(unsigned int elements){
|
||||
aligned_vector_reserve(&PT_LIST.vector, elements);
|
||||
aligned_vector_reserve(_glKosINTERNALGetVertices(), elements/3);
|
||||
aligned_vector_reserve((AlignedVector*)_glKosINTERNALGetVertices(), elements/3);
|
||||
}
|
||||
|
||||
void APIENTRY glKosReserveTRList(unsigned int elements){
|
||||
aligned_vector_reserve(&TR_LIST.vector, elements);
|
||||
aligned_vector_reserve(_glKosINTERNALGetVertices(), elements/3);
|
||||
aligned_vector_reserve((AlignedVector*)_glKosINTERNALGetVertices(), elements/3);
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ static void _updatePVRBlend(pvr_poly_cxt_t* context) {
|
||||
}
|
||||
}
|
||||
|
||||
GLboolean _glCheckValidEnum(GLint param, GLenum* values, const char* func) {
|
||||
GLboolean _glCheckValidEnum(GLenum param, GLenum* values, const char* func) {
|
||||
GLubyte found = 0;
|
||||
while(*values != 0) {
|
||||
if(*values == (GLenum)param) {
|
||||
|
43
GL/texture.c
43
GL/texture.c
@ -225,6 +225,8 @@ GLubyte _glInitTextures() {
|
||||
SHARED_PALETTES[2] = _initTexturePalette();
|
||||
SHARED_PALETTES[3] = _initTexturePalette();
|
||||
|
||||
memset((void*)BANKS_USED,0x0,sizeof(BANKS_USED));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -773,13 +775,6 @@ GLboolean _glIsMipmapComplete(const TextureObject* obj) {
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
#define TWIDTAB(x) ( (x&1)|((x&2)<<1)|((x&4)<<2)|((x&8)<<3)|((x&16)<<4)| \
|
||||
((x&32)<<5)|((x&64)<<6)|((x&128)<<7)|((x&256)<<8)|((x&512)<<9) )
|
||||
|
||||
#define TWIDOUT(x, y) ( TWIDTAB((y)) | (TWIDTAB((x)) << 1) )
|
||||
#define MIN(a, b) ( (a)<(b)? (a):(b) )
|
||||
|
||||
|
||||
void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
|
||||
GLsizei width, GLsizei height, GLint border,
|
||||
GLenum format, GLenum type, const GLvoid *data) {
|
||||
@ -938,16 +933,40 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
|
||||
assert(bytes);
|
||||
|
||||
if(needsTwiddling) {
|
||||
assert(type == GL_UNSIGNED_BYTE); // Anything else needs this loop adjusting
|
||||
GLuint x, y, min, min2, mask;
|
||||
/*assert(type == GL_UNSIGNED_BYTE); // Anything else needs this loop adjusting
|
||||
GLuint x, y;
|
||||
for(y = 0; y < height; ++y) {
|
||||
for(x = 0; x < width; ++x) {
|
||||
GLuint src = (y * width) + x;
|
||||
GLuint dest = morton_index(x, y);
|
||||
|
||||
targetData[dest] = ((GLubyte*) data)[src];
|
||||
}
|
||||
}
|
||||
*/
|
||||
/* Don't convert color indexes */
|
||||
/* Linear/iterative twiddling algorithm from Marcus' tatest */
|
||||
#define TWIDTAB(x) ( (x&1)|((x&2)<<1)|((x&4)<<2)|((x&8)<<3)|((x&16)<<4)| \
|
||||
((x&32)<<5)|((x&64)<<6)|((x&128)<<7)|((x&256)<<8)|((x&512)<<9) )
|
||||
#define TWIDOUT(x, y) ( TWIDTAB((y)) | (TWIDTAB((x)) << 1) )
|
||||
|
||||
#define MIN(a, b) ( (a)<(b)? (a):(b) )
|
||||
|
||||
uint32 x, y, min, mask;
|
||||
|
||||
min = MIN(w, h);
|
||||
min2 = min * min;
|
||||
mask = min - 1;
|
||||
|
||||
uint8 * pixels;
|
||||
uint16 * vtex;
|
||||
pixels = (uint8 *) data;
|
||||
vtex = (uint16*)targetData;
|
||||
|
||||
for(y = 0; y < h; y++) {
|
||||
for(y = 0; y < h; y += 2) {
|
||||
for(x = 0; x < w; x++) {
|
||||
targetData[TWIDOUT(x & mask, y & mask) + (x / min + y / min) * min2] = ((GLubyte*) data)[y * w + x];
|
||||
vtex[TWIDOUT((y & mask) / 2, x & mask) +
|
||||
(x / min + y / min)*min * min / 2] =
|
||||
pixels[y * w + x] | (pixels[(y + 1) * w + x] << 8);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user