twn_gl_15_rendering.c: better caching of pipelines

This commit is contained in:
veclav talica 2024-10-01 15:18:00 +03:00
parent 2ebb2ba53b
commit d163e0f7ae

View File

@ -59,6 +59,9 @@ static Pipeline pipeline_last_used = PIPELINE_NO;
void use_space_pipeline(void) {
if (pipeline_last_used == PIPELINE_SPACE)
return;
static GLuint list = 0;
if (!list) {
list = glGenLists(1);
@ -104,6 +107,9 @@ void use_2d_pipeline(void) {
glFlush();
}
if (pipeline_last_used == PIPELINE_2D)
return;
static GLuint list = 0;
if (!list) {
list = glGenLists(1);
@ -205,6 +211,7 @@ void use_texture_mode(TextureMode mode) {
if (!lists) {
lists = glGenLists(3);
/* ghostly */
glNewList(lists + 0, GL_COMPILE); {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@ -213,6 +220,7 @@ void use_texture_mode(TextureMode mode) {
glDisable(GL_ALPHA_TEST);
} glEndList();
/* seethrough */
glNewList(lists + 1, GL_COMPILE); {
glDisable(GL_BLEND);
glDepthFunc(GL_LEQUAL);
@ -221,6 +229,7 @@ void use_texture_mode(TextureMode mode) {
glAlphaFunc(GL_EQUAL, 1.0f);
} glEndList();
/* opaque */
glNewList(lists + 2, GL_COMPILE); {
glDisable(GL_BLEND);
glDepthFunc(GL_LESS);