瀏覽代碼

Workaround a driver bug. Enable rasterization tests for everyone

Panagiotis Christopoulos Charitos 8 年之前
父節點
當前提交
671a070938
共有 2 個文件被更改,包括 19 次插入38 次删除
  1. 5 3
      shaders/VolumetricUpscale.frag.glsl
  2. 14 35
      src/anki/scene/Visibility.cpp

+ 5 - 3
shaders/VolumetricUpscale.frag.glsl

@@ -8,7 +8,7 @@
 #define BLUE_NOISE 0
 #define BLUE_NOISE 0
 
 
 layout(location = 0) in vec2 in_uv;
 layout(location = 0) in vec2 in_uv;
-layout(location = 0) out vec3 out_color;
+layout(location = 0) out vec4 out_color;
 
 
 layout(ANKI_TEX_BINDING(0, 0)) uniform sampler2D u_depthFullTex;
 layout(ANKI_TEX_BINDING(0, 0)) uniform sampler2D u_depthFullTex;
 layout(ANKI_TEX_BINDING(0, 1)) uniform sampler2D u_depthHalfTex;
 layout(ANKI_TEX_BINDING(0, 1)) uniform sampler2D u_depthHalfTex;
@@ -24,13 +24,15 @@ layout(ANKI_UBO_BINDING(0, 0)) uniform u0_
 
 
 void main()
 void main()
 {
 {
-	out_color =
+	vec3 col =
 		bilateralUpsample(u_depthFullTex, u_depthHalfTex, u_colorTex, 1.0 / SRC_SIZE, in_uv, u_linearizeCfPad2.xy).rgb;
 		bilateralUpsample(u_depthFullTex, u_depthHalfTex, u_colorTex, 1.0 / SRC_SIZE, in_uv, u_linearizeCfPad2.xy).rgb;
 
 
 #if BLUE_NOISE
 #if BLUE_NOISE
 	vec3 blueNoise = texture(u_noiseTex, vec3(FB_SIZE / vec2(NOISE_TEX_SIZE) * in_uv, 0.0), 0.0).rgb;
 	vec3 blueNoise = texture(u_noiseTex, vec3(FB_SIZE / vec2(NOISE_TEX_SIZE) * in_uv, 0.0), 0.0).rgb;
 	blueNoise = blueNoise * 2.0 - 1.0;
 	blueNoise = blueNoise * 2.0 - 1.0;
 	blueNoise = sign(blueNoise) * (1.0 - sqrt(1.0 - abs(blueNoise)));
 	blueNoise = sign(blueNoise) * (1.0 - sqrt(1.0 - abs(blueNoise)));
-	out_color += blueNoise / 16.0;
+	col += blueNoise / 16.0;
 #endif
 #endif
+
+	out_color = vec4(col, 0.0);
 }
 }

+ 14 - 35
src/anki/scene/Visibility.cpp

@@ -316,7 +316,7 @@ void VisibilityTestTask::test(ThreadHive& hive)
 		U spIdx = 0;
 		U spIdx = 0;
 		U count = 0;
 		U count = 0;
 		Error err = node.iterateComponentsOfType<SpatialComponent>([&](SpatialComponent& sp) {
 		Error err = node.iterateComponentsOfType<SpatialComponent>([&](SpatialComponent& sp) {
-			if(testedFrc.insideFrustum(sp))
+			if(testedFrc.insideFrustum(sp) && testAgainstRasterizer(sp.getSpatialCollisionShape(), sp.getAabb()))
 			{
 			{
 				// Inside
 				// Inside
 				ANKI_ASSERT(spIdx < MAX_U8);
 				ANKI_ASSERT(spIdx < MAX_U8);
@@ -382,37 +382,21 @@ void VisibilityTestTask::test(ThreadHive& hive)
 
 
 		if(lc && wantsLightComponents)
 		if(lc && wantsLightComponents)
 		{
 		{
-			// Perform an additional check against the rasterizer
-			Bool in;
-			if(lc->getShadowEnabled())
+			VisibilityGroupType gt;
+			switch(lc->getLightComponentType())
 			{
 			{
-				ANKI_ASSERT(spIdx == 1);
-				const SpatialComponent& sc = *sps[0].m_sp;
-				in = testAgainstRasterizer(sc.getSpatialCollisionShape(), sc.getAabb());
-			}
-			else
-			{
-				in = true;
+			case LightComponentType::POINT:
+				gt = VisibilityGroupType::LIGHTS_POINT;
+				break;
+			case LightComponentType::SPOT:
+				gt = VisibilityGroupType::LIGHTS_SPOT;
+				break;
+			default:
+				ANKI_ASSERT(0);
+				gt = VisibilityGroupType::TYPE_COUNT;
 			}
 			}
 
 
-			if(in)
-			{
-				VisibilityGroupType gt;
-				switch(lc->getLightComponentType())
-				{
-				case LightComponentType::POINT:
-					gt = VisibilityGroupType::LIGHTS_POINT;
-					break;
-				case LightComponentType::SPOT:
-					gt = VisibilityGroupType::LIGHTS_SPOT;
-					break;
-				default:
-					ANKI_ASSERT(0);
-					gt = VisibilityGroupType::TYPE_COUNT;
-				}
-
-				visible->moveBack(alloc, gt, visibleNode);
-			}
+			visible->moveBack(alloc, gt, visibleNode);
 		}
 		}
 
 
 		if(lfc && wantsFlareComponents)
 		if(lfc && wantsFlareComponents)
@@ -422,12 +406,7 @@ void VisibilityTestTask::test(ThreadHive& hive)
 
 
 		if(reflc && wantsReflectionProbes)
 		if(reflc && wantsReflectionProbes)
 		{
 		{
-			ANKI_ASSERT(spIdx == 1);
-			const SpatialComponent& sc = *sps[0].m_sp;
-			if(testAgainstRasterizer(sc.getSpatialCollisionShape(), sc.getAabb()))
-			{
-				visible->moveBack(alloc, VisibilityGroupType::REFLECTION_PROBES, visibleNode);
-			}
+			visible->moveBack(alloc, VisibilityGroupType::REFLECTION_PROBES, visibleNode);
 		}
 		}
 
 
 		if(proxyc && wantsReflectionProxies)
 		if(proxyc && wantsReflectionProxies)