Browse Source

Fixing bug that was causing problems in probes

Panagiotis Christopoulos Charitos 9 years ago
parent
commit
c8a36dbdd6
2 changed files with 13 additions and 11 deletions
  1. 11 9
      shaders/Is.frag.glsl
  2. 2 2
      src/renderer/Is.cpp

+ 11 - 9
shaders/Is.frag.glsl

@@ -198,25 +198,27 @@ void main()
 #endif
 
 // out_color = diffCol;
-#if 0
-	if(pointLightCount == 0)
+#if 0 && INDIRECT_ENABLED
+	uint count = probeCount;
+	if(count == 0)
 	{
+		out_color = vec3(1.0, 0.0, 0.0);
 	}
-	else if(pointLightCount == 1)
+	else if(count == 1)
 	{
-		out_color += vec3(0.0, 1.0, 0.0);
+		out_color = vec3(0.0, 1.0, 0.0);
 	}
-	else if(pointLightCount == 2)
+	else if(count == 2)
 	{
-		out_color += vec3(0.0, 0.0, 1.0);
+		out_color = vec3(0.0, 0.0, 1.0);
 	}
-	else if(pointLightCount == 3)
+	else if(count == 3)
 	{
-		out_color += vec3(1.0, 0.0, 1.0);
+		out_color = vec3(1.0, 0.0, 1.0);
 	}
 	else
 	{
-		out_color += vec3(1.0, 0.0, 0.0);
+		out_color = vec3(1.0, 1.0, 0.0);
 	}
 #endif
 }

+ 2 - 2
src/renderer/Is.cpp

@@ -74,7 +74,7 @@ struct ShaderCommonUniforms
 };
 
 static const U MAX_TYPED_LIGHTS_PER_CLUSTER = 16;
-static const U MAX_PROBES_PER_CLUSTER = 8;
+static const U MAX_PROBES_PER_CLUSTER = 12;
 static const F32 INVALID_TEXTURE_INDEX = 128.0;
 
 class ClusterLightIndex
@@ -258,7 +258,7 @@ private:
 	{
 		U8 a = count.get();
 		count.set(a % maxCount);
-		if(a > maxCount)
+		if(ANKI_UNLIKELY(a >= maxCount))
 		{
 			ANKI_LOGW("Increase cluster limit: %s", &what[0]);
 		}