Remove unused code. Various clean ups
This commit is contained in:
parent
411d4f0e4f
commit
dc69a81da1
62
GL/texture.c
62
GL/texture.c
|
@ -89,40 +89,7 @@ static GLshort _glGenPaletteSlot(GLushort size) {
|
||||||
fprintf(stderr, "GL ERROR: No palette slots remain\n");
|
fprintf(stderr, "GL ERROR: No palette slots remain\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
static GLshort _glGenSharedPaletteSlot(GLushort size) {
|
|
||||||
GLushort i, j;
|
|
||||||
TextureObject* active = _glGetBoundTexture();
|
|
||||||
|
|
||||||
assert(size == 16 || size == 256);
|
|
||||||
|
|
||||||
if(size == 16) {
|
|
||||||
|
|
||||||
i = active->shared_bank / MAX_GLDC_4BPP_PALETTE_SLOTS;
|
|
||||||
BANKS_USED[i] = GL_TRUE;
|
|
||||||
j = i * MAX_GLDC_4BPP_PALETTE_SLOTS;
|
|
||||||
j = active->shared_bank - j;
|
|
||||||
SUBBANKS_USED[i][j] = GL_TRUE;
|
|
||||||
return (i * MAX_GLDC_4BPP_PALETTE_SLOTS) + j;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for(i = 0; i < MAX_GLDC_PALETTE_SLOTS; ++i) {
|
|
||||||
if(!BANKS_USED[i]) {
|
|
||||||
BANKS_USED[i] = GL_TRUE;
|
|
||||||
for(j = 0; j < MAX_GLDC_4BPP_PALETTE_SLOTS; ++j) {
|
|
||||||
SUBBANKS_USED[i][j] = GL_TRUE;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr, "GL ERROR: No palette slots remain\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ozzy: used for statistics */
|
|
||||||
GLushort _glFreePaletteSlots(GLushort size)
|
GLushort _glFreePaletteSlots(GLushort size)
|
||||||
{
|
{
|
||||||
GLushort i, j , slots = 0;
|
GLushort i, j , slots = 0;
|
||||||
|
@ -1055,10 +1022,9 @@ GL_FORCE_INLINE void _rgb888_to_rgba8888(const GLubyte* source, GLubyte* dest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_FORCE_INLINE void _rgb888_to_rgba4444(const GLubyte* source, GLubyte* dest) {
|
GL_FORCE_INLINE void _rgb888_to_rgba4444(const GLubyte* source, GLubyte* dest) {
|
||||||
/* Noop */
|
|
||||||
*((GLushort*) dest) = 0xF << 8 | (source[2] & 0xF0) << 4 | (source[1] & 0xF0) | (source[0] & 0xF0) >> 4;
|
*((GLushort*) dest) = 0xF << 8 | (source[2] & 0xF0) << 4 | (source[1] & 0xF0) | (source[0] & 0xF0) >> 4;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_FORCE_INLINE void _rgb888_to_rgb565(const GLubyte* source, GLubyte* dest) {
|
GL_FORCE_INLINE void _rgb888_to_rgb565(const GLubyte* source, GLubyte* dest) {
|
||||||
*((GLushort*) dest) = ((source[0] & 0b11111000) << 8) | ((source[1] & 0b11111100) << 3) | (source[2] >> 3);
|
*((GLushort*) dest) = ((source[0] & 0b11111000) << 8) | ((source[1] & 0b11111100) << 3) | (source[2] >> 3);
|
||||||
}
|
}
|
||||||
|
@ -1105,25 +1071,16 @@ GL_FORCE_INLINE void _rgba5551_to_rgba8888(const GLubyte* source, GLubyte* dest)
|
||||||
dst[3] = (src >> 15) << 7;
|
dst[3] = (src >> 15) << 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GL_FORCE_INLINE void _i8_to_i8(const GLubyte* source, GLubyte* dest) {
|
GL_FORCE_INLINE void _i8_to_i8(const GLubyte* source, GLubyte* dest) {
|
||||||
/* For indexes */
|
/* For indexes */
|
||||||
GLubyte* dst = (GLubyte*) dest;
|
GLubyte* dst = (GLubyte*) dest;
|
||||||
*dst = *source;
|
*dst = *source;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _alpha8_to_argb4444(const GLubyte* source, GLubyte* dest) {
|
static inline void _a8_to_argb4444(const GLubyte* source, GLubyte* dest) {
|
||||||
#if 0
|
|
||||||
/*A111*/
|
|
||||||
*((GLushort*) dest) = (*source & 0xF0) << 8 | (0xFF & 0xF0) << 4 | (0xFF & 0xF0) | (0xFF & 0xF0) >> 4;
|
|
||||||
#else
|
|
||||||
//Tested with multi-texturing sample , unit0: texture map unit1:alpha map
|
|
||||||
/* AAAA rather than A111*/
|
|
||||||
GLushort color = *source & 0xf0;
|
GLushort color = *source & 0xf0;
|
||||||
color |= color>>4;
|
color |= (color >> 4);
|
||||||
|
|
||||||
*((GLushort*) dest) = (color << 8) | color;
|
*((GLushort*) dest) = (color << 8) | color;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static TextureConversionFunc _determineConversion(GLint internalFormat, GLenum format, GLenum type) {
|
static TextureConversionFunc _determineConversion(GLint internalFormat, GLenum format, GLenum type) {
|
||||||
|
@ -1131,8 +1088,8 @@ static TextureConversionFunc _determineConversion(GLint internalFormat, GLenum f
|
||||||
case GL_ALPHA: {
|
case GL_ALPHA: {
|
||||||
if(format == GL_ALPHA) {
|
if(format == GL_ALPHA) {
|
||||||
/* Dreamcast doesn't really support GL_ALPHA internally, so store as argb with each rgb value as white */
|
/* Dreamcast doesn't really support GL_ALPHA internally, so store as argb with each rgb value as white */
|
||||||
/* Ozzy : applying alpha values to all channels seems a better option*/
|
/* Applying alpha values to all channels seems a better option*/
|
||||||
return _alpha8_to_argb4444;
|
return _a8_to_argb4444;
|
||||||
} else if(type == GL_UNSIGNED_BYTE && format == GL_RGBA) {
|
} else if(type == GL_UNSIGNED_BYTE && format == GL_RGBA) {
|
||||||
return _rgba8888_to_a000;
|
return _rgba8888_to_a000;
|
||||||
} else if(type == GL_BYTE && format == GL_RGBA) {
|
} else if(type == GL_BYTE && format == GL_RGBA) {
|
||||||
|
@ -1812,16 +1769,7 @@ GLAPI void APIENTRY glColorTableEXT(GLenum target, GLenum internalFormat, GLsize
|
||||||
palette->size = (width > 16) ? 256 : 16;
|
palette->size = (width > 16) ? 256 : 16;
|
||||||
assert(palette->size == 16 || palette->size == 256);
|
assert(palette->size == 16 || palette->size == 256);
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (sharedPaletteUsed == GL_FALSE){
|
|
||||||
palette->bank = _glGenPaletteSlot(palette->size);
|
palette->bank = _glGenPaletteSlot(palette->size);
|
||||||
}
|
|
||||||
else{
|
|
||||||
palette->bank = _glGenSharedPaletteSlot(palette->size);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
palette->bank = _glGenPaletteSlot(palette->size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(palette->bank < 0) {
|
if(palette->bank < 0) {
|
||||||
/* We ran out of slots! */
|
/* We ran out of slots! */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user