Shader "Hidden/HDRenderPipeline/Blit" { HLSLINCLUDE #pragma target 4.5 #pragma only_renderers d3d11 ps4 xboxone vulkan metal #include "CoreRP/ShaderLibrary/Common.hlsl" #include "../ShaderVariables.hlsl" TEXTURE2D(_BlitTexture); SamplerState sampler_PointClamp; SamplerState sampler_LinearClamp; uniform float4 _BlitScaleBias; uniform float4 _BlitScaleBiasRt; uniform float _BlitMipLevel; struct Attributes { uint vertexID : SV_VertexID; }; struct Varyings { float4 positionCS : SV_POSITION; float2 texcoord : TEXCOORD0; }; Varyings Vert(Attributes input) { Varyings output; output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID); output.texcoord = GetFullScreenTriangleTexCoord(input.vertexID) * _BlitScaleBias.xy + _BlitScaleBias.zw; return output; } Varyings VertQuad(Attributes input) { Varyings output; output.positionCS = GetQuadVertexPosition(input.vertexID) * float4(_BlitScaleBiasRt.x, _BlitScaleBiasRt.y, 1, 1) + float4(_BlitScaleBiasRt.z, _BlitScaleBiasRt.w, 0, 0); output.positionCS.xy = output.positionCS.xy * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f); //convert to -1..1 output.texcoord = GetQuadTexCoord(input.vertexID) * _BlitScaleBias.xy + _BlitScaleBias.zw; return output; } float4 FragNearest(Varyings input) : SV_Target { return SAMPLE_TEXTURE2D_LOD(_BlitTexture, sampler_PointClamp, input.texcoord, _BlitMipLevel); } float4 FragBilinear(Varyings input) : SV_Target { return SAMPLE_TEXTURE2D_LOD(_BlitTexture, sampler_LinearClamp, input.texcoord, _BlitMipLevel); } ENDHLSL SubShader { Tags{ "RenderPipeline" = "HDRenderPipeline" } // 0: Nearest Pass { ZWrite Off ZTest Always Blend Off Cull Off HLSLPROGRAM #pragma vertex Vert #pragma fragment FragNearest ENDHLSL } // 1: Bilinear Pass { ZWrite Off ZTest Always Blend Off Cull Off HLSLPROGRAM #pragma vertex Vert #pragma fragment FragBilinear ENDHLSL } // 2: Nearest quad Pass { ZWrite Off ZTest Always Blend Off Cull Off HLSLPROGRAM #pragma vertex VertQuad #pragma fragment FragNearest ENDHLSL } // 3: Bilinear quad Pass { ZWrite Off ZTest Always Blend Off Cull Off HLSLPROGRAM #pragma vertex VertQuad #pragma fragment FragBilinear ENDHLSL } } Fallback Off }