From c28e56f9e860592a1ca6e592d0b12c3898016603 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 7 Apr 2019 19:42:32 +0200 Subject: [PATCH] - workaround buggy preprocessor in old AMD OpenGL drivers --- wadsrc/static/shaders/glsl/main.vp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/wadsrc/static/shaders/glsl/main.vp b/wadsrc/static/shaders/glsl/main.vp index cc332ad951..f8de93ba06 100644 --- a/wadsrc/static/shaders/glsl/main.vp +++ b/wadsrc/static/shaders/glsl/main.vp @@ -21,21 +21,12 @@ layout(location = 6) out vec4 vEyeNormal; #ifdef NO_CLIPDISTANCE_SUPPORT layout(location = 7) out vec4 ClipDistanceA; layout(location = 8) out vec4 ClipDistanceB; -#define ClipDistance0 ClipDistanceA.x -#define ClipDistance1 ClipDistanceA.y -#define ClipDistance2 ClipDistanceA.z -#define ClipDistance3 ClipDistanceA.w -#define ClipDistance4 ClipDistanceB.x -#else -#define ClipDistance0 gl_ClipDistance[0] -#define ClipDistance1 gl_ClipDistance[1] -#define ClipDistance2 gl_ClipDistance[2] -#define ClipDistance3 gl_ClipDistance[3] -#define ClipDistance4 gl_ClipDistance[4] #endif void main() { + float ClipDistance0, ClipDistance1, ClipDistance2, ClipDistance3, ClipDistance4; + vec2 parmTexCoord; vec4 parmPosition; @@ -138,5 +129,16 @@ void main() ClipDistance4 = 1.0; } +#ifdef NO_CLIPDISTANCE_SUPPORT + ClipDistanceA = vec4(ClipDistance0, ClipDistance1, ClipDistance2, ClipDistance3); + ClipDistanceB = vec4(ClipDistance4, 0.0, 0.0, 0.0); +#else + gl_ClipDistance[0] = ClipDistance0; + gl_ClipDistance[1] = ClipDistance1; + gl_ClipDistance[2] = ClipDistance2; + gl_ClipDistance[3] = ClipDistance3; + gl_ClipDistance[4] = ClipDistance4; +#endif + gl_PointSize = 1.0; }