Per's patch to use texture compression, modified to always specify generic compression (and let the driver decide which compression to use) and to
only compress the texure pages, and not backdrops and other textures. This this should give a framerate increase of 5-10 fps on fillrate limited systems (cpu usage < 100%). git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1289 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
d659136496
commit
2fe34ce6cc
|
@ -449,7 +449,7 @@ void pie_DownLoadRadar( unsigned char *buffer )
|
|||
}
|
||||
}
|
||||
pie_SetTexturePage(radarTexture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 128, 128, 0,
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, wz_texture_compression, 128, 128, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, radarBitmap);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
|
|
@ -58,7 +58,7 @@ extern BOOL drawing_interface;
|
|||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
static BOOL check_extension(const char* extension_name)
|
||||
BOOL check_extension(const char* extension_name)
|
||||
{
|
||||
const char *extension_list = (const char *)glGetString(GL_EXTENSIONS);
|
||||
unsigned int extension_name_length = strlen(extension_name);
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
*/
|
||||
/***************************************************************************/
|
||||
#define DIVIDE_TABLE_SIZE 1024
|
||||
|
||||
/***************************************************************************/
|
||||
/*
|
||||
* Local Variables
|
||||
|
@ -91,6 +92,16 @@ BOOL pie_Initialise(void)
|
|||
_iVPRIM_DIVTABLE[i-0] = MAKEINT ( FRACTdiv(MAKEFRACT(1),MAKEFRACT(i)) * iV_DIVMULTP);
|
||||
}
|
||||
|
||||
/* Find texture compression extension */
|
||||
if (check_extension("GL_ARB_texture_compression"))
|
||||
{
|
||||
debug(LOG_TEXTURE, "Texture compression: Yes");
|
||||
wz_texture_compression = GL_COMPRESSED_RGBA_ARB;
|
||||
} else {
|
||||
debug(LOG_TEXTURE, "Texture compression: No");
|
||||
wz_texture_compression = GL_RGBA;
|
||||
}
|
||||
|
||||
pie_MatInit();
|
||||
_TEX_INDEX = 0;
|
||||
|
||||
|
|
|
@ -64,6 +64,9 @@ UDWORD screenDepth = 0;
|
|||
|
||||
SDL_Surface *screen;
|
||||
|
||||
/* global used to indicate preferred internal OpenGL format */
|
||||
int wz_texture_compression;
|
||||
|
||||
//backDrop
|
||||
UWORD* pBackDropData = NULL;
|
||||
BOOL bBackDrop = FALSE;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/*
|
||||
* Screen.h
|
||||
*
|
||||
* Interface to the Direct Draw double buffered display.
|
||||
* Interface to the OpenGL double buffered display.
|
||||
*
|
||||
*/
|
||||
#ifndef _screen_h
|
||||
|
@ -82,4 +82,9 @@ char* screenDumpToDisk(char* path);
|
|||
/* Toggle the display between full screen or windowed */
|
||||
extern void screenToggleMode(void);
|
||||
|
||||
extern int wz_texture_compression;
|
||||
|
||||
/* defined in piedraw.c */
|
||||
BOOL check_extension(const char* extension_name);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include "lib/ivis_common/piepalette.h"
|
||||
#include "lib/ivis_common/ivispatch.h"
|
||||
|
||||
#include "screen.h"
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
iTexPage _TEX_PAGE[iV_TEX_MAX];
|
||||
|
@ -100,7 +102,7 @@ int pie_AddBMPtoTexPages(iTexture* s, const char* filename, int type, BOOL bReso
|
|||
|
||||
if ((s->width & (s->width-1)) == 0 && (s->height & (s->height-1)) == 0)
|
||||
{
|
||||
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, s->width, s->height,
|
||||
gluBuild2DMipmaps(GL_TEXTURE_2D, wz_texture_compression, s->width, s->height,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, s->bmp);
|
||||
} else {
|
||||
debug(LOG_ERROR, "pie_AddBMPtoTexPages: non POT texture %s.", filename);
|
||||
|
@ -135,7 +137,7 @@ void pie_ChangeTexPage(int tex_index, iTexture* s, int type, BOOL bResource)
|
|||
|
||||
if ((s->width & (s->width-1)) == 0 && (s->height & (s->height-1)) == 0)
|
||||
{
|
||||
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, s->width, s->height,
|
||||
gluBuild2DMipmaps(GL_TEXTURE_2D, wz_texture_compression, s->width, s->height,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, s->bmp);
|
||||
} else {
|
||||
debug(LOG_ERROR, "pie_ChangeTexPage: non POT texture %i", tex_index);
|
||||
|
|
Loading…
Reference in New Issue