|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-24 02:48:17
|
Author: Lasse Kärkkäinen <tronic+ndrm at trn.iki.fi> Date: Thu Feb 24 03:39:26 2011 +0100 Shader cleanup, now conditional parts only in fragment shader (where performance matters). --- data/shaders/core.frag | 18 ------------------ data/shaders/core.vert | 16 ---------------- data/shaders/dancenote.vert | 9 ++++----- 3 files changed, 4 insertions(+), 39 deletions(-) diff --git a/data/shaders/core.frag b/data/shaders/core.frag index ffec65a..3d3353c 100644 --- a/data/shaders/core.frag +++ b/data/shaders/core.frag @@ -3,37 +3,19 @@ //DEFINES -#ifdef ENABLE_BOGUS in float bogus; // Nvidia will overwrite the first in variable with bogus data, so as a workaround we put a bogus variable here -#endif - in mat4 colorMat; - -#ifdef ENABLE_LIGHTING in vec3 normal; -#endif - -#ifdef ENABLE_VERTEX_COLOR in vec4 color; -#endif - -#ifdef SURFACE -#endif #ifdef ENABLE_TEXTURING - in vec4 texCoord; - #if ENABLE_TEXTURING == 1 - uniform sampler2DRect tex; #define TEXFUNC texture2DRect(tex, texCoord.st) - #elif ENABLE_TEXTURING == 2 - uniform sampler2D tex; #define TEXFUNC texture2D(tex, texCoord.st) - #else #error Unknown texturing mode in ENABLE_TEXTURING #endif diff --git a/data/shaders/core.vert b/data/shaders/core.vert index 95934b5..f47515b 100644 --- a/data/shaders/core.vert +++ b/data/shaders/core.vert @@ -2,46 +2,30 @@ //DEFINES -#ifdef ENABLE_BOGUS varying float bogus; -#endif in vec4 vertPos; uniform mat4 colorMatrix; varying mat4 colorMat; -#ifdef ENABLE_TEXTURING in vec4 vertTexCoord; varying vec4 texCoord; varying vec4 vTexCoord; -#endif -#ifdef ENABLE_LIGHTING in vec3 vertNormal; varying vec3 normal; varying vec3 vNormal; -#endif -#ifdef ENABLE_VERTEX_COLOR in vec4 vertColor; varying vec4 color; varying vec4 vColor; -#endif void main() { -#ifdef ENABLE_BOGUS bogus = 0.0; -#endif colorMat = colorMatrix; // In case no geometry shader is used (otherwise it sets this) gl_Position = gl_ModelViewProjectionMatrix * vertPos; -#ifdef ENABLE_TEXTURING vTexCoord = texCoord = vertTexCoord; -#endif -#ifdef ENABLE_LIGHTING vNormal = normal = normalize(gl_NormalMatrix * vertNormal); -#endif -#ifdef ENABLE_VERTEX_COLOR vColor = color = vertColor; -#endif } diff --git a/data/shaders/dancenote.vert b/data/shaders/dancenote.vert index 06c35a7..4919a05 100644 --- a/data/shaders/dancenote.vert +++ b/data/shaders/dancenote.vert @@ -1,10 +1,9 @@ #version 120 -// Input from glVertexAttribPointer -/* layout (location = 0) */ in vec4 vertPos; -/* layout (location = 1) */ in vec4 vertTexCoord; -/* layout (location = 2) */ in vec3 vertNormal; -/* layout (location = 3) */ in vec4 vertColor; +in vec4 vertPos; +in vec4 vertTexCoord; +in vec3 vertNormal; +in vec4 vertColor; varying float bogus; |