Skip to main content

Global Shadow Mask Default Dx9 Fetch4 Slice2

(global_shadow_mask:default:DX9_FETCH4:SLICE2, 0xe4858682045c5611)

This template is referenced 1 time by global_shadow_mask:SLICE2.

Technique ambient

Render States

More info can be found on the Direct3D Docs

enum D3DRENDERSTATETYPE {
D3DRS_ZENABLE = 1,
D3DRS_ZFUNC = 7,
D3DRS_ZWRITEENABLE = 0,
D3DRS_ALPHABLENDENABLE = 0,
D3DRS_CULLMODE = 1,
D3DRS_COLORWRITEENABLE = 8,
D3DRS_COLORWRITEENABLE1 = 15,
D3DRS_COLORWRITEENABLE2 = 15,
D3DRS_STENCILENABLE = 0,
D3DRS_STENCILFUNC = 1,
D3DRS_STENCILFAIL = 1,
D3DRS_STENCILMASK = 0,
D3DRS_STENCILPASS = 1,
D3DRS_STENCILREF = 0,
D3DRS_STENCILWRITEMASK = 0,
D3DRS_STENCILZFAIL = 1,
D3DRS_DEPTHBIAS = 0,
D3DRS_SLOPESCALEDEPTHBIAS = 0,
D3DRS_FOGENABLE = 0,
D3DRS_SPECULARENABLE = 0,
D3DRS_ADAPTIVETESS_X = 0,
D3DRS_ADAPTIVETESS_Z = 0,
D3DRS_ADAPTIVETESS_W = 0,
D3DRS_SRGBWRITEENABLE = 0,
D3DRS_SEPARATEALPHABLENDENABLE = 0,
D3DRS_ALPHATESTENABLE = 0,
};

Sampler States

More info can be found on the Direct3D Docs

Sampler 0

enum D3DSAMPLERSTATETYPE {
D3DSAMP_MIPMAPLODBIAS = 827606343,
D3DSAMP_SRGBTEXTURE = 0,
D3DSAMP_ADDRESSU = 3,
D3DSAMP_ADDRESSV = 3,
D3DSAMP_MAGFILTER = 1,
D3DSAMP_MINFILTER = 1,
D3DSAMP_MIPFILTER = 1,
};

Sampler 1

enum D3DSAMPLERSTATETYPE {
D3DSAMP_MIPMAPLODBIAS = 877937991,
D3DSAMP_SRGBTEXTURE = 0,
D3DSAMP_ADDRESSU = 3,
D3DSAMP_ADDRESSV = 3,
D3DSAMP_MAGFILTER = 2,
D3DSAMP_MINFILTER = 2,
D3DSAMP_MIPFILTER = 2,
};

Shaders

Vertex Shader

column_major float4x4 camera_inv_view_matrix : register(vs_3_0, c4);
float3 camera_unprojection : register(vs_3_0, c7);
float ref_depth_clip_space : register(vs_3_0, c8);
column_major float4x4 view_proj_matrix : register(vs_3_0, c0);
struct VertexMain_Input
{
float4 position : POSITION;
float4 texcoord : TEXCOORD;
};

struct VertexMain_Output
{
float4 position : POSITION;
float2 texcoord : TEXCOORD;
float3 texcoord1 : TEXCOORD1;
};

VertexMain_Output VertexMain(VertexMain_Input i)
{
VertexMain_Output o;
float2 temp0;
float3 temp1;
// def c9, 1, 0, 0, 0
// dcl_position v0
// dcl_texcoord v1
// dcl_position o0
// dcl_texcoord o1.xy
// dcl_texcoord1 o2.xyz
// dp4 o0.w, v0, c3
o.position.w = dot(i.position, (view_proj_matrix._m03_m13_m23_m33));
// dp4 r0.x, v0, c0
temp0.x = dot(i.position, (view_proj_matrix._m00_m10_m20_m30));
// dp4 r0.y, v0, c1
temp0.y = dot(i.position, (view_proj_matrix._m01_m11_m21_m31));
// mul r1.xy, r0, c7
temp1.xy = temp0.xy * camera_unprojection.xy;
// mov o0.xy, r0
o.position.xy = temp0.xy;
// mov r1.z, c9.x
temp1.z = float1(1);
// dp3 o2.x, r1, c4
o.texcoord1.x = dot(temp1.xyz, (camera_inv_view_matrix._m00_m10_m20_m30).xyz);
// dp3 o2.y, r1, c5
o.texcoord1.y = dot(temp1.xyz, (camera_inv_view_matrix._m01_m11_m21_m31).xyz);
// dp3 o2.z, r1, c6
o.texcoord1.z = dot(temp1.xyz, (camera_inv_view_matrix._m02_m12_m22_m32).xyz);
// mov o0.z, c8.x
o.position.z = ref_depth_clip_space.x;
// mov o1.xy, v1
o.texcoord = i.texcoord;
//

return o;
}

Decompiled by DXDecompiler.

Pixel Shader

column_major float4x4 camera_world_matrix : register(ps_3_0, c11);
sampler2D depth : register(ps_3_0, s0);
sampler2D displacement_texture : register(ps_3_0, s1);
float3 displacement_texture_size : register(ps_3_0, c16);
column_major float4x4 global_shadow_projection[3] : register(ps_3_0, c0);
float3 ref_shadow_slice_depths : register(ps_3_0, c14);
float3 ref_shadow_slice_overlap : register(ps_3_0, c15);
struct PixelMain_Input
{
float2 texcoord : TEXCOORD;
float3 texcoord1 : TEXCOORD1;
};

float4 PixelMain(PixelMain_Input i) : COLOR
{
float4 out_color;
float4 temp0, temp1, temp2, temp4, temp5, temp6, temp7, temp8, temp9, temp10;
float3 temp3;
// def c17, 0, 1, 2, -1
// def c18, 0.11111111, 0, 0, 0
// dcl_texcoord v0.xy
// dcl_texcoord1 v1.xyz
// dcl_2d s0
// dcl_2d s1
// mov r0.z, c17.y
temp0.z = float1(1);
// texld r1, v0, s0
temp1 = tex2D(depth, i.texcoord.xy);
// add r1.yz, -r1.x, c14.xyxw
temp1.yz = -temp1.xx + ref_shadow_slice_depths.yx;
// cmp r1.z, r1.z, c17.x, c17.y
temp1.z = (temp1.z >= 0) ? float1(0) : float1(1);
// cmp r1.y, r1.y, r1.z, c17.z
temp1.y = (temp1.y >= 0) ? temp1.z : float1(2);
// add r2.xyz, r1.y, -c17
temp2.xyz = temp1.yyy + float3(-0, -1, -2);
// mov r3.x, c17.x
temp3.x = float1(0);
// cmp r4, -r2_abs.x, c0, r3.x
temp4 = (-abs(temp2).x >= 0) ? (global_shadow_projection[0]._m00_m10_m20_m30) : temp3.x;
// cmp r4, -r2_abs.y, c4, r4
temp4 = (-abs(temp2).y >= 0) ? (global_shadow_projection[1]._m00_m10_m20_m30) : temp4;
// cmp r4, -r2_abs.z, c8, r4
temp4 = (-abs(temp2).z >= 0) ? (global_shadow_projection[2]._m00_m10_m20_m30) : temp4;
// mov r5.w, c17.y
temp5.w = float1(1);
// mad r5.x, v1.x, r1.x, c11.w
temp5.x = i.texcoord1.x * temp1.x + (camera_world_matrix._m00_m10_m20_m30).w;
// mad r5.y, v1.y, r1.x, c12.w
temp5.y = i.texcoord1.y * temp1.x + (camera_world_matrix._m01_m11_m21_m31).w;
// mad r5.z, v1.z, r1.x, c13.w
temp5.z = i.texcoord1.z * temp1.x + (camera_world_matrix._m02_m12_m22_m32).w;
// dp4 r4.x, r5, r4
temp4.x = dot(temp5, temp4);
// cmp r6, -r2_abs.x, c1, r3.x
temp6 = (-abs(temp2).x >= 0) ? (global_shadow_projection[0]._m01_m11_m21_m31) : temp3.x;
// cmp r6, -r2_abs.y, c5, r6
temp6 = (-abs(temp2).y >= 0) ? (global_shadow_projection[1]._m01_m11_m21_m31) : temp6;
// cmp r6, -r2_abs.z, c9, r6
temp6 = (-abs(temp2).z >= 0) ? (global_shadow_projection[2]._m01_m11_m21_m31) : temp6;
// dp4 r4.y, r5, r6
temp4.y = dot(temp5, temp6);
// rcp r6.x, c16.x
temp6.x = 1.0f / displacement_texture_size.x;
// rcp r6.y, c16.y
temp6.y = 1.0f / displacement_texture_size.y;
// add r1.zw, r4.xyxy, -r6.xyxy
temp1.zw = temp4.xy + -temp6.xy;
// texld r7, r1.zwzw, s1
temp7 = tex2D(displacement_texture, temp1.zw);
// cmp r8, -r2_abs.x, c2, r3.x
temp8 = (-abs(temp2).x >= 0) ? (global_shadow_projection[0]._m02_m12_m22_m32) : temp3.x;
// cmp r8, -r2_abs.y, c6, r8
temp8 = (-abs(temp2).y >= 0) ? (global_shadow_projection[1]._m02_m12_m22_m32) : temp8;
// cmp r2, -r2_abs.z, c10, r8
temp2 = (-abs(temp2).z >= 0) ? (global_shadow_projection[2]._m02_m12_m22_m32) : temp8;
// dp4 r1.z, r5, r2
temp1.z = dot(temp5, temp2);
// add r2, -r7, r1.z
temp2 = -temp7 + temp1.z;
// cmp r2, r2, c17.x, c17.y
temp2 = (temp2 >= 0) ? float4(0, 0, 0, 0) : float4(1, 1, 1, 1);
// mul r3.yz, r4.xxyw, c16.xxyw
temp3.yz = temp4.xy * displacement_texture_size.xy;
// frc r7.xy, r3.yzzw
temp7.xy = frac(temp3.yz);
// add r8.xy, -r7, c17.y
temp8.xy = -temp7.xy + float2(1, 1);
// mov r8.z, c17.y
temp8.z = float1(1);
// mul r0.xyw, r8.yxzy, r8.zzzx
temp0.xyw = temp8.yxy * temp8.zzx;
// dp4 r0.x, r2, r0
temp0.x = dot(temp2, temp0);
// mov r2.y, c17.y
temp2.y = float1(1);
// mad r9, r6.xyxy, c17.ywwy, r4.xyxy
temp9 = temp6.xyxy * float4(1, -1, -1, 1) + temp4.xyxy;
// add r0.yz, r4.xxyw, r6.xxyw
temp0.yz = temp4.xy + temp6.xy;
// texld r4, r0.yzzw, s1
temp4 = tex2D(displacement_texture, temp0.yz);
// add r4, r1.z, -r4
temp4 = temp1.z + -temp4;
// cmp r4, r4, c17.x, c17.y
temp4 = (temp4 >= 0) ? float4(0, 0, 0, 0) : float4(1, 1, 1, 1);
// texld r10, r9, s1
temp10 = tex2D(displacement_texture, temp9.xy);
// texld r9, r9.zwzw, s1
temp9 = tex2D(displacement_texture, temp9.zw);
// add r9, r1.z, -r9
temp9 = temp1.z + -temp9;
// add r10, r1.z, -r10
temp10 = temp1.z + -temp10;
// cmp r10, r10, c17.x, c17.y
temp10 = (temp10 >= 0) ? float4(0, 0, 0, 0) : float4(1, 1, 1, 1);
// cmp r9, r9, c17.x, c17.y
temp9 = (temp9 >= 0) ? float4(0, 0, 0, 0) : float4(1, 1, 1, 1);
// mov r7.zw, c17.y
temp7.zw = float2(1, 1);
// mul r2.xzw, r7.xyxz, r8.yyzy
temp2.xzw = temp7.xxz * temp8.yzy;
// mul r8.yzw, r7.xyyz, r8.xxzx
temp8.yzw = temp7.yyz * temp8.xzx;
// mul r7.xyz, r7.zzyw, r7.xyxw
temp7.xyz = temp7.zzy * temp7.xyx;
// dp4 r0.y, r10, r2
temp0.y = dot(temp10, temp2);
// add r0.x, r0.y, r0.x
temp0.x = temp0.y + temp0.x;
// mov r8.x, c17.y
temp8.x = float1(1);
// dp4 r0.y, r9, r8
temp0.y = dot(temp9, temp8);
// add r0.x, r0.y, r0.x
temp0.x = temp0.y + temp0.x;
// dp4 r0.y, r4, r7
temp0.y = dot(temp4, temp7);
// add r0.x, r0.y, r0.x
temp0.x = temp0.y + temp0.x;
// mov r2.xyz, c14
temp2.xyz = ref_shadow_slice_depths.xyz;
// add r0.yzw, r2.xyxz, -c15.xyxz
temp0.yzw = temp2.yxz + -ref_shadow_slice_overlap.yxz;
// add r2.xyz, -r1.x, r0.yzww
temp2.xyz = -temp1.xxx + temp0.yzw;
// add r0.y, -r0.w, r1.x
temp0.y = -temp0.w + temp1.x;
// cmp r0.z, r2.y, c17.x, c17.y
temp0.z = (temp2.y >= 0) ? float1(0) : float1(1);
// cmp r0.z, r2.x, r0.z, c17.z
temp0.z = (temp2.x >= 0) ? temp0.z : float1(2);
// add r2.xyw, r0.z, -c17.xyzz
temp2.xyw = temp0.zzz + float3(-0, -1, -2);
// cmp r4, -r2_abs.x, c0, r3.x
temp4 = (-abs(temp2).x >= 0) ? (global_shadow_projection[0]._m00_m10_m20_m30) : temp3.x;
// cmp r4, -r2_abs.y, c4, r4
temp4 = (-abs(temp2).y >= 0) ? (global_shadow_projection[1]._m00_m10_m20_m30) : temp4;
// cmp r4, -r2_abs.w, c8, r4
temp4 = (-abs(temp2).w >= 0) ? (global_shadow_projection[2]._m00_m10_m20_m30) : temp4;
// dp4 r4.x, r5, r4
temp4.x = dot(temp5, temp4);
// cmp r7, -r2_abs.x, c1, r3.x
temp7 = (-abs(temp2).x >= 0) ? (global_shadow_projection[0]._m01_m11_m21_m31) : temp3.x;
// cmp r7, -r2_abs.y, c5, r7
temp7 = (-abs(temp2).y >= 0) ? (global_shadow_projection[1]._m01_m11_m21_m31) : temp7;
// cmp r7, -r2_abs.w, c9, r7
temp7 = (-abs(temp2).w >= 0) ? (global_shadow_projection[2]._m01_m11_m21_m31) : temp7;
// dp4 r4.y, r5, r7
temp4.y = dot(temp5, temp7);
// add r1.zw, -r6.xyxy, r4.xyxy
temp1.zw = -temp6.xy + temp4.xy;
// texld r7, r1.zwzw, s1
temp7 = tex2D(displacement_texture, temp1.zw);
// cmp r8, -r2_abs.x, c2, r3.x
temp8 = (-abs(temp2).x >= 0) ? (global_shadow_projection[0]._m02_m12_m22_m32) : temp3.x;
// cmp r8, -r2_abs.y, c6, r8
temp8 = (-abs(temp2).y >= 0) ? (global_shadow_projection[1]._m02_m12_m22_m32) : temp8;
// cmp r8, -r2_abs.w, c10, r8
temp8 = (-abs(temp2).w >= 0) ? (global_shadow_projection[2]._m02_m12_m22_m32) : temp8;
// dp4 r0.w, r5, r8
temp0.w = dot(temp5, temp8);
// add r5, -r7, r0.w
temp5 = -temp7 + temp0.w;
// cmp r5, r5, c17.x, c17.y
temp5 = (temp5 >= 0) ? float4(0, 0, 0, 0) : float4(1, 1, 1, 1);
// mov r7.z, c17.y
temp7.z = float1(1);
// mul r1.zw, r4.xyxy, c16.xyxy
temp1.zw = temp4.xy * displacement_texture_size.xy;
// frc r8.xy, r1.zwzw
temp8.xy = frac(temp1.zw);
// add r9.xy, -r8, c17.y
temp9.xy = -temp8.xy + float2(1, 1);
// mov r9.z, c17.y
temp9.z = float1(1);
// mul r7.xyw, r9.yxzy, r9.zzzx
temp7.xyw = temp9.yxy * temp9.zzx;
// dp4 r1.z, r5, r7
temp1.z = dot(temp5, temp7);
// mad r5, r6.xyxy, c17.ywwy, r4.xyxy
temp5 = temp6.xyxy * float4(1, -1, -1, 1) + temp4.xyxy;
// add r2.xy, r6, r4
temp2.xy = temp6.xy + temp4.xy;
// texld r4, r2, s1
temp4 = tex2D(displacement_texture, temp2.xy);
// add r4, r0.w, -r4
temp4 = temp0.w + -temp4;
// cmp r4, r4, c17.x, c17.y
temp4 = (temp4 >= 0) ? float4(0, 0, 0, 0) : float4(1, 1, 1, 1);
// texld r6, r5, s1
temp6 = tex2D(displacement_texture, temp5.xy);
// texld r5, r5.zwzw, s1
temp5 = tex2D(displacement_texture, temp5.zw);
// add r5, r0.w, -r5
temp5 = temp0.w + -temp5;
// add r6, r0.w, -r6
temp6 = temp0.w + -temp6;
// cmp r6, r6, c17.x, c17.y
temp6 = (temp6 >= 0) ? float4(0, 0, 0, 0) : float4(1, 1, 1, 1);
// cmp r5, r5, c17.x, c17.y
temp5 = (temp5 >= 0) ? float4(0, 0, 0, 0) : float4(1, 1, 1, 1);
// mov r8.zw, c17.y
temp8.zw = float2(1, 1);
// mul r7.xzw, r8.xyxz, r9.yyzy
temp7.xzw = temp8.xxz * temp9.yzy;
// mul r9.yzw, r8.xyyz, r9.xxzx
temp9.yzw = temp8.yyz * temp9.xzx;
// mul r8.xyz, r8.zzyw, r8.xyxw
temp8.xyz = temp8.zzy * temp8.xyx;
// mov r7.y, c17.y
temp7.y = float1(1);
// dp4 r0.w, r6, r7
temp0.w = dot(temp6, temp7);
// add r0.w, r0.w, r1.z
temp0.w = temp0.w + temp1.z;
// mov r9.x, c17.y
temp9.x = float1(1);
// dp4 r1.z, r5, r9
temp1.z = dot(temp5, temp9);
// add r0.w, r0.w, r1.z
temp0.w = temp0.w + temp1.z;
// dp4 r1.z, r4, r8
temp1.z = dot(temp4, temp8);
// add r0.w, r0.w, r1.z
temp0.w = temp0.w + temp1.z;
// mul r0.w, r0.w, c18.x
temp0.w = temp0.w * float1(0.11111111);
// mad r1.z, r0.x, c18.x, -r0.w
temp1.z = temp0.x * float1(0.11111111) + -temp0.w;
// mul r0.x, r0.x, c18.x
temp0.x = temp0.x * float1(0.11111111);
// add r2.xy, r0.z, -c17.yzzw
temp2.xy = temp0.zz + float2(-1, -2);
// add r0.z, -r0.z, r1.y
temp0.z = -temp0.z + temp1.y;
// cmp r1.yw, -r2_abs.xxzy, c17.y, c17.x
temp1.yw = (-abs(temp2).xy >= 0) ? float2(1, 1) : float2(0, 0);
// dp2add r1.x, c14, r1.ywzw, -r1.x
temp1.x = dot(ref_shadow_slice_depths.xy, temp1.yw) + -temp1.x;
// dp2add r1.y, c15, r1.ywzw, r3.x
temp1.y = dot(ref_shadow_slice_overlap.xy, temp1.yw) + temp3.x;
// rcp r1.y, r1.y
temp1.y = 1.0f / temp1.y;
// mul r1.x, r1.y, r1.x
temp1.x = temp1.y * temp1.x;
// mad r0.w, r1.x, r1.z, r0.w
temp0.w = temp1.x * temp1.z + temp0.w;
// cmp r0.x, -r0_abs.z, r0.x, r0.w
temp0.x = (-abs(temp0).z >= 0) ? temp0.x : temp0.w;
// rcp r0.z, c15.z
temp0.z = 1.0f / ref_shadow_slice_overlap.z;
// mul_sat r0.y, r0.z, r0.y
temp0.y = saturate(temp0.z * temp0.y);
// add_sat r0.y, r0.y, r0.x
temp0.y = saturate(temp0.y + temp0.x);
// cmp oC0, r2.z, r0.x, r0.y
out_color = (temp2.z >= 0) ? temp0.x : temp0.y;
//

return out_color;
}

Decompiled by DXDecompiler.