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