ezquake-source
ezquake-source copied to clipboard
The latest works of the Master
r_fx_fog throws glsl compilation errors and drops my framerate quite a bit
VertexShader.Compile(aliasmodel[0]) failed Shader->Compile(8B31) failed -- Version: 4.6 (Compatibility Profile) Mesa 22.2.0 -- GLSL: 4.60 0:201(20): error: illegal use of reserved word `input' 0:201(20): error: syntax error, unexpected ERROR_TOK, expecting ')'
VertexShader.Compile(aliasmodel[0]) failed
This correctly prevents client exiting due to:
Error: GL_Upload8: image too big (dirt_grey01: 1024x1024)
As for fog, I'm not seeing those errors with NVIDIA 3080 at least, just says shader compilation successful. Still confused about colors. qss vs fte/ezq does fog colors differently from world spawn attribute. Not sure if one format is legacy and other is not.
this fixes it fyi:
diff --git a/gl_program.c b/gl_program.c
index e45f3f20..686df86d 100644
--- a/gl_program.c
+++ b/gl_program.c
@@ -1276,10 +1276,10 @@ static void GL_BuildCoreDefinitions(void)
"uniform float fogDensity;\n"
"uniform vec3 fogColor;\n"
"#endif\n"
- "vec4 applyFog(vec4 input, float z) {\n"
+ "vec4 applyFog(vec4 vecinput, float z) {\n"
" float fogmix = exp(-fogDensity * z);\n"
" fogmix = clamp(fogmix, 0.0, 1.0); \n"
- " return vec4(mix(fogColor, input.rgb, fogmix), 1) * input.a; \n"
+ " return vec4(mix(fogColor, vecinput.rgb, fogmix), 1) * vecinput.a; \n"
"}\n"
"#elif defined(FOG_EXP2)\n"
"const float LOG2 = 1.442695;\n"
@@ -1288,10 +1288,10 @@ static void GL_BuildCoreDefinitions(void)
"uniform vec3 fogColor;\n"
"#endif"
"\n"
- "vec4 applyFog(vec4 input, float z) {\n"
+ "vec4 applyFog(vec4 vecinput, float z) {\n"
" float fogmix = exp2(-fogDensity * z * z * LOG2);\n"
" fogmix = clamp(fogmix, 0.0, 1.0);\n"
- " return vec4(mix(fogColor, input.rgb, fogmix), 1) * input.a;\n"
+ " return vec4(mix(fogColor, vecinput.rgb, fogmix), 1) * vecinput.a;\n"
"}\n"
"#elif defined(FOG_LINEAR)\n"
"#ifdef EZ_LEGACY_GL\n"
@@ -1300,14 +1300,14 @@ static void GL_BuildCoreDefinitions(void)
"uniform vec3 fogColor; \n"
"#endif"
"\n"
- "vec4 applyFog(vec4 input, float z) {\n"
+ "vec4 applyFog(vec4 vecinput, float z) {\n"
"float fogmix = (fogMaxZ - z) / (fogMaxZ - fogMinZ); \n"
"fogmix = clamp(fogmix, 0.0, 1.0); \n"
- "return vec4(mix(fogColor, input.rgb / input.a, fogmix), 1) * input.a; \n"
+ "return vec4(mix(fogColor, vecinput.rgb / vecinput.a, fogmix), 1) * vecinput.a; \n"
"}\n"
"#else\n"
- "vec4 applyFog(vec4 input, float z) {\n"
- " return input; \n"
+ "vec4 applyFog(vec4 vecinput, float z) {\n"
+ " return vecinput; \n"
"}\n"
"#endif\n"
"#endif // DRAW_FOG\n", sizeof(core_definitions)
...and this fixes loading fog color from maps
diff --git a/r_rmisc.c b/r_rmisc.c
index 04dbf54b..05682bcd 100644
--- a/r_rmisc.c
+++ b/r_rmisc.c
@@ -192,9 +192,9 @@ static qbool R_ParseWorldspawn(const char* entstring, worldspawn_info_t* worldsp
Cmd_TokenizeStringEx(&fog, temp);
if (Cmd_ArgcEx(&fog) == 4) {
worldspawn->fog_density = atof(Cmd_ArgvEx(&fog, 0));
- worldspawn->fog_color[0] = atof(Cmd_ArgvEx(&fog, 0));
- worldspawn->fog_color[1] = atof(Cmd_ArgvEx(&fog, 1));
- worldspawn->fog_color[2] = atof(Cmd_ArgvEx(&fog, 2));
+ worldspawn->fog_color[0] = atof(Cmd_ArgvEx(&fog, 1));
+ worldspawn->fog_color[1] = atof(Cmd_ArgvEx(&fog, 2));
+ worldspawn->fog_color[2] = atof(Cmd_ArgvEx(&fog, 3));
worldspawn->fog_density = bound(0, worldspawn->fog_density, 1);
worldspawn->fog_color[0] = bound(0, worldspawn->fog_color[0], 1);
All rockettrails except blood (4, 5) are not drawn if fog is enabled, haven't checked other particle effects.
@ciscon @dsvensson, your patches are part of #692, as I was not able to update this PR.
This PR is closed, as the follow-up (#692) will be merged. That one contains some patches on top of this.