Files
UnrealEngineUWP/Engine/Shaders/Private/PositionOnlyDepthVertexShader.usf
serge bernier 9ce7402b1f Support INVARIANT on platform using DXC-SPIRV
-Add a new define to wrap the output semantic that we want to be post declare as precise.
-Modify DXC-SIRV to add the NoContraction decorator on precise output semantics.
-Modify spirv_glsl to post declare as precise output semantics
  -Example: out precise float4 gl_positon; will add precise gl_position; post declaration.

[REVIEW] [at]laura.hermanns

[CL 29338529 by serge bernier in ue5-main branch]
2023-11-01 19:14:21 -04:00

38 lines
1.1 KiB
Plaintext

// Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
PositionOnlyDepthOnlyVertexShader.hlsl: Depth-only vertex shader.
=============================================================================*/
#include "Common.ush"
#include "/Engine/Generated/Material.ush"
#include "/Engine/Generated/VertexFactory.ush"
void Main(
FPositionOnlyVertexFactoryInput Input,
out INVARIANT_OUTPUT float4 OutPosition : SV_POSITION
#if USE_GLOBAL_CLIP_PLANE
, out float OutGlobalClipPlaneDistance : SV_ClipDistance
#endif
#if INSTANCED_STEREO
, out uint ViewportIndex : SV_ViewPortArrayIndex
#endif
)
{
#if INSTANCED_STEREO
const uint EyeIndex = GetEyeIndexFromVF(Input);
ViewportIndex = EyeIndex;
#endif
ResolvedView = ResolveViewFromVF(Input);
float4 WorldPos = VertexFactoryGetWorldPosition(Input);
{
OutPosition = INVARIANT(mul(WorldPos, ResolvedView.TranslatedWorldToClip));
}
#if USE_GLOBAL_CLIP_PLANE
OutGlobalClipPlaneDistance = dot(ResolvedView.GlobalClippingPlane, float4(WorldPos.xyz, 1));
#endif
}