// CRC32: DF7A050C | Matched 45 variants of 1 shaders: Hidden/Internal-PrePassLighting
// 
//               Unity headers extracted from Internal-PrePassLighting.shader
//               Shader "Hidden/Internal-PrePassLighting" {
//                 Properties {
//                  _LightTexture0 ("", any) = "" {}
//                  _LightTextureB0 ("", 2D) = "" {}
//                  _ShadowMapTexture ("", any) = "" {}
//                 }
//                 Fallback Off
//                 SubShader 1/1 {
// 000000007fff:     Pass 1/3 {
// 00003fff8000:     Pass 2/3 {
// 1fffc0000000:     Pass 3/3 {
//                     Tags { "ShadowSupport"="True" }
//                     ZWrite Off
//                     Fog { Mode Off }
// 000000007fff:       Blend DstColor Zero
// 1fffffff8000:       Blend One One
//                     Program "vp" {
//                       SubProgram "d3d9 " {
// 000080010002:           Keywords { "DIRECTIONAL" "SHADOWS_OFF" }
// 002000400080:           Keywords { "DIRECTIONAL" "SHADOWS_SCREEN" }
// 000400080010:           Keywords { "DIRECTIONAL_COOKIE" "SHADOWS_OFF" }
// 004000800100:           Keywords { "DIRECTIONAL_COOKIE" "SHADOWS_SCREEN" }
// 080010002000:           Keywords { "POINT" "SHADOWS_CUBE" "SHADOWS_SOFT" }
// 008001000200:           Keywords { "POINT" "SHADOWS_CUBE" }
// 000040008001:           Keywords { "POINT" "SHADOWS_OFF" }
// 100020004000:           Keywords { "POINT_COOKIE" "SHADOWS_CUBE" "SHADOWS_SOFT" }
// 010002000400:           Keywords { "POINT_COOKIE" "SHADOWS_CUBE" }
// 000200040008:           Keywords { "POINT_COOKIE" "SHADOWS_OFF" }
// 040008001000:           Keywords { "SHADOWS_DEPTH" "SHADOWS_NATIVE" "SHADOWS_SOFT" "SPOT" }
// 001000200040:           Keywords { "SHADOWS_DEPTH" "SHADOWS_NATIVE" "SPOT" }
// 020004000800:           Keywords { "SHADOWS_DEPTH" "SHADOWS_SOFT" "SPOT" }
// 000800100020:           Keywords { "SHADOWS_DEPTH" "SPOT" }
// 000100020004:           Keywords { "SHADOWS_OFF" "SPOT" }
//                         Bind "vertex" Vertex
//                         Bind "normal" Normal
//                         Matrix 0 [glstate_matrix_modelview0]
//                         Matrix 4 [glstate_matrix_mvp]
//                         Vector 8 [_ProjectionParams]
//                         Vector 9 [_ScreenParams]
//                         Float 10 [_LightAsQuad]
//                       }
//                     }
//                   }
//                 }
//               }
// 
// Headers extracted with DarkStarSword's extract_unity_shaders.py
// https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/extract_unity_shaders.py

    vs_3_0
    dcl_position o0
    dcl_texcoord0 o1
    dcl_texcoord1 o2
    def c11, 0.50000000, -1.00000000, 1.00000000, 0
    dcl_position0 v0
    dcl_normal0 v1

def c220, 0, 1, 0.0625, 0.5
dcl_2d s0

    dp4 r0.w, v0, c7
    dp4 r0.z, v0, c6
    dp4 r0.x, v0, c4
    dp4 r0.y, v0, c5
    mov o0, r0 // moved up before the stereo correction

// Apply stereo correction to screen coords stored in texcoord:
texldl r31, c220.z, s0
add r31.w, r0.w, -r31.y
mul r31.w, r31.w, r31.x
add r0.x, r0.x, r31.w

    mul r1.xyz, r0.xyww, c11.x
    mul r1.y, r1, c8.x
    dp4 r2.z, v0, c2
    dp4 r2.x, v0, c0
    dp4 r2.y, v0, c1

// This is a simplified version of the maths to find P.I[0,0] from MV.I and MVP
// For a detailed explanation of what we are doing here, see this thread:
// https://forums.geforce.com/default/topic/781954/3d-vision/dreamfall-chapters/post/4352670/#4352670

// Transpose first component of the MV.I matrix regs into r30:
mov r30.x, c180.x
mov r30.y, c181.x
mov r30.z, c182.x
mov r30.w, c183.x
dp4 r30.x, r30, c4 // Calculate P[0,0]
rcp r30.x, r30.x // Calculate P.I[0,0]

mad r2.x, r31.w, r30.x, r2.x

    mad o1.xy, r1.z, c9.zwzw, r1
    mad r1.xyz, -r2, c11.yyzw, v1
    mul r2.xyz, r2, c11.yyzw
    mad o2.xyz, r1, c10.x, r2
    mov o1.zw, r0
