From cf16fd29381cf67542f741f8de4ff017b167819e Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Sun, 13 Jun 2021 17:56:11 +0300 Subject: [PATCH] Fix custom shaders that define only one stage, like footfix --- src/hardware/hw_shaders.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/hardware/hw_shaders.c b/src/hardware/hw_shaders.c index e28624226..c341577eb 100644 --- a/src/hardware/hw_shaders.c +++ b/src/hardware/hw_shaders.c @@ -834,6 +834,12 @@ skip_field: { int shader_index = i + NUMSHADERTARGETS; // index to gl_shaders gl_shadertargets[i].custom_shader = shader_index; + // if only one stage (vertex/fragment) is defined, the other one + // is copied from the base shaders. + if (!gl_shaders[shader_index].fragment) + gl_shaders[shader_index].fragment = Z_StrDup(gl_shadersources[i].fragment); + if (!gl_shaders[shader_index].vertex) + gl_shaders[shader_index].vertex = Z_StrDup(gl_shadersources[i].vertex); HWR_CompileShader(shader_index); if (!gl_shaders[shader_index].compiled) CONS_Alert(CONS_ERROR, "HWR_LoadCustomShadersFromFile: A compilation error occured for the %s shader in file %s. See the console messages above for more information.\n", shaderxlat[i].type, wadfiles[wadnum]->filename);