Browse Source

Include large vertex shader array uniforms only when needed.

Lasse Öörni 12 years ago
parent
commit
6325520ef3

+ 6 - 2
Bin/CoreData/Shaders/GLSL/Uniforms.vert

@@ -20,5 +20,9 @@ uniform mat4 cZone;
 #else
     uniform mat4 cLightMatrices[2];
 #endif
-uniform vec4 cSkinMatrices[64*3];
-uniform vec4 cVertexLights[4*3];
+#ifdef SKINNED
+    uniform vec4 cSkinMatrices[64*3];
+#endif
+#ifdef NUMVERTEXLIGHTS
+    uniform vec4 cVertexLights[4*3];
+#endif

+ 2 - 0
Bin/CoreData/Shaders/HLSL/Transform.hlsl

@@ -1,3 +1,4 @@
+#ifdef SKINNED
 float4x3 GetSkinMatrix(float4 blendWeights, int4 blendIndices)
 {
     return cSkinMatrices[blendIndices.x] * blendWeights.x +
@@ -5,6 +6,7 @@ float4x3 GetSkinMatrix(float4 blendWeights, int4 blendIndices)
         cSkinMatrices[blendIndices.z] * blendWeights.z +
         cSkinMatrices[blendIndices.w] * blendWeights.w;
 }
+#endif
 
 float2 GetTexCoord(float2 iTexCoord)
 {

+ 6 - 2
Bin/CoreData/Shaders/HLSL/Uniforms.hlsl

@@ -17,8 +17,12 @@ uniform float3 cViewRightVector;
 uniform float3 cViewUpVector;
 uniform float4x3 cZone;
 uniform float4x4 cLightMatrices[4];
-uniform float4x3 cSkinMatrices[64];
-uniform float4 cVertexLights[4*3];
+#ifdef SKINNED
+    uniform float4x3 cSkinMatrices[64];
+#endif
+#ifdef NUMVERTEXLIGHTS
+    uniform float4 cVertexLights[4*3];
+#endif
 
 // Pixel shader uniforms
 uniform float3 cAmbientColor;