//
// Generated by Microsoft (R) HLSL Shader Compiler 9.23.949.2378
//
// Parameters:
//
//   sampler2D StippleTexture;
//   sampler2D TextureSampler;
//   float4 globalScalars;
//   float4 stencil;
//
//
// Registers:
//
//   Name           Reg   Size
//   -------------- ----- ----
//   globalScalars  c39      1
//   stencil        c52      1
//   TextureSampler s0       1
//   StippleTexture s10      1
//

    ps_3_0
    def c0, -1, 0, 9.99999975e-006, 1
    def c1, 3.99600005, 4, 0.125, 0.25
    def c2, 0.5, 0, 1, 0.25
def c150, 0.0, 1.0, 0.0, 0.0
def c175, 0.0, 0.5, 2.0, -1.0
//x - clamp level, y - bump level mix, w - diffuse mix
def c177, 1.4, 4.0, 3.0, 0.35
    dcl_texcoord v0.xy
    dcl_texcoord1 v1.xyz
    dcl_color v2.xw
    dcl vPos.xy
    dcl_2d s0
    dcl_2d s10
dcl_2d s13
    texld r0, v0, s0


mov r10.zw, c150.x
mov r10.xy, v0
mul r10.xy, r10, c177.z
texld r11, r10, s13
mad r11, r11, c175.z, c175.w //for normals
//mul r0.xyz, r0, r11
//mad r10.xyz, r11.w, c175.z, c175.w
mov r10.xyz, r11.w
//mul r0.xyz, r0, r10
mul r10, r10, c177.w
add r10, r10, -c175.w
//mul r2.xyz, r2, r10
//mul r0.xyz, r0, r10
mul r10, r0, r10
mov r9.xyz, r0

//affect dark only
max r9.w, r0.x, r0.y
max r9.w, r9.w, r0.z
mul_sat r9.w, r9.w, c177.x
//mul r9.w, r9.w, r9.w
//mul r9.w, r9.w, r9.w
pow r9.w, r9.w, c177.x
//mul_sat r9.w, r9.w, r12.x //affect specular level
lrp r0.xyz, r9.w, r9, r10


    mul r0.w, r0.w, v2.w
    mul r0.w, r0.w, c39.x
    mov_sat r1.x, r0.w
    mul r1.x, r1.x, c1.x
    frc r1.y, r1.x
    mul r1.z, r1.y, c1.y
    frc r1.w, r1.z
    add r2.xy, r1.zxzw, -r1.wyzw
    mul r1.xy, c1.z, vPos
    frc r1.xy, r1_abs
    cmp r1.xy, vPos, r1, -r1
    mul r1.xy, r1, c1.w
    mad r1.xy, r2, c1.w, r1
    texld r1, r1, s10
    cmp r1, -r1.y, c0.x, c0.y
    texkill r1
    add r1.xyz, c0.z, v1
    dp3 r1.w, r1, r1
    rsq r1.w, r1.w
    mad r1.xyz, r1, r1.w, c0.w
    mul oC1.xyz, r1, c2.x
    mov oC0, r0
    mov oC1.w, r0.w
    mad oC2.xyz, v2.x, c2.yyzw, c2.ywyw
    mov oC2.w, r0.w
    mov r0.xy, c0
    mul oC3, -r0.xyyy, c52.x

//mov oC0.x, c0.w
// approximately 28 instruction slots used (2 texture, 26 arithmetic)
 