Files
UnrealEngineUWP/Engine/Shaders/ColorUtils.usf
Ben Marsh 149375b14b Update copyright notices to 2015.
[CL 2379638 by Ben Marsh in Main branch]
2014-12-07 19:09:38 -05:00

19 lines
797 B
Plaintext

// Copyright 1998-2015 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);
}