From 04aec208913098fcd8199fb33c8d1385a256977c Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Tue, 27 Aug 2024 23:47:15 +0300 Subject: [PATCH] gl1, gl3: use GL_LIGHTMAP_FORMAT intead internal_format value is never changed, so replace should be safe. --- src/client/refresh/gl1/gl1_lightmap.c | 8 +++----- src/client/refresh/gl1/header/local.h | 1 - src/client/refresh/gl3/gl3_lightmap.c | 4 +--- src/client/refresh/gl3/header/local.h | 1 - 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/client/refresh/gl1/gl1_lightmap.c b/src/client/refresh/gl1/gl1_lightmap.c index 477c327c..57496351 100644 --- a/src/client/refresh/gl1/gl1_lightmap.c +++ b/src/client/refresh/gl1/gl1_lightmap.c @@ -109,8 +109,7 @@ LM_UploadBlock(qboolean dynamic) } else { - gl_lms.internal_format = GL_LIGHTMAP_FORMAT; - glTexImage2D(GL_TEXTURE_2D, 0, gl_lms.internal_format, + glTexImage2D(GL_TEXTURE_2D, 0, GL_LIGHTMAP_FORMAT, gl_state.block_width, gl_state.block_height, 0, GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE, gl_lms.lightmap_buffer[buffer]); @@ -123,7 +122,7 @@ LM_UploadBlock(qboolean dynamic) R_Bind(gl_state.lightmap_textures + (gl_state.max_lightmaps * i) + texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexImage2D(GL_TEXTURE_2D, 0, gl_lms.internal_format, + glTexImage2D(GL_TEXTURE_2D, 0, GL_LIGHTMAP_FORMAT, gl_state.block_width, gl_state.block_height, 0, GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE, gl_lms.lightmap_buffer[buffer]); @@ -326,7 +325,6 @@ LM_BeginBuildingLightmaps(model_t *m) } gl_lms.current_lightmap_texture = 1; - gl_lms.internal_format = GL_LIGHTMAP_FORMAT; if (gl_config.multitexture) { @@ -341,7 +339,7 @@ LM_BeginBuildingLightmaps(model_t *m) R_Bind(gl_state.lightmap_textures + 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexImage2D(GL_TEXTURE_2D, 0, gl_lms.internal_format, + glTexImage2D(GL_TEXTURE_2D, 0, GL_LIGHTMAP_FORMAT, gl_state.block_width, gl_state.block_height, 0, GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE, gl_lms.lightmap_buffer[0]); diff --git a/src/client/refresh/gl1/header/local.h b/src/client/refresh/gl1/header/local.h index 950efba2..ab9252fe 100644 --- a/src/client/refresh/gl1/header/local.h +++ b/src/client/refresh/gl1/header/local.h @@ -463,7 +463,6 @@ typedef struct typedef struct { - int internal_format; int current_lightmap_texture; msurface_t *lightmap_surfaces[MAX_LIGHTMAPS]; diff --git a/src/client/refresh/gl3/gl3_lightmap.c b/src/client/refresh/gl3/gl3_lightmap.c index 80d93b62..6b344b2e 100644 --- a/src/client/refresh/gl3/gl3_lightmap.c +++ b/src/client/refresh/gl3/gl3_lightmap.c @@ -56,8 +56,7 @@ GL3_LM_UploadBlock(void) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - gl3_lms.internal_format = GL_LIGHTMAP_FORMAT; - glTexImage2D(GL_TEXTURE_2D, 0, gl3_lms.internal_format, + glTexImage2D(GL_TEXTURE_2D, 0, GL_LIGHTMAP_FORMAT, BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE, gl3_lms.lightmap_buffers[map]); } @@ -255,7 +254,6 @@ GL3_LM_BeginBuildingLightmaps(gl3model_t *m) gl3_newrefdef.lightstyles = lightstyles; gl3_lms.current_lightmap_texture = 0; - gl3_lms.internal_format = GL_LIGHTMAP_FORMAT; // Note: the dynamic lightmap used to be initialized here, we don't use that anymore. } diff --git a/src/client/refresh/gl3/header/local.h b/src/client/refresh/gl3/header/local.h index 65feb69a..456ffe71 100644 --- a/src/client/refresh/gl3/header/local.h +++ b/src/client/refresh/gl3/header/local.h @@ -317,7 +317,6 @@ enum {MAX_GL3TEXTURES = 1024}; typedef struct { - int internal_format; int current_lightmap_texture; // index into gl3state.lightmap_textureIDs[] //msurface_t *lightmap_surfaces[MAX_LIGHTMAPS]; - no more lightmap chains, lightmaps are rendered multitextured