Files
UnrealEngineUWP/Engine/Shaders/PostProcessDilation.usf
Martin Mittring c9355c292c integrated from Orion
optimized shaders to use SvPosition where possible, following change could remove some unused interpolator

[CL 2697164 by Martin Mittring in Main branch]
2015-09-18 12:10:27 -04:00

40 lines
1.1 KiB
Plaintext

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
PostProcessDilation.usf: PostProcessing dilation of the diffuse SVO content
=============================================================================*/
#include "Common.usf"
#include "PostProcessCommon.usf"
// pixel shader
void MainPS(noperspective float4 UVAndScreenPos : TEXCOORD0, float4 SvPosition : SV_POSITION, out float4 OutColor : SV_Target0)
{
float2 UV = UVAndScreenPos.xy;
// screen position in [-1, 1] screen space
float2 ScreenSpacePos = UVAndScreenPos.zw;
int3 PixelPos = int3((int2)(SvPosition.xy), 0);
OutColor = PostprocessInput0.Load(PixelPos);
int2 MaxSize = (int2)ViewportSize;
#define SAMPLE(x, y)\
{\
int3 p = PixelPos + int3(x, y, 0);\
FLATTEN\
if(all(OutColor.rgb == 0) && all(p.xy < MaxSize))\
{\
OutColor = PostprocessInput0.Load(p);\
}\
}
// take content from neighbors
SAMPLE(-1,0) SAMPLE( 1,0) SAMPLE(0,-1) SAMPLE(0, 1)
// not needed
// SAMPLE(-1,1) SAMPLE( 1,1) SAMPLE(1,-1) SAMPLE(1, 1) SAMPLE(-1,-1) SAMPLE( 1,-1) SAMPLE(-1,-1) SAMPLE(-1, 1)
}