From: Brian Paul Date: Fri, 4 Feb 2000 16:23:47 +0000 (+0000) Subject: added support for GL_RGB5_A1 internal texture format (Eero Pajarre) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=38a683816bb00347d6e34c4b3215e57df8c9c870;p=mesa.git added support for GL_RGB5_A1 internal texture format (Eero Pajarre) --- diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index 747d2555c79..0e1b1ea1da2 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -659,6 +659,10 @@ int fxTexGetInfo(int w, int h, GrLOD_t *lodlevel, GrAspectRatio_t *ar, return 1; } +/* + * Given an OpenGL internal texture format, return the corresponding + * Glide internal texture format and base texture format. + */ void fxTexGetFormat(GLenum glformat, GrTextureFormat_t *tfmt, GLint *ifmt) { switch(glformat) { @@ -724,7 +728,6 @@ void fxTexGetFormat(GLenum glformat, GrTextureFormat_t *tfmt, GLint *ifmt) case GL_RGBA: case GL_RGBA2: case GL_RGBA4: - case GL_RGB5_A1: case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: @@ -734,6 +737,12 @@ void fxTexGetFormat(GLenum glformat, GrTextureFormat_t *tfmt, GLint *ifmt) if(ifmt) (*ifmt)=GL_RGBA; break; + case GL_RGB5_A1: + if(tfmt) + (*tfmt)=GR_TEXFMT_ARGB_1555; + if(ifmt) + (*ifmt)=GL_RGBA; + break; case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: case GL_COLOR_INDEX2_EXT: @@ -961,7 +970,7 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image, if(wscale==hscale==1) { int i=0; int lenght=h*w; - unsigned short r,g,b; + unsigned int r,g,b; while(i++> 3); } } else { - unsigned short r,g,b; + unsigned int r,g,b; for(y=0;y> 4); } } else { - unsigned short r,g,b,a; + unsigned int r,g,b,a; for(y=0;y> 3); + } + } else { + unsigned r,g,b,a; + + for(y=0;y> 3); + } + } + break; default: fprintf(stderr,"fx Driver: wrong internalFormat in texbuildimagemap()\n"); fxCloseHardware(); @@ -1231,7 +1284,6 @@ static void fxTexBuildSubImageMap(const struct gl_texture_image *image, case GL_RGBA: case GL_RGBA2: case GL_RGBA4: - case GL_RGB5_A1: case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: @@ -1264,6 +1316,36 @@ static void fxTexBuildSubImageMap(const struct gl_texture_image *image, } } break; + case GL_RGB5_A1: + { + int x,y; + unsigned char *src; + unsigned short *dst,r,g,b,a; + int simgw,dimgw; + + src=(unsigned char *)(image->Data+(yoffset*image->Width+xoffset)*4); + dst=destimg+(yoffset*image->Width+xoffset); + + simgw=(image->Width-width)*4; + dimgw=image->Width-width; + for(y=0;y> 3); + } + + src += simgw; + dst += dimgw; + } + } + break; default: fprintf(stderr,"fx Driver: wrong internalFormat in fxTexBuildSubImageMap()\n"); fxCloseHardware();