Files
UnrealEngineUWP/Engine/Shaders/ColorUtils.usf
Ben Marsh 20bf0eb6a1 Updating copyright notices to 2017 (copying from //Tasks/UE4/Dev-Copyright-2017).
#rb none
#lockdown Nick.Penwarden

[CL 3226823 by Ben Marsh in Main branch]
2016-12-08 08:52:44 -05:00

19 lines
797 B
Plaintext

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
ColorUtils.hlsl: Some utility functions for dealing with colors.
=============================================================================*/
void ReplicateChannel(inout float4 BaseColor, half4 InComponentReplicate, half4 InComponentReplicateAlpha)
{
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM4
//In SM4/5, doing a texture lookup from a G8 texture gives float4(value,0,0,0), so we need to replicate it to the other channels.
//On all other platforms, the value is replicated automatically.
if(any(InComponentReplicate != 0.0))
{
BaseColor = dot(BaseColor,InComponentReplicate);
}
#endif
BaseColor.a = dot(BaseColor,InComponentReplicateAlpha);
}