GL1: removed many fruitless glTexParameteri calls

They were in this form:
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG/MIN_FILTER,GL_LINEAR)
Only appeared at startup, but we didn't need so many of them.
This commit is contained in:
Jaime Moreira 2024-07-14 19:31:00 -04:00
parent fd2ebb8891
commit 1bae1e359f
2 changed files with 12 additions and 15 deletions

View file

@ -147,21 +147,12 @@ R_SetTexturePalette(unsigned palette[256])
void
R_SelectTexture(GLenum texture)
{
int tmu;
if (!gl_config.multitexture)
if (!gl_config.multitexture || gl_state.currenttarget == texture)
{
return;
}
tmu = texture - GL_TEXTURE0;
if (tmu == gl_state.currenttmu)
{
return;
}
gl_state.currenttmu = tmu;
gl_state.currenttmu = texture - GL_TEXTURE0;
gl_state.currenttarget = texture;
qglActiveTexture(texture);
@ -180,7 +171,7 @@ R_TexEnv(GLenum mode)
}
}
void
qboolean
R_Bind(int texnum)
{
extern image_t *draw_chars;
@ -192,11 +183,12 @@ R_Bind(int texnum)
if (gl_state.currenttextures[gl_state.currenttmu] == texnum)
{
return;
return false;
}
gl_state.currenttextures[gl_state.currenttmu] = texnum;
glBindTexture(GL_TEXTURE_2D, texnum);
return true;
}
void
@ -308,7 +300,11 @@ R_TextureMode(char *string)
nolerp = true;
}
R_Bind(glt->texnum);
if ( !R_Bind(glt->texnum) )
{
continue; // don't bother changing anything if texture was already set
}
if ((glt->type != it_pic) && (glt->type != it_sky)) /* mipmapped texture */
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);

View file

@ -229,7 +229,7 @@ extern int c_visible_textures;
extern float r_world_matrix[16];
void R_TranslatePlayerSkin(int playernum);
void R_Bind(int texnum);
qboolean R_Bind(int texnum);
void R_TexEnv(GLenum value);
void R_SelectTexture(GLenum);
@ -296,6 +296,7 @@ void glCheckError_(const char *file, const char *function, int line);
// Either way, errors are caught, since error flags are persisted until the next glGetError() call.
// So they show, even if the location of the error is inaccurate.
#define glDrawArrays(...) glDrawArrays(__VA_ARGS__); glCheckError_(__FILE__, __func__, __LINE__)
#define glDrawElements(...) glDrawElements(__VA_ARGS__); glCheckError_(__FILE__, __func__, __LINE__)
#define glTexImage2D(...) glTexImage2D(__VA_ARGS__); glCheckError_(__FILE__, __func__, __LINE__)
#define glTexSubImage2D(...) glTexSubImage2D(__VA_ARGS__); glCheckError_(__FILE__, __func__, __LINE__)
#define glTexEnvf(...) glTexEnvf(__VA_ARGS__); glCheckError_(__FILE__, __func__, __LINE__)