Public feed
#531439
color.rgb *= AmbientColor + DiffuseColor * myhalf(max(float(dot(surfacenormal, diffusenormal)), 0.0));
gives
TEMP R0;
TEMP R1;
TEMP R2;
DP3 R0.x, fragment.texcoord[2], fragment.texcoord[2];
RSQ R0.x, R0.x;
MUL R1.xyz, R0.x, fragment.texcoord[2];
ADD R1.xyz, fragment.texcoord[1], R1;
DP3 R1.w, R1, R1;
TEX R0.xyz, fragment.texcoord[0], texture[1], 2D;
ADD R0.xyz, R0, -c[5].x;
DP3 R0.w, R0, R0;
RSQ R0.w, R0.w;
RSQ R1.w, R1.w;
MUL R0.xyz, R0.w, R0;
MUL R1.xyz, R1.w, R1;
DP3 R0.w, R0, R1;
MAX R0.w, R0, c[5].y;
TEX R1.xyz, fragment.texcoord[0], texture[2], 2D;
MUL R1.xyz, R1, c[2];
POW R0.w, R0.w, c[4].x;
MUL R2.xyz, R1, R0.w;
DP3 R0.x, R0, fragment.texcoord[1];
MAX R1.x, R0, c[5].y;
MUL R1.xyz, R1.x, c[1];
TEX R0, fragment.texcoord[0], texture[0], 2D;
ADD R1.xyz, R1, c[0];
MAD R0.xyz, R0, R1, R2;
MUL R0, R0, fragment.color.primary;
MUL result.color.xyz, R0, c[3].x;
MOV result.color.w, R0;
END
# 27 instructions, 3 R-regs
-----------------------------------
color.rgb = color.rgb * AmbientColor + DiffuseColor * myhalf(max(float(dot(surfacenormal, diffusenormal)), 0.0));
gives
TEMP R0;
TEMP R1;
DP3 R0.x, fragment.texcoord[2], fragment.texcoord[2];
RSQ R0.x, R0.x;
MUL R1.xyz, R0.x, fragment.texcoord[2];
ADD R1.xyz, R1, fragment.texcoord[1];
DP3 R1.w, R1, R1;
RSQ R1.w, R1.w;
TEX R0.xyz, fragment.texcoord[0], texture[1], 2D;
ADD R0.xyz, R0, -c[5].x;
DP3 R0.w, R0, R0;
RSQ R0.w, R0.w;
MUL R0.xyz, R0.w, R0;
MUL R1.xyz, R1.w, R1;
DP3 R0.w, R0, R1;
DP3 R0.x, R0, fragment.texcoord[1];
MAX R0.y, R0.w, c[5];
MAX R0.x, R0, c[5].y;
POW R1.w, R0.y, c[4].x;
MUL R1.xyz, R0.x, c[1];
TEX R0, fragment.texcoord[0], texture[0], 2D;
MAD R1.xyz, R0, c[0], R1;
TEX R0.xyz, fragment.texcoord[0], texture[2], 2D;
MUL R0.xyz, R0, c[2];
MAD R0.xyz, R0, R1.w, R1;
MUL R0, R0, fragment.color.primary;
MUL result.color.xyz, R0, c[3].x;
MOV result.color.w, R0;
END
# 26 instructions, 2 R-regs