Skip to content

Commit

Permalink
allow disabling use of 10 bit depth for lightmaps with -nopackedpixels
Browse files Browse the repository at this point in the history
.. which disables the EXT_packed_pixels extension.
  • Loading branch information
sezero committed Aug 28, 2023
1 parent 3605a47 commit 0328318
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Linux/sgml/Quakespasm.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ QuakeSpasm 0.94 has support for playing the 2021 re-release content: Copy the qu
<item> Fix a potential crash after loading of saved game.
<item> Fix possible out-of-bound reads when handling progs type sizes.
<item> Fix Dutch angle VP_PARALLEL_UPRIGHT sprites.
<item> Fix an issue with blending of lights.
<item> Fix an issue with blending of lights by using 10 bit depth for lightmaps. (GLSL mode only. Disable with "-nopackedpixels" if necessarry.)
<item> No relative motions when the window is not focused.
<item> Status bar and intermission screen tweaks.
<item> Properly display monster counts > 3 digits.
Expand Down
11 changes: 8 additions & 3 deletions Quake/gl_vidsdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1267,19 +1267,24 @@ static void GL_CheckExtensions (void)
else if (gl_glsl_able && gl_vbo_able && gl_max_texture_units >= 3)
{
gl_glsl_alias_able = true;
gl_packed_pixels = true;
Con_Printf("Enabled: GLSL alias model rendering\n");
Con_Printf("Enabled: EXT_packed_pixels\n");
}
else
{
Con_Warning ("GLSL alias model rendering not available, using Fitz renderer\n");
}

if (COM_CheckParm("-nopackedpixels"))
Con_Warning ("EXT_packed_pixels disabled at command line\n");
else if (gl_glsl_alias_able)
{
gl_packed_pixels = true;
Con_Printf("Enabled: EXT_packed_pixels\n");
}
#if 0 /* Disabling for non-GLSL path, needs more surgery. See: https://github.com/sezero/quakespasm/issues/47#issuecomment-1681540278 */
// packed_pixels
//
if (!gl_packed_pixels)
else
{
if (GL_ParseExtensionList(gl_extensions, "GL_APPLE_packed_pixels"))
{
Expand Down
8 changes: 7 additions & 1 deletion Quake/r_world.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ static GLuint fullbrightTexLoc;
static GLuint useFullbrightTexLoc;
static GLuint useOverbrightLoc;
static GLuint useAlphaTestLoc;
static GLuint usePackedPixelsLoc;
static GLuint alphaLoc;

#define vertAttrIndex 0
Expand Down Expand Up @@ -633,6 +634,7 @@ void R_DrawTextureChains_Water (qmodel_t *model, entity_t *ent, texchain_t chain
GL_Uniform1iFunc (fullbrightTexLoc, 2);
GL_Uniform1iFunc (useFullbrightTexLoc, 0);
GL_Uniform1iFunc (useOverbrightLoc, (int)gl_overbright.value);
GL_Uniform1iFunc (usePackedPixelsLoc, gl_packed_pixels);
GL_Uniform1iFunc (useAlphaTestLoc, 0);

for (i=0 ; i<model->numtextures ; i++)
Expand Down Expand Up @@ -843,6 +845,7 @@ void GLWorld_CreateShaders (void)
"uniform bool UseFullbrightTex;\n"
"uniform bool UseOverbright;\n"
"uniform bool UseAlphaTest;\n"
"uniform bool UsePackedPixels;\n"
"uniform float Alpha;\n"
"\n"
"varying float FogFragCoord;\n"
Expand All @@ -853,7 +856,8 @@ void GLWorld_CreateShaders (void)
" if (UseAlphaTest && (result.a < 0.666))\n"
" discard;\n"
" result *= texture2D(LMTex, gl_TexCoord[1].xy);\n"
" result.rgb *= 4.0;\n"
" if (UsePackedPixels)\n"
" result.rgb *= 4.0;\n"
" if (UseOverbright)\n"
" result.rgb *= 2.0;\n"
" if (UseFullbrightTex)\n"
Expand All @@ -880,6 +884,7 @@ void GLWorld_CreateShaders (void)
useFullbrightTexLoc = GL_GetUniformLocation (&r_world_program, "UseFullbrightTex");
useOverbrightLoc = GL_GetUniformLocation (&r_world_program, "UseOverbright");
useAlphaTestLoc = GL_GetUniformLocation (&r_world_program, "UseAlphaTest");
usePackedPixelsLoc = GL_GetUniformLocation (&r_world_program, "UsePackedPixels");
alphaLoc = GL_GetUniformLocation (&r_world_program, "Alpha");
}
}
Expand Down Expand Up @@ -932,6 +937,7 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
GL_Uniform1iFunc (useFullbrightTexLoc, 0);
GL_Uniform1iFunc (useOverbrightLoc, (int)gl_overbright.value);
GL_Uniform1iFunc (useAlphaTestLoc, 0);
GL_Uniform1iFunc (usePackedPixelsLoc, gl_packed_pixels);
GL_Uniform1fFunc (alphaLoc, entalpha);

for (i=0 ; i<model->numtextures ; i++)
Expand Down
2 changes: 1 addition & 1 deletion Quakespasm.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ <H2><A NAME="ss5.1">5.1</A> <A HREF="#toc5.1">Changes in 0.96.0</A>
<LI> Fix a potential crash after loading of saved game.</LI>
<LI> Fix possible out-of-bound reads when handling progs type sizes.</LI>
<LI> Fix Dutch angle VP_PARALLEL_UPRIGHT sprites.</LI>
<LI> Fix an issue with blending of lights.</LI>
<LI> Fix an issue with blending of lights by using 10 bit depth for lightmaps. (GLSL mode only. Disable with "-nopackedpixels" if necessarry.)</LI>
<LI> No relative motions when the window is not focused.</LI>
<LI> Status bar and intermission screen tweaks.</LI>
<LI> Properly display monster counts &gt; 3 digits.</LI>
Expand Down
4 changes: 3 additions & 1 deletion Quakespasm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,9 @@

- Fix Dutch angle VP_PARALLEL_UPRIGHT sprites.

- Fix an issue with blending of lights.
- Fix an issue with blending of lights by using 10 bit depth for
lightmaps. (GLSL mode only. Disable with "-nopackedpixels" if
necessarry.)

- No relative motions when the window is not focused.

Expand Down

0 comments on commit 0328318

Please sign in to comment.