From: <nou...@li...> - 2006-12-20 19:27:38
|
NouVeau CVS commit Author : ppaalanen Module : renouveau Dir : renouveau Modified Files: tests.c Log Message: In test_texture_format(), paletted textures: - fix element size: unsigned long is 64 bit on amd64, changed to uint32_t - Added test using GL_COLOR_INDEX2_EXT =================================================================== RCS file: /cvsroot/nouveau/renouveau/tests.c,v retrieving revision 1.148 retrieving revision 1.149 diff -u -3 -r1.148 -r1.149 --- tests.c 18 Dec 2006 18:07:10 -0000 1.148 +++ tests.c 20 Dec 2006 19:27:35 -0000 1.149 @@ -3076,7 +3076,9 @@ tx_formats[max_tx_formats++] = GL_RGBA8; /* All */ if (strstr(extensions, "GL_EXT_paletted_texture")) { - tx_formats[max_tx_formats++] = GL_COLOR_INDEX8_EXT; /* NV10-NV30 */ + tx_formats[max_tx_formats++] = GL_COLOR_INDEX2_EXT; + /*tx_formats[max_tx_formats++] = GL_COLOR_INDEX4_EXT;*/ + tx_formats[max_tx_formats++] = GL_COLOR_INDEX8_EXT; /* NV10-NV30 */ } else { printf(" GL_EXT_paletted_texture not present\n"); } @@ -3156,7 +3158,7 @@ regl.TexParameteri(tx_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); regl.TexParameteri(tx_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - unsigned long palette[4*256]; + uint32_t palette[4*256]; for (i=0; i<256;i++) { palette[i] = (i<<24)|(i<<16)|(i<<8)|i; } @@ -3165,10 +3167,12 @@ printf("TEXformat %d: %04x\n", i, tx_formats[i]); dump_before(); int format = GL_RGBA; - if (tx_formats[i] == GL_COLOR_INDEX8_EXT) { + if (tx_formats[i] >= GL_COLOR_INDEX1_EXT && + tx_formats[i] <= GL_COLOR_INDEX8_EXT) { format = GL_COLOR_INDEX; - regl.ColorTableEXT(tx_target, GL_RGBA, 256, GL_RGBA, - GL_UNSIGNED_BYTE, palette); + regl.ColorTableEXT(tx_target, GL_RGBA, + 1<<(1<<(tx_formats[i]-GL_COLOR_INDEX1_EXT)), + GL_RGBA, GL_UNSIGNED_BYTE, palette); } regl.TexImage2D(tx_target, 0, tx_formats[i], TEXTURE_WIDTH,TEXTURE_HEIGHT, 0, format, GL_UNSIGNED_BYTE, texture); |