Thread: [Plib-devel] texture compression
Brought to you by:
sjbaker
From: <tia...@sa...> - 2006-01-10 16:51:34
|
Hello I was wondering if i or someone else can add texture compression support to plib, which i believe can be done without disrupting the current plib behaviour and with few files being affected. Below is my original post to the FlightGear devel list, with a quick hack patch. Currently we're still discussing this, so no further details, but if we go ahead with it, is it alright regarding plib? Thanks Cheers, Tiago *********************************************************************** *********************************************************************** Hello I'm having a HW problem and i can't enable AGP in linux, which makes the hunter, b1900d and the Nimitz lower FPSs dramatically, which i believe is caused by the NVRAM filling up with textures thus forcing texture transfers to the card (GF4 MX 440 64MB) so after Surge mentioned texture compression, i added it in plib, with amazing performance improvements in those situations, It also appears to be improving FPS in general in other situations. it doesn't check for the extension, **before trying**, check glxinfo for the presence of "EXT_texture_compression_s3tc" it's just an ugly hack, works for me and likely everyone else with s3tc, but it's bad code, i know, a brief explanation: http://www.digit-life.com/articles/reviews3tcfxt1/ spec: http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_compression_s3tc.txt i have no experience with patches, but here it is, against plib 1.8.4,for those interested. added one line, made one token change: diff -cr plib-1.8.4/src/ssg/ssgLoadTexture.cxx plib-1.8.4ext/src/ssg/ssgLoadTexture.cxx *** plib-1.8.4/src/ssg/ssgLoadTexture.cxx 2003-06-27 08:15:15.000000000 +0000 --- plib-1.8.4ext/src/ssg/ssgLoadTexture.cxx 2006-01-07 16:44:17.000000000 +0000 *************** *** 24,29 **** --- 24,30 ---- #include "ssgLocal.h" + #define PROXY_TEXTURES_ARE_BROKEN struct _ssgTextureFormat { *************** *** 161,167 **** total_texels_loaded += w * h ; glTexImage2D ( GL_TEXTURE_2D, ! map_level, zsize, w, h, FALSE /* Border */, (zsize==1)?GL_LUMINANCE: (zsize==2)?GL_LUMINANCE_ALPHA: (zsize==3)?GL_RGB: --- 162,168 ---- total_texels_loaded += w * h ; glTexImage2D ( GL_TEXTURE_2D, ! map_level, /*zsize*/ 0x83F3, w, h, FALSE /* Border */, (zsize==1)?GL_LUMINANCE: (zsize==2)?GL_LUMINANCE_ALPHA: (zsize==3)?GL_RGB: |
From: Paolo L. <p.l...@ci...> - 2006-01-11 09:05:40
|
Sorry, just a question: what about actually loading the DDS texture = image data? I.e. putting a new zsize mode parameter in the glTexImage2D call suppose = we are supplying proper pixed data, and, beside the large pixel data block, = we should also read w, h, and the GL_COMPRESSED_RGBx_S3TC_DXTx_EXT mode off = the file. Is there code for this too? Greetings - Paolo Leoncini > -----Messaggio originale----- > Da: pli...@li...=20 > [mailto:pli...@li...] Per conto di=20 > Tiago Gusm=E3o > Inviato: marted=EC 10 gennaio 2006 17.51 > A: pli...@li... > Oggetto: [Plib-devel] texture compression >=20 >=20 > Hello >=20 > I was wondering if i or someone else can add texture=20 > compression support=20 > to plib, which i believe can be done without disrupting the=20 > current plib=20 > behaviour and with few files being affected. >=20 > Below is my original post to the FlightGear devel list, with a quick=20 > hack patch. >=20 > Currently we're still discussing this, so no further details,=20 > but if we=20 > go ahead with it, is it alright regarding plib? >=20 >=20 > Thanks >=20 > Cheers, > Tiago >=20 >=20 > ************************************************************** > ********* > ************************************************************** > ********* > Hello >=20 > I'm having a HW problem and i can't enable AGP in linux,=20 > which makes the hunter, b1900d and the Nimitz lower FPSs=20 > dramatically, which i believe is caused by the NVRAM filling=20 > up with textures thus forcing texture transfers to the card=20 > (GF4 MX 440 64MB) >=20 > so after Surge mentioned texture compression, i added it in=20 > plib, with amazing performance improvements in those=20 > situations, It also appears to be improving FPS in general in=20 > other situations. >=20 > it doesn't check for the extension, **before trying**, check=20 > glxinfo for the presence of "EXT_texture_compression_s3tc"=20 > it's just an ugly hack, works for me and likely everyone else=20 > with s3tc,=20 > but it's bad code, i know, >=20 > a brief explanation:=20 > http://www.digit-life.com/articles/reviews3tcfxt1/ > spec:=20 > http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_co > mpression_s3tc.txt >=20 >=20 > i have no experience with patches, but here it is, against=20 > plib 1.8.4,for those interested. added one line, made one=20 > token change: >=20 > diff -cr plib-1.8.4/src/ssg/ssgLoadTexture.cxx > plib-1.8.4ext/src/ssg/ssgLoadTexture.cxx > *** plib-1.8.4/src/ssg/ssgLoadTexture.cxx 2003-06-27=20 > 08:15:15.000000000 > +0000 > --- plib-1.8.4ext/src/ssg/ssgLoadTexture.cxx 2006-01-07 > 16:44:17.000000000 +0000 > *************** > *** 24,29 **** > --- 24,30 ---- >=20 > #include "ssgLocal.h" >=20 > + #define PROXY_TEXTURES_ARE_BROKEN >=20 > struct _ssgTextureFormat > { > *************** > *** 161,167 **** > total_texels_loaded +=3D w * h ; >=20 > glTexImage2D ( GL_TEXTURE_2D, > ! map_level, zsize, w, h, FALSE /* Border */, > (zsize=3D=3D1)?GL_LUMINANCE: > (zsize=3D=3D2)?GL_LUMINANCE_ALPHA: > (zsize=3D=3D3)?GL_RGB: > --- 162,168 ---- > total_texels_loaded +=3D w * h ; >=20 > glTexImage2D ( GL_TEXTURE_2D, > ! map_level, /*zsize*/ 0x83F3, w, h, FALSE /* > Border */, > (zsize=3D=3D1)?GL_LUMINANCE: > (zsize=3D=3D2)?GL_LUMINANCE_ALPHA: > (zsize=3D=3D3)?GL_RGB: >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep=20 > through log files for problems? Stop! Download the new AJAX=20 > search engine that makes searching your log files as easy as=20 > surfing the web. DOWNLOAD SPLUNK!=20 > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > _______________________________________________ > plib-devel mailing list > pli...@li...=20 > https://lists.sourceforge.net/lists/listinfo/plib-devel >=20 |
From: <tia...@sa...> - 2006-01-11 14:03:09
|
Hello If i understand correctly, .DDS are pre-compressed image files. I think coding what you are suggesting would be easy, but it would require that we decompress the textures ourselves in case the user doesn't have the extension (and the final result would have the same compression artifacts). In FG's case, i think the best option is make it so we can override the default Z from FG/SimGear, thus making extension checking our problem and allowing the user to choose if he prefers no compression (and so no compression artifacts). Cheers Paolo Leoncini wrote: > Sorry, just a question: what about actually loading the DDS texture image > data? > > I.e. putting a new zsize mode parameter in the glTexImage2D call suppose we > are supplying proper pixed data, and, beside the large pixel data block, we > should also read w, h, and the GL_COMPRESSED_RGBx_S3TC_DXTx_EXT mode off the > file. Is there code for this too? > > Greetings - > > Paolo Leoncini |