//
// 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.0, 4.0, 3.0, 1.6
    dcl_texcoord v0.xy
    dcl_texcoord1 v1.xyz
    dcl_color v2.xw
    dcl vPos.xy
    dcl_2d s0
    dcl_2d s10
dcl_2d s13
    mov_sat r0.x, c39.x
    mul r0.x, r0.x, c1.x
    frc r0.y, r0.x
    mul r0.z, r0.y, c1.y
    frc r0.w, r0.z
    add r1.xy, r0.zxzw, -r0.wyzw
    mul r0.xy, c1.z, vPos
    frc r0.xy, r0_abs
    cmp r0.xy, vPos, r0, -r0
    mul r0.xy, r0, c1.w
    mad r0.xy, r1, c1.w, r0
    texld r0, r0, s10
    cmp r0, -r0.y, c0.x, c0.y
    texkill r0
    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


    add r1.xyz, c0.z, v1
    dp3 r1.w, r1, r1
    rsq r1.w, r1.w
    mul r0.w, r0.w, v2.w
    mad r1.xyz, r1, r1.w, c0.w
    mul oC1.xyz, r1, c2.x
    mul r0.w, r0.w, c39.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.y, c0.w
// approximately 28 instruction slots used (2 texture, 26 arithmetic)
 