Rasagar/Library/PackageCache/com.unity.render-pipelines.universal/Shaders/PostProcessing/StopNaN.shader

42 lines
1.1 KiB
Plaintext
Raw Normal View History

2024-08-26 13:07:20 -07:00
Shader "Hidden/Universal Render Pipeline/Stop NaN"
{
HLSLINCLUDE
#pragma target 3.5
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
#define NAN_COLOR half4(0.0, 0.0, 0.0, 0.0)
half4 FragStopNaN(Varyings input) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
float2 uv = UnityStereoTransformScreenSpaceTex(input.texcoord);
half4 color = SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_PointClamp, uv);
if (AnyIsNaN(color) || AnyIsInf(color))
color = NAN_COLOR;
return color;
}
ENDHLSL
SubShader
{
Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline"}
LOD 100
ZTest Always ZWrite Off Cull Off
Pass
{
Name "Stop NaN"
HLSLPROGRAM
#pragma vertex Vert
#pragma fragment FragStopNaN
ENDHLSL
}
}
}