
// Vk3DVision (http://3dsurroundgaming.com/) - Original Shader
#version 450
#extension GL_EXT_nonuniform_qualifier : require
#extension GL_ARB_shader_draw_parameters : require
#extension GL_ARB_shader_ballot : require

out float gl_ClipDistance[1];

invariant gl_Position;

struct S_MATRICES
{
    mat4 _mModelViewProj;
    mat4 _mModelViewProjPrevious;
    mat4 _mModelView;
    mat4 _mInvModelView;
};

struct unaligned_float3
{
    float x;
    float y;
    float z;
};

struct S_INDICES
{
    uint _uiObjectIndex;
    uint _uiMaterialIndex;
    uint _uiMaterialInstanceIndex;
    uint _uiLastFrameMaterialIndex;
    uint _uiLastFrameMaterialInstanceIndex;
    uint _uiPositionsBufferIndex;
    uint _uiPrevPositionsBufferIndex;
    uint _uiNormalsBufferIndex;
    uint _uiPositionOffset;
    uint _uiPrevPositionOffset;
    uint _uiNormalOffset;
    uint _uiMatricesIndex;
};

struct S_MAIN_DEFAULT
{
    S_INDICES _Indices;
};

struct S_MAIN_DEFAULT_ARRAY
{
    S_MAIN_DEFAULT _aMain[32];
};

struct S_SPEEDTREE_MESH_OBJECT
{
    mat4 _mModel;
    mat4 _mModelLast;
    mat4 _mInvModel;
    mat4 _mInvModelLast;
    vec4 _vDiversityOffset;
    uint _uiSceneZoneIndex;
    uint _uiNeighborSceneZoneIndex;
    uint _uiDisplayFlags;
    uint _uiPackedLocalExposureCompensation;
    vec4 _vPortalDirAndDistance;
    int _iPickingID[2];
    uint _uiPadding[2];
    vec4 _vTreeRotation;
    vec4 _vWindGlobal;
    vec4 _vWindVector;
    vec4 _vWindBranchAdherences;
    vec4 _vWindBranch;
    vec4 _vWindBranchTwitch;
    vec4 _vWindBranchWhipTurbulences;
    vec4 _vWindFrondRipple;
    vec4 _vWindLeaf1Ripple;
    vec4 _vWindLeaf1Tumble;
    vec4 _vWindLeaf1Twitch;
    vec4 _vWindLeaf2Ripple;
    vec4 _vWindLeaf2Tumble;
    vec4 _vWindLeaf2Twitch;
    vec4 _vAnchorAllTime;
    vec4 _vRollingBranch;
    vec4 _vRollingLeafOffset;
    vec4 _vRollingNoise;
    uint _uiLOD;
    uint _uiSmooth;
    float _fLocalExposureCompensation;
    float _fLocalExposureCompensationEV100;
    vec4 _vWindGlobalLast;
    vec4 _vWindBranchLast;
    vec4 _vWindFrondRippleLast;
    vec4 _vWindLeaf1RippleLast;
    vec4 _vWindLeaf1TumbleLast;
    vec4 _vWindLeaf1TwitchLast;
    vec4 _vWindLeaf2RippleLast;
    vec4 _vWindLeaf2TumbleLast;
    vec4 _vAnchorAllTimeLast;
};

struct S_PASS_MATRICES
{
    mat4 _mViewJitteredProj;
    mat4 _mViewProj;
    mat4 _mView;
    mat4 _mInvView;
    mat4 _mJitteredProj;
};

struct S_EYE_DATA
{
    S_PASS_MATRICES _mCurrentFrameMatrices[2];
    S_PASS_MATRICES _mPreviousFrameMatrices[2];
    mat4 _mJitteredProjection[2];
    mat4 _mNoJitterProjection[2];
    mat4 _mInvViewJitteredProj[2];
    vec4 _vWorldSpaceCameraVector[2];
    vec4 _vWorldSpaceCameraPosition[2];
    vec4 _vFrameBufferScale;
    vec4 _vFrameBufferViewportSize;
    vec4 _vFrameBufferOneOnViewportSize;
    vec4 _vViewportSize;
    vec4 _vFogSubCrop;
    uint _uiAlignment0;
    uint _uiAlignment1;
    float _vCameraJitterDeltaX;
    float _vCameraJitterDeltaY;
    vec4 _vfRcpFVolumetricFogDepthTileSize;
};

struct S_CASCADED_SHADOW
{
    mat4 _mCascadeMatrix[2][8];
    mat4 _mViewSpaceToStaticShadowMapSpace[2];
    vec4 _vfCascadeShadowAttenuation;
    vec4 _vfShadowCascadeTextureTexelSize;
    vec4 _vfStaticShadowBlurRadius;
    vec4 _vfCascadeLinearZProjFactors[8];
    vec4 _vfCascadeParams[8];
};

struct S_CLUSTER_LIGHT_SETUP
{
    S_CASCADED_SHADOW _CascadedShadow;
    vec4 _vfSkinUVParamsAndNormalBias;
    vec4 _vfShadowTextureTexelSize;
    vec4 _vfDummy_SkinFresnelF0AndF90;
    uint _uiCascadedUsed;
    float _fSSSWidth;
    float _fOffsetBias;
    float _fDummy;
};

struct S_CLUSTER_INFO
{
    mat4 _mViewToClusterView[2];
    mat4 _mClusterProjMatrix;
    mat4 _mClusterInvProjMatrix;
    vec4 _vfLeftEyeToCombinedEyeVsDeltaXZ;
    uint _uiFinestMipWidth;
    uint _uiFinestMipHeight;
    uint _uiFinestMipDepth;
    uint _uiFinestMipWidthHeight;
    float _fZSliceGeomFactor;
    float _fRcpLogZSliceGeomFactor;
    float _fDummy0;
    float _fDummy1;
    float _fNearP;
    float _fInvNearP;
    float _fFarP;
    float _fClusterCoincidentWithCamera;
};

struct S_PASS
{
    S_EYE_DATA _EyeData;
    vec4 _avFrustumCorners[4];
    vec4 _vTime;
    vec4 _cFogColor;
    vec4 _vFogSetup;
    vec4 _cSunColor;
    vec4 _vSunDir;
    vec4 _vProjectionSetup;
    vec4 _vProjectionCoeff;
    vec4 _vOutputColor;
    vec4 _vfVsClippingPlane[2];
    S_CLUSTER_LIGHT_SETUP _LightSetup;
    S_CLUSTER_INFO _ClusterInfo;
    float _fIBLIntensity;
    float _fGIIntensity;
    float _fAmbiantOcclusionDirectIntensity;
    float _fAmbiantOcclusionIndirectIntensity;
    float _fNormalSign;
    int _iFogType;
    float _fSelfOcclusionDebugRatio;
    float _fEmissive;
    int _iEnableSkinSSSSS;
    int _iUseHairOpaquePrepass;
    float _fLocalSceneExposure;
    uint _uiDebugMode;
    uint _sFlags;
    float _fTAADropsSharpness;
    uint _uNeoScaleX;
    uint _uNeoScaleY;
    uint _uiDirectOverdrawFilter;
    float _fCoderTest0;
    float _fCoderTest1;
    float _fCoderTest2;
    uint _uiBakeOutput;
    float _fDefaultAmbientIntensity;
    float _fDefaultLightingIntensity;
    uint _uiOutputColor;
    float _fAARotation;
    float _fClampDirectSpecular;
    float _fNearPlane;
    float _fFarPlane;
    float _fNDFFilteringScreenSpaceVariance;
    float _fNDFFilteringThreshold;
    float _fNDFFilteringScreenSpaceVariance_EyeShader;
    float _fNDFFilteringThreshold_EyeShader;
    float _fSurfaceGradientTextureFiltering;
    float _fZero;
    uint _uDepthClamp;
    uint _uiLightDebugMode;
    vec4 _vfFragCoordToDepthTexFactor;
    vec4 _vfFragCoordToDepthTexFactor_HalfRes;
    uint _uHdr;
    uint _uiDrawMayaSwatch;
    float _fEyeRoughnessBias;
    float _fDummy1;
};

layout(set = 1, binding = 24, std430) readonly buffer stc_g_rbMatrices_Layout
{
    S_MATRICES g_rbMatrices[];
} _426;

layout(set = 1, binding = 39, std430) readonly buffer g_rbVertices_Layout
{
    unaligned_float3 g_rbVertices[];
} g_rbVertices_Buffer[];

layout(set = 0, binding = 52, std140) uniform dyn_CONSTANT_BUFFER_BLOCK_CB_S_MAIN_ARRAY_BINDING
{
    S_MAIN_DEFAULT_ARRAY g_cbMainArray;
} _3310;

layout(set = 1, binding = 33, std430) readonly buffer g_rbObjects_Layout
{
    S_SPEEDTREE_MESH_OBJECT g_rbObjects[];
} g_rbObjects_Buffer[];

layout(set = 2, binding = 53, std140) uniform dyn_CONSTANT_BUFFER_BLOCK_CB_S_PASS_BINDING
{
    S_PASS g_cbPass;
} _3556;

layout(location = 8) in vec2 in_uv0;
layout(location = 10) in vec4 in_lodPosition;
layout(location = 11) in vec4 in_windBranchData;
layout(location = 12) in vec4 in_windExtraDataFlag;
layout(location = 13) in vec4 in_LeafAnchorHint;
layout(location = 23) out float interp_instanceID;

void main()
{
    int _3300 = gl_InstanceIndex + gl_DrawIDARB;
    int _3301 = readFirstInvocationARB(_3300);
    uint _5197 = uint(gl_VertexIndex) + _3310.g_cbMainArray._aMain[_3301]._Indices._uiPositionOffset;
    vec3 _5395 = vec4(g_rbVertices_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiPositionsBufferIndex].g_rbVertices[_5197].x, g_rbVertices_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiPositionsBufferIndex].g_rbVertices[_5197].y, g_rbVertices_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiPositionsBufferIndex].g_rbVertices[_5197].z, 1.0).xyz;
    vec3 _12518;
    if (g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._uiSmooth > 0u)
    {
        _12518 = mix(in_lodPosition.xyz, _5395, vec3(g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vTreeRotation.z));
    }
    else
    {
        _12518 = _5395;
    }
    bool _5914 = g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._uiLOD == 6u;
    bool _5916 = g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._uiLOD == 8u;
    bool _5919 = g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._uiLOD == 9u;
    bool _5924 = g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._uiLOD == 3u;
    bool _5936 = g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._uiLOD == 2u;
    bool _5939 = g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._uiLOD == 5u;
    bool _5942 = g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._uiLOD == 7u;
    float _12526;
    if (true && _5924)
    {
        vec2 _6268 = ((_12518.xy * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vRollingBranch.x) - vec2(g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vRollingLeafOffset.zw)) * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vRollingNoise.y;
        float _6290 = 5.0 * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vRollingNoise.x;
        vec2 _6316 = cos(_6268);
        float _6311 = abs(sin((((3.1415927410125732421875 * _6268.x) * _6290) + (_6268.y * _6290)) + (g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vRollingNoise.w * (_6316.x + _6316.y))));
        float _6278 = _6311 * _6311;
        float _5961 = mix(g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vRollingBranch.y, 1.0, _6278 * _6278);
        float _12527;
        if ((_5914 || _5916) || _5919)
        {
            _12527 = _5961 * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vTreeRotation.z;
        }
        else
        {
            _12527 = _5961;
        }
        _12526 = _12527;
    }
    else
    {
        _12526 = 0.0;
    }
    vec3 _12564;
    if (true && (g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._uiLOD != 0u))
    {
        float _6345 = max(_12518.y - (0.25 / g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindGlobal.z), 0.0) * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindGlobal.z;
        float _12528;
        if (_6345 != 0.0)
        {
            _12528 = pow(abs(_6345), g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindGlobal.w);
        }
        else
        {
            _12528 = _6345;
        }
        vec4 _6421 = abs((fract(vec4(g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindGlobal.x, g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindGlobal.x * 0.800000011920928955078125, 0.0, 0.0) + vec4(0.5)) * 2.0) - vec4(1.0));
        vec4 _6412 = (((_6421 * _6421) * (vec4(3.0) - (_6421 * 2.0))) - vec4(0.5)) * 2.0;
        float _6365 = _6412.y;
        vec2 _6393 = _12518.xz + (g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindVector.xz * (((g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindGlobal.y * (_6412.x + (_6365 * _6365))) + ((g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranchAdherences.x / g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindGlobal.z) * _12526)) * _12528));
        _12564 = (normalize(vec3(_6393.x, _12518.y, _6393.y)) * length(_12518)) - _12518;
    }
    else
    {
        _12564 = vec3(0.0);
    }
    vec3 _12567;
    if (true && ((((((_5924 || _5914) || _5916) || _5919) || _5936) || _5939) || _5942))
    {
        float _6695 = g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranch.x + in_windBranchData.y;
        vec4 _6862 = abs((fract(vec4(_6695, (g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranch.x * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranchTwitch.y) + in_windBranchData.y, (g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranchTwitch.y * 0.5) * _6695, _6695 + (1.0 - in_windBranchData.x)) + vec4(0.5)) * 2.0) - vec4(1.0));
        vec4 _6853 = (((_6862 * _6862) * (vec4(3.0) - (_6862 * 2.0))) - vec4(0.5)) * 2.0;
        float _6721 = _6853.y * _6853.z;
        bool _6724 = _6721 < 0.0;
        float _12544;
        if (_6724)
        {
            _12544 = -_6721;
        }
        else
        {
            _12544 = _6721;
        }
        float _12704 = _6724 ? (-1.0) : 1.0;
        float _6744 = 1.0 - g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindVector.w;
        float _7006 = g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranch.z + in_windBranchData.w;
        vec4 _7173 = abs((fract(vec4(_7006, (g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranch.z * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranchTwitch.w) + in_windBranchData.w, (g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranchTwitch.w * 0.5) * _7006, _7006 + (1.0 - in_windBranchData.z)) + vec4(0.5)) * 2.0) - vec4(1.0));
        vec4 _7164 = (((_7173 * _7173) * (vec4(3.0) - (_7173 * 2.0))) - vec4(0.5)) * 2.0;
        float _7032 = _7164.y * _7164.z;
        bool _7035 = _7032 < 0.0;
        float _12558;
        if (_7035)
        {
            _12558 = -_7032;
        }
        else
        {
            _12558 = _7032;
        }
        float _12705 = _7035 ? (-1.0) : 1.0;
        _12567 = ((_12518 + (((((fract(vec3(in_windBranchData.y) * vec3(0.0625, -1.0, 16.0)).xzy * 2.0) - vec3(1.0)) * in_windBranchData.x) * ((((mix(mix(_6721, _12704, _12544), _12704, _12544) * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranchTwitch.x) * _6744) + (_6853.x * (1.0 - g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranchTwitch.x))) * (1.0 + ((_6853.w * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranchWhipTurbulences.x) * in_windBranchData.x)))) * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranch.y)) + (((((fract(vec3(in_windBranchData.w) * vec3(0.0625, -1.0, 16.0)).xzy * 2.0) - vec3(1.0)) * in_windBranchData.z) * ((((mix(mix(_7032, _12705, _12558), _12705, _12558) * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranchTwitch.z) * _6744) + (_7164.x * (1.0 - g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranchTwitch.z))) * (1.0 + ((_7164.w * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranchWhipTurbulences.y) * in_windBranchData.z)))) * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vWindBranch.w)) - _12518;
    }
    else
    {
        _12567 = vec3(0.0);
    }
    vec3 _12569;
    if (g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._uiLOD == 4u)
    {
        _12569 = _12518 + (_12564 * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vTreeRotation.z);
    }
    else
    {
        vec3 _12570;
        if (_5939)
        {
            _12570 = _12518 + ((_12564 + _12567) * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vTreeRotation.z);
        }
        else
        {
            vec3 _12571;
            if (_5914)
            {
                _12571 = _12518 + ((_12564 + _12567) * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vTreeRotation.z);
            }
            else
            {
                vec3 _12572;
                if (_5942)
                {
                    _12572 = _12518 + (_12564 + (_12567 * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vTreeRotation.z));
                }
                else
                {
                    vec3 _12573;
                    if (_5916)
                    {
                        _12573 = _12518 + (_12564 + (_12567 * g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._vTreeRotation.z));
                    }
                    else
                    {
                        vec3 _12574;
                        if (_5919)
                        {
                            _12574 = _12518 + (_12564 + _12567);
                        }
                        else
                        {
                            vec3 _12575;
                            if (g_rbObjects_Buffer[_3310.g_cbMainArray._aMain[_3301]._Indices._uiObjectIndex].g_rbObjects[0]._uiLOD == 1u)
                            {
                                _12575 = _12518 + _12564;
                            }
                            else
                            {
                                vec3 _12576;
                                if (_5936)
                                {
                                    _12576 = _12518 + (_12564 + _12567);
                                }
                                else
                                {
                                    vec3 _12577;
                                    if (_5924)
                                    {
                                        _12577 = _12518 + (_12564 + _12567);
                                    }
                                    else
                                    {
                                        _12577 = _12518;
                                    }
                                    _12576 = _12577;
                                }
                                _12575 = _12576;
                            }
                            _12574 = _12575;
                        }
                        _12573 = _12574;
                    }
                    _12572 = _12573;
                }
                _12571 = _12572;
            }
            _12570 = _12571;
        }
        _12569 = _12570;
    }
    vec4 _8853 = vec4(_12569, 1.0);
    vec4 _8854 = _426.g_rbMatrices[_3310.g_cbMainArray._aMain[_3301]._Indices._uiMatricesIndex]._mModelView * _8853;
    vec4 _8873 = _426.g_rbMatrices[_3310.g_cbMainArray._aMain[_3301]._Indices._uiMatricesIndex]._mModelViewProj * _8853;
    vec4 _12700;
    if (_3556.g_cbPass._uDepthClamp == 4294967295u)
    {
        float _8907 = _8873.w;
        vec4 _12701;
        if ((_8873.z / _8907) > 1.0)
        {
            vec4 _12702;
            if (_8854.z > _3556.g_cbPass._fNearPlane)
            {
                vec4 _12496 = _8873;
                _12496.z = _8907;
                _12702 = _12496;
            }
            else
            {
                _12702 = _8873;
            }
            _12701 = _12702;
        }
        else
        {
            _12701 = _8873;
        }
        _12700 = _12701;
    }
    else
    {
        _12700 = _8873;
    }
    interp_instanceID = float(_3300) + 0.5;
    float _5077 = _8854.x;
    float _5078 = _8854.y;
    float _5079 = _8854.z;
    vec4 _5080 = vec4(_5077, _5078, _5079, 1.0);
    float _5081 = dot(_3556.g_cbPass._vfVsClippingPlane[0], _5080);
    float _5082 = -_5081;
    gl_ClipDistance[0] = _5082;
    gl_Position = _12700;
}

