Mesa (master): mesa: Fix fixed function spot lighting on newer hardware ( again)

Matt Turner mattst88 at kemper.freedesktop.org
Sat Aug 20 03:45:47 UTC 2016


Module: Mesa
Branch: master
Commit: 16ef7ab5c13d2c5638f5a4e1fe7f0303d26b4e96
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=16ef7ab5c13d2c5638f5a4e1fe7f0303d26b4e96

Author: Daniel Scharrer <daniel at constexpr.org>
Date:   Sat Aug 20 04:23:29 2016 +0200

mesa: Fix fixed function spot lighting on newer hardware (again)

This was first fixed in commit b3f9c5c and then broken again in commit
fe2d2c7, which removed the abs modifier from input registers.

v2: Don't change the size of struct ureg.

Cc: "12.0" <mesa-stable at lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91342
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Signed-off-by: Daniel Scharrer <daniel at constexpr.org>

---

 src/mesa/main/ffvertex_prog.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index f4ae690..9bf0f68 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -297,10 +297,9 @@ struct ureg {
    GLuint file:4;
    GLint idx:9;      /* relative addressing may be negative */
                      /* sizeof(idx) should == sizeof(prog_src_reg::Index) */
-   GLuint abs:1;
    GLuint negate:1;
    GLuint swz:12;
-   GLuint pad:5;
+   GLuint pad:6;
 };
 
 
@@ -329,7 +328,6 @@ static const struct ureg undef = {
    0,
    0,
    0,
-   0,
    0
 };
 
@@ -348,7 +346,6 @@ static struct ureg make_ureg(GLuint file, GLint idx)
    struct ureg reg;
    reg.file = file;
    reg.idx = idx;
-   reg.abs = 0;
    reg.negate = 0;
    reg.swz = SWIZZLE_NOOP;
    reg.pad = 0;
@@ -356,15 +353,6 @@ static struct ureg make_ureg(GLuint file, GLint idx)
 }
 
 
-
-static struct ureg absolute( struct ureg reg )
-{
-   reg.abs = 1;
-   reg.negate = 0;
-   return reg;
-}
-
-
 static struct ureg negate( struct ureg reg )
 {
    reg.negate ^= 1;
@@ -965,7 +953,8 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p,
 
       emit_op2(p, OPCODE_DP3, spot, 0, negate(VPpli), spot_dir_norm);
       emit_op2(p, OPCODE_SLT, slt, 0, swizzle1(spot_dir_norm,W), spot);
-      emit_op2(p, OPCODE_POW, spot, 0, absolute(spot), swizzle1(attenuation, W));
+      emit_op1(p, OPCODE_ABS, spot, 0, spot);
+      emit_op2(p, OPCODE_POW, spot, 0, spot, swizzle1(attenuation, W));
       emit_op2(p, OPCODE_MUL, att, 0, slt, spot);
 
       release_temp(p, spot);




More information about the mesa-commit mailing list