Files
UnrealEngineUWP/Engine/Shaders/ClearReplacementShaders.usf
Marcus Wassmer 59f7299ccf Fix screenpercentage on Morpheus
#codereview Lee.Clark,JJ.Hoesing

[CL 2500368 by Marcus Wassmer in Main branch]
2015-04-02 16:54:49 -04:00

56 lines
1.2 KiB
Plaintext

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
ClearReplacement.usf: Collection of Shaders for alternative ways to clear a texture/buffer.
=============================================================================*/
#include "Common.usf"
float4 ClearColor;
float4 ClearVS(uint Id : SV_VertexID) : SV_POSITION
{
int x = Id & 1;
int y = Id >> 1;
return float4(x * 2 - 1, y * 2 - 1, 0, 1);
}
float4 ClearPS() : SV_Target0
{
return ClearColor;
}
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM5
RWTexture2D<float4> ClearTextureRW;
uint4 TargetBounds; //xy upperleft, zw lowerright
[numthreads(8,8,1)]
void ClearTexture2DCS(uint2 Position : SV_DispatchThreadID)
{
ClearTextureRW[Position] = ClearColor;
}
//clear with emulated scissor rects.
[numthreads(8, 8, 1)]
void ClearTexture2DScissorCS(uint2 Position : SV_DispatchThreadID)
{
uint2 FinalPos = Position + TargetBounds.xy;
if (all(FinalPos < TargetBounds.zw))
{
ClearTextureRW[FinalPos] = ClearColor;
}
}
uint ClearDword;
RWBuffer<uint> ClearBufferRW;
[numthreads(64,1,1)]
void ClearBufferCS(uint Position : SV_DispatchThreadID)
{
ClearBufferRW[Position] = ClearDword;
}
#endif