From: Atani <at...@at...> - 2006-04-08 13:43:12
|
I see no problems in using this field for this purpose. This field from what I can tell is just used to store the texture after it has been converted to GL format (on all platforms). Do you have numbers show to the performance increase in using twiddled txrs vs normal ones? Mike On 4/7/2006, "Sam Steele" <sam...@gm...> wrote: >Attached is a patch to twiddle textures loaded from image files, >which gives a huge increase in GL performance on the Dreamcast. I'm >using m_txrdata to point to the PVR memory (it seems to point to the >GL-formatted data on the PC side, which isn't touched from the >outside anyway), any objections to using that variable, or should I >add another one for the PVR pointer? I'll check it in if there's no >objections. > >Thanks, >Sam > > >IIndex: texture.cpp >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >--- texture.cpp (revision 310) >+++ texture.cpp (working copy) >@@ -49,7 +49,11 @@ > m_w =3D m_h =3D 0; > m_fmt =3D None; > if (!initial && m_txrdata && m_txrdata !=3D oldptr) >+#if TIKI_PLAT !=3D TIKI_DC > delete[] m_txrdata; >+#else >+ //glDeleteTexture frees the PVR memory for us, how >nice of it! >+#endif > m_txrdata =3D NULL; > if (!initial && m_gltxr) > glDeleteTextures(1, &m_gltxr); >@@ -178,10 +182,6 @@ > memcpy(m_ptr, img->data, img->byteCount); > } >- /* We'll write the converted data into this buffer */ >- if (!m_txrdata) >- m_txrdata =3D new uint8[img->w * img->h * 4]; >- > m_w =3D img->w; > m_h =3D img->h; > m_fmt =3D (Fmt)(img->fmt); >@@ -204,6 +204,10 @@ > glBindTexture(GL_TEXTURE_2D, m_gltxr); >#if TIKI_PLAT !=3D TIKI_DC >+ /* We'll write the converted data into this buffer */ >+ if (!m_txrdata) >+ m_txrdata =3D new uint8[img->w * img->h * 4]; >+ > convertToGl(); > glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); > glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); >@@ -211,10 +215,13 @@ > GLenum err =3D glGetError(); >#else >+ m_txrdata =3D (uint8 *)pvr_mem_malloc(img->w * img->h * 2); >+ pvr_txr_load_ex(m_ptr, m_txrdata, img->w, img->h, >PVR_TXRLOAD_16BPP); >+ > if(use_alpha) { >- glTexImage2D(GL_TEXTURE_2D, 0, GL_ARGB4444, m_w, m_h, >0, GL_ARGB4444, GL_UNSIGNED_BYTE, m_ptr); >+ glKosTex2D(GL_ARGB4444_TWID, m_w, m_h, m_txrdata); > } else { >- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB565, m_w, m_h, >0, GL_RGB565, GL_UNSIGNED_BYTE, m_ptr); >+ glKosTex2D(GL_RGB565_TWID, m_w, m_h, m_txrdata); > } > glTexEnvi(GL_TEXTURE_2D,GL_TEXTURE_ENV_MODE,GL_MODULATEALPHA); >#endif |