skip switching texture modes when they're the same as the last used
This commit is contained in:
parent
1dc0dea762
commit
aa3cab87d2
@ -147,6 +147,7 @@ typedef struct {
|
|||||||
} DeferredCommand;
|
} DeferredCommand;
|
||||||
|
|
||||||
|
|
||||||
|
static TextureMode texture_mode_last_used = -1;
|
||||||
static Pipeline pipeline_last_used = PIPELINE_NO;
|
static Pipeline pipeline_last_used = PIPELINE_NO;
|
||||||
|
|
||||||
|
|
||||||
@ -401,6 +402,7 @@ static void finally_use_space_pipeline(void) {
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadMatrixf(&camera_look_at_matrix.row[0].x);
|
glLoadMatrixf(&camera_look_at_matrix.row[0].x);
|
||||||
|
|
||||||
|
texture_mode_last_used = -1;
|
||||||
pipeline_last_used = PIPELINE_SPACE;
|
pipeline_last_used = PIPELINE_SPACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,6 +454,7 @@ static void finally_use_2d_pipeline(void) {
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
|
texture_mode_last_used = -1;
|
||||||
pipeline_last_used = PIPELINE_2D;
|
pipeline_last_used = PIPELINE_2D;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,6 +504,9 @@ void use_texture_mode(TextureMode mode) {
|
|||||||
|
|
||||||
|
|
||||||
static void finally_use_texture_mode(TextureMode mode) {
|
static void finally_use_texture_mode(TextureMode mode) {
|
||||||
|
if (texture_mode_last_used == mode)
|
||||||
|
return;
|
||||||
|
|
||||||
static GLuint lists = 0;
|
static GLuint lists = 0;
|
||||||
if (!lists) {
|
if (!lists) {
|
||||||
lists = glGenLists(3);
|
lists = glGenLists(3);
|
||||||
@ -539,6 +545,8 @@ static void finally_use_texture_mode(TextureMode mode) {
|
|||||||
} else {
|
} else {
|
||||||
glCallList(lists + 2);
|
glCallList(lists + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
texture_mode_last_used = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user