summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2016-09-25 19:58:33 +0200
committerAxel Davy <[email protected]>2016-10-10 23:43:50 +0200
commitfc9bb19dce2e293a377f19a873d492a16f2312ab (patch)
treefc010c73dcdec4a00fdd0b7ffb2d5e276882d537 /src/gallium/state_trackers
parentc56c7c1fc8feb26eb97b406cb792d474f2c5b03c (diff)
st/nine: Fix condition for specular lightning
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/nine/nine_ff.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c
index 374e92fbd64..1db312cd94c 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -874,19 +874,17 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
ureg_ENDIF(ureg);
/* directional factors, let's not use LIT because of clarity */
- ureg_DP3(ureg, ureg_saturate(tmp_x), vs->aNrm, ureg_src(rHit));
- ureg_MOV(ureg, tmp_y, ureg_imm1f(ureg, 0.0f));
- ureg_IF(ureg, _X(tmp), &label[l++]);
+
+ if (key->localviewer) {
+ ureg_normalize3(ureg, rMid, vs->aVtx);
+ ureg_SUB(ureg, rMid, ureg_src(rHit), ureg_src(rMid));
+ } else {
+ ureg_SUB(ureg, rMid, ureg_src(rHit), ureg_imm3f(ureg, 0.0f, 0.0f, 1.0f));
+ }
+ ureg_normalize3(ureg, rMid, ureg_src(rMid));
+ ureg_DP3(ureg, ureg_saturate(tmp_y), vs->aNrm, ureg_src(rMid));
+ ureg_IF(ureg, _Y(tmp), &label[l++]);
{
- /* midVec = normalize(hitDir + eyeDir) */
- if (key->localviewer) {
- ureg_normalize3(ureg, rMid, vs->aVtx);
- ureg_SUB(ureg, rMid, ureg_src(rHit), ureg_src(rMid));
- } else {
- ureg_SUB(ureg, rMid, ureg_src(rHit), ureg_imm3f(ureg, 0.0f, 0.0f, 1.0f));
- }
- ureg_normalize3(ureg, rMid, ureg_src(rMid));
- ureg_DP3(ureg, ureg_saturate(tmp_y), vs->aNrm, ureg_src(rMid));
ureg_POW(ureg, tmp_y, _Y(tmp), mtlP);
ureg_MUL(ureg, tmp_y, _W(rAtt), _Y(tmp)); /* power factor * att */
ureg_MAD(ureg, rS, cLColS, _Y(tmp), ureg_src(rS)); /* accumulate specular */
@@ -895,6 +893,7 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
ureg_ENDIF(ureg);
ureg_MAD(ureg, rA, cLColA, _W(rAtt), ureg_src(rA)); /* accumulate ambient */
+ ureg_DP3(ureg, ureg_saturate(tmp_x), vs->aNrm, ureg_src(rHit));
ureg_MUL(ureg, tmp_x, _W(rAtt), _X(tmp)); /* dp3(normal,hitDir) * att */
ureg_MAD(ureg, rD, cLColD, _X(tmp), ureg_src(rD)); /* accumulate diffuse */