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