You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
62 lines
1.5 KiB
Plaintext
62 lines
1.5 KiB
Plaintext
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved..
|
|
|
|
/*=============================================================================
|
|
InstancedStereo.usf: Resolve which view uniforms in a stereo pair to use.
|
|
=============================================================================*/
|
|
|
|
#pragma once
|
|
|
|
// Explictly include view uniform buffers
|
|
#include "UniformBuffers/View.usf"
|
|
#include "UniformBuffers/InstancedView.usf"
|
|
|
|
// ViewState, GetPrimaryView and GetInstancedView are generated by the shader compiler to ensure View uniform buffer changes are up to date.
|
|
// see GenerateInstancedStereoCode()
|
|
#include "GeneratedInstancedStereo.usf"
|
|
|
|
// Packing the eye index and instanced stereo flag into a single uint to save an interpolator
|
|
uint PackEyeIndex(uint EyeIndex, bool bIsInstancedStereo)
|
|
{
|
|
uint Result = 0;
|
|
Result |= (uint)bIsInstancedStereo << 31;
|
|
Result |= EyeIndex;
|
|
return Result;
|
|
}
|
|
|
|
uint GetEyeIndex(uint PackedIndex)
|
|
{
|
|
return PackedIndex & 0x1;
|
|
}
|
|
|
|
bool IsInstancedStereo(uint PackedIndex)
|
|
{
|
|
return (PackedIndex >> 1) > 0;
|
|
}
|
|
|
|
static ViewState ResolvedView;
|
|
|
|
ViewState ResolveView()
|
|
{
|
|
return GetPrimaryView();
|
|
}
|
|
|
|
#if INSTANCED_STEREO
|
|
static const float EyeOffsetScale[2] = { -1.0, 1.0 };
|
|
static const float4 EyeClipEdge[2] = { float4(-1.0, 0.0, 0.0, 1.0), float4(1.0, 0.0, 0.0, 1.0) };
|
|
bool bIsInstancedStereo;
|
|
#endif
|
|
|
|
#if INSTANCED_STEREO || MOBILE_MULTI_VIEW
|
|
ViewState ResolveView(uint ViewIndex)
|
|
{
|
|
if (ViewIndex == 0)
|
|
{
|
|
return GetPrimaryView();
|
|
}
|
|
else
|
|
{
|
|
return GetInstancedView();
|
|
}
|
|
}
|
|
#endif
|