Bug 674003. D2D: Fix premultiplying to only premultiply the color components. r=bjacob

We were accidentally squaring alpha this caused our surface to end up with superluminescent values.
Fix this by only multiplying alpha with the color componenets and not itself.
This commit is contained in:
Jeff Muizelaar 2011-07-28 16:31:28 -04:00
parent b79662c4d7
commit 783a3434f0
2 changed files with 38 additions and 38 deletions

View File

@ -180,7 +180,7 @@ float4 SampleRadialGradientPS( VS_RADIAL_OUTPUT In) : SV_Target
float4 output = tex.Sample(sSampler, float2(upper_t, 0.5));
// Premultiply
output *= output.a;
output.rgb *= output.a;
// Multiply the output color by the input mask for the operation.
output *= mask.Sample(sMaskSampler, In.MaskTexCoord).a;
return output;
@ -207,7 +207,7 @@ float4 SampleRadialGradientA0PS( VS_RADIAL_OUTPUT In) : SV_Target
float4 output = tex.Sample(sSampler, float2(t, 0.5));
// Premultiply
output *= output.a;
output.rgb *= output.a;
// Multiply the output color by the input mask for the operation.
output *= mask.Sample(sMaskSampler, In.MaskTexCoord).a;
return output;

View File

@ -443,7 +443,7 @@ technique10 SampleRadialGradient
mov r2.y, c3.x
texld r1, t0, s1
texld r2, r2, s0
mul r2, r2.w, r2
mul r2.xyz, r2.w, r2
mul r1, r1.w, r2
add r0.w, r0.w, r0.x
cmp r0.x, r0.w, r0.x, r0.z
@ -491,9 +491,9 @@ technique10 SampleRadialGradient
mov o0.xyzw, l(0,0,0,0)
ret
endif
mul r0.xyzw, r2.wwww, r2.xyzw
sample r1.xyzw, v1.xyxx, t1.xyzw, s1
mul o0.xyzw, r0.xyzw, r1.wwww
mul r2.xyz, r2.wwww, r2.xyzx
sample r0.xyzw, v1.xyxx, t1.xyzw, s1
mul o0.xyzw, r0.wwww, r2.xyzw
ret
// Approximately 33 instruction slots used
@ -703,7 +703,7 @@ technique10 SampleRadialGradient
texld r2, r0, s0
mov r0.w, c1.w
mad r0.x, r0.x, -c0.z, -r0.w
mul r2, r2.w, r2
mul r2.xyz, r2.w, r2
mul r1, r1.w, r2
cmp r0, r0.x, c2.y, r1
mov oC0, r0
@ -734,9 +734,9 @@ technique10 SampleRadialGradient
mov o0.xyzw, l(0,0,0,0)
ret
endif
mul r0.xyzw, r1.wwww, r1.xyzw
sample r1.xyzw, v1.xyxx, t1.xyzw, s1
mul o0.xyzw, r0.xyzw, r1.wwww
mul r1.xyz, r1.wwww, r1.xyzx
sample r0.xyzw, v1.xyxx, t1.xyzw, s1
mul o0.xyzw, r0.wwww, r1.xyzw
ret
// Approximately 19 instruction slots used
@ -1621,10 +1621,10 @@ technique10 SampleTextureWithShadow
const BYTE d2deffect[] =
{
68, 88, 66, 67, 178, 2,
69, 191, 250, 33, 81, 124,
224, 53, 204, 57, 73, 36,
191, 116, 1, 0, 0, 0,
68, 88, 66, 67, 109, 248,
87, 153, 208, 172, 175, 58,
169, 190, 216, 26, 197, 8,
157, 19, 1, 0, 0, 0,
1, 102, 0, 0, 1, 0,
0, 0, 36, 0, 0, 0,
70, 88, 49, 48, 213, 101,
@ -2406,9 +2406,9 @@ const BYTE d2deffect[] =
0, 0, 0, 2, 0, 0,
0, 0, 0, 0, 0, 220,
9, 0, 0, 68, 88, 66,
67, 246, 85, 96, 22, 53,
16, 231, 164, 220, 13, 79,
114, 29, 26, 138, 193, 1,
67, 75, 110, 115, 165, 159,
108, 132, 208, 154, 90, 141,
18, 236, 102, 72, 112, 1,
0, 0, 0, 220, 9, 0,
0, 6, 0, 0, 0, 56,
0, 0, 0, 128, 2, 0,
@ -2492,7 +2492,7 @@ const BYTE d2deffect[] =
0, 0, 3, 2, 0, 15,
128, 2, 0, 228, 128, 0,
8, 228, 160, 5, 0, 0,
3, 2, 0, 15, 128, 2,
3, 2, 0, 7, 128, 2,
0, 255, 128, 2, 0, 228,
128, 5, 0, 0, 3, 1,
0, 15, 128, 1, 0, 255,
@ -2660,21 +2660,21 @@ const BYTE d2deffect[] =
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 62,
0, 0, 1, 21, 0, 0,
1, 56, 0, 0, 7, 242,
0, 16, 0, 0, 0, 0,
1, 56, 0, 0, 7, 114,
0, 16, 0, 2, 0, 0,
0, 246, 15, 16, 0, 2,
0, 0, 0, 70, 14, 16,
0, 0, 0, 70, 2, 16,
0, 2, 0, 0, 0, 69,
0, 0, 9, 242, 0, 16,
0, 1, 0, 0, 0, 70,
0, 0, 0, 0, 0, 70,
16, 16, 0, 1, 0, 0,
0, 70, 126, 16, 0, 1,
0, 0, 0, 0, 96, 16,
0, 1, 0, 0, 0, 56,
0, 0, 7, 242, 32, 16,
0, 0, 0, 0, 0, 70,
14, 16, 0, 0, 0, 0,
0, 246, 15, 16, 0, 1,
0, 0, 0, 0, 0, 246,
15, 16, 0, 0, 0, 0,
0, 70, 14, 16, 0, 2,
0, 0, 0, 62, 0, 0,
1, 83, 84, 65, 84, 116,
0, 0, 0, 33, 0, 0,
@ -2690,7 +2690,7 @@ const BYTE d2deffect[] =
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 0,
0, 5, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
@ -3132,10 +3132,10 @@ const BYTE d2deffect[] =
0, 0, 1, 0, 0, 0,
2, 0, 0, 0, 0, 0,
0, 0, 188, 7, 0, 0,
68, 88, 66, 67, 233, 12,
254, 166, 83, 201, 49, 7,
133, 181, 124, 223, 180, 7,
158, 182, 1, 0, 0, 0,
68, 88, 66, 67, 158, 207,
216, 153, 107, 204, 140, 217,
118, 241, 126, 175, 204, 121,
49, 49, 1, 0, 0, 0,
188, 7, 0, 0, 6, 0,
0, 0, 56, 0, 0, 0,
196, 1, 0, 0, 56, 4,
@ -3197,7 +3197,7 @@ const BYTE d2deffect[] =
0, 0, 0, 128, 0, 0,
170, 161, 0, 0, 255, 129,
5, 0, 0, 3, 2, 0,
15, 128, 2, 0, 255, 128,
7, 128, 2, 0, 255, 128,
2, 0, 228, 128, 5, 0,
0, 3, 1, 0, 15, 128,
1, 0, 255, 128, 2, 0,
@ -3296,21 +3296,21 @@ const BYTE d2deffect[] =
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 62, 0,
0, 1, 21, 0, 0, 1,
56, 0, 0, 7, 242, 0,
16, 0, 0, 0, 0, 0,
56, 0, 0, 7, 114, 0,
16, 0, 1, 0, 0, 0,
246, 15, 16, 0, 1, 0,
0, 0, 70, 14, 16, 0,
0, 0, 70, 2, 16, 0,
1, 0, 0, 0, 69, 0,
0, 9, 242, 0, 16, 0,
1, 0, 0, 0, 70, 16,
0, 0, 0, 0, 70, 16,
16, 0, 1, 0, 0, 0,
70, 126, 16, 0, 1, 0,
0, 0, 0, 96, 16, 0,
1, 0, 0, 0, 56, 0,
0, 7, 242, 32, 16, 0,
0, 0, 0, 0, 70, 14,
0, 0, 0, 0, 246, 15,
16, 0, 0, 0, 0, 0,
246, 15, 16, 0, 1, 0,
70, 14, 16, 0, 1, 0,
0, 0, 62, 0, 0, 1,
83, 84, 65, 84, 116, 0,
0, 0, 19, 0, 0, 0,
@ -3326,7 +3326,7 @@ const BYTE d2deffect[] =
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 0, 0,
4, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,