diff --git a/reaction/code/rend2/glsl/lightall_fp.glsl b/reaction/code/rend2/glsl/lightall_fp.glsl index ec9bb2dc..ff6eb865 100644 --- a/reaction/code/rend2/glsl/lightall_fp.glsl +++ b/reaction/code/rend2/glsl/lightall_fp.glsl @@ -46,17 +46,16 @@ varying vec4 var_Color; varying vec3 var_Position; #endif -#if defined(USE_TCGEN) || defined(USE_NORMALMAP) || (defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)) +#if defined(USE_TCGEN) || defined(USE_NORMALMAP) || defined(USE_LIGHT) && !defined(USE_FAST_LIGHT) varying vec3 var_SampleToView; #endif #if !defined(USE_FAST_LIGHT) varying vec3 var_Normal; -#endif - -#if defined(USE_VERT_TANGENT_SPACE) + #if defined(USE_VERT_TANGENT_SPACE) varying vec3 var_Tangent; varying vec3 var_Bitangent; + #endif #endif varying vec3 var_VertLight; @@ -233,7 +232,7 @@ void main() vec3 directedLight = var_VertLight; #endif -#if defined(USE_TCGEN) || defined(USE_NORMALMAP) || (defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)) +#if defined(USE_TCGEN) || defined(USE_NORMALMAP) || defined(USE_LIGHT) && !defined(USE_FAST_LIGHT) vec3 SampleToView = normalize(var_SampleToView); #endif vec2 tex = var_DiffuseTex; diff --git a/reaction/code/rend2/glsl/lightall_vp.glsl b/reaction/code/rend2/glsl/lightall_vp.glsl index 9bd19506..027f2741 100644 --- a/reaction/code/rend2/glsl/lightall_vp.glsl +++ b/reaction/code/rend2/glsl/lightall_vp.glsl @@ -152,9 +152,6 @@ void main() #if defined(USE_TCGEN) || defined(USE_NORMALMAP) || defined(USE_LIGHT) && !defined(USE_FAST_LIGHT) vec3 SampleToView = u_ViewOrigin - position.xyz; -#endif - -#if defined(USE_NORMALMAP) || defined(USE_LIGHT) && !defined(USE_FAST_LIGHT) var_SampleToView = SampleToView; #endif diff --git a/reaction/code/rend2/tr_glsl.c b/reaction/code/rend2/tr_glsl.c index 941d75a9..7f0b7a4d 100644 --- a/reaction/code/rend2/tr_glsl.c +++ b/reaction/code/rend2/tr_glsl.c @@ -334,7 +334,7 @@ static int GLSL_LoadGPUShaderText(const char *name, const char *fallback, return result; } -static void GLSL_LinkProgram(GLhandleARB program) +static void GLSL_LinkProgram(GLhandleARB program, char *vpCode, char *fpCode) { GLint linked; @@ -344,6 +344,8 @@ static void GLSL_LinkProgram(GLhandleARB program) if(!linked) { GLSL_PrintInfoLog(program, qfalse); + ri.Printf(PRINT_ALL, "vpCode:\n%s\n", vpCode); + ri.Printf(PRINT_ALL, "fpCode:\n%s\n", fpCode); ri.Error(ERR_DROP, "\nshaders failed to link"); } } @@ -467,7 +469,7 @@ static int GLSL_InitGPUShader2(shaderProgram_t * program, const char *name, int qglBindAttribLocationARB(program->program, ATTR_INDEX_BITANGENT2, "attr_Bitangent2"); #endif - GLSL_LinkProgram(program->program); + GLSL_LinkProgram(program->program, vpCode, fpCode); program->numUniforms = numUniforms;