From d163e0f7ae907f6edd451e8c9b0d4a2d69241c8a Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Tue, 1 Oct 2024 15:18:00 +0300 Subject: [PATCH] twn_gl_15_rendering.c: better caching of pipelines --- src/rendering/twn_gl_15_rendering.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/rendering/twn_gl_15_rendering.c b/src/rendering/twn_gl_15_rendering.c index 241f753..a6a4bdd 100644 --- a/src/rendering/twn_gl_15_rendering.c +++ b/src/rendering/twn_gl_15_rendering.c @@ -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);