Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit d2ce68a

Browse files
committed
Fixed NaN killer in SRP
1 parent 2a40419 commit d2ce68a

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

PostProcessing/Shaders/Builtins/Copy.shader

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ Shader "Hidden/PostProcessing/Copy"
1212
return color;
1313
}
1414

15+
float4 FragKillNaN(VaryingsDefault i) : SV_Target
16+
{
17+
float4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord);
18+
19+
#if !SHADER_API_GLES
20+
if (any(isnan(color)) || any(isinf(color)))
21+
{
22+
color = (0.0).xxxx;
23+
}
24+
#endif
25+
26+
return color;
27+
}
28+
1529
ENDHLSL
1630

1731
SubShader
@@ -28,5 +42,16 @@ Shader "Hidden/PostProcessing/Copy"
2842

2943
ENDHLSL
3044
}
45+
46+
// 1 - Fullscreen triangle copy + NaN killer
47+
Pass
48+
{
49+
HLSLPROGRAM
50+
51+
#pragma vertex VertDefault
52+
#pragma fragment FragKillNaN
53+
54+
ENDHLSL
55+
}
3156
}
3257
}

0 commit comments

Comments
 (0)