
;SHADOWS, SpecREFLECTIONS1
;ShaderRegex made by Losti
[ShaderRegex_0SpecREFLECTIONS1]
shader_model = ps_4_0 ps_5_0 cs_5_0
temps = stereo tmp1 tmp2 tmp3 tmp4 tmp5

[ShaderRegex_0SpecREFLECTIONS1.Pattern]
(?P<section0>
sample_l_indexable\(texture2d\)\(float,float,float,float\) r\d\.[xyzw], v\d\.[xyzw]{4}, t\d\.[xyzw]{4}, s\d\, l\(0\.000000\)\n
)
(?s)(?P<rest0>.*)\n
(?P<section1>
\s*dp4 r\d+\.x, (?P<pos>r\d+)\.xyzw, cb0\[53\]\.xyzw\n
\s*dp4 r\d+\.y, (?P=pos)\.xyzw, cb0\[54\]\.xyzw\n
)
(?P<section2>
\s*dp4 r\d+\.z, (?P=pos)\.xyzw, cb0\[55\]\.xyzw\n
\s*dp4 (?P<depth>r\d+)\.(?P<swizzle>[xyzw]), (?P=pos)\.xyzw, cb0\[(?P<number>\d+)\]\.xyzw\n
\s*div r\d+\.xyz, r\d+\.xyzx, (?P=depth)\.(?P=swizzle)(?P=swizzle)(?P=swizzle)(?P=swizzle)\n
)
(?s)(?P<rest>.*)\n
(?P<section3>
\s*mul r\d\.[xyzw]{3}, (?P<pos2>r\d+)\.yyyy, cb0\[32\]\.[xyzw]{4}\n
\s*mad r\d\.[xyzw]{3}, (?P=pos2)\.xxxx, cb0\[31\]\.[xyzw]{4}, r\d\.[xyzw]{4}\n
)
(?P<section4>
\s*mad r\d\.[xyzw]{3}, (?P=pos2)\.zzzz, cb0\[33\]\.[xyzw]{4}, r\d\.[xyzw]{4}\n
\s*add r\d\.[xyzw]{3}, r\d\.[xyzw]{4}, cb0\[35\]\.[xyzw]{4}\n
)
(?s)(?P<rest2>.*)\n
(?P<section5>
\s*mul r\d\.[xyzw]{3}, (?P=pos)\.yyyy, cb0\[32\]\.[xyzw]{4}\n
\s*mad r\d\.[xyzw]{3}, (?P=pos)\.xxxx, cb0\[31\]\.[xyzw]{4}, r\d\.[xyzw]{4}\n
\s*mad r\d\.[xyzw]{3}, (?P=pos)\.zzzz, cb0\[33\]\.[xyzw]{4}, r\d\.[xyzw]{4}\n
\s*mul r\d\.[xyzw]{3}, r\d\.[xyzw]{4}, cb0\[\d\d\]\.[xyzw]{4}\n
)
[ShaderRegex_0SpecREFLECTIONS1.Pattern.Replace]
\n
${rest0}\n
${section0}\n
// SpecReflections1 by Losti:\n
//fix 1/2\n
ld_indexable(texture2d)(float,float,float,float) ${stereo}.xyzw, l(0, 0, 0, 0), t125.xyzw\n
dp4 ${tmp2}.${swizzle}, ${pos}.xyzw, cb0[52].xyzw\n
mul ${tmp1}.x ${stereo}.y, ${tmp2}.${swizzle}\n
add ${tmp1}.x, ${tmp1}.x, l(-1.0)\n
//add ${tmp1}.x, ${tmp2}.x, l(-1.0)\n
mul ${tmp1}.x, ${stereo}.x, ${tmp1}.x\n
add ${pos}.x, ${pos}.x, ${tmp1}.x\n
//fix 1/2\n
${section1}\n
//skip from cought by another RegEx\n
${section2}\n
${rest}\n
//fix 2/2\n
add ${stereo}.w, -${tmp2}.${swizzle}, ${stereo}.y\n
mul ${stereo}.w, ${stereo}.w, cb0[53].x\n
mul ${stereo}.w, ${stereo}.w, l(1.6)\n
mad ${pos2}.x, ${stereo}.w, ${stereo}.x, ${pos2}.x\n
//fix 2/2\n
// SpecReflections1 by DHR and Losti:\n
${section3}\n
//skip from cought by another RegEx\n
${section4}\n
${rest2}\n
${section5}\n
\n
[ShaderRegex_0SpecREFLECTIONS1.InsertDeclarations]
dcl_resource_texture2d (float,float,float,float) t125
;*********************************************************************************************


;SHADOWS, SpecREFLECTIONS2
;ShaderRegex made by Losti
[ShaderRegex_0SpecREFLECTIONS2]
shader_model = ps_4_0 ps_5_0 cs_5_0
temps = stereo tmp1 tmp2 tmp3 tmp4 tmp5
[ShaderRegex_0SpecREFLECTIONS2.Pattern]
(?P<section0>
sample_l_indexable\(texture2d\)\(float,float,float,float\) r\d\.[xyzw], v\d\.[xyzw]{4}, t\d\.[xyzw]{4}, s\d\, l\(0\.000000\)\n
)
(?s)(?P<rest0>.*)\n
(?P<section1>
\s*dp4 r\d+\.x, (?P<pos>r\d+)\.xyzw, cb0\[53\]\.xyzw\n
\s*dp4 r\d+\.y, (?P=pos)\.xyzw, cb0\[54\]\.xyzw\n
)
(?P<section2>
\s*dp4 r\d+\.z, (?P=pos)\.xyzw, cb0\[55\]\.xyzw\n
\s*dp4 (?P<depth>r\d+)\.(?P<swizzle>[xyzw]), (?P=pos)\.xyzw, cb0\[(?P<number>\d+)\]\.xyzw\n
\s*div r\d+\.xyz, r\d+\.xyzx, (?P=depth)\.(?P=swizzle)(?P=swizzle)(?P=swizzle)(?P=swizzle)\n
)
(?s)(?P<rest>.*)\n
(?P<section3>
\s*mul r\d\.[xyzw]{3}, (?P<pos2>r\d+)\.yyyy, cb0\[32\]\.[xyzw]{4}\n
\s*mad r\d\.[xyzw]{3}, (?P=pos2)\.xxxx, cb0\[31\]\.[xyzw]{4}, r\d\.[xyzw]{4}\n
\s*mad r\d\.[xyzw]{3}, (?P=pos2)\.zzzz, cb0\[33\]\.[xyzw]{4}, r\d\.[xyzw]{4}\n
\s*add r\d\.[xyzw]{3}, r\d\.[xyzw]{4}, cb0\[35\]\.[xyzw]{4}\n
)
[ShaderRegex_0SpecREFLECTIONS2.Pattern.Replace]
\n
${rest0}\n
${section0}\n
// SpecReflections2 by Losti:\n
//fix 1/2\n
ld_indexable(texture2d)(float,float,float,float) ${stereo}.xyzw, l(0, 0, 0, 0), t125.xyzw\n
dp4 ${tmp2}.${swizzle}, ${pos}.xyzw, cb0[52].xyzw\n
mul ${tmp1}.x ${stereo}.y, ${tmp2}.${swizzle}\n
add ${tmp1}.x, ${tmp1}.x, l(-1.0)\n
//add ${tmp1}.x, ${tmp2}.x, l(-1.0)\n
mul ${tmp1}.x, ${stereo}.x, ${tmp1}.x\n
add ${pos}.x, ${pos}.x, ${tmp1}.x\n
//fix 1/2\n
// SpecReflections2 by DHR and Losti:\n
${section1}\n
//skip from cought by another RegEx\n
${section2}\n
${rest}\n
//fix 2/2\n
add ${stereo}.w, -${tmp2}.${swizzle}, ${stereo}.y\n
mul ${stereo}.w, ${stereo}.w, l(0.8)\n
mad ${pos2}.x, ${stereo}.w, ${stereo}.x, ${pos2}.x\n
//fix 2/2\n
${section3}\n
\n
[ShaderRegex_0SpecREFLECTIONS2.InsertDeclarations]
dcl_resource_texture2d (float,float,float,float) t125
;*********************************************************************************************






;*********************************************************************************************
;SHADOWS, LIGHTS, REFLECTIONS AND DECALS 1
;ShaderRegex made by DHR
[ShaderRegex_Shadows1]
shader_model = ps_4_0 ps_5_0 cs_5_0
temps = stereo tmp1 tmp2 tmp3 tmp4 tmp5

[ShaderRegex_Shadows1.Pattern]
;mov (?P<pos>r\d+)\.w, l\(1\.000000\)\n
\s*dp4 r\d+\.x, (?P<pos>r\d+)\.xyzw, cb0\[53\]\.xyzw\n
\s*dp4 r\d+\.y, (?P=pos)\.xyzw, cb0\[54\]\.xyzw\n
\s*dp4 r\d+\.z, (?P=pos)\.xyzw, cb0\[55\]\.xyzw\n
\s*dp4 (?P<depth>r\d+)\.(?P<swizzle>[xyzw]), (?P=pos)\.xyzw, cb0\[(?P<number>\d+)\]\.xyzw\n
\s*div r\d+\.xyz, r\d+\.xyzx, (?P=depth)\.(?P=swizzle)(?P=swizzle)(?P=swizzle)(?P=swizzle)\n

[ShaderRegex_Shadows1.Pattern.Replace]
\n
;\n
;//To use for Contact Shadows if needed\n
;dp4 ${tmp3}.x, ${pos}.xyzw, cb0[53].xyzw\n
;dp4 ${tmp3}.y, ${pos}.xyzw, cb0[54].xyzw\n
;dp4 ${tmp3}.z, ${pos}.xyzw, cb0[55].xyzw\n
;dp4 ${tmp4}.${swizzle}, ${pos}.xyzw, cb0[56].xyzw\n
;div ${tmp5}.xyz, ${tmp3}.xyzx, ${tmp4}.${swizzle}${swizzle}${swizzle}${swizzle}\n
;\n
\n
// Pattern Fix for Shadows, Lights and Reflections 1:\n
ld_indexable(texture2d)(float,float,float,float) ${stereo}.xyzw, l(0, 0, 0, 0), t125.xyzw\n
dp4 ${tmp2}.${swizzle}, ${pos}.xyzw, cb0[${number}].xyzw\n
mul ${tmp1}.x ${stereo}.y, ${tmp2}.${swizzle}\n
add ${tmp1}.x, ${tmp1}.x, l(-1.0)\n
mul ${tmp1}.x, ${stereo}.x, ${tmp1}.x\n
add ${pos}.x, ${pos}.x, ${tmp1}.x\n
\n
${0}

[ShaderRegex_Shadows1.InsertDeclarations]
dcl_resource_texture2d (float,float,float,float) t125

;*********************************************************************************************
; LIGHTS SHAFTS AND VOLUMETRIC FOG
[ShaderRegex_Lights_Shafts1]
shader_model = ps_4_0 ps_5_0
temps = stereo tmp1 tmp2

[ShaderRegex_Lights_Shafts1.Pattern]
(?P<section1>
mov (?P<pos>r\d+)\.xy, v1\.zwzz\n
)
(?P<section2>
mov (?P=pos)\.zw, l\(0,0,1\.000000,1\.000000\)\n
)
(?P<section3>
\s*dp4 (?P<pos_x>r\d+)\.x, (?P=pos)\.xyww, cb0\[53\]\.xyzw\n
\s*dp4 (?P=pos_x)\.y, (?P=pos)\.xyww, cb0\[54\]\.xyzw\n
\s*dp4 (?P=pos_x)\.z, (?P=pos)\.xyww, cb0\[55\]\.xyzw\n
\s*dp4 (?P<depth>r\d+)\.(?P<swizzle>[xyzw]), (?P=pos)\.xyzw, cb0\[(?P<number>\d+)\]\.xyzw\n
\s*div (?P=pos)\.xyz, (?P=pos_x)\.xyzx, (?P=depth)\.(?P=swizzle)(?P=swizzle)(?P=swizzle)(?P=swizzle)\n
)

[ShaderRegex_Lights_Shafts1.Pattern.Replace]
\n
sample_l_indexable(texture2d)(float,float,float,float) ${pos}.z, v1.xyzx, t1.yzxw, s1, l(0.000000)\n
${section1}
mov ${pos}.w, l(1.000000)\n
\n
// Pattern Fix for Lights Shafts 1:\n
ld_indexable(texture2d)(float,float,float,float) ${stereo}.xyzw, l(0, 0, 0, 0), t125.xyzw\n
dp4 ${tmp2}.${swizzle}, ${pos}.xyzw, cb0[${number}].xyzw\n
mul ${tmp1}.x ${stereo}.y, ${tmp2}.${swizzle}\n
add ${tmp1}.x, ${tmp1}.x, l(-1.0)\n
mul ${tmp1}.x, ${stereo}.x, ${tmp1}.x\n
add ${pos}.x, ${pos}.x, ${tmp1}.x\n
\n
${section3}
;dp4 ${pos_x}.x, ${pos}.xyzw, cb0[53].xyzw\n
;dp4 ${pos_x}.y, ${pos}.xyzw, cb0[54].xyzw\n
;dp4 ${pos_x}.z, ${pos}.xyzw, cb0[55].xyzw\n
;dp4 ${depth}.${swizzle}, ${pos}.xyzw, cb0[56].xyzw\n
;div ${pos}.xyz, ${pos_x}.xyzx, ${depth}.${swizzle}${swizzle}${swizzle}${swizzle}\n


[ShaderRegex_Lights_Shafts1.InsertDeclarations]
dcl_resource_texture2d (float,float,float,float) t125
